From owner-svn-src-all@freebsd.org Sun Jan 21 04:57:31 2018 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 2D1FDEB880D; Sun, 21 Jan 2018 04:57:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0723F7B4B0; Sun, 21 Jan 2018 04:57:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 563F726C87; Sun, 21 Jan 2018 04:57:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0L4vUkD013308; Sun, 21 Jan 2018 04:57:30 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0L4vUb6013306; Sun, 21 Jan 2018 04:57:30 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801210457.w0L4vUb6013306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 21 Jan 2018 04:57:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328211 - head/lib/libc/regex X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/regex X-SVN-Commit-Revision: 328211 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 04:57:31 -0000 Author: kevans Date: Sun Jan 21 04:57:29 2018 New Revision: 328211 URL: https://svnweb.freebsd.org/changeset/base/328211 Log: regex(3): Resolve issues with higher WARNS levels libc is set for WARNS=2, but the incoming libregex will use WARNS=6. Sprinkle some casts and (void)bc's to alleviate the warnings that come along with the higher WARNS level. These 'bc' parameters could be outright removed, but as of right now they will be used in some parts of libregex land. Silence the warnings instead rather than flip-flopping. Modified: head/lib/libc/regex/engine.c head/lib/libc/regex/regcomp.c Modified: head/lib/libc/regex/engine.c ============================================================================== --- head/lib/libc/regex/engine.c Sat Jan 20 23:46:03 2018 (r328210) +++ head/lib/libc/regex/engine.c Sun Jan 21 04:57:29 2018 (r328211) @@ -398,7 +398,7 @@ dissect(struct match *m, es += OPND(m->g->strip[es]); break; case OCH_: - while (OP(m->g->strip[es]) != O_CH) + while (OP(m->g->strip[es]) != (sop)O_CH) es += OPND(m->g->strip[es]); break; } @@ -512,7 +512,7 @@ dissect(struct match *m, assert(OP(m->g->strip[esub]) == OOR2); ssub = esub + 1; esub += OPND(m->g->strip[esub]); - if (OP(m->g->strip[esub]) == OOR2) + if (OP(m->g->strip[esub]) == (sop)OOR2) esub--; else assert(OP(m->g->strip[esub]) == O_CH); @@ -647,7 +647,7 @@ backref(struct match *m, do { assert(OP(s) == OOR2); ss += OPND(s); - } while (OP(s = m->g->strip[ss]) != O_CH); + } while (OP(s = m->g->strip[ss]) != (sop)O_CH); /* note that the ss++ gets us past the O_CH */ break; default: /* have to make a choice */ @@ -680,7 +680,7 @@ backref(struct match *m, ssp = m->offp + m->pmatch[i].rm_so; if (memcmp(sp, ssp, len) != 0) return(NULL); - while (m->g->strip[ss] != SOP(O_BACK, i)) + while (m->g->strip[ss] != (sop)SOP(O_BACK, i)) ss++; return(backref(m, sp+len, stop, ss+1, stopst, lev, rec)); case OQUEST_: /* to null or not */ @@ -712,13 +712,13 @@ backref(struct match *m, if (dp != NULL) return(dp); /* that one missed, try next one */ - if (OP(m->g->strip[esub]) == O_CH) + if (OP(m->g->strip[esub]) == (sop)O_CH) return(NULL); /* there is none */ esub++; - assert(OP(m->g->strip[esub]) == OOR2); + assert(OP(m->g->strip[esub]) == (sop)OOR2); ssub = esub + 1; esub += OPND(m->g->strip[esub]); - if (OP(m->g->strip[esub]) == OOR2) + if (OP(m->g->strip[esub]) == (sop)OOR2) esub--; else assert(OP(m->g->strip[esub]) == O_CH); @@ -847,7 +847,7 @@ walk(struct match *m, const char *start, const char *s else matchp = p; } - if (EQ(st, empty) || p == stop || clen > stop - p) + if (EQ(st, empty) || p == stop || clen > (size_t)(stop - p)) break; /* NOTE BREAK OUT */ /* no, we must deal with this character */ @@ -969,22 +969,22 @@ step(struct re_guts *g, break; case OCH_: /* mark the first two branches */ FWD(aft, aft, 1); - assert(OP(g->strip[pc+OPND(s)]) == OOR2); + assert(OP(g->strip[pc+OPND(s)]) == (sop)OOR2); FWD(aft, aft, OPND(s)); break; case OOR1: /* done a branch, find the O_CH */ if (ISSTATEIN(aft, here)) { for (look = 1; - OP(s = g->strip[pc+look]) != O_CH; - look += OPND(s)) - assert(OP(s) == OOR2); + OP(s = g->strip[pc+look]) != (sop)O_CH; + look += OPND(s)) + assert(OP(s) == (sop)OOR2); FWD(aft, aft, look + 1); } break; case OOR2: /* propagate OCH_'s marking */ FWD(aft, aft, 1); - if (OP(g->strip[pc+OPND(s)]) != O_CH) { - assert(OP(g->strip[pc+OPND(s)]) == OOR2); + if (OP(g->strip[pc+OPND(s)]) != (sop)O_CH) { + assert(OP(g->strip[pc+OPND(s)]) == (sop)OOR2); FWD(aft, aft, OPND(s)); } break; Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Sat Jan 20 23:46:03 2018 (r328210) +++ head/lib/libc/regex/regcomp.c Sun Jan 21 04:57:29 2018 (r328211) @@ -364,6 +364,7 @@ p_ere_exp(struct parse *p, struct branchc *bc) sopno subno; int wascaret = 0; + (void)bc; assert(MORE()); /* caller should have ensured this */ c = GETNEXT(); @@ -534,6 +535,7 @@ p_branch_eat_delim(struct parse *p, struct branchc *bc { int nskip; + (void)bc; nskip = 0; while (EAT('|')) ++nskip; @@ -587,6 +589,7 @@ static bool p_branch_empty(struct parse *p, struct branchc *bc) { + (void)bc; SETERROR(REG_EMPTY); return (false); } @@ -1617,12 +1620,12 @@ findmust(struct parse *p, struct re_guts *g) scan += OPND(s); s = *scan; /* assert() interferes w debug printouts */ - if (OP(s) != O_QUEST && OP(s) != O_CH && - OP(s) != OOR2) { + if (OP(s) != (sop)O_QUEST && + OP(s) != (sop)O_CH && OP(s) != (sop)OOR2) { g->iflags |= BAD; return; } - } while (OP(s) != O_QUEST && OP(s) != O_CH); + } while (OP(s) != (sop)O_QUEST && OP(s) != (sop)O_CH); /* FALLTHROUGH */ case OBOW: /* things that break a sequence */ case OEOW: @@ -1631,7 +1634,7 @@ findmust(struct parse *p, struct re_guts *g) case O_QUEST: case O_CH: case OEND: - if (newlen > g->mlen) { /* ends one */ + if (newlen > (sopno)g->mlen) { /* ends one */ start = newstart; g->mlen = newlen; if (offset > -1) { @@ -1646,7 +1649,7 @@ findmust(struct parse *p, struct re_guts *g) newlen = 0; break; case OANY: - if (newlen > g->mlen) { /* ends one */ + if (newlen > (sopno)g->mlen) { /* ends one */ start = newstart; g->mlen = newlen; if (offset > -1) { @@ -1664,7 +1667,7 @@ findmust(struct parse *p, struct re_guts *g) break; case OANYOF: /* may or may not invalidate offset */ /* First, everything as OANY */ - if (newlen > g->mlen) { /* ends one */ + if (newlen > (sopno)g->mlen) { /* ends one */ start = newstart; g->mlen = newlen; if (offset > -1) { @@ -1687,7 +1690,7 @@ findmust(struct parse *p, struct re_guts *g) * save the last known good offset, in case the * must sequence doesn't occur later. */ - if (newlen > g->mlen) { /* ends one */ + if (newlen > (sopno)g->mlen) { /* ends one */ start = newstart; g->mlen = newlen; if (offset > -1) @@ -1748,7 +1751,7 @@ altoffset(sop *scan, int offset) largest = 0; try = 0; s = *scan++; - while (OP(s) != O_QUEST && OP(s) != O_CH) { + while (OP(s) != (sop)O_QUEST && OP(s) != (sop)O_CH) { switch (OP(s)) { case OOR1: if (try > largest) @@ -1764,10 +1767,10 @@ altoffset(sop *scan, int offset) do { scan += OPND(s); s = *scan; - if (OP(s) != O_QUEST && OP(s) != O_CH && - OP(s) != OOR2) + if (OP(s) != (sop)O_QUEST && + OP(s) != (sop)O_CH && OP(s) != (sop)OOR2) return -1; - } while (OP(s) != O_QUEST && OP(s) != O_CH); + } while (OP(s) != (sop)O_QUEST && OP(s) != (sop)O_CH); /* We must skip to the next position, or we'll * leave altoffset() too early. */ From owner-svn-src-all@freebsd.org Sun Jan 21 10:35:18 2018 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 55513EC5200; Sun, 21 Jan 2018 10:35:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2FCD920FF; Sun, 21 Jan 2018 10:35:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65FEC24CC; Sun, 21 Jan 2018 10:35:17 +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 w0LAZHJD054712; Sun, 21 Jan 2018 10:35:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LAZHo8054711; Sun, 21 Jan 2018 10:35:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801211035.w0LAZHo8054711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 21 Jan 2018 10:35:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328213 - stable/11/sys/dev/cpuctl X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/dev/cpuctl X-SVN-Commit-Revision: 328213 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 10:35:18 -0000 Author: kib Date: Sun Jan 21 10:35:17 2018 New Revision: 328213 URL: https://svnweb.freebsd.org/changeset/base/328213 Log: MFC r327963: When re-evaluating cpu_features, also re-print CPU identification. Modified: stable/11/sys/dev/cpuctl/cpuctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/11/sys/dev/cpuctl/cpuctl.c Sun Jan 21 08:48:26 2018 (r328212) +++ stable/11/sys/dev/cpuctl/cpuctl.c Sun Jan 21 10:35:17 2018 (r328213) @@ -526,6 +526,7 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td identify_cpu1(); identify_cpu2(); restore_cpu(oldcpu, is_bound, td); + printcpuinfo(); return (0); } From owner-svn-src-all@freebsd.org Sun Jan 21 08:48:27 2018 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 5BE19EC15C6; Sun, 21 Jan 2018 08:48:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 376EF81E57; Sun, 21 Jan 2018 08:48:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 719FB12ED; Sun, 21 Jan 2018 08:48:26 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0L8mQED008419; Sun, 21 Jan 2018 08:48:26 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0L8mQA4008418; Sun, 21 Jan 2018 08:48:26 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801210848.w0L8mQA4008418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 21 Jan 2018 08:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328212 - head/usr.bin/limits X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/limits X-SVN-Commit-Revision: 328212 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 08:48:27 -0000 Author: eadler Date: Sun Jan 21 08:48:26 2018 New Revision: 328212 URL: https://svnweb.freebsd.org/changeset/base/328212 Log: limits(1): fix always true condition Reviewed by: imp MFC After: 1 week Modified: head/usr.bin/limits/limits.c Modified: head/usr.bin/limits/limits.c ============================================================================== --- head/usr.bin/limits/limits.c Sun Jan 21 04:57:29 2018 (r328211) +++ head/usr.bin/limits/limits.c Sun Jan 21 08:48:26 2018 (r328212) @@ -509,7 +509,7 @@ main(int argc, char *argv[]) for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) { if (doall || num_limits == 0 || which_limits[rcswhich] != 0) { - if (which_limits[rcswhich] == ANY || which_limits[rcswhich]) + if (which_limits[rcswhich] == ANY) which_limits[rcswhich] = type; if (shellparm[shelltype].lprm[rcswhich].pfx) { if (shellparm[shelltype].both && limits[rcswhich].rlim_cur == limits[rcswhich].rlim_max) { From owner-svn-src-all@freebsd.org Sun Jan 21 10:43:02 2018 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 A8855EC5500; Sun, 21 Jan 2018 10:43:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 836A127F5; Sun, 21 Jan 2018 10:43: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C49D82661; Sun, 21 Jan 2018 10:43:01 +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 w0LAh1rT058760; Sun, 21 Jan 2018 10:43:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LAh12u058759; Sun, 21 Jan 2018 10:43:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801211043.w0LAh12u058759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 21 Jan 2018 10:43:01 +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: r328216 - stable/11/sys/amd64/include X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/include X-SVN-Commit-Revision: 328216 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 10:43:02 -0000 Author: kib Date: Sun Jan 21 10:43:01 2018 New Revision: 328216 URL: https://svnweb.freebsd.org/changeset/base/328216 Log: MFC r327965: Add STAC and CLAC instructions wrappers. Modified: stable/11/sys/amd64/include/cpufunc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/include/cpufunc.h ============================================================================== --- stable/11/sys/amd64/include/cpufunc.h Sun Jan 21 10:39:57 2018 (r328215) +++ stable/11/sys/amd64/include/cpufunc.h Sun Jan 21 10:43:01 2018 (r328216) @@ -862,6 +862,20 @@ intr_restore(register_t rflags) write_rflags(rflags); } +static __inline void +stac(void) +{ + + __asm __volatile("stac" : : : "cc"); +} + +static __inline void +clac(void) +{ + + __asm __volatile("clac" : : : "cc"); +} + #else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ int breakpoint(void); From owner-svn-src-all@freebsd.org Sun Jan 21 11:19:20 2018 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 040C1EC6807; Sun, 21 Jan 2018 11:19:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D46763A86; Sun, 21 Jan 2018 11:19:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28EA02B52; Sun, 21 Jan 2018 11:19:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0LBJJNc071704; Sun, 21 Jan 2018 11:19:19 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LBJJRx071703; Sun, 21 Jan 2018 11:19:19 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201801211119.w0LBJJRx071703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sun, 21 Jan 2018 11:19:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328217 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 328217 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 11:19:20 -0000 Author: avg Date: Sun Jan 21 11:19:18 2018 New Revision: 328217 URL: https://svnweb.freebsd.org/changeset/base/328217 Log: zfs: no need to check that size of zfs_cmd_t is not greater than IOCPARM_MAX Nowadays we do not pass zfs_cmd_t directly through the ioctl interface. Instead a small zfs_iocparm_t object is passed and the command is explicitly copied in and out. So, the check has become irrelevant. MFC after: 3 weeks Sponsored by: Panzura Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Jan 21 10:43:01 2018 (r328216) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Jan 21 11:19:18 2018 (r328217) @@ -204,7 +204,6 @@ #include "lua.h" #include "lauxlib.h" -CTASSERT(sizeof(zfs_cmd_t) < IOCPARM_MAX); static struct cdev *zfsdev; extern void zfs_init(void); From owner-svn-src-all@freebsd.org Sun Jan 21 10:39:58 2018 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 6718DEC5317; Sun, 21 Jan 2018 10:39:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 41D072475; Sun, 21 Jan 2018 10:39:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9609F24CF; Sun, 21 Jan 2018 10:39:57 +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 w0LAdvM6054978; Sun, 21 Jan 2018 10:39:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LAdvhc054975; Sun, 21 Jan 2018 10:39:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801211039.w0LAdvhc054975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 21 Jan 2018 10:39:57 +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: r328215 - in stable/11/sys/x86: include x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys/x86: include x86 X-SVN-Commit-Revision: 328215 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 10:39:58 -0000 Author: kib Date: Sun Jan 21 10:39:57 2018 New Revision: 328215 URL: https://svnweb.freebsd.org/changeset/base/328215 Log: MFC r327964: Enumerate and print Intel CPU features for Speculative Execution Side Channel Mitigations. Modified: stable/11/sys/x86/include/specialreg.h stable/11/sys/x86/include/x86_var.h stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/include/specialreg.h ============================================================================== --- stable/11/sys/x86/include/specialreg.h Sun Jan 21 10:38:38 2018 (r328214) +++ stable/11/sys/x86/include/specialreg.h Sun Jan 21 10:39:57 2018 (r328215) @@ -383,6 +383,17 @@ #define CPUID_STDEXT2_SGXLC 0x40000000 /* + * CPUID instruction 7 Structured Extended Features, leaf 0 edx info + */ +#define CPUID_STDEXT3_IBPB 0x04000000 +#define CPUID_STDEXT3_STIBP 0x08000000 +#define CPUID_STDEXT3_ARCH_CAP 0x20000000 + +/* MSR IA32_ARCH_CAP(ABILITIES) bits */ +#define IA32_ARCH_CAP_RDCL_NO 0x00000001 +#define IA32_ARCH_CAP_IBRS_ALL 0x00000002 + +/* * CPUID manufacturers identifiers */ #define AMD_VENDOR_ID "AuthenticAMD" @@ -410,6 +421,8 @@ #define MSR_EBL_CR_POWERON 0x02a #define MSR_TEST_CTL 0x033 #define MSR_IA32_FEATURE_CONTROL 0x03a +#define MSR_IA32_SPEC_CTRL 0x048 +#define MSR_IA32_PRED_CMD 0x049 #define MSR_BIOS_UPDT_TRIG 0x079 #define MSR_BBL_CR_D0 0x088 #define MSR_BBL_CR_D1 0x089 @@ -422,6 +435,7 @@ #define MSR_APERF 0x0e8 #define MSR_IA32_EXT_CONFIG 0x0ee /* Undocumented. Core Solo/Duo only */ #define MSR_MTRRcap 0x0fe +#define MSR_IA32_ARCH_CAP 0x10a #define MSR_BBL_CR_ADDR 0x116 #define MSR_BBL_CR_DECC 0x118 #define MSR_BBL_CR_CTL 0x119 @@ -563,6 +577,13 @@ #define IA32_MISC_EN_LIMCPUID 0x0000000000400000ULL #define IA32_MISC_EN_xTPRD 0x0000000000800000ULL #define IA32_MISC_EN_XDD 0x0000000400000000ULL + +/* MSR IA32_SPEC_CTRL */ +#define IA32_SPEC_CTRL_IBRS 0x0000000000000001ULL +#define IA32_SPEC_CTRL_STIBP 0x0000000000000002ULL + +/* MSR IA32_PRED_CMD */ +#define IA32_PRED_CMD_IBPB_BARRIER 0x0000000000000001ULL /* * PAT modes. Modified: stable/11/sys/x86/include/x86_var.h ============================================================================== --- stable/11/sys/x86/include/x86_var.h Sun Jan 21 10:38:38 2018 (r328214) +++ stable/11/sys/x86/include/x86_var.h Sun Jan 21 10:39:57 2018 (r328215) @@ -51,6 +51,8 @@ extern u_int via_feature_xcrypt; extern u_int cpu_clflush_line_size; extern u_int cpu_stdext_feature; extern u_int cpu_stdext_feature2; +extern u_int cpu_stdext_feature3; +extern uint64_t cpu_ia32_arch_caps; extern u_int cpu_fxsr; extern u_int cpu_high; extern u_int cpu_id; Modified: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Sun Jan 21 10:38:38 2018 (r328214) +++ stable/11/sys/x86/x86/identcpu.c Sun Jan 21 10:39:57 2018 (r328215) @@ -105,8 +105,10 @@ u_int cpu_vendor_id; /* CPU vendor ID */ u_int cpu_fxsr; /* SSE enabled */ u_int cpu_mxcsr_mask; /* Valid bits in mxcsr */ u_int cpu_clflush_line_size = 32; -u_int cpu_stdext_feature; -u_int cpu_stdext_feature2; +u_int cpu_stdext_feature; /* %ebx */ +u_int cpu_stdext_feature2; /* %ecx */ +u_int cpu_stdext_feature3; /* %edx */ +uint64_t cpu_ia32_arch_caps; u_int cpu_max_ext_state_size; u_int cpu_mon_mwait_flags; /* MONITOR/MWAIT flags (CPUID.05H.ECX) */ u_int cpu_mon_min_size; /* MONITOR minimum range size, bytes */ @@ -980,6 +982,16 @@ printcpuinfo(void) ); } + if (cpu_stdext_feature3 != 0) { + printf("\n Structured Extended Features3=0x%b", + cpu_stdext_feature3, + "\020" + "\033IBPB" + "\034STIBP" + "\036ARCH_CAP" + ); + } + if ((cpu_feature2 & CPUID2_XSAVE) != 0) { cpuid_count(0xd, 0x1, regs); if (regs[0] != 0) { @@ -993,6 +1005,15 @@ printcpuinfo(void) } } + if (cpu_ia32_arch_caps != 0) { + printf("\n IA32_ARCH_CAPS=0x%b", + (u_int)cpu_ia32_arch_caps, + "\020" + "\001RDCL_NO" + "\002IBRS_ALL" + ); + } + if (amd_extended_feature_extensions != 0) { printf("\n " "AMD Extended Feature Extensions ID EBX=" @@ -1423,6 +1444,10 @@ identify_cpu2(void) cpu_stdext_feature &= ~cpu_stdext_disable; cpu_stdext_feature2 = regs[2]; + cpu_stdext_feature3 = regs[3]; + + if ((cpu_stdext_feature3 & CPUID_STDEXT3_ARCH_CAP) != 0) + cpu_ia32_arch_caps = rdmsr(MSR_IA32_ARCH_CAP); } } From owner-svn-src-all@freebsd.org Sun Jan 21 10:38:40 2018 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 0E7E2EC529C; Sun, 21 Jan 2018 10:38:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA3F1222D; Sun, 21 Jan 2018 10:38:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11EC124CE; Sun, 21 Jan 2018 10:38:39 +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 w0LAccHC054881; Sun, 21 Jan 2018 10:38:38 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LAcce9054878; Sun, 21 Jan 2018 10:38:38 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801211038.w0LAcce9054878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 21 Jan 2018 10:38:38 +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: r328214 - in stable/11/sys/x86: include x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys/x86: include x86 X-SVN-Commit-Revision: 328214 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 10:38:40 -0000 Author: kib Date: Sun Jan 21 10:38:38 2018 New Revision: 328214 URL: https://svnweb.freebsd.org/changeset/base/328214 Log: MFC r323822 (by cem): x86: Decode AMD "Extended Feature Extensions ID EBX" bits. Modified: stable/11/sys/x86/include/specialreg.h stable/11/sys/x86/include/x86_var.h stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/include/specialreg.h ============================================================================== --- stable/11/sys/x86/include/specialreg.h Sun Jan 21 10:35:17 2018 (r328213) +++ stable/11/sys/x86/include/specialreg.h Sun Jan 21 10:38:38 2018 (r328214) @@ -323,6 +323,13 @@ #define AMDPM_CPB 0x00000200 /* + * AMD extended function 8000_0008h ebx info (amd_extended_feature_extensions) + */ +#define AMDFEID_CLZERO 0x00000001 +#define AMDFEID_IRPERF 0x00000002 +#define AMDFEID_XSAVEERPTR 0x00000004 + +/* * AMD extended function 8000_0008h ecx info */ #define AMDID_CMP_CORES 0x000000ff Modified: stable/11/sys/x86/include/x86_var.h ============================================================================== --- stable/11/sys/x86/include/x86_var.h Sun Jan 21 10:35:17 2018 (r328213) +++ stable/11/sys/x86/include/x86_var.h Sun Jan 21 10:38:38 2018 (r328214) @@ -45,6 +45,7 @@ extern u_int cpu_feature2; extern u_int amd_feature; extern u_int amd_feature2; extern u_int amd_pminfo; +extern u_int amd_extended_feature_extensions; extern u_int via_feature_rng; extern u_int via_feature_xcrypt; extern u_int cpu_clflush_line_size; Modified: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Sun Jan 21 10:35:17 2018 (r328213) +++ stable/11/sys/x86/x86/identcpu.c Sun Jan 21 10:38:38 2018 (r328214) @@ -92,6 +92,7 @@ u_int cpu_feature2; /* Feature flags */ u_int amd_feature; /* AMD feature flags */ u_int amd_feature2; /* AMD feature flags */ u_int amd_pminfo; /* AMD advanced power management info */ +u_int amd_extended_feature_extensions; u_int via_feature_rng; /* VIA RNG features */ u_int via_feature_xcrypt; /* VIA ACE features */ u_int cpu_high; /* Highest arg to CPUID */ @@ -992,6 +993,16 @@ printcpuinfo(void) } } + if (amd_extended_feature_extensions != 0) { + printf("\n " + "AMD Extended Feature Extensions ID EBX=" + "0x%b", amd_extended_feature_extensions, + "\020" + "\001CLZERO" + "\002IRPerf" + "\003XSaveErPtr"); + } + if (via_feature_rng != 0 || via_feature_xcrypt != 0) print_via_padlock_info(); @@ -1473,6 +1484,7 @@ finishidentcpu(void) if (cpu_exthigh >= 0x80000008) { do_cpuid(0x80000008, regs); cpu_maxphyaddr = regs[0] & 0xff; + amd_extended_feature_extensions = regs[1]; cpu_procinfo2 = regs[2]; } else { cpu_maxphyaddr = (cpu_feature & CPUID_PAE) != 0 ? 36 : 32; From owner-svn-src-all@freebsd.org Sun Jan 21 15:42:43 2018 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 67B0DECFAC4; Sun, 21 Jan 2018 15:42:43 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1235E7088A; Sun, 21 Jan 2018 15:42:43 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5728F5B62; Sun, 21 Jan 2018 15:42: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 w0LFggw3006030; Sun, 21 Jan 2018 15:42:42 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LFgbsp005980; Sun, 21 Jan 2018 15:42:37 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801211542.w0LFgbsp005980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 21 Jan 2018 15:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/e1000 dev/esp dev/fb dev/... X-SVN-Commit-Revision: 328218 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 15:42:43 -0000 Author: pfg Date: Sun Jan 21 15:42:36 2018 New Revision: 328218 URL: https://svnweb.freebsd.org/changeset/base/328218 Log: Revert r327828, r327949, r327953, r328016-r328026, r328041: Uses of mallocarray(9). The use of mallocarray(9) has rocketed the required swap to build FreeBSD. This is likely caused by the allocation size attributes which put extra pressure on the compiler. Given that most of these checks are superfluous we have to choose better where to use mallocarray(9). We still have more uses of mallocarray(9) but hopefully this is enough to bring swap usage to a reasonable level. Reported by: wosch PR: 225197 Modified: head/sys/amd64/amd64/bpf_jit_machdep.c head/sys/arm/xscale/ixp425/if_npe.c head/sys/arm64/arm64/busdma_bounce.c head/sys/cam/cam_queue.c head/sys/cam/ctl/ctl_frontend.c head/sys/compat/ndis/subr_ndis.c head/sys/dev/aacraid/aacraid.c head/sys/dev/advansys/advansys.c head/sys/dev/ath/if_ath_rx_edma.c head/sys/dev/beri/virtio/virtio.c head/sys/dev/bnxt/if_bnxt.c head/sys/dev/bwn/if_bwn.c head/sys/dev/bwn/if_bwn_phy_lp.c head/sys/dev/ciss/ciss.c head/sys/dev/cxgbe/crypto/t4_crypto.c head/sys/dev/e1000/if_em.c head/sys/dev/esp/ncr53c9x.c head/sys/dev/fb/splash.c head/sys/dev/gpio/gpiobus.c head/sys/dev/if_ndis/if_ndis.c head/sys/dev/iwi/if_iwi.c head/sys/dev/ixl/if_ixlv.c head/sys/dev/ixl/ixl_pf_iov.c head/sys/dev/ixl/ixl_pf_main.c head/sys/dev/kbd/kbd.c head/sys/dev/liquidio/base/lio_request_manager.c head/sys/dev/liquidio/lio_main.c head/sys/dev/mpr/mpr.c head/sys/dev/mpr/mpr_mapping.c head/sys/dev/mps/mps.c head/sys/dev/mps/mps_mapping.c head/sys/dev/mpt/mpt_cam.c head/sys/dev/mrsas/mrsas.c head/sys/dev/mxge/if_mxge.c head/sys/dev/netmap/if_ptnet.c head/sys/dev/nvme/nvme_ns.c head/sys/dev/pst/pst-iop.c head/sys/dev/ral/rt2560.c head/sys/dev/ral/rt2661.c head/sys/dev/rp/rp.c head/sys/dev/rp/rp_isa.c head/sys/dev/rp/rp_pci.c head/sys/dev/sound/midi/midi.c head/sys/dev/sound/pci/hda/hdaa.c head/sys/dev/syscons/fire/fire_saver.c head/sys/dev/virtio/console/virtio_console.c head/sys/dev/virtio/mmio/virtio_mmio.c head/sys/dev/virtio/network/if_vtnet.c head/sys/dev/virtio/pci/virtio_pci.c head/sys/dev/vmware/vmxnet3/if_vmx.c head/sys/dev/vnic/nicvf_queues.c head/sys/dev/xen/blkback/blkback.c head/sys/dev/xen/blkfront/blkfront.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/geom/uzip/g_uzip_zlib.c head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c head/sys/i386/i386/bpf_jit_machdep.c head/sys/i386/i386/k6_mem.c head/sys/kern/init_main.c head/sys/kern/kern_cpu.c head/sys/kern/kern_ctf.c head/sys/kern/kern_pmc.c head/sys/kern/subr_bus.c head/sys/kern/subr_taskqueue.c head/sys/kern/subr_vmem.c head/sys/mips/mips/busdma_machdep.c head/sys/mips/nlm/dev/sec/nlmrsa.c head/sys/net/if_vlan.c head/sys/net/iflib.c head/sys/netgraph/ng_bridge.c head/sys/netgraph/ng_deflate.c head/sys/netgraph/ng_parse.c head/sys/netinet6/in6_jail.c head/sys/powerpc/pseries/phyp_vscsi.c head/sys/x86/cpufreq/est.c Modified: head/sys/amd64/amd64/bpf_jit_machdep.c ============================================================================== --- head/sys/amd64/amd64/bpf_jit_machdep.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/amd64/amd64/bpf_jit_machdep.c Sun Jan 21 15:42:36 2018 (r328218) @@ -186,7 +186,7 @@ bpf_jit_compile(struct bpf_insn *prog, u_int nins, siz /* Allocate the reference table for the jumps. */ if (fjmp) { #ifdef _KERNEL - stream.refs = mallocarray(nins + 1, sizeof(u_int), M_BPFJIT, + stream.refs = malloc((nins + 1) * sizeof(u_int), M_BPFJIT, M_NOWAIT | M_ZERO); #else stream.refs = calloc(nins + 1, sizeof(u_int)); Modified: head/sys/arm/xscale/ixp425/if_npe.c ============================================================================== --- head/sys/arm/xscale/ixp425/if_npe.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/arm/xscale/ixp425/if_npe.c Sun Jan 21 15:42:36 2018 (r328218) @@ -515,8 +515,7 @@ npe_dma_setup(struct npe_softc *sc, struct npedma *dma return error; } /* XXX M_TEMP */ - dma->buf = mallocarray(nbuf, sizeof(struct npebuf), M_TEMP, - M_NOWAIT | M_ZERO); + dma->buf = malloc(nbuf * sizeof(struct npebuf), M_TEMP, M_NOWAIT | M_ZERO); if (dma->buf == NULL) { device_printf(sc->sc_dev, "unable to allocate memory for %s s/w buffers\n", Modified: head/sys/arm64/arm64/busdma_bounce.c ============================================================================== --- head/sys/arm64/arm64/busdma_bounce.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/arm64/arm64/busdma_bounce.c Sun Jan 21 15:42:36 2018 (r328218) @@ -302,8 +302,8 @@ bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags error = 0; if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)mallocarray( - dmat->common.nsegments, sizeof(bus_dma_segment_t), + dmat->segments = (bus_dma_segment_t *)malloc( + sizeof(bus_dma_segment_t) * dmat->common.nsegments, M_DEVBUF, M_NOWAIT); if (dmat->segments == NULL) { CTR3(KTR_BUSDMA, "%s: tag %p error %d", Modified: head/sys/cam/cam_queue.c ============================================================================== --- head/sys/cam/cam_queue.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/cam/cam_queue.c Sun Jan 21 15:42:36 2018 (r328218) @@ -126,7 +126,7 @@ camq_resize(struct camq *queue, int new_size) KASSERT(new_size >= queue->entries, ("camq_resize: " "New queue size can't accommodate queued entries (%d < %d).", new_size, queue->entries)); - new_array = (cam_pinfo **)mallocarray(new_size, sizeof(cam_pinfo *), + new_array = (cam_pinfo **)malloc(new_size * sizeof(cam_pinfo *), M_CAMQ, M_NOWAIT); if (new_array == NULL) { /* Couldn't satisfy request */ Modified: head/sys/cam/ctl/ctl_frontend.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/cam/ctl/ctl_frontend.c Sun Jan 21 15:42:36 2018 (r328218) @@ -172,8 +172,8 @@ ctl_port_register(struct ctl_port *port) * Initialize the initiator and portname mappings */ port->max_initiators = CTL_MAX_INIT_PER_PORT; - port->wwpn_iid = mallocarray(port->max_initiators, - sizeof(*port->wwpn_iid), M_CTL, M_NOWAIT | M_ZERO); + port->wwpn_iid = malloc(sizeof(*port->wwpn_iid) * port->max_initiators, + M_CTL, M_NOWAIT | M_ZERO); if (port->wwpn_iid == NULL) { retval = ENOMEM; goto error; Modified: head/sys/compat/ndis/subr_ndis.c ============================================================================== --- head/sys/compat/ndis/subr_ndis.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/compat/ndis/subr_ndis.c Sun Jan 21 15:42:36 2018 (r328218) @@ -1351,7 +1351,7 @@ NdisMAllocateMapRegisters(ndis_handle adapter, uint32_ block = (ndis_miniport_block *)adapter; sc = device_get_softc(block->nmb_physdeviceobj->do_devext); - sc->ndis_mmaps = mallocarray(physmapneeded, sizeof(bus_dmamap_t), + sc->ndis_mmaps = malloc(sizeof(bus_dmamap_t) * physmapneeded, M_DEVBUF, M_NOWAIT|M_ZERO); if (sc->ndis_mmaps == NULL) Modified: head/sys/dev/aacraid/aacraid.c ============================================================================== --- head/sys/dev/aacraid/aacraid.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/aacraid/aacraid.c Sun Jan 21 15:42:36 2018 (r328218) @@ -1458,7 +1458,7 @@ aac_convert_sgraw2(struct aac_softc *sc, struct aac_ra int i, j, pos; u_int32_t addr_low; - sge = mallocarray(nseg_new, sizeof(struct aac_sge_ieee1212), + sge = malloc(nseg_new * sizeof(struct aac_sge_ieee1212), M_AACRAIDBUF, M_NOWAIT|M_ZERO); if (sge == NULL) return nseg; Modified: head/sys/dev/advansys/advansys.c ============================================================================== --- head/sys/dev/advansys/advansys.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/advansys/advansys.c Sun Jan 21 15:42:36 2018 (r328218) @@ -1255,7 +1255,7 @@ adv_attach(adv) * a transaction and use it for mapping the queue to the * upper level SCSI transaction it represents. */ - adv->ccb_infos = mallocarray(adv->max_openings, sizeof(*adv->ccb_infos), + adv->ccb_infos = malloc(sizeof(*adv->ccb_infos) * adv->max_openings, M_DEVBUF, M_NOWAIT); if (adv->ccb_infos == NULL) Modified: head/sys/dev/ath/if_ath_rx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_rx_edma.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/ath/if_ath_rx_edma.c Sun Jan 21 15:42:36 2018 (r328218) @@ -901,8 +901,9 @@ ath_edma_setup_rxfifo(struct ath_softc *sc, HAL_RX_QUE re->m_fifolen); /* Allocate ath_buf FIFO array, pre-zero'ed */ - re->m_fifo = mallocarray(re->m_fifolen, sizeof(struct ath_buf *), - M_ATHDEV, M_NOWAIT | M_ZERO); + re->m_fifo = malloc(sizeof(struct ath_buf *) * re->m_fifolen, + M_ATHDEV, + M_NOWAIT | M_ZERO); if (re->m_fifo == NULL) { device_printf(sc->sc_dev, "%s: malloc failed\n", __func__); Modified: head/sys/dev/beri/virtio/virtio.c ============================================================================== --- head/sys/dev/beri/virtio/virtio.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/beri/virtio/virtio.c Sun Jan 21 15:42:36 2018 (r328218) @@ -250,7 +250,7 @@ getcopy(struct iovec *iov, int n) struct iovec *tiov; int i; - tiov = mallocarray(n, sizeof(struct iovec), M_DEVBUF, M_NOWAIT); + tiov = malloc(n * sizeof(struct iovec), M_DEVBUF, M_NOWAIT); for (i = 0; i < n; i++) { tiov[i].iov_base = iov[i].iov_base; tiov[i].iov_len = iov[i].iov_len; Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/bnxt/if_bnxt.c Sun Jan 21 15:42:36 2018 (r328218) @@ -351,7 +351,7 @@ bnxt_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, softc = iflib_get_softc(ctx); - softc->tx_cp_rings = mallocarray(ntxqsets, sizeof(struct bnxt_cp_ring), + softc->tx_cp_rings = malloc(sizeof(struct bnxt_cp_ring) * ntxqsets, M_DEVBUF, M_NOWAIT | M_ZERO); if (!softc->tx_cp_rings) { device_printf(iflib_get_dev(ctx), @@ -359,7 +359,7 @@ bnxt_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, rc = ENOMEM; goto cp_alloc_fail; } - softc->tx_rings = mallocarray(ntxqsets, sizeof(struct bnxt_ring), + softc->tx_rings = malloc(sizeof(struct bnxt_ring) * ntxqsets, M_DEVBUF, M_NOWAIT | M_ZERO); if (!softc->tx_rings) { device_printf(iflib_get_dev(ctx), @@ -446,7 +446,7 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, softc = iflib_get_softc(ctx); - softc->rx_cp_rings = mallocarray(nrxqsets, sizeof(struct bnxt_cp_ring), + softc->rx_cp_rings = malloc(sizeof(struct bnxt_cp_ring) * nrxqsets, M_DEVBUF, M_NOWAIT | M_ZERO); if (!softc->rx_cp_rings) { device_printf(iflib_get_dev(ctx), @@ -454,7 +454,7 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, rc = ENOMEM; goto cp_alloc_fail; } - softc->rx_rings = mallocarray(nrxqsets, sizeof(struct bnxt_ring), + softc->rx_rings = malloc(sizeof(struct bnxt_ring) * nrxqsets, M_DEVBUF, M_NOWAIT | M_ZERO); if (!softc->rx_rings) { device_printf(iflib_get_dev(ctx), @@ -462,7 +462,7 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, rc = ENOMEM; goto ring_alloc_fail; } - softc->ag_rings = mallocarray(nrxqsets, sizeof(struct bnxt_ring), + softc->ag_rings = malloc(sizeof(struct bnxt_ring) * nrxqsets, M_DEVBUF, M_NOWAIT | M_ZERO); if (!softc->ag_rings) { device_printf(iflib_get_dev(ctx), @@ -470,7 +470,7 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, rc = ENOMEM; goto ag_alloc_fail; } - softc->grp_info = mallocarray(nrxqsets, sizeof(struct bnxt_grp_info), + softc->grp_info = malloc(sizeof(struct bnxt_grp_info) * nrxqsets, M_DEVBUF, M_NOWAIT | M_ZERO); if (!softc->grp_info) { device_printf(iflib_get_dev(ctx), @@ -540,10 +540,9 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, softc->rx_rings[i].paddr = paddrs[i * nrxqs + 1]; /* Allocate the TPA start buffer */ - softc->rx_rings[i].tpa_start = mallocarray( - RX_TPA_START_CMPL_AGG_ID_MASK >> RX_TPA_START_CMPL_AGG_ID_SFT, - sizeof(struct bnxt_full_tpa_start), M_DEVBUF, - M_NOWAIT | M_ZERO); + softc->rx_rings[i].tpa_start = malloc(sizeof(struct bnxt_full_tpa_start) * + (RX_TPA_START_CMPL_AGG_ID_MASK >> RX_TPA_START_CMPL_AGG_ID_SFT), + M_DEVBUF, M_NOWAIT | M_ZERO); if (softc->rx_rings[i].tpa_start == NULL) { rc = -ENOMEM; device_printf(softc->dev, Modified: head/sys/dev/bwn/if_bwn.c ============================================================================== --- head/sys/dev/bwn/if_bwn.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/bwn/if_bwn.c Sun Jan 21 15:42:36 2018 (r328218) @@ -2677,8 +2677,8 @@ bwn_dma_ringsetup(struct bwn_mac *mac, int controller_ if (for_tx) dr->dr_numslots = BWN_TXRING_SLOTS; - dr->dr_meta = mallocarray(dr->dr_numslots, - sizeof(struct bwn_dmadesc_meta), M_DEVBUF, M_NOWAIT | M_ZERO); + dr->dr_meta = malloc(dr->dr_numslots * sizeof(struct bwn_dmadesc_meta), + M_DEVBUF, M_NOWAIT | M_ZERO); if (dr->dr_meta == NULL) goto fail0; Modified: head/sys/dev/bwn/if_bwn_phy_lp.c ============================================================================== --- head/sys/dev/bwn/if_bwn_phy_lp.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/bwn/if_bwn_phy_lp.c Sun Jan 21 15:42:36 2018 (r328218) @@ -1127,7 +1127,7 @@ bwn_phy_lp_bugfix(struct bwn_mac *mac) uint8_t mode; int8_t txpwridx; - tabs = (uint32_t *)mallocarray(size, sizeof(uint32_t), M_DEVBUF, + tabs = (uint32_t *)malloc(sizeof(uint32_t) * size, M_DEVBUF, M_NOWAIT | M_ZERO); if (tabs == NULL) { device_printf(sc->sc_dev, "failed to allocate buffer.\n"); Modified: head/sys/dev/ciss/ciss.c ============================================================================== --- head/sys/dev/ciss/ciss.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/ciss/ciss.c Sun Jan 21 15:42:36 2018 (r328218) @@ -1427,7 +1427,7 @@ ciss_init_logical(struct ciss_softc *sc) } sc->ciss_logical = - mallocarray(sc->ciss_max_logical_bus, sizeof(struct ciss_ldrive *), + malloc(sc->ciss_max_logical_bus * sizeof(struct ciss_ldrive *), CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO); if (sc->ciss_logical == NULL) { error = ENXIO; @@ -1436,7 +1436,7 @@ ciss_init_logical(struct ciss_softc *sc) for (i = 0; i < sc->ciss_max_logical_bus; i++) { sc->ciss_logical[i] = - mallocarray(sc->ciss_cfg->max_logical_supported, + malloc(sc->ciss_cfg->max_logical_supported * sizeof(struct ciss_ldrive), CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO); if (sc->ciss_logical[i] == NULL) { @@ -1549,7 +1549,7 @@ ciss_init_physical(struct ciss_softc *sc) } sc->ciss_controllers = - mallocarray(sc->ciss_max_logical_bus, sizeof(union ciss_device_address), + malloc(sc->ciss_max_logical_bus * sizeof (union ciss_device_address), CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO); if (sc->ciss_controllers == NULL) { @@ -1566,7 +1566,7 @@ ciss_init_physical(struct ciss_softc *sc) } sc->ciss_physical = - mallocarray(sc->ciss_max_physical_bus, sizeof(struct ciss_pdrive *), + malloc(sc->ciss_max_physical_bus * sizeof(struct ciss_pdrive *), CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO); if (sc->ciss_physical == NULL) { ciss_printf(sc, "Could not allocate memory for physical device map\n"); @@ -2873,7 +2873,7 @@ ciss_cam_init(struct ciss_softc *sc) */ maxbus = max(sc->ciss_max_logical_bus, sc->ciss_max_physical_bus + CISS_PHYSICAL_BASE); - sc->ciss_cam_sim = mallocarray(maxbus, sizeof(struct cam_sim*), + sc->ciss_cam_sim = malloc(maxbus * sizeof(struct cam_sim*), CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO); if (sc->ciss_cam_sim == NULL) { ciss_printf(sc, "can't allocate memory for controller SIM\n"); Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_crypto.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Sun Jan 21 15:42:36 2018 (r328218) @@ -1900,7 +1900,7 @@ ccr_newsession(device_t dev, uint32_t *sidp, struct cr } } if (sess == -1) { - s = mallocarray(sc->nsessions + 1, sizeof(*s), M_CCR, + s = malloc(sizeof(*s) * (sc->nsessions + 1), M_CCR, M_NOWAIT | M_ZERO); if (s == NULL) { mtx_unlock(&sc->lock); Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/e1000/if_em.c Sun Jan 21 15:42:36 2018 (r328218) @@ -2835,9 +2835,9 @@ em_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, u /* First allocate the top level queue structs */ if (!(adapter->tx_queues = - (struct em_tx_queue *) mallocarray(adapter->tx_num_queues, - sizeof(struct em_tx_queue), M_DEVBUF, M_NOWAIT | M_ZERO))) { - device_printf(iflib_get_dev(ctx), "Unable to allocate queue memory\n"); + (struct em_tx_queue *) malloc(sizeof(struct em_tx_queue) * + adapter->tx_num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { + device_printf(iflib_get_dev(ctx), "Unable to allocate queue memory\n"); return(ENOMEM); } @@ -2849,8 +2849,7 @@ em_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, u que->me = txr->me = i; /* Allocate report status array */ - if (!(txr->tx_rsq = (qidx_t *) mallocarray(scctx->isc_ntxd[0], - sizeof(qidx_t), M_DEVBUF, M_NOWAIT | M_ZERO))) { + if (!(txr->tx_rsq = (qidx_t *) malloc(sizeof(qidx_t) * scctx->isc_ntxd[0], M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(iflib_get_dev(ctx), "failed to allocate rs_idxs memory\n"); error = ENOMEM; goto fail; @@ -2882,8 +2881,8 @@ em_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, u /* First allocate the top level queue structs */ if (!(adapter->rx_queues = - (struct em_rx_queue *) mallocarray(adapter->rx_num_queues, - sizeof(struct em_rx_queue), M_DEVBUF, M_NOWAIT | M_ZERO))) { + (struct em_rx_queue *) malloc(sizeof(struct em_rx_queue) * + adapter->rx_num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(iflib_get_dev(ctx), "Unable to allocate queue memory\n"); error = ENOMEM; goto fail; Modified: head/sys/dev/esp/ncr53c9x.c ============================================================================== --- head/sys/dev/esp/ncr53c9x.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/esp/ncr53c9x.c Sun Jan 21 15:42:36 2018 (r328218) @@ -292,7 +292,7 @@ ncr53c9x_attach(struct ncr53c9x_softc *sc) } else sc->sc_imess_self = 0; - sc->sc_tinfo = mallocarray(sc->sc_ntarg, sizeof(sc->sc_tinfo[0]), + sc->sc_tinfo = malloc(sc->sc_ntarg * sizeof(sc->sc_tinfo[0]), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->sc_tinfo == NULL) { device_printf(sc->sc_dev, Modified: head/sys/dev/fb/splash.c ============================================================================== --- head/sys/dev/fb/splash.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/fb/splash.c Sun Jan 21 15:42:36 2018 (r328218) @@ -136,8 +136,8 @@ splash_register(splash_decoder_t *decoder) break; } if ((i >= decoders) && (decoders % DECODER_ARRAY_DELTA) == 0) { - p = mallocarray(decoders + DECODER_ARRAY_DELTA, - sizeof(*p), M_DEVBUF, M_NOWAIT); + p = malloc(sizeof(*p)*(decoders + DECODER_ARRAY_DELTA), + M_DEVBUF, M_NOWAIT); if (p == NULL) return ENOMEM; if (decoder_set != NULL) { Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/gpio/gpiobus.c Sun Jan 21 15:42:36 2018 (r328218) @@ -235,7 +235,7 @@ gpiobus_init_softc(device_t dev) /* Pins = GPIO_PIN_MAX() + 1 */ sc->sc_npins++; - sc->sc_pins = mallocarray(sc->sc_npins, sizeof(*sc->sc_pins), M_DEVBUF, + sc->sc_pins = malloc(sizeof(*sc->sc_pins) * sc->sc_npins, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->sc_pins == NULL) return (ENOMEM); @@ -251,11 +251,11 @@ gpiobus_alloc_ivars(struct gpiobus_ivar *devi) { /* Allocate pins and flags memory. */ - devi->pins = mallocarray(devi->npins, sizeof(uint32_t), M_DEVBUF, + devi->pins = malloc(sizeof(uint32_t) * devi->npins, M_DEVBUF, M_NOWAIT | M_ZERO); if (devi->pins == NULL) return (ENOMEM); - devi->flags = mallocarray(devi->npins, sizeof(uint32_t), M_DEVBUF, + devi->flags = malloc(sizeof(uint32_t) * devi->npins, M_DEVBUF, M_NOWAIT | M_ZERO); if (devi->flags == NULL) { free(devi->pins, M_DEVBUF); Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/if_ndis/if_ndis.c Sun Jan 21 15:42:36 2018 (r328218) @@ -665,8 +665,8 @@ ndis_attach(device_t dev) if (sc->ndis_maxpkts == 0) sc->ndis_maxpkts = 10; - sc->ndis_txarray = mallocarray(sc->ndis_maxpkts, - sizeof(ndis_packet *), M_DEVBUF, M_NOWAIT|M_ZERO); + sc->ndis_txarray = malloc(sizeof(ndis_packet *) * + sc->ndis_maxpkts, M_DEVBUF, M_NOWAIT|M_ZERO); /* Allocate a pool of ndis_packets for TX encapsulation. */ Modified: head/sys/dev/iwi/if_iwi.c ============================================================================== --- head/sys/dev/iwi/if_iwi.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/iwi/if_iwi.c Sun Jan 21 15:42:36 2018 (r328218) @@ -640,7 +640,7 @@ iwi_alloc_tx_ring(struct iwi_softc *sc, struct iwi_tx_ goto fail; } - ring->data = mallocarray(count, sizeof(struct iwi_tx_data), M_DEVBUF, + ring->data = malloc(count * sizeof (struct iwi_tx_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (ring->data == NULL) { device_printf(sc->sc_dev, "could not allocate soft data\n"); @@ -748,7 +748,7 @@ iwi_alloc_rx_ring(struct iwi_softc *sc, struct iwi_rx_ ring->count = count; ring->cur = 0; - ring->data = mallocarray(count, sizeof(struct iwi_rx_data), M_DEVBUF, + ring->data = malloc(count * sizeof (struct iwi_rx_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (ring->data == NULL) { device_printf(sc->sc_dev, "could not allocate soft data\n"); Modified: head/sys/dev/ixl/if_ixlv.c ============================================================================== --- head/sys/dev/ixl/if_ixlv.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/ixl/if_ixlv.c Sun Jan 21 15:42:36 2018 (r328218) @@ -1637,8 +1637,8 @@ ixlv_setup_queues(struct ixlv_sc *sc) /* Get memory for the station queues */ if (!(vsi->queues = - (struct ixl_queue *) mallocarray(vsi->num_queues, - sizeof(struct ixl_queue), M_DEVBUF, M_NOWAIT | M_ZERO))) { + (struct ixl_queue *) malloc(sizeof(struct ixl_queue) * + vsi->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate queue memory\n"); error = ENOMEM; goto early; Modified: head/sys/dev/ixl/ixl_pf_iov.c ============================================================================== --- head/sys/dev/ixl/ixl_pf_iov.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/ixl/ixl_pf_iov.c Sun Jan 21 15:42:36 2018 (r328218) @@ -1695,8 +1695,8 @@ ixl_iov_init(device_t dev, uint16_t num_vfs, const nvl pf_vsi = &pf->vsi; IXL_PF_LOCK(pf); - pf->vfs = mallocarray(num_vfs, sizeof(struct ixl_vf), M_IXL, - M_NOWAIT | M_ZERO); + pf->vfs = malloc(sizeof(struct ixl_vf) * num_vfs, M_IXL, M_NOWAIT | + M_ZERO); if (pf->vfs == NULL) { error = ENOMEM; Modified: head/sys/dev/ixl/ixl_pf_main.c ============================================================================== --- head/sys/dev/ixl/ixl_pf_main.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/ixl/ixl_pf_main.c Sun Jan 21 15:42:36 2018 (r328218) @@ -2431,8 +2431,8 @@ ixl_setup_stations(struct ixl_pf *pf) /* Get memory for the station queues */ if (!(vsi->queues = - (struct ixl_queue *) mallocarray(vsi->num_queues, - sizeof(struct ixl_queue), M_DEVBUF, M_NOWAIT | M_ZERO))) { + (struct ixl_queue *) malloc(sizeof(struct ixl_queue) * + vsi->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate queue memory\n"); error = ENOMEM; return (error); @@ -3317,7 +3317,7 @@ ixl_add_hw_filters(struct ixl_vsi *vsi, int flags, int hw = &pf->hw; IXL_PF_LOCK_ASSERT(pf); - a = mallocarray(cnt, sizeof(struct i40e_aqc_add_macvlan_element_data), + a = malloc(sizeof(struct i40e_aqc_add_macvlan_element_data) * cnt, M_DEVBUF, M_NOWAIT | M_ZERO); if (a == NULL) { device_printf(dev, "add_hw_filters failed to get memory\n"); @@ -3380,8 +3380,7 @@ ixl_del_hw_filters(struct ixl_vsi *vsi, int cnt) hw = &pf->hw; dev = pf->dev; - d = mallocarray(cnt, - sizeof(struct i40e_aqc_remove_macvlan_element_data), + d = malloc(sizeof(struct i40e_aqc_remove_macvlan_element_data) * cnt, M_DEVBUF, M_NOWAIT | M_ZERO); if (d == NULL) { printf("del hw filter failed to get memory\n"); Modified: head/sys/dev/kbd/kbd.c ============================================================================== --- head/sys/dev/kbd/kbd.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/kbd/kbd.c Sun Jan 21 15:42:36 2018 (r328218) @@ -94,18 +94,17 @@ kbd_realloc_array(void) { keyboard_t **new_kbd; keyboard_switch_t **new_kbdsw; - u_int newsize; + int newsize; int s; s = spltty(); newsize = rounddown(keyboards + ARRAY_DELTA, ARRAY_DELTA); - new_kbd = mallocarray(newsize, sizeof(*new_kbd), M_DEVBUF, - M_NOWAIT|M_ZERO); + new_kbd = malloc(sizeof(*new_kbd)*newsize, M_DEVBUF, M_NOWAIT|M_ZERO); if (new_kbd == NULL) { splx(s); return (ENOMEM); } - new_kbdsw = mallocarray(newsize, sizeof(*new_kbdsw), M_DEVBUF, + new_kbdsw = malloc(sizeof(*new_kbdsw)*newsize, M_DEVBUF, M_NOWAIT|M_ZERO); if (new_kbdsw == NULL) { free(new_kbd, M_DEVBUF); Modified: head/sys/dev/liquidio/base/lio_request_manager.c ============================================================================== --- head/sys/dev/liquidio/base/lio_request_manager.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/liquidio/base/lio_request_manager.c Sun Jan 21 15:42:36 2018 (r328218) @@ -110,7 +110,7 @@ lio_init_instr_queue(struct octeon_device *oct, union * Initialize a list to holds requests that have been posted to * Octeon but has yet to be fetched by octeon */ - iq->request_list = mallocarray(num_descs, sizeof(*iq->request_list), + iq->request_list = malloc(sizeof(*iq->request_list) * num_descs, M_DEVBUF, M_NOWAIT | M_ZERO); if (iq->request_list == NULL) { lio_dev_err(oct, "Alloc failed for IQ[%d] nr free list\n", Modified: head/sys/dev/liquidio/lio_main.c ============================================================================== --- head/sys/dev/liquidio/lio_main.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/liquidio/lio_main.c Sun Jan 21 15:42:36 2018 (r328218) @@ -1724,12 +1724,12 @@ lio_setup_glists(struct octeon_device *oct, struct lio struct lio_gather *g; int i, j; - lio->glist_lock = mallocarray(num_iqs, sizeof(*lio->glist_lock), - M_DEVBUF, M_NOWAIT | M_ZERO); + lio->glist_lock = malloc(num_iqs * sizeof(*lio->glist_lock), M_DEVBUF, + M_NOWAIT | M_ZERO); if (lio->glist_lock == NULL) return (1); - lio->ghead = mallocarray(num_iqs, sizeof(*lio->ghead), M_DEVBUF, + lio->ghead = malloc(num_iqs * sizeof(*lio->ghead), M_DEVBUF, M_NOWAIT | M_ZERO); if (lio->ghead == NULL) { free((void *)lio->glist_lock, M_DEVBUF); @@ -1743,10 +1743,10 @@ lio_setup_glists(struct octeon_device *oct, struct lio * allocate memory to store virtual and dma base address of * per glist consistent memory */ - lio->glists_virt_base = mallocarray(num_iqs, sizeof(void *), M_DEVBUF, + lio->glists_virt_base = malloc(num_iqs * sizeof(void *), M_DEVBUF, M_NOWAIT | M_ZERO); - lio->glists_dma_base = mallocarray(num_iqs, sizeof(vm_paddr_t), - M_DEVBUF, M_NOWAIT | M_ZERO); + lio->glists_dma_base = malloc(num_iqs * sizeof(vm_paddr_t), M_DEVBUF, + M_NOWAIT | M_ZERO); if ((lio->glists_virt_base == NULL) || (lio->glists_dma_base == NULL)) { lio_delete_glists(oct, lio); return (1); Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/mpr/mpr.c Sun Jan 21 15:42:36 2018 (r328218) @@ -1192,7 +1192,7 @@ mpr_alloc_queues(struct mpr_softc *sc) nq = sc->msi_msgs; mpr_dprint(sc, MPR_INIT|MPR_XINFO, "Allocating %d I/O queues\n", nq); - sc->queues = mallocarray(nq, sizeof(struct mpr_queue), M_MPR, + sc->queues = malloc(sizeof(struct mpr_queue) * nq, M_MPR, M_NOWAIT|M_ZERO); if (sc->queues == NULL) return (ENOMEM); Modified: head/sys/dev/mpr/mpr_mapping.c ============================================================================== --- head/sys/dev/mpr/mpr_mapping.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/mpr/mpr_mapping.c Sun Jan 21 15:42:36 2018 (r328218) @@ -2141,27 +2141,27 @@ mpr_mapping_allocate_memory(struct mpr_softc *sc) { uint32_t dpm_pg0_sz; - sc->mapping_table = mallocarray(sc->max_devices, - sizeof(struct dev_mapping_table), M_MPR, M_ZERO|M_NOWAIT); + sc->mapping_table = malloc((sizeof(struct dev_mapping_table) * + sc->max_devices), M_MPR, M_ZERO|M_NOWAIT); if (!sc->mapping_table) goto free_resources; - sc->removal_table = mallocarray(sc->max_devices, - sizeof(struct map_removal_table), M_MPR, M_ZERO|M_NOWAIT); + sc->removal_table = malloc((sizeof(struct map_removal_table) * + sc->max_devices), M_MPR, M_ZERO|M_NOWAIT); if (!sc->removal_table) goto free_resources; - sc->enclosure_table = mallocarray(sc->max_enclosures, - sizeof(struct enc_mapping_table), M_MPR, M_ZERO|M_NOWAIT); + sc->enclosure_table = malloc((sizeof(struct enc_mapping_table) * + sc->max_enclosures), M_MPR, M_ZERO|M_NOWAIT); if (!sc->enclosure_table) goto free_resources; - sc->dpm_entry_used = mallocarray(sc->max_dpm_entries, sizeof(u8), + sc->dpm_entry_used = malloc((sizeof(u8) * sc->max_dpm_entries), M_MPR, M_ZERO|M_NOWAIT); if (!sc->dpm_entry_used) goto free_resources; - sc->dpm_flush_entry = mallocarray(sc->max_dpm_entries, sizeof(u8), + sc->dpm_flush_entry = malloc((sizeof(u8) * sc->max_dpm_entries), M_MPR, M_ZERO|M_NOWAIT); if (!sc->dpm_flush_entry) goto free_resources; @@ -2912,7 +2912,7 @@ mpr_mapping_topology_change_event(struct mpr_softc *sc if (!num_entries) goto out; - phy_change = mallocarray(num_entries, sizeof(struct _map_phy_change), + phy_change = malloc(sizeof(struct _map_phy_change) * num_entries, M_MPR, M_NOWAIT|M_ZERO); topo_change.phy_details = phy_change; if (!phy_change) @@ -2963,7 +2963,7 @@ mpr_mapping_pcie_topology_change_event(struct mpr_soft if (!num_entries) goto out; - port_change = mallocarray(num_entries, sizeof(struct _map_port_change), + port_change = malloc(sizeof(struct _map_port_change) * num_entries, M_MPR, M_NOWAIT|M_ZERO); topo_change.port_details = port_change; if (!port_change) @@ -3003,7 +3003,7 @@ mpr_mapping_ir_config_change_event(struct mpr_softc *s struct dev_mapping_table *mt_entry; u16 element_flags; - wwid_table = mallocarray(event_data->NumElements, sizeof(u64), M_MPR, + wwid_table = malloc(sizeof(u64) * event_data->NumElements, M_MPR, M_NOWAIT | M_ZERO); if (!wwid_table) goto out; Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/mps/mps.c Sun Jan 21 15:42:36 2018 (r328218) @@ -1164,12 +1164,12 @@ static int mps_alloc_queues(struct mps_softc *sc) { struct mps_queue *q; - u_int nq, i; + int nq, i; nq = sc->msi_msgs; mps_dprint(sc, MPS_INIT|MPS_XINFO, "Allocating %d I/O queues\n", nq); - sc->queues = mallocarray(nq, sizeof(struct mps_queue), M_MPT2, + sc->queues = malloc(sizeof(struct mps_queue) * nq, M_MPT2, M_NOWAIT|M_ZERO); if (sc->queues == NULL) return (ENOMEM); Modified: head/sys/dev/mps/mps_mapping.c ============================================================================== --- head/sys/dev/mps/mps_mapping.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/mps/mps_mapping.c Sun Jan 21 15:42:36 2018 (r328218) @@ -1694,27 +1694,27 @@ mps_mapping_allocate_memory(struct mps_softc *sc) { uint32_t dpm_pg0_sz; - sc->mapping_table = mallocarray(sc->max_devices, - sizeof(struct dev_mapping_table), M_MPT2, M_ZERO|M_NOWAIT); + sc->mapping_table = malloc((sizeof(struct dev_mapping_table) * + sc->max_devices), M_MPT2, M_ZERO|M_NOWAIT); if (!sc->mapping_table) goto free_resources; - sc->removal_table = mallocarray(sc->max_devices, - sizeof(struct map_removal_table), M_MPT2, M_ZERO|M_NOWAIT); + sc->removal_table = malloc((sizeof(struct map_removal_table) * + sc->max_devices), M_MPT2, M_ZERO|M_NOWAIT); if (!sc->removal_table) goto free_resources; - sc->enclosure_table = mallocarray(sc->max_enclosures, - sizeof(struct enc_mapping_table), M_MPT2, M_ZERO|M_NOWAIT); + sc->enclosure_table = malloc((sizeof(struct enc_mapping_table) * + sc->max_enclosures), M_MPT2, M_ZERO|M_NOWAIT); if (!sc->enclosure_table) goto free_resources; - sc->dpm_entry_used = mallocarray(sc->max_dpm_entries, sizeof(u8), + sc->dpm_entry_used = malloc((sizeof(u8) * sc->max_dpm_entries), M_MPT2, M_ZERO|M_NOWAIT); if (!sc->dpm_entry_used) goto free_resources; - sc->dpm_flush_entry = mallocarray(sc->max_dpm_entries, sizeof(u8), + sc->dpm_flush_entry = malloc((sizeof(u8) * sc->max_dpm_entries), M_MPT2, M_ZERO|M_NOWAIT); if (!sc->dpm_flush_entry) goto free_resources; @@ -2451,7 +2451,7 @@ mps_mapping_topology_change_event(struct mps_softc *sc if (!num_entries) goto out; - phy_change = mallocarray(num_entries, sizeof(struct _map_phy_change), + phy_change = malloc(sizeof(struct _map_phy_change) * num_entries, M_MPT2, M_NOWAIT|M_ZERO); topo_change.phy_details = phy_change; if (!phy_change) @@ -2492,7 +2492,7 @@ mps_mapping_ir_config_change_event(struct mps_softc *s struct dev_mapping_table *mt_entry; u16 element_flags; - wwid_table = mallocarray(event_data->NumElements, sizeof(u64), M_MPT2, + wwid_table = malloc(sizeof(u64) * event_data->NumElements, M_MPT2, M_NOWAIT | M_ZERO); if (!wwid_table) goto out; Modified: head/sys/dev/mpt/mpt_cam.c ============================================================================== --- head/sys/dev/mpt/mpt_cam.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/mpt/mpt_cam.c Sun Jan 21 15:42:36 2018 (r328218) @@ -637,8 +637,8 @@ mptsas_sas_io_unit_pg0(struct mpt_softc *mpt, struct m } portinfo->num_phys = buffer->NumPhys; - portinfo->phy_info = mallocarray(portinfo->num_phys, - sizeof(*portinfo->phy_info), M_DEVBUF, M_NOWAIT|M_ZERO); + portinfo->phy_info = malloc(sizeof(*portinfo->phy_info) * + portinfo->num_phys, M_DEVBUF, M_NOWAIT|M_ZERO); if (portinfo->phy_info == NULL) { free(buffer, M_DEVBUF); error = ENOMEM; @@ -4234,7 +4234,7 @@ mpt_add_target_commands(struct mpt_softc *mpt) max = mpt->mpt_max_tgtcmds; } mpt->tgt_cmd_ptrs = - mallocarray(max, sizeof(request_t *), M_DEVBUF, M_NOWAIT | M_ZERO); + malloc(max * sizeof (request_t *), M_DEVBUF, M_NOWAIT | M_ZERO); if (mpt->tgt_cmd_ptrs == NULL) { mpt_prt(mpt, "mpt_add_target_commands: could not allocate cmd ptrs\n"); Modified: head/sys/dev/mrsas/mrsas.c ============================================================================== --- head/sys/dev/mrsas/mrsas.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/mrsas/mrsas.c Sun Jan 21 15:42:36 2018 (r328218) @@ -2566,8 +2566,7 @@ mrsas_alloc_mpt_cmds(struct mrsas_softc *sc) * Allocate the dynamic array first and then allocate individual * commands. */ - sc->mpt_cmd_list = mallocarray(max_cmd, sizeof(struct mrsas_mpt_cmd *), - M_MRSAS, M_NOWAIT); + sc->mpt_cmd_list = malloc(sizeof(struct mrsas_mpt_cmd *) * max_cmd, M_MRSAS, M_NOWAIT); if (!sc->mpt_cmd_list) { device_printf(sc->mrsas_dev, "Cannot alloc memory for mpt_cmd_list.\n"); return (ENOMEM); Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/mxge/if_mxge.c Sun Jan 21 15:42:36 2018 (r328218) @@ -688,7 +688,7 @@ z_alloc(void *nil, u_int items, u_int size) { void *ptr; - ptr = mallocarray(items, size, M_TEMP, M_NOWAIT); + ptr = malloc(items * size, M_TEMP, M_NOWAIT); return ptr; } @@ -4390,8 +4390,8 @@ mxge_alloc_slices(mxge_softc_t *sc) sc->rx_ring_size = cmd.data0; max_intr_slots = 2 * (sc->rx_ring_size / sizeof (mcp_dma_addr_t)); - sc->ss = mallocarray(sc->num_slices, sizeof(*sc->ss), M_DEVBUF, - M_NOWAIT | M_ZERO); + bytes = sizeof (*sc->ss) * sc->num_slices; + sc->ss = malloc(bytes, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->ss == NULL) return (ENOMEM); for (i = 0; i < sc->num_slices; i++) { @@ -4535,6 +4535,7 @@ abort_with_fw: static int mxge_add_msix_irqs(mxge_softc_t *sc) { + size_t bytes; int count, err, i, rid; rid = PCIR_BAR(2); @@ -4562,8 +4563,8 @@ mxge_add_msix_irqs(mxge_softc_t *sc) err = ENOSPC; goto abort_with_msix; } - sc->msix_irq_res = mallocarray(sc->num_slices, - sizeof(*sc->msix_irq_res), M_DEVBUF, M_NOWAIT|M_ZERO); + bytes = sizeof (*sc->msix_irq_res) * sc->num_slices; + sc->msix_irq_res = malloc(bytes, M_DEVBUF, M_NOWAIT|M_ZERO); if (sc->msix_irq_res == NULL) { err = ENOMEM; goto abort_with_msix; @@ -4582,8 +4583,8 @@ mxge_add_msix_irqs(mxge_softc_t *sc) } } - sc->msix_ih = mallocarray(sc->num_slices, sizeof(*sc->msix_ih), - M_DEVBUF, M_NOWAIT|M_ZERO); + bytes = sizeof (*sc->msix_ih) * sc->num_slices; + sc->msix_ih = malloc(bytes, M_DEVBUF, M_NOWAIT|M_ZERO); for (i = 0; i < sc->num_slices; i++) { err = bus_setup_intr(sc->dev, sc->msix_irq_res[i], Modified: head/sys/dev/netmap/if_ptnet.c ============================================================================== --- head/sys/dev/netmap/if_ptnet.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/netmap/if_ptnet.c Sun Jan 21 15:42:36 2018 (r328218) @@ -351,7 +351,7 @@ ptnet_attach(device_t dev) sc->num_tx_rings = num_tx_rings; /* Allocate and initialize per-queue data structures. */ - sc->queues = mallocarray(sc->num_rings, sizeof(struct ptnet_queue), + sc->queues = malloc(sizeof(struct ptnet_queue) * sc->num_rings, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->queues == NULL) { err = ENOMEM; Modified: head/sys/dev/nvme/nvme_ns.c ============================================================================== --- head/sys/dev/nvme/nvme_ns.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/nvme/nvme_ns.c Sun Jan 21 15:42:36 2018 (r328218) @@ -321,8 +321,7 @@ nvme_allocate_child_bios(int num_bios) struct bio **child_bios; int err = 0, i; - child_bios = mallocarray(num_bios, sizeof(struct bio *), M_NVME, - M_NOWAIT); + child_bios = malloc(num_bios * sizeof(struct bio *), M_NVME, M_NOWAIT); if (child_bios == NULL) return (NULL); Modified: head/sys/dev/pst/pst-iop.c ============================================================================== --- head/sys/dev/pst/pst-iop.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/pst/pst-iop.c Sun Jan 21 15:42:36 2018 (r328218) @@ -323,7 +323,7 @@ iop_get_lct(struct iop_softc *sc) contigfree(reply, ALLOCSIZE, M_PSTIOP); return 0; } - if (!(sc->lct = mallocarray(reply->table_size, sizeof(struct i2o_lct_entry), + if (!(sc->lct = malloc(reply->table_size * sizeof(struct i2o_lct_entry), M_PSTIOP, M_NOWAIT | M_ZERO))) { contigfree(reply, ALLOCSIZE, M_PSTIOP); return 0; Modified: head/sys/dev/ral/rt2560.c ============================================================================== --- head/sys/dev/ral/rt2560.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/ral/rt2560.c Sun Jan 21 15:42:36 2018 (r328218) @@ -488,7 +488,7 @@ rt2560_alloc_tx_ring(struct rt2560_softc *sc, struct r goto fail; } - ring->data = mallocarray(count, sizeof(struct rt2560_tx_data), M_DEVBUF, + ring->data = malloc(count * sizeof (struct rt2560_tx_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (ring->data == NULL) { device_printf(sc->sc_dev, "could not allocate soft data\n"); @@ -632,8 +632,8 @@ rt2560_alloc_rx_ring(struct rt2560_softc *sc, struct r goto fail; } - ring->data = mallocarray(count, sizeof (struct rt2560_rx_data), - M_DEVBUF, M_NOWAIT | M_ZERO); + ring->data = malloc(count * sizeof (struct rt2560_rx_data), M_DEVBUF, + M_NOWAIT | M_ZERO); if (ring->data == NULL) { device_printf(sc->sc_dev, "could not allocate soft data\n"); error = ENOMEM; Modified: head/sys/dev/ral/rt2661.c ============================================================================== --- head/sys/dev/ral/rt2661.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/ral/rt2661.c Sun Jan 21 15:42:36 2018 (r328218) @@ -497,7 +497,7 @@ rt2661_alloc_tx_ring(struct rt2661_softc *sc, struct r goto fail; } - ring->data = mallocarray(count, sizeof(struct rt2661_tx_data), M_DEVBUF, + ring->data = malloc(count * sizeof (struct rt2661_tx_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (ring->data == NULL) { device_printf(sc->sc_dev, "could not allocate soft data\n"); @@ -638,7 +638,7 @@ rt2661_alloc_rx_ring(struct rt2661_softc *sc, struct r goto fail; } - ring->data = mallocarray(count, sizeof(struct rt2661_rx_data), M_DEVBUF, + ring->data = malloc(count * sizeof (struct rt2661_rx_data), M_DEVBUF, M_NOWAIT | M_ZERO); if (ring->data == NULL) { device_printf(sc->sc_dev, "could not allocate soft data\n"); Modified: head/sys/dev/rp/rp.c ============================================================================== --- head/sys/dev/rp/rp.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/rp/rp.c Sun Jan 21 15:42:36 2018 (r328218) @@ -732,8 +732,7 @@ rp_attachcommon(CONTROLLER_T *ctlp, int num_aiops, int ctlp->num_ports = num_ports; ctlp->rp = rp = (struct rp_port *) - mallocarray(num_ports, sizeof(struct rp_port), M_DEVBUF, - M_NOWAIT | M_ZERO); + malloc(sizeof(struct rp_port) * num_ports, M_DEVBUF, M_NOWAIT | M_ZERO); if (rp == NULL) { device_printf(ctlp->dev, "rp_attachcommon: Could not malloc rp_ports structures.\n"); retval = ENOMEM; Modified: head/sys/dev/rp/rp_isa.c ============================================================================== --- head/sys/dev/rp/rp_isa.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/rp/rp_isa.c Sun Jan 21 15:42:36 2018 (r328218) @@ -178,10 +178,8 @@ rp_probe(device_t dev) /* The IO ports of AIOPs for an ISA controller are discrete. */ ctlp->io_num = 1; - ctlp->io_rid = mallocarray(MAX_AIOPS_PER_BOARD, sizeof(*(ctlp->io_rid)), - M_DEVBUF, M_NOWAIT | M_ZERO); - ctlp->io = mallocarray(MAX_AIOPS_PER_BOARD, sizeof(*(ctlp->io)), - M_DEVBUF, M_NOWAIT | M_ZERO); + ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT | M_ZERO); + ctlp->io = malloc(sizeof(*(ctlp->io)) * MAX_AIOPS_PER_BOARD, M_DEVBUF, M_NOWAIT | M_ZERO); if (ctlp->io_rid == NULL || ctlp->io == NULL) { device_printf(dev, "rp_attach: Out of memory.\n"); retval = ENOMEM; Modified: head/sys/dev/rp/rp_pci.c ============================================================================== --- head/sys/dev/rp/rp_pci.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/rp/rp_pci.c Sun Jan 21 15:42:36 2018 (r328218) @@ -164,10 +164,8 @@ rp_pciattach(device_t dev) /* The IO ports of AIOPs for a PCI controller are continuous. */ ctlp->io_num = 1; - ctlp->io_rid = mallocarray(ctlp->io_num, sizeof(*(ctlp->io_rid)), - M_DEVBUF, M_NOWAIT | M_ZERO); - ctlp->io = mallocarray(ctlp->io_num, sizeof(*(ctlp->io)), M_DEVBUF, - M_NOWAIT | M_ZERO); + ctlp->io_rid = malloc(sizeof(*(ctlp->io_rid)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO); + ctlp->io = malloc(sizeof(*(ctlp->io)) * ctlp->io_num, M_DEVBUF, M_NOWAIT | M_ZERO); if (ctlp->io_rid == NULL || ctlp->io == NULL) { device_printf(dev, "rp_pciattach: Out of memory.\n"); retval = ENOMEM; Modified: head/sys/dev/sound/midi/midi.c ============================================================================== --- head/sys/dev/sound/midi/midi.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/sound/midi/midi.c Sun Jan 21 15:42:36 2018 (r328218) @@ -340,15 +340,14 @@ midi_init(kobj_class_t cls, int unit, int channel, voi mtx_lock(&m->qlock); if (inqsize) - buf = mallocarray(inqsize, sizeof(MIDI_TYPE), M_MIDI, M_NOWAIT); + buf = malloc(sizeof(MIDI_TYPE) * inqsize, M_MIDI, M_NOWAIT); else buf = NULL; MIDIQ_INIT(m->inq, buf, inqsize); if (outqsize) - buf = mallocarray(outqsize, sizeof(MIDI_TYPE), M_MIDI, - M_NOWAIT); + buf = malloc(sizeof(MIDI_TYPE) * outqsize, M_MIDI, M_NOWAIT); else buf = NULL; m->hiwat = outqsize / 2; Modified: head/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/sound/pci/hda/hdaa.c Sun Jan 21 15:42:36 2018 (r328218) @@ -3034,8 +3034,8 @@ hdaa_audio_ctl_parse(struct hdaa_devinfo *devinfo) if (max < 1) return; - ctls = (struct hdaa_audio_ctl *)mallocarray(max, - sizeof(*ctls), M_HDAA, M_ZERO | M_NOWAIT); + ctls = (struct hdaa_audio_ctl *)malloc( + sizeof(*ctls) * max, M_HDAA, M_ZERO | M_NOWAIT); if (ctls == NULL) { /* Blekh! */ @@ -3187,8 +3187,8 @@ hdaa_audio_as_parse(struct hdaa_devinfo *devinfo) if (max < 1) return; - as = (struct hdaa_audio_as *)mallocarray(max, - sizeof(*as), M_HDAA, M_ZERO | M_NOWAIT); + as = (struct hdaa_audio_as *)malloc( + sizeof(*as) * max, M_HDAA, M_ZERO | M_NOWAIT); if (as == NULL) { /* Blekh! */ @@ -4078,8 +4078,8 @@ hdaa_audio_bind_as(struct hdaa_devinfo *devinfo) cnt += as[j].num_chans; } if (devinfo->num_chans == 0) { - devinfo->chans = (struct hdaa_chan *)mallocarray(cnt, - sizeof(struct hdaa_chan), + devinfo->chans = (struct hdaa_chan *)malloc( + sizeof(struct hdaa_chan) * cnt, M_HDAA, M_ZERO | M_NOWAIT); if (devinfo->chans == NULL) { device_printf(devinfo->dev, @@ -5491,8 +5491,8 @@ hdaa_prepare_pcms(struct hdaa_devinfo *devinfo) devinfo->num_devs = max(ardev, apdev) + max(drdev, dpdev); devinfo->devs = - (struct hdaa_pcm_devinfo *)mallocarray( - devinfo->num_devs, sizeof(struct hdaa_pcm_devinfo), + (struct hdaa_pcm_devinfo *)malloc( + devinfo->num_devs * sizeof(struct hdaa_pcm_devinfo), M_HDAA, M_ZERO | M_NOWAIT); if (devinfo->devs == NULL) { device_printf(devinfo->dev, Modified: head/sys/dev/syscons/fire/fire_saver.c ============================================================================== --- head/sys/dev/syscons/fire/fire_saver.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/syscons/fire/fire_saver.c Sun Jan 21 15:42:36 2018 (r328218) @@ -155,7 +155,7 @@ fire_init(video_adapter_t *adp) scrw = info.vi_width; scrh = info.vi_height; - buf = (u_char *)mallocarray(scrw, scrh + 1, M_DEVBUF, M_NOWAIT); + buf = (u_char *)malloc(scrw * (scrh + 1), M_DEVBUF, M_NOWAIT); if (buf) { bzero(buf, scrw * (scrh + 1)); } else { Modified: head/sys/dev/virtio/console/virtio_console.c ============================================================================== --- head/sys/dev/virtio/console/virtio_console.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/virtio/console/virtio_console.c Sun Jan 21 15:42:36 2018 (r328218) @@ -474,11 +474,11 @@ static int vtcon_alloc_scports(struct vtcon_softc *sc) { struct vtcon_softc_port *scport; - u_int max, i; + int max, i; max = sc->vtcon_max_ports; - sc->vtcon_ports = mallocarray(max, sizeof(struct vtcon_softc_port), + sc->vtcon_ports = malloc(sizeof(struct vtcon_softc_port) * max, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->vtcon_ports == NULL) return (ENOMEM); @@ -497,8 +497,7 @@ vtcon_alloc_virtqueues(struct vtcon_softc *sc) device_t dev; struct vq_alloc_info *info; struct vtcon_softc_port *scport; - u_int i, idx, portidx, nvqs; - int error; + int i, idx, portidx, nvqs, error; dev = sc->vtcon_dev; @@ -506,8 +505,7 @@ vtcon_alloc_virtqueues(struct vtcon_softc *sc) if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) nvqs += 2; - info = mallocarray(nvqs, sizeof(struct vq_alloc_info), M_TEMP, - M_NOWAIT); + info = malloc(sizeof(struct vq_alloc_info) * nvqs, M_TEMP, M_NOWAIT); if (info == NULL) return (ENOMEM); Modified: head/sys/dev/virtio/mmio/virtio_mmio.c ============================================================================== --- head/sys/dev/virtio/mmio/virtio_mmio.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/virtio/mmio/virtio_mmio.c Sun Jan 21 15:42:36 2018 (r328218) @@ -507,7 +507,7 @@ vtmmio_alloc_virtqueues(device_t dev, int flags, int n if (nvqs <= 0) return (EINVAL); - sc->vtmmio_vqs = mallocarray(nvqs, sizeof(struct vtmmio_virtqueue), + sc->vtmmio_vqs = malloc(nvqs * sizeof(struct vtmmio_virtqueue), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->vtmmio_vqs == NULL) return (ENOMEM); Modified: head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- head/sys/dev/virtio/network/if_vtnet.c Sun Jan 21 11:19:18 2018 (r328217) +++ head/sys/dev/virtio/network/if_vtnet.c Sun Jan 21 15:42:36 2018 (r328218) @@ -755,9 +755,9 @@ vtnet_alloc_rxtx_queues(struct vtnet_softc *sc) npairs = sc->vtnet_max_vq_pairs; - sc->vtnet_rxqs = mallocarray(npairs, sizeof(struct vtnet_rxq), M_DEVBUF, + sc->vtnet_rxqs = malloc(sizeof(struct vtnet_rxq) * npairs, M_DEVBUF, M_NOWAIT | M_ZERO); - sc->vtnet_txqs = mallocarray(npairs, sizeof(struct vtnet_txq), M_DEVBUF, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Jan 21 17:31:33 2018 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 77264ED2F91; Sun, 21 Jan 2018 17:31:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C72573F58; Sun, 21 Jan 2018 17:31:33 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E0A26BA2; Sun, 21 Jan 2018 17:31: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 w0LHVWmt048422; Sun, 21 Jan 2018 17:31:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LHVVQS048416; Sun, 21 Jan 2018 17:31:31 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201801211731.w0LHVVQS048416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 21 Jan 2018 17:31:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328219 - head/sys/dev/usb/template X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/dev/usb/template X-SVN-Commit-Revision: 328219 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 17:31:33 -0000 Author: trasz Date: Sun Jan 21 17:31:31 2018 New Revision: 328219 URL: https://svnweb.freebsd.org/changeset/base/328219 Log: Add missing manufacturer/serial number string descriptors. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/usb/template/usb_template_audio.c head/sys/dev/usb/template/usb_template_kbd.c head/sys/dev/usb/template/usb_template_midi.c head/sys/dev/usb/template/usb_template_modem.c head/sys/dev/usb/template/usb_template_mouse.c head/sys/dev/usb/template/usb_template_phone.c Modified: head/sys/dev/usb/template/usb_template_audio.c ============================================================================== --- head/sys/dev/usb/template/usb_template_audio.c Sun Jan 21 15:42:36 2018 (r328218) +++ head/sys/dev/usb/template/usb_template_audio.c Sun Jan 21 17:31:31 2018 (r328219) @@ -72,19 +72,25 @@ enum { AUDIO_MIXER_INDEX, AUDIO_RECORD_INDEX, AUDIO_PLAYBACK_INDEX, + AUDIO_MANUFACTURER_INDEX, AUDIO_PRODUCT_INDEX, + AUDIO_SERIAL_NUMBER_INDEX, AUDIO_MAX_INDEX, }; -#define AUDIO_DEFAULT_PRODUCT "Audio Test Device" #define AUDIO_DEFAULT_MIXER "Mixer interface" #define AUDIO_DEFAULT_RECORD "Record interface" #define AUDIO_DEFAULT_PLAYBACK "Playback interface" +#define AUDIO_DEFAULT_MANUFACTURER "FreeBSD foundation" +#define AUDIO_DEFAULT_PRODUCT "Audio Test Device" +#define AUDIO_DEFAULT_SERIAL_NUMBER "March 2008" static struct usb_string_descriptor audio_mixer; static struct usb_string_descriptor audio_record; static struct usb_string_descriptor audio_playback; +static struct usb_string_descriptor audio_manufacturer; static struct usb_string_descriptor audio_product; +static struct usb_string_descriptor audio_serial_number; static struct sysctl_ctx_list audio_ctx_list; @@ -364,7 +370,9 @@ struct usb_temp_device_desc usb_template_audio = { .bDeviceClass = UDCLASS_COMM, .bDeviceSubClass = 0, .bDeviceProtocol = 0, + .iManufacturer = AUDIO_MANUFACTURER_INDEX, .iProduct = AUDIO_PRODUCT_INDEX, + .iSerialNumber = AUDIO_SERIAL_NUMBER_INDEX, }; /*------------------------------------------------------------------------* @@ -382,7 +390,9 @@ audio_get_string_desc(uint16_t lang_id, uint8_t string [AUDIO_MIXER_INDEX] = &audio_mixer, [AUDIO_RECORD_INDEX] = &audio_record, [AUDIO_PLAYBACK_INDEX] = &audio_playback, + [AUDIO_MANUFACTURER_INDEX] = &audio_manufacturer, [AUDIO_PRODUCT_INDEX] = &audio_product, + [AUDIO_SERIAL_NUMBER_INDEX] = &audio_serial_number, }; if (string_index == 0) { @@ -409,8 +419,12 @@ audio_init(void *arg __unused) AUDIO_DEFAULT_RECORD); usb_make_str_desc(&audio_playback, sizeof(audio_playback), AUDIO_DEFAULT_PLAYBACK); + usb_make_str_desc(&audio_manufacturer, sizeof(audio_manufacturer), + AUDIO_DEFAULT_MANUFACTURER); usb_make_str_desc(&audio_product, sizeof(audio_product), AUDIO_DEFAULT_PRODUCT); + usb_make_str_desc(&audio_serial_number, sizeof(audio_serial_number), + AUDIO_DEFAULT_SERIAL_NUMBER); snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_AUDIO); sysctl_ctx_init(&audio_ctx_list); @@ -440,9 +454,17 @@ audio_init(void *arg __unused) "A", "Playback interface string"); #endif SYSCTL_ADD_PROC(&audio_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, + "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + &audio_manufacturer, sizeof(audio_manufacturer), usb_temp_sysctl, + "A", "Manufacturer string"); + SYSCTL_ADD_PROC(&audio_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &audio_product, sizeof(audio_product), usb_temp_sysctl, "A", "Product string"); + SYSCTL_ADD_PROC(&audio_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, + "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + &audio_serial_number, sizeof(audio_serial_number), usb_temp_sysctl, + "A", "Serial number string"); } static void Modified: head/sys/dev/usb/template/usb_template_kbd.c ============================================================================== --- head/sys/dev/usb/template/usb_template_kbd.c Sun Jan 21 15:42:36 2018 (r328218) +++ head/sys/dev/usb/template/usb_template_kbd.c Sun Jan 21 17:31:31 2018 (r328219) @@ -70,15 +70,21 @@ enum { KBD_LANG_INDEX, KBD_INTERFACE_INDEX, + KBD_MANUFACTURER_INDEX, KBD_PRODUCT_INDEX, + KBD_SERIAL_NUMBER_INDEX, KBD_MAX_INDEX, }; #define KBD_DEFAULT_INTERFACE "Keyboard Interface" +#define KBD_DEFAULT_MANUFACTURER "FreeBSD foundation" #define KBD_DEFAULT_PRODUCT "Keyboard Test Device" +#define KBD_DEFAULT_SERIAL_NUMBER "March 2008" static struct usb_string_descriptor kbd_interface; +static struct usb_string_descriptor kbd_manufacturer; static struct usb_string_descriptor kbd_product; +static struct usb_string_descriptor kbd_serial_number; static struct sysctl_ctx_list kbd_ctx_list; @@ -172,9 +178,9 @@ struct usb_temp_device_desc usb_template_kbd = { .bDeviceClass = UDCLASS_COMM, .bDeviceSubClass = 0, .bDeviceProtocol = 0, - .iManufacturer = 0, + .iManufacturer = KBD_MANUFACTURER_INDEX, .iProduct = KBD_PRODUCT_INDEX, - .iSerialNumber = 0, + .iSerialNumber = KBD_SERIAL_NUMBER_INDEX, }; /*------------------------------------------------------------------------* @@ -210,7 +216,9 @@ keyboard_get_string_desc(uint16_t lang_id, uint8_t str static const void *ptr[KBD_MAX_INDEX] = { [KBD_LANG_INDEX] = &usb_string_lang_en, [KBD_INTERFACE_INDEX] = &kbd_interface, + [KBD_MANUFACTURER_INDEX] = &kbd_manufacturer, [KBD_PRODUCT_INDEX] = &kbd_product, + [KBD_SERIAL_NUMBER_INDEX] = &kbd_serial_number, }; if (string_index == 0) { @@ -233,8 +241,12 @@ kbd_init(void *arg __unused) usb_make_str_desc(&kbd_interface, sizeof(kbd_interface), KBD_DEFAULT_INTERFACE); + usb_make_str_desc(&kbd_manufacturer, sizeof(kbd_manufacturer), + KBD_DEFAULT_MANUFACTURER); usb_make_str_desc(&kbd_product, sizeof(kbd_product), KBD_DEFAULT_PRODUCT); + usb_make_str_desc(&kbd_serial_number, sizeof(kbd_serial_number), + KBD_DEFAULT_SERIAL_NUMBER); snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_KBD); sysctl_ctx_init(&kbd_ctx_list); @@ -256,9 +268,17 @@ kbd_init(void *arg __unused) "A", "Interface string"); #endif SYSCTL_ADD_PROC(&kbd_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, + "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + &kbd_manufacturer, sizeof(kbd_manufacturer), usb_temp_sysctl, + "A", "Manufacturer string"); + SYSCTL_ADD_PROC(&kbd_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &kbd_product, sizeof(kbd_product), usb_temp_sysctl, "A", "Product string"); + SYSCTL_ADD_PROC(&kbd_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, + "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + &kbd_serial_number, sizeof(kbd_serial_number), usb_temp_sysctl, + "A", "Serial number string"); } static void Modified: head/sys/dev/usb/template/usb_template_midi.c ============================================================================== --- head/sys/dev/usb/template/usb_template_midi.c Sun Jan 21 15:42:36 2018 (r328218) +++ head/sys/dev/usb/template/usb_template_midi.c Sun Jan 21 17:31:31 2018 (r328219) @@ -69,15 +69,21 @@ enum { MIDI_LANG_INDEX, MIDI_INTERFACE_INDEX, + MIDI_MANUFACTURER_INDEX, MIDI_PRODUCT_INDEX, + MIDI_SERIAL_NUMBER_INDEX, MIDI_MAX_INDEX, }; #define MIDI_DEFAULT_INTERFACE "MIDI interface" +#define MIDI_DEFAULT_MANUFACTURER "FreeBSD foundation" #define MIDI_DEFAULT_PRODUCT "MIDI Test Device" +#define MIDI_DEFAULT_SERIAL_NUMBER "March 2008" static struct usb_string_descriptor midi_interface; +static struct usb_string_descriptor midi_manufacturer; static struct usb_string_descriptor midi_product; +static struct usb_string_descriptor midi_serial_number; static struct sysctl_ctx_list midi_ctx_list; @@ -212,9 +218,9 @@ struct usb_temp_device_desc usb_template_midi = { .bDeviceClass = 0, .bDeviceSubClass = 0, .bDeviceProtocol = 0, - .iManufacturer = 0, + .iManufacturer = MIDI_MANUFACTURER_INDEX, .iProduct = MIDI_PRODUCT_INDEX, - .iSerialNumber = 0, + .iSerialNumber = MIDI_SERIAL_NUMBER_INDEX, }; /*------------------------------------------------------------------------* @@ -230,7 +236,9 @@ midi_get_string_desc(uint16_t lang_id, uint8_t string_ static const void *ptr[MIDI_MAX_INDEX] = { [MIDI_LANG_INDEX] = &usb_string_lang_en, [MIDI_INTERFACE_INDEX] = &midi_interface, + [MIDI_MANUFACTURER_INDEX] = &midi_manufacturer, [MIDI_PRODUCT_INDEX] = &midi_product, + [MIDI_SERIAL_NUMBER_INDEX] = &midi_serial_number, }; if (string_index == 0) { @@ -253,8 +261,12 @@ midi_init(void *arg __unused) usb_make_str_desc(&midi_interface, sizeof(midi_interface), MIDI_DEFAULT_INTERFACE); + usb_make_str_desc(&midi_manufacturer, sizeof(midi_manufacturer), + MIDI_DEFAULT_MANUFACTURER); usb_make_str_desc(&midi_product, sizeof(midi_product), MIDI_DEFAULT_PRODUCT); + usb_make_str_desc(&midi_serial_number, sizeof(midi_serial_number), + MIDI_DEFAULT_SERIAL_NUMBER); snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_MIDI); sysctl_ctx_init(&midi_ctx_list); @@ -276,9 +288,17 @@ midi_init(void *arg __unused) "A", "Interface string"); #endif SYSCTL_ADD_PROC(&midi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, + "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + &midi_manufacturer, sizeof(midi_manufacturer), usb_temp_sysctl, + "A", "Manufacturer string"); + SYSCTL_ADD_PROC(&midi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &midi_product, sizeof(midi_product), usb_temp_sysctl, "A", "Product string"); + SYSCTL_ADD_PROC(&midi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, + "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + &midi_serial_number, sizeof(midi_serial_number), usb_temp_sysctl, + "A", "Serial number string"); } static void Modified: head/sys/dev/usb/template/usb_template_modem.c ============================================================================== --- head/sys/dev/usb/template/usb_template_modem.c Sun Jan 21 15:42:36 2018 (r328218) +++ head/sys/dev/usb/template/usb_template_modem.c Sun Jan 21 17:31:31 2018 (r328219) @@ -70,15 +70,21 @@ enum { MODEM_LANG_INDEX, MODEM_INTERFACE_INDEX, + MODEM_MANUFACTURER_INDEX, MODEM_PRODUCT_INDEX, + MODEM_SERIAL_NUMBER_INDEX, MODEM_MAX_INDEX, }; #define MODEM_DEFAULT_INTERFACE "Modem interface" +#define MODEM_DEFAULT_MANUFACTURER "FreeBSD foundation" #define MODEM_DEFAULT_PRODUCT "Modem Test Device" +#define MODEM_DEFAULT_SERIAL_NUMBER "March 2008" static struct usb_string_descriptor modem_interface; +static struct usb_string_descriptor modem_manufacturer; static struct usb_string_descriptor modem_product; +static struct usb_string_descriptor modem_serial_number; static struct sysctl_ctx_list modem_ctx_list; @@ -207,9 +213,9 @@ struct usb_temp_device_desc usb_template_modem = { .bDeviceClass = UDCLASS_COMM, .bDeviceSubClass = 0, .bDeviceProtocol = 0, - .iManufacturer = 0, + .iManufacturer = MODEM_MANUFACTURER_INDEX, .iProduct = MODEM_PRODUCT_INDEX, - .iSerialNumber = 0, + .iSerialNumber = MODEM_SERIAL_NUMBER_INDEX, }; /*------------------------------------------------------------------------* @@ -238,7 +244,9 @@ modem_get_string_desc(uint16_t lang_id, uint8_t string static const void *ptr[MODEM_MAX_INDEX] = { [MODEM_LANG_INDEX] = &usb_string_lang_en, [MODEM_INTERFACE_INDEX] = &modem_interface, + [MODEM_MANUFACTURER_INDEX] = &modem_manufacturer, [MODEM_PRODUCT_INDEX] = &modem_product, + [MODEM_SERIAL_NUMBER_INDEX] = &modem_serial_number, }; if (string_index == 0) { @@ -261,8 +269,12 @@ modem_init(void *arg __unused) usb_make_str_desc(&modem_interface, sizeof(modem_interface), MODEM_DEFAULT_INTERFACE); + usb_make_str_desc(&modem_manufacturer, sizeof(modem_manufacturer), + MODEM_DEFAULT_MANUFACTURER); usb_make_str_desc(&modem_product, sizeof(modem_product), MODEM_DEFAULT_PRODUCT); + usb_make_str_desc(&modem_serial_number, sizeof(modem_serial_number), + MODEM_DEFAULT_SERIAL_NUMBER); snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_MODEM); sysctl_ctx_init(&modem_ctx_list); @@ -284,9 +296,17 @@ modem_init(void *arg __unused) "A", "Interface string"); #endif SYSCTL_ADD_PROC(&modem_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, + "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + &modem_manufacturer, sizeof(modem_manufacturer), usb_temp_sysctl, + "A", "Manufacturer string"); + SYSCTL_ADD_PROC(&modem_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &modem_product, sizeof(modem_product), usb_temp_sysctl, "A", "Product string"); + SYSCTL_ADD_PROC(&modem_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, + "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + &modem_serial_number, sizeof(modem_serial_number), usb_temp_sysctl, + "A", "Serial number string"); } static void Modified: head/sys/dev/usb/template/usb_template_mouse.c ============================================================================== --- head/sys/dev/usb/template/usb_template_mouse.c Sun Jan 21 15:42:36 2018 (r328218) +++ head/sys/dev/usb/template/usb_template_mouse.c Sun Jan 21 17:31:31 2018 (r328219) @@ -70,15 +70,21 @@ enum { MOUSE_LANG_INDEX, MOUSE_INTERFACE_INDEX, + MOUSE_MANUFACTURER_INDEX, MOUSE_PRODUCT_INDEX, + MOUSE_SERIAL_NUMBER_INDEX, MOUSE_MAX_INDEX, }; #define MOUSE_DEFAULT_INTERFACE "Mouse interface" +#define MOUSE_DEFAULT_MANUFACTURER "FreeBSD foundation" #define MOUSE_DEFAULT_PRODUCT "Mouse Test Interface" +#define MOUSE_DEFAULT_SERIAL_NUMBER "March 2008" static struct usb_string_descriptor mouse_interface; +static struct usb_string_descriptor mouse_manufacturer; static struct usb_string_descriptor mouse_product; +static struct usb_string_descriptor mouse_serial_number; static struct sysctl_ctx_list mouse_ctx_list; @@ -170,9 +176,9 @@ struct usb_temp_device_desc usb_template_mouse = { .bDeviceClass = UDCLASS_COMM, .bDeviceSubClass = 0, .bDeviceProtocol = 0, - .iManufacturer = 0, + .iManufacturer = MOUSE_MANUFACTURER_INDEX, .iProduct = MOUSE_PRODUCT_INDEX, - .iSerialNumber = 0, + .iSerialNumber = MOUSE_SERIAL_NUMBER_INDEX, }; /*------------------------------------------------------------------------* @@ -208,7 +214,9 @@ mouse_get_string_desc(uint16_t lang_id, uint8_t string static const void *ptr[MOUSE_MAX_INDEX] = { [MOUSE_LANG_INDEX] = &usb_string_lang_en, [MOUSE_INTERFACE_INDEX] = &mouse_interface, + [MOUSE_MANUFACTURER_INDEX] = &mouse_manufacturer, [MOUSE_PRODUCT_INDEX] = &mouse_product, + [MOUSE_SERIAL_NUMBER_INDEX] = &mouse_serial_number, }; if (string_index == 0) { @@ -231,8 +239,12 @@ mouse_init(void *arg __unused) usb_make_str_desc(&mouse_interface, sizeof(mouse_interface), MOUSE_DEFAULT_INTERFACE); + usb_make_str_desc(&mouse_manufacturer, sizeof(mouse_manufacturer), + MOUSE_DEFAULT_MANUFACTURER); usb_make_str_desc(&mouse_product, sizeof(mouse_product), MOUSE_DEFAULT_PRODUCT); + usb_make_str_desc(&mouse_serial_number, sizeof(mouse_serial_number), + MOUSE_DEFAULT_SERIAL_NUMBER); snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_MOUSE); sysctl_ctx_init(&mouse_ctx_list); @@ -254,9 +266,17 @@ mouse_init(void *arg __unused) "A", "Interface string"); #endif SYSCTL_ADD_PROC(&mouse_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, + "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + &mouse_manufacturer, sizeof(mouse_manufacturer), usb_temp_sysctl, + "A", "Manufacturer string"); + SYSCTL_ADD_PROC(&mouse_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &mouse_product, sizeof(mouse_product), usb_temp_sysctl, "A", "Product string"); + SYSCTL_ADD_PROC(&mouse_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, + "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + &mouse_serial_number, sizeof(mouse_serial_number), usb_temp_sysctl, + "A", "Serial number string"); } static void Modified: head/sys/dev/usb/template/usb_template_phone.c ============================================================================== --- head/sys/dev/usb/template/usb_template_phone.c Sun Jan 21 15:42:36 2018 (r328218) +++ head/sys/dev/usb/template/usb_template_phone.c Sun Jan 21 17:31:31 2018 (r328219) @@ -72,22 +72,28 @@ enum { PHONE_MIXER_INDEX, PHONE_RECORD_INDEX, PHONE_PLAYBACK_INDEX, - PHONE_PRODUCT_INDEX, PHONE_HID_INDEX, + PHONE_MANUFACTURER_INDEX, + PHONE_PRODUCT_INDEX, + PHONE_SERIAL_NUMBER_INDEX, PHONE_MAX_INDEX, }; #define PHONE_DEFAULT_MIXER "Mixer interface" #define PHONE_DEFAULT_RECORD "Record interface" #define PHONE_DEFAULT_PLAYBACK "Playback interface" -#define PHONE_DEFAULT_PRODUCT "USB Phone Device" #define PHONE_DEFAULT_HID "HID interface" +#define PHONE_DEFAULT_MANUFACTURER "FreeBSD foundation" +#define PHONE_DEFAULT_PRODUCT "USB Phone Device" +#define PHONE_DEFAULT_SERIAL_NUMBER "March 2008" static struct usb_string_descriptor phone_mixer; static struct usb_string_descriptor phone_record; static struct usb_string_descriptor phone_playback; -static struct usb_string_descriptor phone_product; static struct usb_string_descriptor phone_hid; +static struct usb_string_descriptor phone_manufacturer; +static struct usb_string_descriptor phone_product; +static struct usb_string_descriptor phone_serial_number; static struct sysctl_ctx_list phone_ctx_list; @@ -362,9 +368,9 @@ struct usb_temp_device_desc usb_template_phone = { .bDeviceClass = UDCLASS_IN_INTERFACE, .bDeviceSubClass = 0, .bDeviceProtocol = 0, - .iManufacturer = 0, + .iManufacturer = PHONE_MANUFACTURER_INDEX, .iProduct = PHONE_PRODUCT_INDEX, - .iSerialNumber = 0, + .iSerialNumber = PHONE_SERIAL_NUMBER_INDEX, }; /*------------------------------------------------------------------------* @@ -402,8 +408,10 @@ phone_get_string_desc(uint16_t lang_id, uint8_t string [PHONE_MIXER_INDEX] = &phone_mixer, [PHONE_RECORD_INDEX] = &phone_record, [PHONE_PLAYBACK_INDEX] = &phone_playback, - [PHONE_PRODUCT_INDEX] = &phone_product, [PHONE_HID_INDEX] = &phone_hid, + [PHONE_MANUFACTURER_INDEX] = &phone_manufacturer, + [PHONE_PRODUCT_INDEX] = &phone_product, + [PHONE_SERIAL_NUMBER_INDEX] = &phone_serial_number, }; if (string_index == 0) { @@ -430,10 +438,14 @@ phone_init(void *arg __unused) PHONE_DEFAULT_RECORD); usb_make_str_desc(&phone_playback, sizeof(phone_playback), PHONE_DEFAULT_PLAYBACK); - usb_make_str_desc(&phone_product, sizeof(phone_product), - PHONE_DEFAULT_PRODUCT); usb_make_str_desc(&phone_hid, sizeof(phone_hid), PHONE_DEFAULT_HID); + usb_make_str_desc(&phone_manufacturer, sizeof(phone_manufacturer), + PHONE_DEFAULT_MANUFACTURER); + usb_make_str_desc(&phone_product, sizeof(phone_product), + PHONE_DEFAULT_PRODUCT); + usb_make_str_desc(&phone_serial_number, sizeof(phone_serial_number), + PHONE_DEFAULT_SERIAL_NUMBER); snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_PHONE); sysctl_ctx_init(&phone_ctx_list); @@ -461,15 +473,23 @@ phone_init(void *arg __unused) "playback", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &phone_playback, sizeof(phone_playback), usb_temp_sysctl, "A", "Playback interface string"); + SYSCTL_ADD_PROC(&phone_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, + "hid", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + &phone_hid, sizeof(phone_hid), usb_temp_sysctl, + "A", "HID interface string"); #endif SYSCTL_ADD_PROC(&phone_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, + "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + &phone_manufacturer, sizeof(phone_manufacturer), usb_temp_sysctl, + "A", "Manufacturer string"); + SYSCTL_ADD_PROC(&phone_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &phone_product, sizeof(phone_product), usb_temp_sysctl, "A", "Product string"); SYSCTL_ADD_PROC(&phone_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO, - "hid", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, - &phone_hid, sizeof(phone_hid), usb_temp_sysctl, - "A", "HID interface string"); + "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + &phone_serial_number, sizeof(phone_serial_number), usb_temp_sysctl, + "A", "Serial number string"); } static void From owner-svn-src-all@freebsd.org Sun Jan 21 18:50:15 2018 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 11DA3EB2ED5 for ; Sun, 21 Jan 2018 18:50:15 +0000 (UTC) (envelope-from joerg@bec.de) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 CFFEA76FA2 for ; Sun, 21 Jan 2018 18:50:14 +0000 (UTC) (envelope-from joerg@bec.de) Received: from britannica.bec.de (p200300D2ABC4DD104639C4FFFE599710.dip0.t-ipconnect.de [IPv6:2003:d2:abc4:dd10:4639:c4ff:fe59:9710]) (Authenticated sender: joerg@bec.de) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 9166317209C for ; Sun, 21 Jan 2018 19:50:06 +0100 (CET) Date: Sun, 21 Jan 2018 19:49:22 +0100 From: Joerg Sonnenberger To: svn-src-all@freebsd.org Subject: Re: svn commit: r328159 - head/sys/modules Message-ID: <20180121184922.GA32134@britannica.bec.de> References: <201801191737.w0JHbM90073097@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.0 (2017-09-02) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 21 Jan 2018 18:50:15 -0000 On Fri, Jan 19, 2018 at 08:40:56PM +0200, Andriy Gapon wrote: > I seem to recall that the actual shift happens to be N % 32 for 32-bit registers > (at least on some processors). It depends. That's the behavior some architectures implement. Others will just give you 0 as result for N>32. This is a case of UB where the implementation-defined behavior of different CPUs is actually inconsistent. Joerg From owner-svn-src-all@freebsd.org Sun Jan 21 19:26:39 2018 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 DBB7BEB62F0; Sun, 21 Jan 2018 19:26:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A348378A60; Sun, 21 Jan 2018 19:26:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE4967E83; Sun, 21 Jan 2018 19:26:38 +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 w0LJQcOi099070; Sun, 21 Jan 2018 19:26:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LJQcF0099064; Sun, 21 Jan 2018 19:26:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801211926.w0LJQcF0099064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 21 Jan 2018 19:26:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328220 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zfs vendor/illumos/di... X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zfs vendor/illumos/dist/lib/libzfs/common vend... X-SVN-Commit-Revision: 328220 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 19:26:40 -0000 Author: mav Date: Sun Jan 21 19:26:38 2018 New Revision: 328220 URL: https://svnweb.freebsd.org/changeset/base/328220 Log: 8677 Open-Context Channel Programs illumos/illumos-gate@a3b2868063897ff0083dea538f55f9873eec981f https://www.illumos.org/issues/8677 We want to be able to run channel programs outside of synching context. This would greatly improve performance of channel program that just gather information, as we won't have to wait for synching context anymore. This feature should introduce the following: - A new command line flag in "zfs program" to specify our intention to run in open context. - A new flag/option within the channel program ioctl which selects the context. - Appropriate error handling whenever we try a channel program in open-context that contains zfs.sync* expressions. - Documentation for the new feature in the manual pages. Reviewed by: Matt Ahrens Reviewed by: Chris Williamson Reviewed by: Pavel Zakharov Approved by: Robert Mustacchi Author: Serapheim Dimitropoulos Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h vendor/illumos/dist/man/man1m/zfs-program.1m vendor/illumos/dist/man/man1m/zfs.1m Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c Sun Jan 21 17:31:31 2018 (r328219) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c Sun Jan 21 19:26:38 2018 (r328220) @@ -542,6 +542,7 @@ dsl_destroy_snapshots_nvl(nvlist_t *snaps, boolean_t d nvlist_t *result = fnvlist_alloc(); int error = zcp_eval(nvpair_name(nvlist_next_nvpair(snaps, NULL)), program, + B_TRUE, 0, zfs_lua_max_memlimit, nvlist_next_nvpair(wrapper, NULL), result); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h Sun Jan 21 17:31:31 2018 (r328219) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h Sun Jan 21 19:26:38 2018 (r328220) @@ -38,20 +38,25 @@ extern uint64_t zfs_lua_max_memlimit; int zcp_argerror(lua_State *, int, const char *, ...); -int zcp_eval(const char *, const char *, uint64_t, uint64_t, nvpair_t *, - nvlist_t *); +int zcp_eval(const char *, const char *, boolean_t, uint64_t, uint64_t, + nvpair_t *, nvlist_t *); int zcp_load_list_lib(lua_State *); int zcp_load_synctask_lib(lua_State *, boolean_t); typedef void (zcp_cleanup_t)(void *); +typedef struct zcp_cleanup_handler { + zcp_cleanup_t *zch_cleanup_func; + void *zch_cleanup_arg; + list_node_t zch_node; +} zcp_cleanup_handler_t; typedef struct zcp_run_info { dsl_pool_t *zri_pool; /* - * An estimate of the total ammount of space consumed by all + * An estimate of the total amount of space consumed by all * synctasks we have successfully performed so far in this * channel program. Used to generate ENOSPC errors for syncfuncs. */ @@ -89,16 +94,21 @@ typedef struct zcp_run_info { boolean_t zri_timed_out; /* - * The currently registered cleanup function, which will be called - * with the stored argument if a fatal error occurs. + * Boolean indicating whether or not we are running in syncing + * context. */ - zcp_cleanup_t *zri_cleanup; - void *zri_cleanup_arg; + boolean_t zri_sync; + + /* + * List of currently registered cleanup handlers, which will be + * triggered in the event of a fatal error. + */ + list_t zri_cleanup_handlers; } zcp_run_info_t; zcp_run_info_t *zcp_run_info(lua_State *); -void zcp_register_cleanup(lua_State *, zcp_cleanup_t, void *); -void zcp_clear_cleanup(lua_State *); +zcp_cleanup_handler_t *zcp_register_cleanup(lua_State *, zcp_cleanup_t, void *); +void zcp_deregister_cleanup(lua_State *, zcp_cleanup_handler_t *); void zcp_cleanup(lua_State *); /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c Sun Jan 21 17:31:31 2018 (r328219) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c Sun Jan 21 19:26:38 2018 (r328220) @@ -130,13 +130,6 @@ typedef struct zcp_eval_arg { uint64_t ea_instrlimit; } zcp_eval_arg_t; -/*ARGSUSED*/ -static int -zcp_eval_check(void *arg, dmu_tx_t *tx) -{ - return (0); -} - /* * The outer-most error callback handler for use with lua_pcall(). On * error Lua will call this callback with a single argument that @@ -180,41 +173,45 @@ zcp_argerror(lua_State *state, int narg, const char *m * * If an error occurs, the cleanup function will be invoked exactly once and * then unreigstered. + * + * Returns the registered cleanup handler so the caller can deregister it + * if no error occurs. */ -void +zcp_cleanup_handler_t * zcp_register_cleanup(lua_State *state, zcp_cleanup_t cleanfunc, void *cleanarg) { zcp_run_info_t *ri = zcp_run_info(state); - /* - * A cleanup function should always be explicitly removed before - * installing a new one to avoid accidental clobbering. - */ - ASSERT3P(ri->zri_cleanup, ==, NULL); - ri->zri_cleanup = cleanfunc; - ri->zri_cleanup_arg = cleanarg; + zcp_cleanup_handler_t *zch = kmem_alloc(sizeof (*zch), KM_SLEEP); + zch->zch_cleanup_func = cleanfunc; + zch->zch_cleanup_arg = cleanarg; + list_insert_head(&ri->zri_cleanup_handlers, zch); + + return (zch); } void -zcp_clear_cleanup(lua_State *state) +zcp_deregister_cleanup(lua_State *state, zcp_cleanup_handler_t *zch) { zcp_run_info_t *ri = zcp_run_info(state); - - ri->zri_cleanup = NULL; - ri->zri_cleanup_arg = NULL; + list_remove(&ri->zri_cleanup_handlers, zch); + kmem_free(zch, sizeof (*zch)); } /* - * If it exists, execute the currently set cleanup function then unregister it. + * Execute the currently registered cleanup handlers then free them and + * destroy the handler list. */ void zcp_cleanup(lua_State *state) { zcp_run_info_t *ri = zcp_run_info(state); - if (ri->zri_cleanup != NULL) { - ri->zri_cleanup(ri->zri_cleanup_arg); - zcp_clear_cleanup(state); + for (zcp_cleanup_handler_t *zch = + list_remove_head(&ri->zri_cleanup_handlers); zch != NULL; + zch = list_remove_head(&ri->zri_cleanup_handlers)) { + zch->zch_cleanup_func(zch->zch_cleanup_arg); + kmem_free(zch, sizeof (*zch)); } } @@ -815,19 +812,12 @@ zcp_panic_cb(lua_State *state) } static void -zcp_eval_sync(void *arg, dmu_tx_t *tx) +zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) { int err; zcp_run_info_t ri; - zcp_eval_arg_t *evalargs = arg; lua_State *state = evalargs->ea_state; - /* - * Open context should have setup the stack to contain: - * 1: Error handler callback - * 2: Script to run (converted to a Lua function) - * 3: nvlist input to function (converted to Lua table or nil) - */ VERIFY3U(3, ==, lua_gettop(state)); /* @@ -840,8 +830,9 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) ri.zri_cred = evalargs->ea_cred; ri.zri_tx = tx; ri.zri_timed_out = B_FALSE; - ri.zri_cleanup = NULL; - ri.zri_cleanup_arg = NULL; + ri.zri_sync = sync; + list_create(&ri.zri_cleanup_handlers, sizeof (zcp_cleanup_handler_t), + offsetof(zcp_cleanup_handler_t, zch_node)); ri.zri_curinstrs = 0; ri.zri_maxinstrs = evalargs->ea_instrlimit; @@ -878,10 +869,10 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) /* * Remove the error handler callback from the stack. At this point, - * if there is a cleanup function registered, then it was registered - * but never run or removed, which should never occur. + * there shouldn't be any cleanup handler registered in the handler + * list (zri_cleanup_handlers), regardless of whether it ran or not. */ - ASSERT3P(ri.zri_cleanup, ==, NULL); + list_destroy(&ri.zri_cleanup_handlers); lua_remove(state, 1); switch (err) { @@ -963,9 +954,73 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) } } +static void +zcp_pool_error(zcp_eval_arg_t *evalargs, const char *poolname) +{ + evalargs->ea_result = SET_ERROR(ECHRNG); + (void) lua_pushfstring(evalargs->ea_state, "Could not open pool: %s", + poolname); + zcp_convert_return_values(evalargs->ea_state, evalargs->ea_outnvl, + ZCP_RET_ERROR, evalargs); + +} + +static void +zcp_eval_sync(void *arg, dmu_tx_t *tx) +{ + zcp_eval_arg_t *evalargs = arg; + + /* + * Open context should have setup the stack to contain: + * 1: Error handler callback + * 2: Script to run (converted to a Lua function) + * 3: nvlist input to function (converted to Lua table or nil) + */ + VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + + zcp_eval_impl(tx, B_TRUE, evalargs); +} + +static void +zcp_eval_open(zcp_eval_arg_t *evalargs, const char *poolname) +{ + + int error; + dsl_pool_t *dp; + dmu_tx_t *tx; + + /* + * See comment from the same assertion in zcp_eval_sync(). + */ + VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + + error = dsl_pool_hold(poolname, FTAG, &dp); + if (error != 0) { + zcp_pool_error(evalargs, poolname); + return; + } + + /* + * As we are running in open-context, we have no transaction associated + * with the channel program. At the same time, functions from the + * zfs.check submodule need to be associated with a transaction as + * they are basically dry-runs of their counterparts in the zfs.sync + * submodule. These functions should be able to run in open-context. + * Therefore we create a new transaction that we later abort once + * the channel program has been evaluated. + */ + tx = dmu_tx_create_dd(dp->dp_mos_dir); + + zcp_eval_impl(tx, B_FALSE, evalargs); + + dmu_tx_abort(tx); + + dsl_pool_rele(dp, FTAG); +} + int -zcp_eval(const char *poolname, const char *program, uint64_t instrlimit, - uint64_t memlimit, nvpair_t *nvarg, nvlist_t *outnvl) +zcp_eval(const char *poolname, const char *program, boolean_t sync, + uint64_t instrlimit, uint64_t memlimit, nvpair_t *nvarg, nvlist_t *outnvl) { int err; lua_State *state; @@ -1076,9 +1131,14 @@ zcp_eval(const char *poolname, const char *program, ui evalargs.ea_outnvl = outnvl; evalargs.ea_result = 0; - VERIFY0(dsl_sync_task(poolname, zcp_eval_check, - zcp_eval_sync, &evalargs, 0, ZFS_SPACE_CHECK_NONE)); - + if (sync) { + err = dsl_sync_task(poolname, NULL, + zcp_eval_sync, &evalargs, 0, ZFS_SPACE_CHECK_NONE); + if (err != 0) + zcp_pool_error(&evalargs, poolname); + } else { + zcp_eval_open(&evalargs, poolname); + } lua_close(state); return (evalargs.ea_result); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c Sun Jan 21 17:31:31 2018 (r328219) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c Sun Jan 21 19:26:38 2018 (r328220) @@ -55,6 +55,10 @@ typedef struct zcp_synctask_info { * * If 'sync' is false, executes a dry run and returns the error code. * + * If we are not running in syncing context and we are not doing a dry run + * (meaning we are running a zfs.sync function in open-context) then we + * return a Lua error. + * * This function also handles common fatal error cases for channel program * library functions. If a fatal error occurs, err_dsname will be the dataset * name reported in error messages, if supplied. @@ -70,6 +74,13 @@ zcp_sync_task(lua_State *state, dsl_checkfunc_t *check if (!sync) return (err); + if (!ri->zri_sync) { + return (luaL_error(state, "running functions from the zfs.sync " + "submodule requires passing sync=TRUE to " + "lzc_channel_program() (i.e. do not specify the \"-n\" " + "command line argument)")); + } + if (err == 0) { syncfunc(arg, ri->zri_tx); } else if (err == EIO) { @@ -234,6 +245,15 @@ zcp_synctask_snapshot(lua_State *state, boolean_t sync zcp_run_info_t *ri = zcp_run_info(state); /* + * On old pools, the ZIL must not be active when a snapshot is created, + * but we can't suspend the ZIL because we're already in syncing + * context. + */ + if (spa_version(ri->zri_pool->dp_spa) < SPA_VERSION_FAST_SNAP) { + return (ENOTSUP); + } + + /* * We only allow for a single snapshot rather than a list, so the * error list output is unnecessary. */ @@ -243,33 +263,23 @@ zcp_synctask_snapshot(lua_State *state, boolean_t sync ddsa.ddsa_snaps = fnvlist_alloc(); fnvlist_add_boolean(ddsa.ddsa_snaps, dsname); - /* - * On old pools, the ZIL must not be active when a snapshot is created, - * but we can't suspend the ZIL because we're already in syncing - * context. - */ - if (spa_version(ri->zri_pool->dp_spa) < SPA_VERSION_FAST_SNAP) { - return (ENOTSUP); - } + zcp_cleanup_handler_t *zch = zcp_register_cleanup(state, + (zcp_cleanup_t *)&fnvlist_free, ddsa.ddsa_snaps); err = zcp_sync_task(state, dsl_dataset_snapshot_check, dsl_dataset_snapshot_sync, &ddsa, sync, dsname); + zcp_deregister_cleanup(state, zch); fnvlist_free(ddsa.ddsa_snaps); return (err); } -void -zcp_synctask_wrapper_cleanup(void *arg) -{ - fnvlist_free(arg); -} - static int zcp_synctask_wrapper(lua_State *state) { int err; + zcp_cleanup_handler_t *zch; int num_ret = 1; nvlist_t *err_details = fnvlist_alloc(); @@ -277,7 +287,8 @@ zcp_synctask_wrapper(lua_State *state) * Make sure err_details is properly freed, even if a fatal error is * thrown during the synctask. */ - zcp_register_cleanup(state, &zcp_synctask_wrapper_cleanup, err_details); + zch = zcp_register_cleanup(state, + (zcp_cleanup_t *)&fnvlist_free, err_details); zcp_synctask_info_t *info = lua_touserdata(state, lua_upvalueindex(1)); boolean_t sync = lua_toboolean(state, lua_upvalueindex(2)); @@ -317,7 +328,7 @@ zcp_synctask_wrapper(lua_State *state) num_ret++; } - zcp_clear_cleanup(state); + zcp_deregister_cleanup(state, zch); fnvlist_free(err_details); return (num_ret); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Sun Jan 21 17:31:31 2018 (r328219) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Sun Jan 21 19:26:38 2018 (r328220) @@ -3606,11 +3606,15 @@ zfs_ioc_channel_program(const char *poolname, nvlist_t { char *program; uint64_t instrlimit, memlimit; + boolean_t sync_flag; nvpair_t *nvarg = NULL; if (0 != nvlist_lookup_string(innvl, ZCP_ARG_PROGRAM, &program)) { return (EINVAL); } + if (0 != nvlist_lookup_boolean_value(innvl, ZCP_ARG_SYNC, &sync_flag)) { + sync_flag = B_TRUE; + } if (0 != nvlist_lookup_uint64(innvl, ZCP_ARG_INSTRLIMIT, &instrlimit)) { instrlimit = ZCP_DEFAULT_INSTRLIMIT; } @@ -3626,7 +3630,7 @@ zfs_ioc_channel_program(const char *poolname, nvlist_t if (memlimit == 0 || memlimit > zfs_lua_max_memlimit) return (EINVAL); - return (zcp_eval(poolname, program, instrlimit, memlimit, + return (zcp_eval(poolname, program, sync_flag, instrlimit, memlimit, nvarg, outnvl)); } Modified: vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Sun Jan 21 17:31:31 2018 (r328219) +++ vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Sun Jan 21 19:26:38 2018 (r328220) @@ -963,6 +963,7 @@ typedef enum { */ #define ZCP_ARG_PROGRAM "program" #define ZCP_ARG_ARGLIST "arg" +#define ZCP_ARG_SYNC "sync" #define ZCP_ARG_INSTRLIMIT "instrlimit" #define ZCP_ARG_MEMLIMIT "memlimit" From owner-svn-src-all@freebsd.org Sun Jan 21 19:26:40 2018 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 D6FCDEB62F5; Sun, 21 Jan 2018 19:26:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9718878A61; Sun, 21 Jan 2018 19:26:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CBD9A7E84; Sun, 21 Jan 2018 19:26:39 +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 w0LJQdt4099082; Sun, 21 Jan 2018 19:26:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LJQdad099075; Sun, 21 Jan 2018 19:26:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801211926.w0LJQdad099075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 21 Jan 2018 19:26:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328220 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zfs vendor/illumos/di... X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zfs vendor/illumos/dist/lib/libzfs/common vend... X-SVN-Commit-Revision: 328220 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 19:26:40 -0000 Author: mav Date: Sun Jan 21 19:26:38 2018 New Revision: 328220 URL: https://svnweb.freebsd.org/changeset/base/328220 Log: 8677 Open-Context Channel Programs illumos/illumos-gate@a3b2868063897ff0083dea538f55f9873eec981f https://www.illumos.org/issues/8677 We want to be able to run channel programs outside of synching context. This would greatly improve performance of channel program that just gather information, as we won't have to wait for synching context anymore. This feature should introduce the following: - A new command line flag in "zfs program" to specify our intention to run in open context. - A new flag/option within the channel program ioctl which selects the context. - Appropriate error handling whenever we try a channel program in open-context that contains zfs.sync* expressions. - Documentation for the new feature in the manual pages. Reviewed by: Matt Ahrens Reviewed by: Chris Williamson Reviewed by: Pavel Zakharov Approved by: Robert Mustacchi Author: Serapheim Dimitropoulos Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h vendor/illumos/dist/man/man1m/zfs-program.1m vendor/illumos/dist/man/man1m/zfs.1m Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c ============================================================================== --- vendor/illumos/dist/cmd/zfs/zfs_main.c Sun Jan 21 17:31:31 2018 (r328219) +++ vendor/illumos/dist/cmd/zfs/zfs_main.c Sun Jan 21 19:26:38 2018 (r328220) @@ -329,7 +329,7 @@ get_usage(zfs_help_t idx) case HELP_BOOKMARK: return (gettext("\tbookmark \n")); case HELP_CHANNEL_PROGRAM: - return (gettext("\tprogram [-t ] " + return (gettext("\tprogram [-n] [-t ] " "[-m ] " "[lua args...]\n")); } @@ -6982,11 +6982,12 @@ zfs_do_channel_program(int argc, char **argv) nvlist_t *outnvl; uint64_t instrlimit = ZCP_DEFAULT_INSTRLIMIT; uint64_t memlimit = ZCP_DEFAULT_MEMLIMIT; + boolean_t sync_flag = B_TRUE; zpool_handle_t *zhp; /* check options */ while (-1 != - (c = getopt(argc, argv, "t:(instr-limit)m:(memory-limit)"))) { + (c = getopt(argc, argv, "nt:(instr-limit)m:(memory-limit)"))) { switch (c) { case 't': case 'm': { @@ -7024,6 +7025,10 @@ zfs_do_channel_program(int argc, char **argv) } break; } + case 'n': { + sync_flag = B_FALSE; + break; + } case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); @@ -7095,8 +7100,13 @@ zfs_do_channel_program(int argc, char **argv) nvlist_t *argnvl = fnvlist_alloc(); fnvlist_add_string_array(argnvl, ZCP_ARG_CLIARGV, argv + 2, argc - 2); - ret = lzc_channel_program(poolname, progbuf, instrlimit, memlimit, - argnvl, &outnvl); + if (sync_flag) { + ret = lzc_channel_program(poolname, progbuf, + instrlimit, memlimit, argnvl, &outnvl); + } else { + ret = lzc_channel_program_nosync(poolname, progbuf, + instrlimit, memlimit, argnvl, &outnvl); + } if (ret != 0) { /* Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Sun Jan 21 17:31:31 2018 (r328219) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Sun Jan 21 19:26:38 2018 (r328220) @@ -2348,7 +2348,7 @@ zcp_check(zfs_handle_t *zhp, zfs_prop_t prop, uint64_t fnvlist_add_string(argnvl, "dataset", zhp->zfs_name); fnvlist_add_string(argnvl, "property", zfs_prop_to_name(prop)); - error = lzc_channel_program(poolname, program, + error = lzc_channel_program_nosync(poolname, program, 10 * 1000 * 1000, 10 * 1024 * 1024, argnvl, &outnvl); if (error == 0) { Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c Sun Jan 21 17:31:31 2018 (r328219) +++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c Sun Jan 21 19:26:38 2018 (r328220) @@ -881,6 +881,25 @@ lzc_destroy_bookmarks(nvlist_t *bmarks, nvlist_t **err return (error); } +static int +lzc_channel_program_impl(const char *pool, const char *program, boolean_t sync, + uint64_t instrlimit, uint64_t memlimit, nvlist_t *argnvl, nvlist_t **outnvl) +{ + int error; + nvlist_t *args; + + args = fnvlist_alloc(); + fnvlist_add_string(args, ZCP_ARG_PROGRAM, program); + fnvlist_add_nvlist(args, ZCP_ARG_ARGLIST, argnvl); + fnvlist_add_boolean_value(args, ZCP_ARG_SYNC, sync); + fnvlist_add_uint64(args, ZCP_ARG_INSTRLIMIT, instrlimit); + fnvlist_add_uint64(args, ZCP_ARG_MEMLIMIT, memlimit); + error = lzc_ioctl(ZFS_IOC_CHANNEL_PROGRAM, pool, args, outnvl); + fnvlist_free(args); + + return (error); +} + /* * Executes a channel program. * @@ -918,16 +937,26 @@ int lzc_channel_program(const char *pool, const char *program, uint64_t instrlimit, uint64_t memlimit, nvlist_t *argnvl, nvlist_t **outnvl) { - int error; - nvlist_t *args; + return (lzc_channel_program_impl(pool, program, B_TRUE, instrlimit, + memlimit, argnvl, outnvl)); +} - args = fnvlist_alloc(); - fnvlist_add_string(args, ZCP_ARG_PROGRAM, program); - fnvlist_add_nvlist(args, ZCP_ARG_ARGLIST, argnvl); - fnvlist_add_uint64(args, ZCP_ARG_INSTRLIMIT, instrlimit); - fnvlist_add_uint64(args, ZCP_ARG_MEMLIMIT, memlimit); - error = lzc_ioctl(ZFS_IOC_CHANNEL_PROGRAM, pool, args, outnvl); - fnvlist_free(args); - - return (error); +/* + * Executes a read-only channel program. + * + * A read-only channel program works programmatically the same way as a + * normal channel program executed with lzc_channel_program(). The only + * difference is it runs exclusively in open-context and therefore can + * return faster. The downside to that, is that the program cannot change + * on-disk state by calling functions from the zfs.sync submodule. + * + * The return values of this function (and their meaning) are exactly the + * same as the ones described in lzc_channel_program(). + */ +int +lzc_channel_program_nosync(const char *pool, const char *program, + uint64_t timeout, uint64_t memlimit, nvlist_t *argnvl, nvlist_t **outnvl) +{ + return (lzc_channel_program_impl(pool, program, B_FALSE, timeout, + memlimit, argnvl, outnvl)); } Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h Sun Jan 21 17:31:31 2018 (r328219) +++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h Sun Jan 21 19:26:38 2018 (r328220) @@ -86,8 +86,10 @@ boolean_t lzc_exists(const char *); int lzc_rollback(const char *, char *, int); int lzc_rollback_to(const char *, const char *); -int lzc_channel_program(const char *, const char *, uint64_t, uint64_t, - nvlist_t *, nvlist_t **); +int lzc_channel_program(const char *, const char *, uint64_t, + uint64_t, nvlist_t *, nvlist_t **); +int lzc_channel_program_nosync(const char *, const char *, uint64_t, + uint64_t, nvlist_t *, nvlist_t **); #ifdef __cplusplus } Modified: vendor/illumos/dist/man/man1m/zfs-program.1m ============================================================================== --- vendor/illumos/dist/man/man1m/zfs-program.1m Sun Jan 21 17:31:31 2018 (r328219) +++ vendor/illumos/dist/man/man1m/zfs-program.1m Sun Jan 21 19:26:38 2018 (r328220) @@ -14,10 +14,11 @@ .Dt ZFS-PROGRAM 1M .Os .Sh NAME -.Nm zfs program +.Nm "zfs program" .Nd executes ZFS channel programs .Sh SYNOPSIS -.Cm zfs program +.Cm "zfs program" +.Op Fl n .Op Fl t Ar instruction-limit .Op Fl m Ar memory-limit .Ar pool @@ -45,6 +46,14 @@ will be run on and any attempts to access or modify other pools will cause an error. .Sh OPTIONS .Bl -tag -width "-t" +.It Fl n +Executes a read-only channel program, which runs faster. +The program cannot change on-disk state by calling functions from the +zfs.sync submodule. +The program can be used to gather information such as properties and +determining if changes would succeed (zfs.check.*). +Without this flag, all pending changes must be synced to disk before a +channel program can complete. .It Fl t Ar instruction-limit Execution time limit, in number of Lua instructions to execute. If a channel program executes more than the specified number of instructions, Modified: vendor/illumos/dist/man/man1m/zfs.1m ============================================================================== --- vendor/illumos/dist/man/man1m/zfs.1m Sun Jan 21 17:31:31 2018 (r328219) +++ vendor/illumos/dist/man/man1m/zfs.1m Sun Jan 21 19:26:38 2018 (r328220) @@ -267,6 +267,7 @@ .Ar snapshot Ar snapshot Ns | Ns Ar filesystem .Nm .Cm program +.Op Fl n .Op Fl t Ar timeout .Op Fl m Ar memory_limit .Ar pool script @@ -3408,6 +3409,7 @@ Display the path's inode change time as the first colu .It Xo .Nm .Cm program +.Op Fl n .Op Fl t Ar timeout .Op Fl m Ar memory_limit .Ar pool script @@ -3427,8 +3429,15 @@ Channel programs may only be run with root privileges. .sp For full documentation of the ZFS channel program interface, see the manual page for -.Xr zfs-program 1M . .Bl -tag -width "" +.It Fl n +Executes a read-only channel program, which runs faster. +The program cannot change on-disk state by calling functions from +the zfs.sync submodule. +The program can be used to gather information such as properties and +determining if changes would succeed (zfs.check.*). +Without this flag, all pending changes must be synced to disk before +a channel program can complete. .It Fl t Ar timeout Execution time limit, in milliseconds. If a channel program executes for longer than the provided timeout, it will From owner-svn-src-all@freebsd.org Sun Jan 21 20:27:48 2018 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 DE98CEB917F; Sun, 21 Jan 2018 20:27:48 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB0FE7AE3A; Sun, 21 Jan 2018 20:27:48 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F42910821; Sun, 21 Jan 2018 20:27:48 +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 w0LKRlum024424; Sun, 21 Jan 2018 20:27:47 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LKRlj4024423; Sun, 21 Jan 2018 20:27:47 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801212027.w0LKRlj4024423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 21 Jan 2018 20:27:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328221 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 328221 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 20:27:49 -0000 Author: pfg Date: Sun Jan 21 20:27:47 2018 New Revision: 328221 URL: https://svnweb.freebsd.org/changeset/base/328221 Log: Define a new __alloc_size2 attribute to complement the exiting support. At least on GCC7 calling __alloc_size(x) twice is not equivalent to calling using the attribute once with two arguments. The later is the documented use in GCC documentation so add a new alloc_size(n, x) alternative to cover for the few places where it is used: basically: calloc(3), reallocarray(3) and mallocarray(9). Submitted by: Mark Millard MFC after: 3 days Reference: http://docs.freebsd.org/cgi/mid.cgi?F227842D-6BE2-4680-82E7-07906AF61CD7 Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Sun Jan 21 19:26:38 2018 (r328220) +++ head/sys/sys/cdefs.h Sun Jan 21 20:27:47 2018 (r328221) @@ -230,8 +230,10 @@ #endif #if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__) #define __alloc_size(x) __attribute__((__alloc_size__(x))) +#define __alloc_size2(n, x) __attribute__((__alloc_size__(n, x))) #else #define __alloc_size(x) +#define __alloc_size2(n, x) #endif #if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__) #define __alloc_align(x) __attribute__((__alloc_align__(x))) From owner-svn-src-all@freebsd.org Sun Jan 21 21:09:09 2018 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 9F8E4EBB4F2; Sun, 21 Jan 2018 21:09:09 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 744D67C4EC; Sun, 21 Jan 2018 21:09:09 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADB8310E91; Sun, 21 Jan 2018 21:09:08 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0LL98Zw040871; Sun, 21 Jan 2018 21:09:08 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LL98OU040870; Sun, 21 Jan 2018 21:09:08 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801212109.w0LL98OU040870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 21 Jan 2018 21:09:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328222 - head/lib/libiconv_modules/ISO2022 X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/lib/libiconv_modules/ISO2022 X-SVN-Commit-Revision: 328222 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 21:09:09 -0000 Author: eadler Date: Sun Jan 21 21:09:08 2018 New Revision: 328222 URL: https://svnweb.freebsd.org/changeset/base/328222 Log: iconv: adding missing break break is probably intended and correct, but has no correctness implications due to is94 => is96 Reviewed by: cem, jilles Reported by: swildner@DragonFlyBSD.org MFC After: 1 week Modified: head/lib/libiconv_modules/ISO2022/citrus_iso2022.c Modified: head/lib/libiconv_modules/ISO2022/citrus_iso2022.c ============================================================================== --- head/lib/libiconv_modules/ISO2022/citrus_iso2022.c Sun Jan 21 20:27:47 2018 (r328221) +++ head/lib/libiconv_modules/ISO2022/citrus_iso2022.c Sun Jan 21 21:09:08 2018 (r328222) @@ -776,6 +776,7 @@ asis: case CS94: if (!(is94(string[0] & 0x7f))) goto asis; + break; case CS96: if (!(is96(string[0] & 0x7f))) goto asis; From owner-svn-src-all@freebsd.org Sun Jan 21 21:27:42 2018 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 BC0DAEBC6FD; Sun, 21 Jan 2018 21:27:42 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9758D7D3D6; Sun, 21 Jan 2018 21:27:42 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6BF0111D7; Sun, 21 Jan 2018 21:27:41 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0LLRfvu049233; Sun, 21 Jan 2018 21:27:41 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LLRfR0049230; Sun, 21 Jan 2018 21:27:41 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201801212127.w0LLRfR0049230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Sun, 21 Jan 2018 21:27:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328223 - in head/sys: arm/broadcom/bcm2835 modules modules/bcm283x_pwm modules/rpi_pwm X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: in head/sys: arm/broadcom/bcm2835 modules modules/bcm283x_pwm modules/rpi_pwm X-SVN-Commit-Revision: 328223 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 21:27:42 -0000 Author: phk Date: Sun Jan 21 21:27:41 2018 New Revision: 328223 URL: https://svnweb.freebsd.org/changeset/base/328223 Log: Rename rpi_pwm to bcm283x_pwm, and build it on armv[67] and arm64. Truncate ratio if period is lowered. Tested on Rpi2 and Rpi3. Rpi3 requires DTB->DTS->edit->DTB hack Added: head/sys/modules/bcm283x_pwm/ - copied from r328222, head/sys/modules/rpi_pwm/ Deleted: head/sys/modules/rpi_pwm/ Modified: head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c head/sys/modules/Makefile head/sys/modules/bcm283x_pwm/Makefile Modified: head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Sun Jan 21 21:09:08 2018 (r328222) +++ head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Sun Jan 21 21:27:41 2018 (r328223) @@ -160,6 +160,8 @@ bcm_pwm_reconf(struct bcm_pwm_softc *sc) /* Config PWM */ W_RNG(sc, sc->period); + if (sc->ratio > sc->period) + sc->ratio = sc->period; W_DAT(sc, sc->ratio); /* Start PWM */ Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sun Jan 21 21:09:08 2018 (r328222) +++ head/sys/modules/Makefile Sun Jan 21 21:27:41 2018 (r328223) @@ -60,6 +60,7 @@ SUBDIR= \ ${_autofs} \ ${_auxio} \ ${_bce} \ + ${_bcm283x_pwm} \ bfe \ bge \ bhnd \ @@ -804,6 +805,10 @@ _cloudabi32= cloudabi32 _cloudabi64= cloudabi64 .endif +.endif + +.if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64" +_bcm283x_pwm= bcm283x_pwm .endif .if ${MACHINE_ARCH:Marmv[67]*} != "" Modified: head/sys/modules/bcm283x_pwm/Makefile ============================================================================== --- head/sys/modules/rpi_pwm/Makefile Sun Jan 21 21:09:08 2018 (r328222) +++ head/sys/modules/bcm283x_pwm/Makefile Sun Jan 21 21:27:41 2018 (r328223) @@ -2,7 +2,7 @@ .PATH: ${SRCTOP}/sys/arm/broadcom/bcm2835/ -KMOD= rpi_pwm +KMOD= bcm283x_pwm SRCS= bcm2835_pwm.c SRCS+= bus_if.h device_if.h ofw_bus_if.h From owner-svn-src-all@freebsd.org Sun Jan 21 23:02:07 2018 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 C2601EC044D; Sun, 21 Jan 2018 23:02:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7594F7FE27; Sun, 21 Jan 2018 23:02:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2A0912187; Sun, 21 Jan 2018 23:02: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 w0LN26xx088297; Sun, 21 Jan 2018 23:02:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LN253K088285; Sun, 21 Jan 2018 23:02:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801212302.w0LN253K088285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 21 Jan 2018 23:02:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328224 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs... X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/ope... X-SVN-Commit-Revision: 328224 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 23:02:07 -0000 Author: mav Date: Sun Jan 21 23:02:05 2018 New Revision: 328224 URL: https://svnweb.freebsd.org/changeset/base/328224 Log: MFV r328220: 8677 Open-Context Channel Programs illumos/illumos-gate@a3b2868063897ff0083dea538f55f9873eec981f https://www.illumos.org/issues/8677 We want to be able to run channel programs outside of synching context. This would greatly improve performance of channel program that just gather information, as we won't have to wait for synching context anymore. This feature should introduce the following: - A new command line flag in "zfs program" to specify our intention to run in open context. - A new flag/option within the channel program ioctl which selects the context. - Appropriate error handling whenever we try a channel program in open-context that contains zfs.sync* expressions. - Documentation for the new feature in the manual pages. Reviewed by: Matt Ahrens Reviewed by: Chris Williamson Reviewed by: Pavel Zakharov Approved by: Robert Mustacchi Author: Serapheim Dimitropoulos Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.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/dsl_destroy.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h 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-program.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Sun Jan 21 21:27:41 2018 (r328223) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Sun Jan 21 23:02:05 2018 (r328224) @@ -18,6 +18,7 @@ .Nd executes ZFS channel programs .Sh SYNOPSIS .Cm zfs program +.Op Fl n .Op Fl t Ar instruction-limit .Op Fl m Ar memory-limit .Ar pool @@ -45,6 +46,14 @@ will be run on and any attempts to access or modify other pools will cause an error. .Sh OPTIONS .Bl -tag -width "-t" +.It Fl n +Executes a read-only channel program, which runs faster. +The program cannot change on-disk state by calling functions from the +zfs.sync submodule. +The program can be used to gather information such as properties and +determining if changes would succeed (zfs.check.*). +Without this flag, all pending changes must be synced to disk before a +channel program can complete. .It Fl t Ar instruction-limit Execution time limit, in number of Lua instructions to execute. If a channel program executes more than the specified number of instructions, Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Jan 21 21:27:41 2018 (r328223) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Jan 21 23:02:05 2018 (r328224) @@ -287,6 +287,7 @@ .Op Ar snapshot Ns | Ns Ar filesystem .Nm .Cm program +.Op Fl n .Op Fl t Ar timeout .Op Fl m Ar memory_limit .Ar pool script @@ -3294,6 +3295,7 @@ Display the path's inode change time as the first colu .It Xo .Nm .Cm program +.Op Fl n .Op Fl t Ar timeout .Op Fl m Ar memory_limit .Ar pool script @@ -3316,6 +3318,14 @@ For full documentation of the ZFS channel program inte page for .Xr zfs-program 8 . .Bl -tag -width indent +.It Fl n +Executes a read-only channel program, which runs faster. +The program cannot change on-disk state by calling functions from +the zfs.sync submodule. +The program can be used to gather information such as properties and +determining if changes would succeed (zfs.check.*). +Without this flag, all pending changes must be synced to disk before +a channel program can complete. .It Fl t Ar timeout Execution time limit, in milliseconds. If a channel program executes for longer than the provided timeout, it will Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Jan 21 21:27:41 2018 (r328223) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Jan 21 23:02:05 2018 (r328224) @@ -345,7 +345,7 @@ get_usage(zfs_help_t idx) case HELP_BOOKMARK: return (gettext("\tbookmark \n")); case HELP_CHANNEL_PROGRAM: - return (gettext("\tprogram [-t ] " + return (gettext("\tprogram [-n] [-t ] " "[-m ] " "[lua args...]\n")); } @@ -7131,11 +7131,12 @@ zfs_do_channel_program(int argc, char **argv) nvlist_t *outnvl; uint64_t instrlimit = ZCP_DEFAULT_INSTRLIMIT; uint64_t memlimit = ZCP_DEFAULT_MEMLIMIT; + boolean_t sync_flag = B_TRUE; zpool_handle_t *zhp; /* check options */ while (-1 != - (c = getopt(argc, argv, "t:(instr-limit)m:(memory-limit)"))) { + (c = getopt(argc, argv, "nt:(instr-limit)m:(memory-limit)"))) { switch (c) { case 't': case 'm': { @@ -7173,6 +7174,10 @@ zfs_do_channel_program(int argc, char **argv) } break; } + case 'n': { + sync_flag = B_FALSE; + break; + } case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); @@ -7244,8 +7249,13 @@ zfs_do_channel_program(int argc, char **argv) nvlist_t *argnvl = fnvlist_alloc(); fnvlist_add_string_array(argnvl, ZCP_ARG_CLIARGV, argv + 2, argc - 2); - ret = lzc_channel_program(poolname, progbuf, instrlimit, memlimit, - argnvl, &outnvl); + if (sync_flag) { + ret = lzc_channel_program(poolname, progbuf, + instrlimit, memlimit, argnvl, &outnvl); + } else { + ret = lzc_channel_program_nosync(poolname, progbuf, + instrlimit, memlimit, argnvl, &outnvl); + } if (ret != 0) { /* Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Jan 21 21:27:41 2018 (r328223) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Jan 21 23:02:05 2018 (r328224) @@ -2381,7 +2381,7 @@ zcp_check(zfs_handle_t *zhp, zfs_prop_t prop, uint64_t fnvlist_add_string(argnvl, "dataset", zhp->zfs_name); fnvlist_add_string(argnvl, "property", zfs_prop_to_name(prop)); - error = lzc_channel_program(poolname, program, + error = lzc_channel_program_nosync(poolname, program, 10 * 1000 * 1000, 10 * 1024 * 1024, argnvl, &outnvl); if (error == 0) { Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Sun Jan 21 21:27:41 2018 (r328223) +++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Sun Jan 21 23:02:05 2018 (r328224) @@ -918,6 +918,25 @@ lzc_destroy_bookmarks(nvlist_t *bmarks, nvlist_t **err return (error); } +static int +lzc_channel_program_impl(const char *pool, const char *program, boolean_t sync, + uint64_t instrlimit, uint64_t memlimit, nvlist_t *argnvl, nvlist_t **outnvl) +{ + int error; + nvlist_t *args; + + args = fnvlist_alloc(); + fnvlist_add_string(args, ZCP_ARG_PROGRAM, program); + fnvlist_add_nvlist(args, ZCP_ARG_ARGLIST, argnvl); + fnvlist_add_boolean_value(args, ZCP_ARG_SYNC, sync); + fnvlist_add_uint64(args, ZCP_ARG_INSTRLIMIT, instrlimit); + fnvlist_add_uint64(args, ZCP_ARG_MEMLIMIT, memlimit); + error = lzc_ioctl(ZFS_IOC_CHANNEL_PROGRAM, pool, args, outnvl); + fnvlist_free(args); + + return (error); +} + /* * Executes a channel program. * @@ -955,16 +974,26 @@ int lzc_channel_program(const char *pool, const char *program, uint64_t instrlimit, uint64_t memlimit, nvlist_t *argnvl, nvlist_t **outnvl) { - int error; - nvlist_t *args; + return (lzc_channel_program_impl(pool, program, B_TRUE, instrlimit, + memlimit, argnvl, outnvl)); +} - args = fnvlist_alloc(); - fnvlist_add_string(args, ZCP_ARG_PROGRAM, program); - fnvlist_add_nvlist(args, ZCP_ARG_ARGLIST, argnvl); - fnvlist_add_uint64(args, ZCP_ARG_INSTRLIMIT, instrlimit); - fnvlist_add_uint64(args, ZCP_ARG_MEMLIMIT, memlimit); - error = lzc_ioctl(ZFS_IOC_CHANNEL_PROGRAM, pool, args, outnvl); - fnvlist_free(args); - - return (error); +/* + * Executes a read-only channel program. + * + * A read-only channel program works programmatically the same way as a + * normal channel program executed with lzc_channel_program(). The only + * difference is it runs exclusively in open-context and therefore can + * return faster. The downside to that, is that the program cannot change + * on-disk state by calling functions from the zfs.sync submodule. + * + * The return values of this function (and their meaning) are exactly the + * same as the ones described in lzc_channel_program(). + */ +int +lzc_channel_program_nosync(const char *pool, const char *program, + uint64_t timeout, uint64_t memlimit, nvlist_t *argnvl, nvlist_t **outnvl) +{ + return (lzc_channel_program_impl(pool, program, B_FALSE, timeout, + memlimit, argnvl, outnvl)); } Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Sun Jan 21 21:27:41 2018 (r328223) +++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Sun Jan 21 23:02:05 2018 (r328224) @@ -86,8 +86,10 @@ boolean_t lzc_exists(const char *); int lzc_rollback(const char *, char *, int); int lzc_rollback_to(const char *, const char *); -int lzc_channel_program(const char *, const char *, uint64_t, uint64_t, - nvlist_t *, nvlist_t **); +int lzc_channel_program(const char *, const char *, uint64_t, + uint64_t, nvlist_t *, nvlist_t **); +int lzc_channel_program_nosync(const char *, const char *, uint64_t, + uint64_t, nvlist_t *, nvlist_t **); #ifdef __cplusplus } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Sun Jan 21 21:27:41 2018 (r328223) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Sun Jan 21 23:02:05 2018 (r328224) @@ -542,6 +542,7 @@ dsl_destroy_snapshots_nvl(nvlist_t *snaps, boolean_t d nvlist_t *result = fnvlist_alloc(); int error = zcp_eval(nvpair_name(nvlist_next_nvpair(snaps, NULL)), program, + B_TRUE, 0, zfs_lua_max_memlimit, nvlist_next_nvpair(wrapper, NULL), result); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h Sun Jan 21 21:27:41 2018 (r328223) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h Sun Jan 21 23:02:05 2018 (r328224) @@ -38,20 +38,25 @@ extern uint64_t zfs_lua_max_memlimit; int zcp_argerror(lua_State *, int, const char *, ...); -int zcp_eval(const char *, const char *, uint64_t, uint64_t, nvpair_t *, - nvlist_t *); +int zcp_eval(const char *, const char *, boolean_t, uint64_t, uint64_t, + nvpair_t *, nvlist_t *); int zcp_load_list_lib(lua_State *); int zcp_load_synctask_lib(lua_State *, boolean_t); typedef void (zcp_cleanup_t)(void *); +typedef struct zcp_cleanup_handler { + zcp_cleanup_t *zch_cleanup_func; + void *zch_cleanup_arg; + list_node_t zch_node; +} zcp_cleanup_handler_t; typedef struct zcp_run_info { dsl_pool_t *zri_pool; /* - * An estimate of the total ammount of space consumed by all + * An estimate of the total amount of space consumed by all * synctasks we have successfully performed so far in this * channel program. Used to generate ENOSPC errors for syncfuncs. */ @@ -89,16 +94,21 @@ typedef struct zcp_run_info { boolean_t zri_timed_out; /* - * The currently registered cleanup function, which will be called - * with the stored argument if a fatal error occurs. + * Boolean indicating whether or not we are running in syncing + * context. */ - zcp_cleanup_t *zri_cleanup; - void *zri_cleanup_arg; + boolean_t zri_sync; + + /* + * List of currently registered cleanup handlers, which will be + * triggered in the event of a fatal error. + */ + list_t zri_cleanup_handlers; } zcp_run_info_t; zcp_run_info_t *zcp_run_info(lua_State *); -void zcp_register_cleanup(lua_State *, zcp_cleanup_t, void *); -void zcp_clear_cleanup(lua_State *); +zcp_cleanup_handler_t *zcp_register_cleanup(lua_State *, zcp_cleanup_t, void *); +void zcp_deregister_cleanup(lua_State *, zcp_cleanup_handler_t *); void zcp_cleanup(lua_State *); /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Sun Jan 21 21:27:41 2018 (r328223) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Sun Jan 21 23:02:05 2018 (r328224) @@ -137,13 +137,6 @@ typedef struct zcp_eval_arg { uint64_t ea_instrlimit; } zcp_eval_arg_t; -/*ARGSUSED*/ -static int -zcp_eval_check(void *arg, dmu_tx_t *tx) -{ - return (0); -} - /* * The outer-most error callback handler for use with lua_pcall(). On * error Lua will call this callback with a single argument that @@ -187,41 +180,45 @@ zcp_argerror(lua_State *state, int narg, const char *m * * If an error occurs, the cleanup function will be invoked exactly once and * then unreigstered. + * + * Returns the registered cleanup handler so the caller can deregister it + * if no error occurs. */ -void +zcp_cleanup_handler_t * zcp_register_cleanup(lua_State *state, zcp_cleanup_t cleanfunc, void *cleanarg) { zcp_run_info_t *ri = zcp_run_info(state); - /* - * A cleanup function should always be explicitly removed before - * installing a new one to avoid accidental clobbering. - */ - ASSERT3P(ri->zri_cleanup, ==, NULL); - ri->zri_cleanup = cleanfunc; - ri->zri_cleanup_arg = cleanarg; + zcp_cleanup_handler_t *zch = kmem_alloc(sizeof (*zch), KM_SLEEP); + zch->zch_cleanup_func = cleanfunc; + zch->zch_cleanup_arg = cleanarg; + list_insert_head(&ri->zri_cleanup_handlers, zch); + + return (zch); } void -zcp_clear_cleanup(lua_State *state) +zcp_deregister_cleanup(lua_State *state, zcp_cleanup_handler_t *zch) { zcp_run_info_t *ri = zcp_run_info(state); - - ri->zri_cleanup = NULL; - ri->zri_cleanup_arg = NULL; + list_remove(&ri->zri_cleanup_handlers, zch); + kmem_free(zch, sizeof (*zch)); } /* - * If it exists, execute the currently set cleanup function then unregister it. + * Execute the currently registered cleanup handlers then free them and + * destroy the handler list. */ void zcp_cleanup(lua_State *state) { zcp_run_info_t *ri = zcp_run_info(state); - if (ri->zri_cleanup != NULL) { - ri->zri_cleanup(ri->zri_cleanup_arg); - zcp_clear_cleanup(state); + for (zcp_cleanup_handler_t *zch = + list_remove_head(&ri->zri_cleanup_handlers); zch != NULL; + zch = list_remove_head(&ri->zri_cleanup_handlers)) { + zch->zch_cleanup_func(zch->zch_cleanup_arg); + kmem_free(zch, sizeof (*zch)); } } @@ -822,19 +819,12 @@ zcp_panic_cb(lua_State *state) } static void -zcp_eval_sync(void *arg, dmu_tx_t *tx) +zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) { int err; zcp_run_info_t ri; - zcp_eval_arg_t *evalargs = arg; lua_State *state = evalargs->ea_state; - /* - * Open context should have setup the stack to contain: - * 1: Error handler callback - * 2: Script to run (converted to a Lua function) - * 3: nvlist input to function (converted to Lua table or nil) - */ VERIFY3U(3, ==, lua_gettop(state)); /* @@ -847,8 +837,9 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) ri.zri_cred = evalargs->ea_cred; ri.zri_tx = tx; ri.zri_timed_out = B_FALSE; - ri.zri_cleanup = NULL; - ri.zri_cleanup_arg = NULL; + ri.zri_sync = sync; + list_create(&ri.zri_cleanup_handlers, sizeof (zcp_cleanup_handler_t), + offsetof(zcp_cleanup_handler_t, zch_node)); ri.zri_curinstrs = 0; ri.zri_maxinstrs = evalargs->ea_instrlimit; @@ -885,10 +876,10 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) /* * Remove the error handler callback from the stack. At this point, - * if there is a cleanup function registered, then it was registered - * but never run or removed, which should never occur. + * there shouldn't be any cleanup handler registered in the handler + * list (zri_cleanup_handlers), regardless of whether it ran or not. */ - ASSERT3P(ri.zri_cleanup, ==, NULL); + list_destroy(&ri.zri_cleanup_handlers); lua_remove(state, 1); switch (err) { @@ -970,9 +961,73 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) } } +static void +zcp_pool_error(zcp_eval_arg_t *evalargs, const char *poolname) +{ + evalargs->ea_result = SET_ERROR(ECHRNG); + (void) lua_pushfstring(evalargs->ea_state, "Could not open pool: %s", + poolname); + zcp_convert_return_values(evalargs->ea_state, evalargs->ea_outnvl, + ZCP_RET_ERROR, evalargs); + +} + +static void +zcp_eval_sync(void *arg, dmu_tx_t *tx) +{ + zcp_eval_arg_t *evalargs = arg; + + /* + * Open context should have setup the stack to contain: + * 1: Error handler callback + * 2: Script to run (converted to a Lua function) + * 3: nvlist input to function (converted to Lua table or nil) + */ + VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + + zcp_eval_impl(tx, B_TRUE, evalargs); +} + +static void +zcp_eval_open(zcp_eval_arg_t *evalargs, const char *poolname) +{ + + int error; + dsl_pool_t *dp; + dmu_tx_t *tx; + + /* + * See comment from the same assertion in zcp_eval_sync(). + */ + VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + + error = dsl_pool_hold(poolname, FTAG, &dp); + if (error != 0) { + zcp_pool_error(evalargs, poolname); + return; + } + + /* + * As we are running in open-context, we have no transaction associated + * with the channel program. At the same time, functions from the + * zfs.check submodule need to be associated with a transaction as + * they are basically dry-runs of their counterparts in the zfs.sync + * submodule. These functions should be able to run in open-context. + * Therefore we create a new transaction that we later abort once + * the channel program has been evaluated. + */ + tx = dmu_tx_create_dd(dp->dp_mos_dir); + + zcp_eval_impl(tx, B_FALSE, evalargs); + + dmu_tx_abort(tx); + + dsl_pool_rele(dp, FTAG); +} + int -zcp_eval(const char *poolname, const char *program, uint64_t instrlimit, - uint64_t memlimit, nvpair_t *nvarg, nvlist_t *outnvl) +zcp_eval(const char *poolname, const char *program, boolean_t sync, + uint64_t instrlimit, uint64_t memlimit, nvpair_t *nvarg, nvlist_t *outnvl) { int err; lua_State *state; @@ -1083,9 +1138,14 @@ zcp_eval(const char *poolname, const char *program, ui evalargs.ea_outnvl = outnvl; evalargs.ea_result = 0; - VERIFY0(dsl_sync_task(poolname, zcp_eval_check, - zcp_eval_sync, &evalargs, 0, ZFS_SPACE_CHECK_NONE)); - + if (sync) { + err = dsl_sync_task(poolname, NULL, + zcp_eval_sync, &evalargs, 0, ZFS_SPACE_CHECK_NONE); + if (err != 0) + zcp_pool_error(&evalargs, poolname); + } else { + zcp_eval_open(&evalargs, poolname); + } lua_close(state); return (evalargs.ea_result); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c Sun Jan 21 21:27:41 2018 (r328223) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_synctask.c Sun Jan 21 23:02:05 2018 (r328224) @@ -55,6 +55,10 @@ typedef struct zcp_synctask_info { * * If 'sync' is false, executes a dry run and returns the error code. * + * If we are not running in syncing context and we are not doing a dry run + * (meaning we are running a zfs.sync function in open-context) then we + * return a Lua error. + * * This function also handles common fatal error cases for channel program * library functions. If a fatal error occurs, err_dsname will be the dataset * name reported in error messages, if supplied. @@ -70,6 +74,13 @@ zcp_sync_task(lua_State *state, dsl_checkfunc_t *check if (!sync) return (err); + if (!ri->zri_sync) { + return (luaL_error(state, "running functions from the zfs.sync " + "submodule requires passing sync=TRUE to " + "lzc_channel_program() (i.e. do not specify the \"-n\" " + "command line argument)")); + } + if (err == 0) { syncfunc(arg, ri->zri_tx); } else if (err == EIO) { @@ -234,6 +245,15 @@ zcp_synctask_snapshot(lua_State *state, boolean_t sync zcp_run_info_t *ri = zcp_run_info(state); /* + * On old pools, the ZIL must not be active when a snapshot is created, + * but we can't suspend the ZIL because we're already in syncing + * context. + */ + if (spa_version(ri->zri_pool->dp_spa) < SPA_VERSION_FAST_SNAP) { + return (ENOTSUP); + } + + /* * We only allow for a single snapshot rather than a list, so the * error list output is unnecessary. */ @@ -243,33 +263,23 @@ zcp_synctask_snapshot(lua_State *state, boolean_t sync ddsa.ddsa_snaps = fnvlist_alloc(); fnvlist_add_boolean(ddsa.ddsa_snaps, dsname); - /* - * On old pools, the ZIL must not be active when a snapshot is created, - * but we can't suspend the ZIL because we're already in syncing - * context. - */ - if (spa_version(ri->zri_pool->dp_spa) < SPA_VERSION_FAST_SNAP) { - return (ENOTSUP); - } + zcp_cleanup_handler_t *zch = zcp_register_cleanup(state, + (zcp_cleanup_t *)&fnvlist_free, ddsa.ddsa_snaps); err = zcp_sync_task(state, dsl_dataset_snapshot_check, dsl_dataset_snapshot_sync, &ddsa, sync, dsname); + zcp_deregister_cleanup(state, zch); fnvlist_free(ddsa.ddsa_snaps); return (err); } -void -zcp_synctask_wrapper_cleanup(void *arg) -{ - fnvlist_free(arg); -} - static int zcp_synctask_wrapper(lua_State *state) { int err; + zcp_cleanup_handler_t *zch; int num_ret = 1; nvlist_t *err_details = fnvlist_alloc(); @@ -277,7 +287,8 @@ zcp_synctask_wrapper(lua_State *state) * Make sure err_details is properly freed, even if a fatal error is * thrown during the synctask. */ - zcp_register_cleanup(state, &zcp_synctask_wrapper_cleanup, err_details); + zch = zcp_register_cleanup(state, + (zcp_cleanup_t *)&fnvlist_free, err_details); zcp_synctask_info_t *info = lua_touserdata(state, lua_upvalueindex(1)); boolean_t sync = lua_toboolean(state, lua_upvalueindex(2)); @@ -317,7 +328,7 @@ zcp_synctask_wrapper(lua_State *state) num_ret++; } - zcp_clear_cleanup(state); + zcp_deregister_cleanup(state, zch); fnvlist_free(err_details); return (num_ret); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Jan 21 21:27:41 2018 (r328223) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Jan 21 23:02:05 2018 (r328224) @@ -3777,11 +3777,15 @@ zfs_ioc_channel_program(const char *poolname, nvlist_t { char *program; uint64_t instrlimit, memlimit; + boolean_t sync_flag; nvpair_t *nvarg = NULL; if (0 != nvlist_lookup_string(innvl, ZCP_ARG_PROGRAM, &program)) { return (EINVAL); } + if (0 != nvlist_lookup_boolean_value(innvl, ZCP_ARG_SYNC, &sync_flag)) { + sync_flag = B_TRUE; + } if (0 != nvlist_lookup_uint64(innvl, ZCP_ARG_INSTRLIMIT, &instrlimit)) { instrlimit = ZCP_DEFAULT_INSTRLIMIT; } @@ -3797,7 +3801,7 @@ zfs_ioc_channel_program(const char *poolname, nvlist_t if (memlimit == 0 || memlimit > zfs_lua_max_memlimit) return (EINVAL); - return (zcp_eval(poolname, program, instrlimit, memlimit, + return (zcp_eval(poolname, program, sync_flag, instrlimit, memlimit, nvarg, outnvl)); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sun Jan 21 21:27:41 2018 (r328223) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sun Jan 21 23:02:05 2018 (r328224) @@ -984,6 +984,7 @@ typedef enum { */ #define ZCP_ARG_PROGRAM "program" #define ZCP_ARG_ARGLIST "arg" +#define ZCP_ARG_SYNC "sync" #define ZCP_ARG_INSTRLIMIT "instrlimit" #define ZCP_ARG_MEMLIMIT "memlimit" From owner-svn-src-all@freebsd.org Sun Jan 21 23:04:26 2018 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 CC4A0EC0598; Sun, 21 Jan 2018 23:04:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6E9580004; Sun, 21 Jan 2018 23:04:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE52B121B1; Sun, 21 Jan 2018 23:04:25 +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 w0LN4PW0090811; Sun, 21 Jan 2018 23:04:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LN4PKO090808; Sun, 21 Jan 2018 23:04:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801212304.w0LN4PKO090808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 21 Jan 2018 23:04:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328225 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 328225 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 23:04:26 -0000 Author: mav Date: Sun Jan 21 23:04:25 2018 New Revision: 328225 URL: https://svnweb.freebsd.org/changeset/base/328225 Log: 8603 rename zilog's "zl_writer_lock" to "zl_issuer_lock" illumos/illumos-gate@cf07d3da9915c0d22da8f59e991639f819463cef https://www.illumos.org/issues/8603: To help make the ZIL's code more understandable, it was suggested that the zilog_t's "zl_writer_lock" field should be renamed to "zl_issuer_lock". Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h Sun Jan 21 23:02:05 2018 (r328224) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h Sun Jan 21 23:04:25 2018 (r328225) @@ -57,9 +57,9 @@ typedef enum { * Log write block (lwb) * * Prior to an lwb being issued to disk via zil_lwb_write_issue(), it - * will be protected by the zilog's "zl_writer_lock". Basically, prior + * will be protected by the zilog's "zl_issuer_lock". Basically, prior * to it being issued, it will only be accessed by the thread that's - * holding the "zl_writer_lock". After the lwb is issued, the zilog's + * holding the "zl_issuer_lock". After the lwb is issued, the zilog's * "zl_lock" is used to protect the lwb against concurrent access. */ typedef struct lwb { @@ -91,10 +91,10 @@ typedef struct lwb { * * The "zcw_lock" field is used to protect the commit waiter against * concurrent access. This lock is often acquired while already holding - * the zilog's "zl_writer_lock" or "zl_lock"; see the functions + * the zilog's "zl_issuer_lock" or "zl_lock"; see the functions * zil_process_commit_list() and zil_lwb_flush_vdevs_done() as examples * of this. Thus, one must be careful not to acquire the - * "zl_writer_lock" or "zl_lock" when already holding the "zcw_lock"; + * "zl_issuer_lock" or "zl_lock" when already holding the "zcw_lock"; * e.g. see the zil_commit_waiter_timeout() function. */ typedef struct zil_commit_waiter { @@ -161,7 +161,7 @@ struct zilog { uint8_t zl_keep_first; /* keep first log block in destroy */ uint8_t zl_replay; /* replaying records while set */ uint8_t zl_stop_sync; /* for debugging */ - kmutex_t zl_writer_lock; /* single writer, per ZIL, at a time */ + kmutex_t zl_issuer_lock; /* single writer, per ZIL, at a time */ uint8_t zl_logbias; /* latency or throughput */ uint8_t zl_sync; /* synchronous or asynchronous */ int zl_parse_error; /* last zil_parse() error */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Sun Jan 21 23:02:05 2018 (r328224) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Sun Jan 21 23:04:25 2018 (r328225) @@ -1095,7 +1095,7 @@ zil_lwb_write_open(zilog_t *zilog, lwb_t *lwb) zbookmark_phys_t zb; zio_priority_t prio; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT3P(lwb, !=, NULL); EQUIV(lwb->lwb_root_zio == NULL, lwb->lwb_state == LWB_STATE_CLOSED); EQUIV(lwb->lwb_root_zio != NULL, lwb->lwb_state == LWB_STATE_OPENED); @@ -1192,7 +1192,7 @@ zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) int i, error; boolean_t slog; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT3P(lwb->lwb_root_zio, !=, NULL); ASSERT3P(lwb->lwb_write_zio, !=, NULL); ASSERT3S(lwb->lwb_state, ==, LWB_STATE_OPENED); @@ -1326,7 +1326,7 @@ zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) char *lr_buf; uint64_t dlen, dnow, lwb_sp, reclen, txg; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT3P(lwb, !=, NULL); ASSERT3P(lwb->lwb_buf, !=, NULL); @@ -1742,7 +1742,7 @@ zil_get_commit_list(zilog_t *zilog) uint64_t otxg, txg; list_t *commit_list = &zilog->zl_itx_commit_list; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); if (spa_freeze_txg(zilog->zl_spa) != UINT64_MAX) /* ziltest support */ otxg = ZILTEST_TXG; @@ -1849,7 +1849,7 @@ zil_prune_commit_list(zilog_t *zilog) { itx_t *itx; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); while (itx = list_head(&zilog->zl_itx_commit_list)) { lr_t *lrc = &itx->itx_lr; @@ -1899,12 +1899,12 @@ zil_commit_writer_stall(zilog_t *zilog) * crash (because the previous lwb on-disk would not point to * it). * - * We must hold the zilog's zl_writer_lock while we do this, to + * We must hold the zilog's zl_issuer_lock while we do this, to * ensure no new threads enter zil_process_commit_list() until * all lwb's in the zl_lwb_list have been synced and freed * (which is achieved via the txg_wait_synced() call). */ - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); txg_wait_synced(zilog->zl_dmu_pool, 0); ASSERT3P(list_tail(&zilog->zl_lwb_list), ==, NULL); } @@ -1923,7 +1923,7 @@ zil_process_commit_list(zilog_t *zilog) lwb_t *lwb; itx_t *itx; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); /* * Return if there's nothing to commit before we dirty the fs by @@ -2093,17 +2093,17 @@ zil_commit_writer(zilog_t *zilog, zil_commit_waiter_t ASSERT(spa_writeable(zilog->zl_spa)); ASSERT0(zilog->zl_suspend); - mutex_enter(&zilog->zl_writer_lock); + mutex_enter(&zilog->zl_issuer_lock); if (zcw->zcw_lwb != NULL || zcw->zcw_done) { /* * It's possible that, while we were waiting to acquire - * the "zl_writer_lock", another thread committed this + * the "zl_issuer_lock", another thread committed this * waiter to an lwb. If that occurs, we bail out early, * without processing any of the zilog's queue of itxs. * * On certain workloads and system configurations, the - * "zl_writer_lock" can become highly contended. In an + * "zl_issuer_lock" can become highly contended. In an * attempt to reduce this contention, we immediately drop * the lock if the waiter has already been processed. * @@ -2120,13 +2120,13 @@ zil_commit_writer(zilog_t *zilog, zil_commit_waiter_t zil_process_commit_list(zilog); out: - mutex_exit(&zilog->zl_writer_lock); + mutex_exit(&zilog->zl_issuer_lock); } static void zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_waiter_t *zcw) { - ASSERT(!MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(!MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT(MUTEX_HELD(&zcw->zcw_lock)); ASSERT3B(zcw->zcw_done, ==, B_FALSE); @@ -2138,7 +2138,7 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w * If the lwb has already been issued by another thread, we can * immediately return since there's no work to be done (the * point of this function is to issue the lwb). Additionally, we - * do this prior to acquiring the zl_writer_lock, to avoid + * do this prior to acquiring the zl_issuer_lock, to avoid * acquiring it when it's not necessary to do so. */ if (lwb->lwb_state == LWB_STATE_ISSUED || @@ -2147,13 +2147,13 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w /* * In order to call zil_lwb_write_issue() we must hold the - * zilog's "zl_writer_lock". We can't simply acquire that lock, + * zilog's "zl_issuer_lock". We can't simply acquire that lock, * since we're already holding the commit waiter's "zcw_lock", * and those two locks are aquired in the opposite order * elsewhere. */ mutex_exit(&zcw->zcw_lock); - mutex_enter(&zilog->zl_writer_lock); + mutex_enter(&zilog->zl_issuer_lock); mutex_enter(&zcw->zcw_lock); /* @@ -2171,7 +2171,7 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w /* * We've already checked this above, but since we hadn't - * acquired the zilog's zl_writer_lock, we have to perform this + * acquired the zilog's zl_issuer_lock, we have to perform this * check a second time while holding the lock. We can't call * zil_lwb_write_issue() if the lwb had already been issued. */ @@ -2234,7 +2234,7 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w } out: - mutex_exit(&zilog->zl_writer_lock); + mutex_exit(&zilog->zl_issuer_lock); ASSERT(MUTEX_HELD(&zcw->zcw_lock)); } @@ -2261,7 +2261,7 @@ static void zil_commit_waiter(zilog_t *zilog, zil_commit_waiter_t *zcw) { ASSERT(!MUTEX_HELD(&zilog->zl_lock)); - ASSERT(!MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(!MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT(spa_writeable(zilog->zl_spa)); ASSERT0(zilog->zl_suspend); @@ -2510,7 +2510,7 @@ zil_commit_itx_assign(zilog_t *zilog, zil_commit_waite * on two fundamental concepts: * * 1. The creation and issuance of lwb zio's is protected by - * the zilog's "zl_writer_lock", which ensures only a single + * the zilog's "zl_issuer_lock", which ensures only a single * thread is creating and/or issuing lwb's at a time * 2. The "previous" lwb is a child of the "current" lwb * (leveraging the zio parent-child depenency graph) @@ -2759,7 +2759,7 @@ zil_alloc(objset_t *os, zil_header_t *zh_phys) zilog->zl_last_lwb_latency = 0; mutex_init(&zilog->zl_lock, NULL, MUTEX_DEFAULT, NULL); - mutex_init(&zilog->zl_writer_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&zilog->zl_issuer_lock, NULL, MUTEX_DEFAULT, NULL); for (int i = 0; i < TXG_SIZE; i++) { mutex_init(&zilog->zl_itxg[i].itxg_lock, NULL, @@ -2804,7 +2804,7 @@ zil_free(zilog_t *zilog) mutex_destroy(&zilog->zl_itxg[i].itxg_lock); } - mutex_destroy(&zilog->zl_writer_lock); + mutex_destroy(&zilog->zl_issuer_lock); mutex_destroy(&zilog->zl_lock); cv_destroy(&zilog->zl_cv_suspend); From owner-svn-src-all@freebsd.org Sun Jan 21 23:11:21 2018 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 8EB29EC08E3; Sun, 21 Jan 2018 23:11:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 65D8D8053C; Sun, 21 Jan 2018 23:11:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98BAA122EF; Sun, 21 Jan 2018 23:11:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0LNBKGj094084; Sun, 21 Jan 2018 23:11:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LNBKg5094082; Sun, 21 Jan 2018 23:11:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801212311.w0LNBKg5094082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 21 Jan 2018 23:11:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328226 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 328226 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 23:11:21 -0000 Author: mav Date: Sun Jan 21 23:11:20 2018 New Revision: 328226 URL: https://svnweb.freebsd.org/changeset/base/328226 Log: MFV r328225: 8603 rename zilog's "zl_writer_lock" to "zl_issuer_lock" illumos/illumos-gate@cf07d3da9915c0d22da8f59e991639f819463cef https://www.illumos.org/issues/8603: To help make the ZIL's code more understandable, it was suggested that the zilog_t's "zl_writer_lock" field should be renamed to "zl_issuer_lock". Reviewed by: C Fraire Approved by: Dan McDonald Author: Prakash Surya Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Sun Jan 21 23:04:25 2018 (r328225) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Sun Jan 21 23:11:20 2018 (r328226) @@ -57,9 +57,9 @@ typedef enum { * Log write block (lwb) * * Prior to an lwb being issued to disk via zil_lwb_write_issue(), it - * will be protected by the zilog's "zl_writer_lock". Basically, prior + * will be protected by the zilog's "zl_issuer_lock". Basically, prior * to it being issued, it will only be accessed by the thread that's - * holding the "zl_writer_lock". After the lwb is issued, the zilog's + * holding the "zl_issuer_lock". After the lwb is issued, the zilog's * "zl_lock" is used to protect the lwb against concurrent access. */ typedef struct lwb { @@ -91,10 +91,10 @@ typedef struct lwb { * * The "zcw_lock" field is used to protect the commit waiter against * concurrent access. This lock is often acquired while already holding - * the zilog's "zl_writer_lock" or "zl_lock"; see the functions + * the zilog's "zl_issuer_lock" or "zl_lock"; see the functions * zil_process_commit_list() and zil_lwb_flush_vdevs_done() as examples * of this. Thus, one must be careful not to acquire the - * "zl_writer_lock" or "zl_lock" when already holding the "zcw_lock"; + * "zl_issuer_lock" or "zl_lock" when already holding the "zcw_lock"; * e.g. see the zil_commit_waiter_timeout() function. */ typedef struct zil_commit_waiter { @@ -161,7 +161,7 @@ struct zilog { uint8_t zl_keep_first; /* keep first log block in destroy */ uint8_t zl_replay; /* replaying records while set */ uint8_t zl_stop_sync; /* for debugging */ - kmutex_t zl_writer_lock; /* single writer, per ZIL, at a time */ + kmutex_t zl_issuer_lock; /* single writer, per ZIL, at a time */ uint8_t zl_logbias; /* latency or throughput */ uint8_t zl_sync; /* synchronous or asynchronous */ int zl_parse_error; /* last zil_parse() error */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Jan 21 23:04:25 2018 (r328225) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Jan 21 23:11:20 2018 (r328226) @@ -1104,7 +1104,7 @@ zil_lwb_write_open(zilog_t *zilog, lwb_t *lwb) zbookmark_phys_t zb; zio_priority_t prio; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT3P(lwb, !=, NULL); EQUIV(lwb->lwb_root_zio == NULL, lwb->lwb_state == LWB_STATE_CLOSED); EQUIV(lwb->lwb_root_zio != NULL, lwb->lwb_state == LWB_STATE_OPENED); @@ -1201,7 +1201,7 @@ zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) int i, error; boolean_t slog; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT3P(lwb->lwb_root_zio, !=, NULL); ASSERT3P(lwb->lwb_write_zio, !=, NULL); ASSERT3S(lwb->lwb_state, ==, LWB_STATE_OPENED); @@ -1335,7 +1335,7 @@ zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) char *lr_buf; uint64_t dlen, dnow, lwb_sp, reclen, txg; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT3P(lwb, !=, NULL); ASSERT3P(lwb->lwb_buf, !=, NULL); @@ -1751,7 +1751,7 @@ zil_get_commit_list(zilog_t *zilog) uint64_t otxg, txg; list_t *commit_list = &zilog->zl_itx_commit_list; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); if (spa_freeze_txg(zilog->zl_spa) != UINT64_MAX) /* ziltest support */ otxg = ZILTEST_TXG; @@ -1858,7 +1858,7 @@ zil_prune_commit_list(zilog_t *zilog) { itx_t *itx; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); while (itx = list_head(&zilog->zl_itx_commit_list)) { lr_t *lrc = &itx->itx_lr; @@ -1908,12 +1908,12 @@ zil_commit_writer_stall(zilog_t *zilog) * crash (because the previous lwb on-disk would not point to * it). * - * We must hold the zilog's zl_writer_lock while we do this, to + * We must hold the zilog's zl_issuer_lock while we do this, to * ensure no new threads enter zil_process_commit_list() until * all lwb's in the zl_lwb_list have been synced and freed * (which is achieved via the txg_wait_synced() call). */ - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); txg_wait_synced(zilog->zl_dmu_pool, 0); ASSERT3P(list_tail(&zilog->zl_lwb_list), ==, NULL); } @@ -1932,7 +1932,7 @@ zil_process_commit_list(zilog_t *zilog) lwb_t *lwb; itx_t *itx; - ASSERT(MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock)); /* * Return if there's nothing to commit before we dirty the fs by @@ -2102,17 +2102,17 @@ zil_commit_writer(zilog_t *zilog, zil_commit_waiter_t ASSERT(spa_writeable(zilog->zl_spa)); ASSERT0(zilog->zl_suspend); - mutex_enter(&zilog->zl_writer_lock); + mutex_enter(&zilog->zl_issuer_lock); if (zcw->zcw_lwb != NULL || zcw->zcw_done) { /* * It's possible that, while we were waiting to acquire - * the "zl_writer_lock", another thread committed this + * the "zl_issuer_lock", another thread committed this * waiter to an lwb. If that occurs, we bail out early, * without processing any of the zilog's queue of itxs. * * On certain workloads and system configurations, the - * "zl_writer_lock" can become highly contended. In an + * "zl_issuer_lock" can become highly contended. In an * attempt to reduce this contention, we immediately drop * the lock if the waiter has already been processed. * @@ -2129,13 +2129,13 @@ zil_commit_writer(zilog_t *zilog, zil_commit_waiter_t zil_process_commit_list(zilog); out: - mutex_exit(&zilog->zl_writer_lock); + mutex_exit(&zilog->zl_issuer_lock); } static void zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_waiter_t *zcw) { - ASSERT(!MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(!MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT(MUTEX_HELD(&zcw->zcw_lock)); ASSERT3B(zcw->zcw_done, ==, B_FALSE); @@ -2147,7 +2147,7 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w * If the lwb has already been issued by another thread, we can * immediately return since there's no work to be done (the * point of this function is to issue the lwb). Additionally, we - * do this prior to acquiring the zl_writer_lock, to avoid + * do this prior to acquiring the zl_issuer_lock, to avoid * acquiring it when it's not necessary to do so. */ if (lwb->lwb_state == LWB_STATE_ISSUED || @@ -2156,13 +2156,13 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w /* * In order to call zil_lwb_write_issue() we must hold the - * zilog's "zl_writer_lock". We can't simply acquire that lock, + * zilog's "zl_issuer_lock". We can't simply acquire that lock, * since we're already holding the commit waiter's "zcw_lock", * and those two locks are aquired in the opposite order * elsewhere. */ mutex_exit(&zcw->zcw_lock); - mutex_enter(&zilog->zl_writer_lock); + mutex_enter(&zilog->zl_issuer_lock); mutex_enter(&zcw->zcw_lock); /* @@ -2180,7 +2180,7 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w /* * We've already checked this above, but since we hadn't - * acquired the zilog's zl_writer_lock, we have to perform this + * acquired the zilog's zl_issuer_lock, we have to perform this * check a second time while holding the lock. We can't call * zil_lwb_write_issue() if the lwb had already been issued. */ @@ -2243,7 +2243,7 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w } out: - mutex_exit(&zilog->zl_writer_lock); + mutex_exit(&zilog->zl_issuer_lock); ASSERT(MUTEX_HELD(&zcw->zcw_lock)); } @@ -2270,7 +2270,7 @@ static void zil_commit_waiter(zilog_t *zilog, zil_commit_waiter_t *zcw) { ASSERT(!MUTEX_HELD(&zilog->zl_lock)); - ASSERT(!MUTEX_HELD(&zilog->zl_writer_lock)); + ASSERT(!MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT(spa_writeable(zilog->zl_spa)); ASSERT0(zilog->zl_suspend); @@ -2531,7 +2531,7 @@ zil_commit_itx_assign(zilog_t *zilog, zil_commit_waite * on two fundamental concepts: * * 1. The creation and issuance of lwb zio's is protected by - * the zilog's "zl_writer_lock", which ensures only a single + * the zilog's "zl_issuer_lock", which ensures only a single * thread is creating and/or issuing lwb's at a time * 2. The "previous" lwb is a child of the "current" lwb * (leveraging the zio parent-child depenency graph) @@ -2780,7 +2780,7 @@ zil_alloc(objset_t *os, zil_header_t *zh_phys) zilog->zl_last_lwb_latency = 0; mutex_init(&zilog->zl_lock, NULL, MUTEX_DEFAULT, NULL); - mutex_init(&zilog->zl_writer_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&zilog->zl_issuer_lock, NULL, MUTEX_DEFAULT, NULL); for (int i = 0; i < TXG_SIZE; i++) { mutex_init(&zilog->zl_itxg[i].itxg_lock, NULL, @@ -2825,7 +2825,7 @@ zil_free(zilog_t *zilog) mutex_destroy(&zilog->zl_itxg[i].itxg_lock); } - mutex_destroy(&zilog->zl_writer_lock); + mutex_destroy(&zilog->zl_issuer_lock); mutex_destroy(&zilog->zl_lock); cv_destroy(&zilog->zl_cv_suspend); From owner-svn-src-all@freebsd.org Sun Jan 21 23:12:40 2018 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 9F124EC0B1F; Sun, 21 Jan 2018 23:12:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E8DC80775; Sun, 21 Jan 2018 23:12:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C26E1233F; Sun, 21 Jan 2018 23:12:39 +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 w0LNCdag095070; Sun, 21 Jan 2018 23:12:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LNCd33095065; Sun, 21 Jan 2018 23:12:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801212312.w0LNCd33095065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 21 Jan 2018 23:12:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328227 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 328227 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 23:12:40 -0000 Author: mav Date: Sun Jan 21 23:12:38 2018 New Revision: 328227 URL: https://svnweb.freebsd.org/changeset/base/328227 Log: 8909 8585 can cause a use-after-free kernel panic illumos/illumos-gate@94ddd0900a8838f62bba15e270649a42f4ef9f81 https://www.illumos.org/issues/8909: There's a race condition that exists if `zil_free_lwb` races with either `zil_commit_waiter_timeout` and/or `zil_lwb_flush_vdevs_done`. Here's an example panic due to this bug: > ::status debugging crash dump vmcore.0 (64-bit) from ip-10-110-205-40 operating system: 5.11 dlpx-5.2.2.0_2017-12-04-17-28-32b6ba51fb (i86pc) image uuid: 4af0edfb-e58e-6ed8-cafc-d3e9167c7513 panic message: BAD TRAP: type=e (#pf Page fault) rp=ffffff0010555970 addr=60 occurred in module "zfs" due to a NULL pointer dereference dump content: kernel pages only > $c zio_shrink+0x12() zil_lwb_write_issue+0x30d(ffffff03dcd15cc0, ffffff03e0730e20) zil_commit_waiter_timeout+0xa2(ffffff03dcd15cc0, ffffff03d97ffcf8) zil_commit_waiter+0xf3(ffffff03dcd15cc0, ffffff03d97ffcf8) zil_commit+0x80(ffffff03dcd15cc0, 9a9) zfs_write+0xc34(ffffff03dc38b140, ffffff0010555e60, 40, ffffff03e00fb758, 0) fop_write+0x5b(ffffff03dc38b140, ffffff0010555e60, 40, ffffff03e00fb758, 0) write+0x250(42, fffffd7ff4832000, 2000) sys_syscall+0x177() If there's an outstanding lwb that's in `zil_commit_waiter_timeout` waiting to timeout, waiting on it's waiter's CV, we must be sure not to call `zil_free_lwb`. If we end up calling `zil_free_lwb`, then that LWB may be freed and can result in a use-after-free situation where the stale lwb pointer stored in the `zil_commit_waiter_t` structure of the thread waiting on the waiter's CV is used. A similar situation can occur if an lwb is issued to disk, and thus in the `LWB_STATE_ISSUED` state, and `zil_free_lwb` is called while the disk is servicing that lwb. In this situation, the lwb will be freed by `zil_free_lwb`, which will result in a use-after-free situation when the lwb's zio completes, and `zil_lwb_flush_vdevs_done` is called. This race condition is prevented in `zil_close` by calling `zil_commit` before `zil_free_lwb` is called, which will ensure all outstanding (i.e. all lwb's in the `LWB_STATE_OPEN` and/or `LWB_STATE_ISSUED` states) reach the `LWB_STATE_DONE` state before the lwb's are freed (`zil_commit` will not return untill all the lwb's are `LWB_STATE_DONE`). Further, this race condition is prevented in `zil_sync` by only calling `zil_free_lwb` for lwb's that do not have their `lwb_buf` pointer set. All lwb's not in the `LWB_STATE_DONE` state will have a non-null value for this pointer; the pointer is only cleared in `zil_lwb_flush_vdevs_done`, at which point the lwb's state will be changed to `LWB_STATE_DONE`. This race is present in `zil_suspend`, leading to this bug. At first glance, it would appear as though this would not be true because `zil_suspend` will call `zil_commit`, just like `zil_close`, but the problem is that `zil_suspend` will set the zilog's `zl_suspend` field prior to calling `zil_commit`. Further, in `zil_commit`, if `zl_suspend` is set, `zil_commit` will take a special branch of logic and use `txg_wait_synced` instead of performing the normal `zil_commit` logic. This call to `txg_wait_synced` might be good enough for the data to reach disk safely before it returns, but it does not ensure that all outstanding lwb's reach the `LWB_STATE_DONE` state before it returns. This is because, if there's an lwb "stuck" in `zil_commit_waiter_timeout`, waiting for it's lwb to timeout, it will maintain a non-null value for it's `lwb_buf` field and thus `zil_sync` will not free that lwb. Thus, even though the lwb's data is already on disk, the lwb will be left lingering, waiting on the CV, and will eventually timeout and be issued to disk even though the write is unnesseary. So, after `zil_commit` is called from `zil_suspend`, we incorrectly assume that there are not outstanding lwb's, and proceed to free all lwb's found on the zilog's lwb list. As a result, we free the lwb that will later be used `zil_commit_waiter_timeout`. Reviewed by: John Kennedy Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Brad Lewis Reviewed by: Igor Kozhukhov Approved by: Robert Mustacchi Author: Prakash Surya Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil.h Sun Jan 21 23:11:20 2018 (r328226) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil.h Sun Jan 21 23:12:38 2018 (r328227) @@ -417,6 +417,7 @@ extern void zil_itx_destroy(itx_t *itx); extern void zil_itx_assign(zilog_t *zilog, itx_t *itx, dmu_tx_t *tx); extern void zil_commit(zilog_t *zilog, uint64_t oid); +extern void zil_commit_impl(zilog_t *zilog, uint64_t oid); extern int zil_vdev_offline(const char *osname, void *txarg); extern int zil_claim(struct dsl_pool *dp, Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h Sun Jan 21 23:11:20 2018 (r328226) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h Sun Jan 21 23:12:38 2018 (r328227) @@ -37,13 +37,38 @@ extern "C" { #endif /* - * Possbile states for a given lwb structure. An lwb will start out in - * the "closed" state, and then transition to the "opened" state via a - * call to zil_lwb_write_open(). After the lwb is "open", it can - * transition into the "issued" state via zil_lwb_write_issue(). After - * the lwb's zio completes, and the vdev's are flushed, the lwb will - * transition into the "done" state via zil_lwb_write_done(), and the - * structure eventually freed. + * Possbile states for a given lwb structure. + * + * An lwb will start out in the "closed" state, and then transition to + * the "opened" state via a call to zil_lwb_write_open(). When + * transitioning from "closed" to "opened" the zilog's "zl_issuer_lock" + * must be held. + * + * After the lwb is "opened", it can transition into the "issued" state + * via zil_lwb_write_issue(). Again, the zilog's "zl_issuer_lock" must + * be held when making this transition. + * + * After the lwb's zio completes, and the vdev's are flushed, the lwb + * will transition into the "done" state via zil_lwb_write_done(). When + * transitioning from "issued" to "done", the zilog's "zl_lock" must be + * held, *not* the "zl_issuer_lock". + * + * The zilog's "zl_issuer_lock" can become heavily contended in certain + * workloads, so we specifically avoid acquiring that lock when + * transitioning an lwb from "issued" to "done". This allows us to avoid + * having to acquire the "zl_issuer_lock" for each lwb ZIO completion, + * which would have added more lock contention on an already heavily + * contended lock. + * + * Additionally, correctness when reading an lwb's state is often + * acheived by exploiting the fact that these state transitions occur in + * this specific order; i.e. "closed" to "opened" to "issued" to "done". + * + * Thus, if an lwb is in the "closed" or "opened" state, holding the + * "zl_issuer_lock" will prevent a concurrent thread from transitioning + * that lwb to the "issued" state. Likewise, if an lwb is already in the + * "issued" state, holding the "zl_lock" will prevent a concurrent + * thread from transitioning that lwb to the "done" state. */ typedef enum { LWB_STATE_CLOSED, Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h Sun Jan 21 23:11:20 2018 (r328226) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h Sun Jan 21 23:12:38 2018 (r328227) @@ -556,7 +556,6 @@ extern enum zio_checksum zio_checksum_dedup_select(spa extern enum zio_compress zio_compress_select(spa_t *spa, enum zio_compress child, enum zio_compress parent); -extern void zio_cancel(zio_t *zio); extern void zio_suspend(spa_t *spa, zio_t *zio); extern int zio_resume(spa_t *spa); extern void zio_resume_wait(spa_t *spa); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Sun Jan 21 23:11:20 2018 (r328226) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Sun Jan 21 23:12:38 2018 (r328227) @@ -502,7 +502,7 @@ zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t ASSERT(!MUTEX_HELD(&lwb->lwb_vdev_lock)); ASSERT(avl_is_empty(&lwb->lwb_vdev_tree)); - ASSERT(list_is_empty(&lwb->lwb_waiters)); + VERIFY(list_is_empty(&lwb->lwb_waiters)); return (lwb); } @@ -512,31 +512,13 @@ zil_free_lwb(zilog_t *zilog, lwb_t *lwb) { ASSERT(MUTEX_HELD(&zilog->zl_lock)); ASSERT(!MUTEX_HELD(&lwb->lwb_vdev_lock)); - ASSERT(list_is_empty(&lwb->lwb_waiters)); - - if (lwb->lwb_state == LWB_STATE_OPENED) { - avl_tree_t *t = &lwb->lwb_vdev_tree; - void *cookie = NULL; - zil_vdev_node_t *zv; - - while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) - kmem_free(zv, sizeof (*zv)); - - ASSERT3P(lwb->lwb_root_zio, !=, NULL); - ASSERT3P(lwb->lwb_write_zio, !=, NULL); - - zio_cancel(lwb->lwb_root_zio); - zio_cancel(lwb->lwb_write_zio); - - lwb->lwb_root_zio = NULL; - lwb->lwb_write_zio = NULL; - } else { - ASSERT3S(lwb->lwb_state, !=, LWB_STATE_ISSUED); - } - + VERIFY(list_is_empty(&lwb->lwb_waiters)); ASSERT(avl_is_empty(&lwb->lwb_vdev_tree)); ASSERT3P(lwb->lwb_write_zio, ==, NULL); ASSERT3P(lwb->lwb_root_zio, ==, NULL); + ASSERT3U(lwb->lwb_max_txg, <=, spa_syncing_txg(zilog->zl_spa)); + ASSERT(lwb->lwb_state == LWB_STATE_CLOSED || + lwb->lwb_state == LWB_STATE_DONE); /* * Clear the zilog's field to indicate this lwb is no longer @@ -883,6 +865,12 @@ zil_commit_waiter_skip(zil_commit_waiter_t *zcw) static void zil_commit_waiter_link_lwb(zil_commit_waiter_t *zcw, lwb_t *lwb) { + /* + * The lwb_waiters field of the lwb is protected by the zilog's + * zl_lock, thus it must be held when calling this function. + */ + ASSERT(MUTEX_HELD(&lwb->lwb_zilog->zl_lock)); + mutex_enter(&zcw->zcw_lock); ASSERT(!list_link_active(&zcw->zcw_node)); ASSERT3P(zcw->zcw_lwb, ==, NULL); @@ -1348,8 +1336,10 @@ zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) * For more details, see the comment above zil_commit(). */ if (lrc->lrc_txtype == TX_COMMIT) { + mutex_enter(&zilog->zl_lock); zil_commit_waiter_link_lwb(itx->itx_private, lwb); itx->itx_private = NULL; + mutex_exit(&zilog->zl_lock); return (lwb); } @@ -1957,16 +1947,54 @@ zil_process_commit_list(zilog_t *zilog) zilog_t *, zilog, itx_t *, itx); } - /* - * This is inherently racy and may result in us writing - * out a log block for a txg that was just synced. This - * is ok since we'll end cleaning up that log block the - * next time we call zil_sync(). - */ boolean_t synced = txg <= spa_last_synced_txg(spa); boolean_t frozen = txg > spa_freeze_txg(spa); - if (!synced || frozen) { + /* + * If the txg of this itx has already been synced out, then + * we don't need to commit this itx to an lwb. This is + * because the data of this itx will have already been + * written to the main pool. This is inherently racy, and + * it's still ok to commit an itx whose txg has already + * been synced; this will result in a write that's + * unnecessary, but will do no harm. + * + * With that said, we always want to commit TX_COMMIT itxs + * to an lwb, regardless of whether or not that itx's txg + * has been synced out. We do this to ensure any OPENED lwb + * will always have at least one zil_commit_waiter_t linked + * to the lwb. + * + * As a counter-example, if we skipped TX_COMMIT itx's + * whose txg had already been synced, the following + * situation could occur if we happened to be racing with + * spa_sync: + * + * 1. we commit a non-TX_COMMIT itx to an lwb, where the + * itx's txg is 10 and the last synced txg is 9. + * 2. spa_sync finishes syncing out txg 10. + * 3. we move to the next itx in the list, it's a TX_COMMIT + * whose txg is 10, so we skip it rather than committing + * it to the lwb used in (1). + * + * If the itx that is skipped in (3) is the last TX_COMMIT + * itx in the commit list, than it's possible for the lwb + * used in (1) to remain in the OPENED state indefinitely. + * + * To prevent the above scenario from occuring, ensuring + * that once an lwb is OPENED it will transition to ISSUED + * and eventually DONE, we always commit TX_COMMIT itx's to + * an lwb here, even if that itx's txg has already been + * synced. + * + * Finally, if the pool is frozen, we _always_ commit the + * itx. The point of freezing the pool is to prevent data + * from being written to the main pool via spa_sync, and + * instead rely solely on the ZIL to persistently store the + * data; i.e. when the pool is frozen, the last synced txg + * value can't be trusted. + */ + if (frozen || !synced || lrc->lrc_txtype == TX_COMMIT) { if (lwb != NULL) { lwb = zil_lwb_commit(zilog, itx, lwb); } else if (lrc->lrc_txtype == TX_COMMIT) { @@ -1974,22 +2002,6 @@ zil_process_commit_list(zilog_t *zilog) zil_commit_waiter_link_nolwb( itx->itx_private, &nolwb_waiters); } - } else if (lrc->lrc_txtype == TX_COMMIT) { - ASSERT3B(synced, ==, B_TRUE); - ASSERT3B(frozen, ==, B_FALSE); - - /* - * If this is a commit itx, then there will be a - * thread that is either: already waiting for - * it, or soon will be waiting. - * - * This itx has already been committed to disk - * via spa_sync() so we don't bother committing - * it to an lwb. As a result, we cannot use the - * lwb zio callback to signal the waiter and - * mark it as done, so we must do that here. - */ - zil_commit_waiter_skip(itx->itx_private); } list_remove(&zilog->zl_itx_commit_list, itx); @@ -2091,7 +2103,6 @@ zil_commit_writer(zilog_t *zilog, zil_commit_waiter_t { ASSERT(!MUTEX_HELD(&zilog->zl_lock)); ASSERT(spa_writeable(zilog->zl_spa)); - ASSERT0(zilog->zl_suspend); mutex_enter(&zilog->zl_issuer_lock); @@ -2170,10 +2181,24 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w ASSERT3P(lwb, ==, zcw->zcw_lwb); /* - * We've already checked this above, but since we hadn't - * acquired the zilog's zl_issuer_lock, we have to perform this - * check a second time while holding the lock. We can't call + * We've already checked this above, but since we hadn't acquired + * the zilog's zl_issuer_lock, we have to perform this check a + * second time while holding the lock. + * + * We don't need to hold the zl_lock since the lwb cannot transition + * from OPENED to ISSUED while we hold the zl_issuer_lock. The lwb + * _can_ transition from ISSUED to DONE, but it's OK to race with + * that transition since we treat the lwb the same, whether it's in + * the ISSUED or DONE states. + * + * The important thing, is we treat the lwb differently depending on + * if it's ISSUED or OPENED, and block any other threads that might + * attempt to issue this lwb. For that reason we hold the + * zl_issuer_lock when checking the lwb_state; we must not call * zil_lwb_write_issue() if the lwb had already been issued. + * + * See the comment above the lwb_state_t structure definition for + * more details on the lwb states, and locking requirements. */ if (lwb->lwb_state == LWB_STATE_ISSUED || lwb->lwb_state == LWB_STATE_DONE) @@ -2263,7 +2288,6 @@ zil_commit_waiter(zilog_t *zilog, zil_commit_waiter_t ASSERT(!MUTEX_HELD(&zilog->zl_lock)); ASSERT(!MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT(spa_writeable(zilog->zl_spa)); - ASSERT0(zilog->zl_suspend); mutex_enter(&zcw->zcw_lock); @@ -2568,6 +2592,12 @@ zil_commit(zilog_t *zilog, uint64_t foid) return; } + zil_commit_impl(zilog, foid); +} + +void +zil_commit_impl(zilog_t *zilog, uint64_t foid) +{ /* * Move the "async" itxs for the specified foid to the "sync" * queues, such that they will be later committed (or skipped) @@ -2980,7 +3010,22 @@ zil_suspend(const char *osname, void **cookiep) zilog->zl_suspending = B_TRUE; mutex_exit(&zilog->zl_lock); - zil_commit(zilog, 0); + /* + * We need to use zil_commit_impl to ensure we wait for all + * LWB_STATE_OPENED and LWB_STATE_ISSUED lwb's to be committed + * to disk before proceeding. If we used zil_commit instead, it + * would just call txg_wait_synced(), because zl_suspend is set. + * txg_wait_synced() doesn't wait for these lwb's to be + * LWB_STATE_DONE before returning. + */ + zil_commit_impl(zilog, 0); + + /* + * Now that we've ensured all lwb's are LWB_STATE_DONE, we use + * txg_wait_synced() to ensure the data from the zilog has + * migrated to the main pool before calling zil_destroy(). + */ + txg_wait_synced(zilog->zl_dmu_pool, 0); zil_destroy(zilog, B_FALSE); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Sun Jan 21 23:11:20 2018 (r328226) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Sun Jan 21 23:12:38 2018 (r328227) @@ -1716,20 +1716,6 @@ zio_reexecute(zio_t *pio) } void -zio_cancel(zio_t *zio) -{ - /* - * Disallow cancellation of a zio that's already been issued. - */ - VERIFY3P(zio->io_executor, ==, NULL); - - zio->io_pipeline = ZIO_INTERLOCK_PIPELINE; - zio->io_done = NULL; - - zio_nowait(zio); -} - -void zio_suspend(spa_t *spa, zio_t *zio) { if (spa_get_failmode(spa) == ZIO_FAILURE_MODE_PANIC) From owner-svn-src-all@freebsd.org Sun Jan 21 23:18:43 2018 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 B2841EC0E7A; Sun, 21 Jan 2018 23:18:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B61280AC4; Sun, 21 Jan 2018 23:18:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A28BE1234D; Sun, 21 Jan 2018 23:18:42 +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 w0LNIgBY095312; Sun, 21 Jan 2018 23:18:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LNIgge095307; Sun, 21 Jan 2018 23:18:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801212318.w0LNIgge095307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 21 Jan 2018 23:18:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328228 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 328228 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 23:18:43 -0000 Author: mav Date: Sun Jan 21 23:18:42 2018 New Revision: 328228 URL: https://svnweb.freebsd.org/changeset/base/328228 Log: MFV r328227: 8909 8585 can cause a use-after-free kernel panic illumos/illumos-gate@94ddd0900a8838f62bba15e270649a42f4ef9f81 https://www.illumos.org/issues/8909: There's a race condition that exists if `zil_free_lwb` races with either `zil_commit_waiter_timeout` and/or `zil_lwb_flush_vdevs_done`. Here's an example panic due to this bug: > ::status debugging crash dump vmcore.0 (64-bit) from ip-10-110-205-40 operating system: 5.11 dlpx-5.2.2.0_2017-12-04-17-28-32b6ba51fb (i86pc) image uuid: 4af0edfb-e58e-6ed8-cafc-d3e9167c7513 panic message: BAD TRAP: type=e (#pf Page fault) rp=ffffff0010555970 addr=60 occurred in mo dule "zfs" due to a NULL pointer dereference dump content: kernel pages only > $c zio_shrink+0x12() zil_lwb_write_issue+0x30d(ffffff03dcd15cc0, ffffff03e0730e20) zil_commit_waiter_timeout+0xa2(ffffff03dcd15cc0, ffffff03d97ffcf8) zil_commit_waiter+0xf3(ffffff03dcd15cc0, ffffff03d97ffcf8) zil_commit+0x80(ffffff03dcd15cc0, 9a9) zfs_write+0xc34(ffffff03dc38b140, ffffff0010555e60, 40, ffffff03e00fb758, 0) fop_write+0x5b(ffffff03dc38b140, ffffff0010555e60, 40, ffffff03e00fb758, 0) write+0x250(42, fffffd7ff4832000, 2000) sys_syscall+0x177() If there's an outstanding lwb that's in `zil_commit_waiter_timeout` waiting to timeout, waiting on it's waiter's CV, we must be sure not to call `zil_free_lwb`. If we end up calling `zil_free_lwb`, then that LWB may be freed and can result in a use-after-free situation where the stale lwb pointer stored in the `zil_commit_waiter_t` structure of the thread waiting on the waiter's CV is used. A similar situation can occur if an lwb is issued to disk, and thus in the `LWB_STATE_ISSUED` state, and `zil_free_lwb` is called while the disk is servicing that lwb. In this situation, the lwb will be freed by `zil_free_lwb`, which will result in a use-after-free situation when the lwb's zio completes, and `zil_lwb_flush_vdevs_done` is called. This race condition is prevented in `zil_close` by calling `zil_commit` before `zil_free_lwb` is called, which will ensure all outstanding (i.e. all lwb's in the `LWB_STATE_OPEN` and/or `LWB_STATE_ISSUED` states) reach the `LWB_STATE_DONE` state before the lwb's are freed (`zil_commit` will not return untill all the lwb's are `LWB_STATE_DONE`). Further, this race condition is prevented in `zil_sync` by only calling `zil_free_lwb` for lwb's that do not have their `lwb_buf` pointer set. All lwb's not in the `LWB_STATE_DONE` state will have a non-null value for this pointer; the pointer is only cleared in `zil_lwb_flush_vdevs_done`, at which point the lwb's state will be changed to `LWB_STATE_DONE`. This race is present in `zil_suspend`, leading to this bug. At first glance, it would appear as though this would not be true because `zil_suspend` will call `zil_commit`, just like `zil_close`, but the problem is that `zil_suspend` will set the zilog's `zl_suspend` field prior to calling `zil_commit`. Further, in `zil_commit`, if `zl_suspend` is set, `zil_commit` will take a special branch of logic and use `txg_wait_synced` instead of performing the normal `zil_commit` logic. This call to `txg_wait_synced` might be good enough for the data to reach disk safely before it returns, but it does not ensure that all outstanding lwb's reach the `LWB_STATE_DONE` state before it returns. This is because, if there's an lwb "stuck" in `zil_commit_waiter_timeout`, waiting for it's lwb to timeout, it will maintain a non-null value for it's `lwb_buf` field and thus `zil_sync` will not free that lwb. Thus, even though the lwb's data is already on disk, the lwb will be left lingering, waiting on the CV, and will eventually timeout and be issued to disk even though the write is unnesseary. So, after `zil_commit` is called from `zil_suspend`, we incorrectly assume that there are not outstanding lwb's, and proceed to free all lwb's found on the zilog's lwb list. As a result, we free the lwb that will later be used `zil_commit_waiter_timeout`. Reviewed by: John Kennedy Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Brad Lewis Reviewed by: Igor Kozhukhov Approved by: Robert Mustacchi Author: Prakash Surya Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Sun Jan 21 23:12:38 2018 (r328227) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Sun Jan 21 23:18:42 2018 (r328228) @@ -418,6 +418,7 @@ extern void zil_itx_assign(zilog_t *zilog, itx_t *itx, extern void zil_async_to_sync(zilog_t *zilog, uint64_t oid); extern void zil_commit(zilog_t *zilog, uint64_t oid); +extern void zil_commit_impl(zilog_t *zilog, uint64_t oid); extern int zil_vdev_offline(const char *osname, void *txarg); extern int zil_claim(struct dsl_pool *dp, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Sun Jan 21 23:12:38 2018 (r328227) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h Sun Jan 21 23:18:42 2018 (r328228) @@ -37,13 +37,38 @@ extern "C" { #endif /* - * Possbile states for a given lwb structure. An lwb will start out in - * the "closed" state, and then transition to the "opened" state via a - * call to zil_lwb_write_open(). After the lwb is "open", it can - * transition into the "issued" state via zil_lwb_write_issue(). After - * the lwb's zio completes, and the vdev's are flushed, the lwb will - * transition into the "done" state via zil_lwb_write_done(), and the - * structure eventually freed. + * Possbile states for a given lwb structure. + * + * An lwb will start out in the "closed" state, and then transition to + * the "opened" state via a call to zil_lwb_write_open(). When + * transitioning from "closed" to "opened" the zilog's "zl_issuer_lock" + * must be held. + * + * After the lwb is "opened", it can transition into the "issued" state + * via zil_lwb_write_issue(). Again, the zilog's "zl_issuer_lock" must + * be held when making this transition. + * + * After the lwb's zio completes, and the vdev's are flushed, the lwb + * will transition into the "done" state via zil_lwb_write_done(). When + * transitioning from "issued" to "done", the zilog's "zl_lock" must be + * held, *not* the "zl_issuer_lock". + * + * The zilog's "zl_issuer_lock" can become heavily contended in certain + * workloads, so we specifically avoid acquiring that lock when + * transitioning an lwb from "issued" to "done". This allows us to avoid + * having to acquire the "zl_issuer_lock" for each lwb ZIO completion, + * which would have added more lock contention on an already heavily + * contended lock. + * + * Additionally, correctness when reading an lwb's state is often + * acheived by exploiting the fact that these state transitions occur in + * this specific order; i.e. "closed" to "opened" to "issued" to "done". + * + * Thus, if an lwb is in the "closed" or "opened" state, holding the + * "zl_issuer_lock" will prevent a concurrent thread from transitioning + * that lwb to the "issued" state. Likewise, if an lwb is already in the + * "issued" state, holding the "zl_lock" will prevent a concurrent + * thread from transitioning that lwb to the "done" state. */ typedef enum { LWB_STATE_CLOSED, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sun Jan 21 23:12:38 2018 (r328227) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sun Jan 21 23:18:42 2018 (r328228) @@ -593,7 +593,6 @@ extern enum zio_checksum zio_checksum_dedup_select(spa extern enum zio_compress zio_compress_select(spa_t *spa, enum zio_compress child, enum zio_compress parent); -extern void zio_cancel(zio_t *zio); extern void zio_suspend(spa_t *spa, zio_t *zio); extern int zio_resume(spa_t *spa); extern void zio_resume_wait(spa_t *spa); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Jan 21 23:12:38 2018 (r328227) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Jan 21 23:18:42 2018 (r328228) @@ -511,7 +511,7 @@ zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t ASSERT(!MUTEX_HELD(&lwb->lwb_vdev_lock)); ASSERT(avl_is_empty(&lwb->lwb_vdev_tree)); - ASSERT(list_is_empty(&lwb->lwb_waiters)); + VERIFY(list_is_empty(&lwb->lwb_waiters)); return (lwb); } @@ -521,31 +521,13 @@ zil_free_lwb(zilog_t *zilog, lwb_t *lwb) { ASSERT(MUTEX_HELD(&zilog->zl_lock)); ASSERT(!MUTEX_HELD(&lwb->lwb_vdev_lock)); - ASSERT(list_is_empty(&lwb->lwb_waiters)); - - if (lwb->lwb_state == LWB_STATE_OPENED) { - avl_tree_t *t = &lwb->lwb_vdev_tree; - void *cookie = NULL; - zil_vdev_node_t *zv; - - while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) - kmem_free(zv, sizeof (*zv)); - - ASSERT3P(lwb->lwb_root_zio, !=, NULL); - ASSERT3P(lwb->lwb_write_zio, !=, NULL); - - zio_cancel(lwb->lwb_root_zio); - zio_cancel(lwb->lwb_write_zio); - - lwb->lwb_root_zio = NULL; - lwb->lwb_write_zio = NULL; - } else { - ASSERT3S(lwb->lwb_state, !=, LWB_STATE_ISSUED); - } - + VERIFY(list_is_empty(&lwb->lwb_waiters)); ASSERT(avl_is_empty(&lwb->lwb_vdev_tree)); ASSERT3P(lwb->lwb_write_zio, ==, NULL); ASSERT3P(lwb->lwb_root_zio, ==, NULL); + ASSERT3U(lwb->lwb_max_txg, <=, spa_syncing_txg(zilog->zl_spa)); + ASSERT(lwb->lwb_state == LWB_STATE_CLOSED || + lwb->lwb_state == LWB_STATE_DONE); /* * Clear the zilog's field to indicate this lwb is no longer @@ -892,6 +874,12 @@ zil_commit_waiter_skip(zil_commit_waiter_t *zcw) static void zil_commit_waiter_link_lwb(zil_commit_waiter_t *zcw, lwb_t *lwb) { + /* + * The lwb_waiters field of the lwb is protected by the zilog's + * zl_lock, thus it must be held when calling this function. + */ + ASSERT(MUTEX_HELD(&lwb->lwb_zilog->zl_lock)); + mutex_enter(&zcw->zcw_lock); ASSERT(!list_link_active(&zcw->zcw_node)); ASSERT3P(zcw->zcw_lwb, ==, NULL); @@ -1357,8 +1345,10 @@ zil_lwb_commit(zilog_t *zilog, itx_t *itx, lwb_t *lwb) * For more details, see the comment above zil_commit(). */ if (lrc->lrc_txtype == TX_COMMIT) { + mutex_enter(&zilog->zl_lock); zil_commit_waiter_link_lwb(itx->itx_private, lwb); itx->itx_private = NULL; + mutex_exit(&zilog->zl_lock); return (lwb); } @@ -1966,16 +1956,54 @@ zil_process_commit_list(zilog_t *zilog) zilog_t *, zilog, itx_t *, itx); } - /* - * This is inherently racy and may result in us writing - * out a log block for a txg that was just synced. This - * is ok since we'll end cleaning up that log block the - * next time we call zil_sync(). - */ boolean_t synced = txg <= spa_last_synced_txg(spa); boolean_t frozen = txg > spa_freeze_txg(spa); - if (!synced || frozen) { + /* + * If the txg of this itx has already been synced out, then + * we don't need to commit this itx to an lwb. This is + * because the data of this itx will have already been + * written to the main pool. This is inherently racy, and + * it's still ok to commit an itx whose txg has already + * been synced; this will result in a write that's + * unnecessary, but will do no harm. + * + * With that said, we always want to commit TX_COMMIT itxs + * to an lwb, regardless of whether or not that itx's txg + * has been synced out. We do this to ensure any OPENED lwb + * will always have at least one zil_commit_waiter_t linked + * to the lwb. + * + * As a counter-example, if we skipped TX_COMMIT itx's + * whose txg had already been synced, the following + * situation could occur if we happened to be racing with + * spa_sync: + * + * 1. we commit a non-TX_COMMIT itx to an lwb, where the + * itx's txg is 10 and the last synced txg is 9. + * 2. spa_sync finishes syncing out txg 10. + * 3. we move to the next itx in the list, it's a TX_COMMIT + * whose txg is 10, so we skip it rather than committing + * it to the lwb used in (1). + * + * If the itx that is skipped in (3) is the last TX_COMMIT + * itx in the commit list, than it's possible for the lwb + * used in (1) to remain in the OPENED state indefinitely. + * + * To prevent the above scenario from occuring, ensuring + * that once an lwb is OPENED it will transition to ISSUED + * and eventually DONE, we always commit TX_COMMIT itx's to + * an lwb here, even if that itx's txg has already been + * synced. + * + * Finally, if the pool is frozen, we _always_ commit the + * itx. The point of freezing the pool is to prevent data + * from being written to the main pool via spa_sync, and + * instead rely solely on the ZIL to persistently store the + * data; i.e. when the pool is frozen, the last synced txg + * value can't be trusted. + */ + if (frozen || !synced || lrc->lrc_txtype == TX_COMMIT) { if (lwb != NULL) { lwb = zil_lwb_commit(zilog, itx, lwb); } else if (lrc->lrc_txtype == TX_COMMIT) { @@ -1983,22 +2011,6 @@ zil_process_commit_list(zilog_t *zilog) zil_commit_waiter_link_nolwb( itx->itx_private, &nolwb_waiters); } - } else if (lrc->lrc_txtype == TX_COMMIT) { - ASSERT3B(synced, ==, B_TRUE); - ASSERT3B(frozen, ==, B_FALSE); - - /* - * If this is a commit itx, then there will be a - * thread that is either: already waiting for - * it, or soon will be waiting. - * - * This itx has already been committed to disk - * via spa_sync() so we don't bother committing - * it to an lwb. As a result, we cannot use the - * lwb zio callback to signal the waiter and - * mark it as done, so we must do that here. - */ - zil_commit_waiter_skip(itx->itx_private); } list_remove(&zilog->zl_itx_commit_list, itx); @@ -2100,7 +2112,6 @@ zil_commit_writer(zilog_t *zilog, zil_commit_waiter_t { ASSERT(!MUTEX_HELD(&zilog->zl_lock)); ASSERT(spa_writeable(zilog->zl_spa)); - ASSERT0(zilog->zl_suspend); mutex_enter(&zilog->zl_issuer_lock); @@ -2179,10 +2190,24 @@ zil_commit_waiter_timeout(zilog_t *zilog, zil_commit_w ASSERT3P(lwb, ==, zcw->zcw_lwb); /* - * We've already checked this above, but since we hadn't - * acquired the zilog's zl_issuer_lock, we have to perform this - * check a second time while holding the lock. We can't call + * We've already checked this above, but since we hadn't acquired + * the zilog's zl_issuer_lock, we have to perform this check a + * second time while holding the lock. + * + * We don't need to hold the zl_lock since the lwb cannot transition + * from OPENED to ISSUED while we hold the zl_issuer_lock. The lwb + * _can_ transition from ISSUED to DONE, but it's OK to race with + * that transition since we treat the lwb the same, whether it's in + * the ISSUED or DONE states. + * + * The important thing, is we treat the lwb differently depending on + * if it's ISSUED or OPENED, and block any other threads that might + * attempt to issue this lwb. For that reason we hold the + * zl_issuer_lock when checking the lwb_state; we must not call * zil_lwb_write_issue() if the lwb had already been issued. + * + * See the comment above the lwb_state_t structure definition for + * more details on the lwb states, and locking requirements. */ if (lwb->lwb_state == LWB_STATE_ISSUED || lwb->lwb_state == LWB_STATE_DONE) @@ -2272,7 +2297,6 @@ zil_commit_waiter(zilog_t *zilog, zil_commit_waiter_t ASSERT(!MUTEX_HELD(&zilog->zl_lock)); ASSERT(!MUTEX_HELD(&zilog->zl_issuer_lock)); ASSERT(spa_writeable(zilog->zl_spa)); - ASSERT0(zilog->zl_suspend); mutex_enter(&zcw->zcw_lock); @@ -2589,6 +2613,12 @@ zil_commit(zilog_t *zilog, uint64_t foid) return; } + zil_commit_impl(zilog, foid); +} + +void +zil_commit_impl(zilog_t *zilog, uint64_t foid) +{ /* * Move the "async" itxs for the specified foid to the "sync" * queues, such that they will be later committed (or skipped) @@ -3001,7 +3031,22 @@ zil_suspend(const char *osname, void **cookiep) zilog->zl_suspending = B_TRUE; mutex_exit(&zilog->zl_lock); - zil_commit(zilog, 0); + /* + * We need to use zil_commit_impl to ensure we wait for all + * LWB_STATE_OPENED and LWB_STATE_ISSUED lwb's to be committed + * to disk before proceeding. If we used zil_commit instead, it + * would just call txg_wait_synced(), because zl_suspend is set. + * txg_wait_synced() doesn't wait for these lwb's to be + * LWB_STATE_DONE before returning. + */ + zil_commit_impl(zilog, 0); + + /* + * Now that we've ensured all lwb's are LWB_STATE_DONE, we use + * txg_wait_synced() to ensure the data from the zilog has + * migrated to the main pool before calling zil_destroy(). + */ + txg_wait_synced(zilog->zl_dmu_pool, 0); zil_destroy(zilog, B_FALSE); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sun Jan 21 23:12:38 2018 (r328227) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sun Jan 21 23:18:42 2018 (r328228) @@ -1815,20 +1815,6 @@ zio_reexecute(zio_t *pio) } void -zio_cancel(zio_t *zio) -{ - /* - * Disallow cancellation of a zio that's already been issued. - */ - VERIFY3P(zio->io_executor, ==, NULL); - - zio->io_pipeline = ZIO_INTERLOCK_PIPELINE; - zio->io_done = NULL; - - zio_nowait(zio); -} - -void zio_suspend(spa_t *spa, zio_t *zio) { if (spa_get_failmode(spa) == ZIO_FAILURE_MODE_PANIC) From owner-svn-src-all@freebsd.org Sun Jan 21 23:42:46 2018 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 C2897EC1F8D; Sun, 21 Jan 2018 23:42:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 84AD9818CA; Sun, 21 Jan 2018 23:42: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A86EA1281B; Sun, 21 Jan 2018 23:42:45 +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 w0LNgjsi007464; Sun, 21 Jan 2018 23:42:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LNgjCv007463; Sun, 21 Jan 2018 23:42:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801212342.w0LNgjCv007463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 21 Jan 2018 23:42:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328229 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 328229 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 23:42:46 -0000 Author: mav Date: Sun Jan 21 23:42:45 2018 New Revision: 328229 URL: https://svnweb.freebsd.org/changeset/base/328229 Log: 8930 zfs_zinactive: do not remove the node if the filesystem is readonly illumos/illumos-gate@93c618e0f4932dc0bb9a9c90d8c4a5d029de5797 https://www.illumos.org/issues/8930: We normally remove an unlinked node when its last user goes away and the node becomes inactive. However, we should not do that if the filesystem is mounted read-only including the case where it has its readonly property set. The node will remain on the unlinked queue, so it will not be leaked. One particular scenario is when we receive an incremental stream into a mounted read-only filesystem and that stream contains an unlinked file (still on the unlinked queue). If that file is opened before the receive and some time later after the receive it becomes inactive we would remove it and, thus, modify the read-only filesystem. As a result, the filesystem would diverge from its source and further incremental receives would not be possible (without forcing a rollback). Another related scenario, that may or may not be possible depending on an OS / VFS policy, is when an open file is unlinked, then the filesystem is remounted read-only, and then the file is closed. Reviewed by: Matthew Ahrens Approved by: Gordon Ross Author: Andriy Gapon Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_znode.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_znode.c Sun Jan 21 23:18:42 2018 (r328228) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_znode.c Sun Jan 21 23:42:45 2018 (r328229) @@ -1250,9 +1250,21 @@ zfs_rezget(znode_t *zp) return (SET_ERROR(EIO)); } - zp->z_unlinked = (zp->z_links == 0); zp->z_blksz = doi.doi_data_block_size; + /* + * If the file has zero links, then it has been unlinked on the send + * side and it must be in the received unlinked set. + * We call zfs_znode_dmu_fini() now to prevent any accesses to the + * stale data and to prevent automatical removal of the file in + * zfs_zinactive(). The file will be removed either when it is removed + * on the send side and the next incremental stream is received or + * when the unlinked set gets processed. + */ + zp->z_unlinked = (zp->z_links == 0); + if (zp->z_unlinked) + zfs_znode_dmu_fini(zp); + ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); return (0); @@ -1314,14 +1326,21 @@ zfs_zinactive(znode_t *zp) mutex_exit(&vp->v_lock); /* - * If this was the last reference to a file with no links, - * remove the file from the file system. + * If this was the last reference to a file with no links, remove + * the file from the file system unless the file system is mounted + * read-only. That can happen, for example, if the file system was + * originally read-write, the file was opened, then unlinked and + * the file system was made read-only before the file was finally + * closed. The file will remain in the unlinked set. */ if (zp->z_unlinked) { - mutex_exit(&zp->z_lock); - ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); - zfs_rmnode(zp); - return; + ASSERT(!zfsvfs->z_issnap); + if ((zfsvfs->z_vfs->vfs_flag & VFS_RDONLY) == 0) { + mutex_exit(&zp->z_lock); + ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); + zfs_rmnode(zp); + return; + } } mutex_exit(&zp->z_lock); From owner-svn-src-all@freebsd.org Sun Jan 21 23:49:18 2018 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 B2D0DEC225B; Sun, 21 Jan 2018 23:49:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7146D81A8E; Sun, 21 Jan 2018 23:49:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A69E01281C; Sun, 21 Jan 2018 23:49:17 +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 w0LNnH5I007739; Sun, 21 Jan 2018 23:49:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LNnHul007738; Sun, 21 Jan 2018 23:49:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801212349.w0LNnHul007738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 21 Jan 2018 23:49:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328230 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 328230 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 23:49:18 -0000 Author: mav Date: Sun Jan 21 23:49:17 2018 New Revision: 328230 URL: https://svnweb.freebsd.org/changeset/base/328230 Log: MFV r328229: 8930 zfs_zinactive: do not remove the node if the filesystem is readonly illumos/illumos-gate@93c618e0f4932dc0bb9a9c90d8c4a5d029de5797 https://www.illumos.org/issues/8930: We normally remove an unlinked node when its last user goes away and the node becomes inactive. However, we should not do that if the filesystem is mounted read-only including the case where it has its readonly property set. The node will remain on the unlinked queue, so it will not be leaked. One particular scenario is when we receive an incremental stream into a mounted read-only filesystem and that stream contains an unlinked file (still on the unlinked queue). If that file is opened before the receive and some time later after the receive it becomes inactive we would remove it and, thus, modify the read-only filesystem. As a result, the filesystem would diverge from its source and further incremental receives would not be possible (without forcing a rollback). Another related scenario, that may or may not be possible depending on an OS / VFS policy, is when an open file is unlinked, then the filesystem is remounted read-only, and then the file is closed. Reviewed by: Matthew Ahrens Approved by: Gordon Ross Author: Andriy Gapon Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sun Jan 21 23:42:45 2018 (r328229) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sun Jan 21 23:49:17 2018 (r328230) @@ -1336,12 +1336,24 @@ zfs_rezget(znode_t *zp) return (EIO); } - zp->z_unlinked = (zp->z_links == 0); zp->z_blksz = doi.doi_data_block_size; vn_pages_remove(vp, 0, 0); if (zp->z_size != size) vnode_pager_setsize(vp, zp->z_size); + /* + * If the file has zero links, then it has been unlinked on the send + * side and it must be in the received unlinked set. + * We call zfs_znode_dmu_fini() now to prevent any accesses to the + * stale data and to prevent automatical removal of the file in + * zfs_zinactive(). The file will be removed either when it is removed + * on the send side and the next incremental stream is received or + * when the unlinked set gets processed. + */ + zp->z_unlinked = (zp->z_links == 0); + if (zp->z_unlinked) + zfs_znode_dmu_fini(zp); + ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); return (0); @@ -1380,13 +1392,20 @@ zfs_zinactive(znode_t *zp) ZFS_OBJ_HOLD_ENTER(zfsvfs, z_id); /* - * If this was the last reference to a file with no links, - * remove the file from the file system. + * If this was the last reference to a file with no links, remove + * the file from the file system unless the file system is mounted + * read-only. That can happen, for example, if the file system was + * originally read-write, the file was opened, then unlinked and + * the file system was made read-only before the file was finally + * closed. The file will remain in the unlinked set. */ if (zp->z_unlinked) { - ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); - zfs_rmnode(zp); - return; + ASSERT(!zfsvfs->z_issnap); + if ((zfsvfs->z_vfs->vfs_flag & VFS_RDONLY) == 0) { + ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); + zfs_rmnode(zp); + return; + } } zfs_znode_dmu_fini(zp); From owner-svn-src-all@freebsd.org Sun Jan 21 23:52:38 2018 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 70152EC2531; Sun, 21 Jan 2018 23:52:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A07481EBA; Sun, 21 Jan 2018 23:52:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C9C2129A8; Sun, 21 Jan 2018 23:52: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 w0LNqbJW011736; Sun, 21 Jan 2018 23:52:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LNqbf3011735; Sun, 21 Jan 2018 23:52:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801212352.w0LNqbf3011735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 21 Jan 2018 23:52:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328231 - vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor/illumos/dist/lib/libzfs/common X-SVN-Commit-Revision: 328231 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 23:52:38 -0000 Author: mav Date: Sun Jan 21 23:52:37 2018 New Revision: 328231 URL: https://svnweb.freebsd.org/changeset/base/328231 Log: 8897 zpool online -e fails assertion when run on non-leaf vdevs illumos/illumos-gate@9a551dd645b478816cb11251b19f5034d885bf01 https://www.illumos.org/issues/8897: # zpool online -e test mirror-1 Assertion failed: nvlist_lookup_string(tgt, "path", &pathname) == 0, file ../common/libzfs_pool.c, line 2558, function zpool_vdev_online Abort (core dumped) Not a big deal per se, but should be handled gracefully, same way as 'offline' and 'online' without '-e'. Also reported as: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221408 Reviewed by: Toomas Soome Reviewed by: Igor Kozhukhov Approved by: Dan McDonald Author: Yuri Pankov Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Sun Jan 21 23:49:17 2018 (r328230) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Sun Jan 21 23:52:37 2018 (r328231) @@ -2425,6 +2425,7 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *pat { zfs_cmd_t zc = { 0 }; char msg[1024]; + char *pathname; nvlist_t *tgt; boolean_t avail_spare, l2cache, islog; libzfs_handle_t *hdl = zhp->zpool_hdl; @@ -2447,15 +2448,13 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *pat if (avail_spare) return (zfs_error(hdl, EZFS_ISSPARE, msg)); - if (flags & ZFS_ONLINE_EXPAND || - zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) { - char *pathname = NULL; + if ((flags & ZFS_ONLINE_EXPAND || + zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) && + nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, &pathname) == 0) { uint64_t wholedisk = 0; (void) nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_WHOLE_DISK, &wholedisk); - verify(nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, - &pathname) == 0); /* * XXX - L2ARC 1.0 devices can't support expansion. From owner-svn-src-all@freebsd.org Sun Jan 21 23:53:58 2018 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 16DC5EC2631; Sun, 21 Jan 2018 23:53:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E624E81FFF; Sun, 21 Jan 2018 23:53: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 30291129AA; Sun, 21 Jan 2018 23:53: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 w0LNrvR9011836; Sun, 21 Jan 2018 23:53:57 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LNrvHh011835; Sun, 21 Jan 2018 23:53:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801212353.w0LNrvHh011835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 21 Jan 2018 23:53:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328232 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 328232 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 23:53:58 -0000 Author: mav Date: Sun Jan 21 23:53:56 2018 New Revision: 328232 URL: https://svnweb.freebsd.org/changeset/base/328232 Log: MFV r328231: 8897 zpool online -e fails assertion when run on non-leaf vdevs illumos/illumos-gate@9a551dd645b478816cb11251b19f5034d885bf01 https://www.illumos.org/issues/8897: # zpool online -e test mirror-1 Assertion failed: nvlist_lookup_string(tgt, "path", &pathname) == 0, file ../common/libzfs_pool.c, line 2558, function zpool_vdev_online Abort (core dumped) Not a big deal per se, but should be handled gracefully, same way as 'offline' and 'online' without '-e'. Also reported as: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221408 Reviewed by: Toomas Soome Reviewed by: Igor Kozhukhov Approved by: Dan McDonald Author: Yuri Pankov Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Jan 21 23:52:37 2018 (r328231) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Jan 21 23:53:56 2018 (r328232) @@ -2419,6 +2419,7 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *pat { zfs_cmd_t zc = { 0 }; char msg[1024]; + char *pathname; nvlist_t *tgt; boolean_t avail_spare, l2cache, islog; libzfs_handle_t *hdl = zhp->zpool_hdl; @@ -2441,15 +2442,13 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *pat if (avail_spare) return (zfs_error(hdl, EZFS_ISSPARE, msg)); - if (flags & ZFS_ONLINE_EXPAND || - zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) { - char *pathname = NULL; + if ((flags & ZFS_ONLINE_EXPAND || + zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) && + nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, &pathname) == 0) { uint64_t wholedisk = 0; (void) nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_WHOLE_DISK, &wholedisk); - verify(nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, - &pathname) == 0); /* * XXX - L2ARC 1.0 devices can't support expansion. From owner-svn-src-all@freebsd.org Sun Jan 21 23:57:43 2018 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 25A59EC29E7; Sun, 21 Jan 2018 23:57:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0079B821B5; Sun, 21 Jan 2018 23:57:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39D16129AC; Sun, 21 Jan 2018 23:57:42 +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 w0LNvgEB012021; Sun, 21 Jan 2018 23:57:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LNvfxX012019; Sun, 21 Jan 2018 23:57:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801212357.w0LNvfxX012019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 21 Jan 2018 23:57:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328233 - in vendor/illumos/dist: lib/libzfs/common man/man1m X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in vendor/illumos/dist: lib/libzfs/common man/man1m X-SVN-Commit-Revision: 328233 X-SVN-Commit-Repository: base 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.25 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, 21 Jan 2018 23:57:43 -0000 Author: mav Date: Sun Jan 21 23:57:41 2018 New Revision: 328233 URL: https://svnweb.freebsd.org/changeset/base/328233 Log: 8898 creating fs with checksum=skein on the boot pools fails ungracefully illumos/illumos-gate@9fa2266d9a78b8366e1cd2d5f050e8b5e37d558c https://www.illumos.org/issues/8898: # zfs create -o checksum=skein rpool/test internal error: Result too large Abort (core dumped) Not a big deal per se, but should be handled correctly. Also reported as: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222199 Reviewed by: Toomas Soome Reviewed by: Andy Stormont Approved by: Dan McDonald Author: Yuri Pankov Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/man/man1m/zfs.1m Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Sun Jan 21 23:53:56 2018 (r328232) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Sun Jan 21 23:57:41 2018 (r328233) @@ -28,7 +28,7 @@ * Copyright (c) 2013 Martin Matuska. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] - * Copyright 2016 Nexenta Systems, Inc. + * Copyright 2017 Nexenta Systems, Inc. * Copyright 2016 Igor Kozhukhov * Copyright 2017 RackTop Systems. */ @@ -3476,6 +3476,10 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs "pool must be upgraded to set this " "property or value")); return (zfs_error(hdl, EZFS_BADVERSION, errbuf)); + case ERANGE: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "invalid property value(s) specified")); + return (zfs_error(hdl, EZFS_BADPROP, errbuf)); #ifdef _ILP32 case EOVERFLOW: /* Modified: vendor/illumos/dist/man/man1m/zfs.1m ============================================================================== --- vendor/illumos/dist/man/man1m/zfs.1m Sun Jan 21 23:53:56 2018 (r328232) +++ vendor/illumos/dist/man/man1m/zfs.1m Sun Jan 21 23:57:41 2018 (r328233) @@ -28,7 +28,7 @@ .\" Copyright (c) 2014 Integros [integros.com] .\" Copyright 2017 Nexenta Systems, Inc. .\" -.Dd September 16, 2016 +.Dd December 6, 2017 .Dt ZFS 1M .Os .Sh NAME @@ -997,6 +997,10 @@ Please see for more information on these algorithms. .Pp Changing this property affects only newly-written data. +.Pp +Salted checksum algorithms +.Pq Cm edonr , skein +are currently not supported for any filesystem on the boot pools. .It Xo .Sy compression Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Sy gzip Ns | Ns .Sy gzip- Ns Em N Ns | Ns Sy lz4 Ns | Ns Sy lzjb Ns | Ns Sy zle From owner-svn-src-all@freebsd.org Mon Jan 22 00:01:38 2018 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 12023EC2DDB; Mon, 22 Jan 2018 00:01:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DCE1D82631; Mon, 22 Jan 2018 00:01: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BD0312AF9; Mon, 22 Jan 2018 00:01: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 w0M01alg015102; Mon, 22 Jan 2018 00:01:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M01anI015100; Mon, 22 Jan 2018 00:01:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220001.w0M01anI015100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 00:01:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328234 - in head/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common X-SVN-Commit-Revision: 328234 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 00:01:38 -0000 Author: mav Date: Mon Jan 22 00:01:36 2018 New Revision: 328234 URL: https://svnweb.freebsd.org/changeset/base/328234 Log: MFV r328233: 8898 creating fs with checksum=skein on the boot pools fails ungracefully illumos/illumos-gate@9fa2266d9a78b8366e1cd2d5f050e8b5e37d558c https://www.illumos.org/issues/8898: # zfs create -o checksum=skein rpool/test internal error: Result too large Abort (core dumped) Not a big deal per se, but should be handled correctly. Reviewed by: Toomas Soome Reviewed by: Andy Stormont Approved by: Dan McDonald Author: Yuri Pankov PR: 222199 Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Jan 21 23:57:41 2018 (r328233) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Jan 22 00:01:36 2018 (r328234) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 16, 2016 +.Dd December 6, 2017 .Dt ZFS 8 .Os .Sh NAME @@ -974,6 +974,10 @@ Please see for more information on these algorithms. .Pp Changing this property affects only newly-written data. +.Pp +Salted checksum algorithms +.Pq Cm edonr , skein +are currently not supported for any filesystem on the boot pools. .It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | Cm zle | Cm lz4 Controls the compression algorithm used for this dataset. Setting compression to Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Jan 21 23:57:41 2018 (r328233) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Mon Jan 22 00:01:36 2018 (r328234) @@ -28,7 +28,7 @@ * Copyright (c) 2013 Martin Matuska. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] - * Copyright 2016 Nexenta Systems, Inc. + * Copyright 2017 Nexenta Systems, Inc. * Copyright 2016 Igor Kozhukhov * Copyright 2017 RackTop Systems. */ @@ -3522,6 +3522,10 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs "pool must be upgraded to set this " "property or value")); return (zfs_error(hdl, EZFS_BADVERSION, errbuf)); + case ERANGE: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "invalid property value(s) specified")); + return (zfs_error(hdl, EZFS_BADPROP, errbuf)); #ifdef _ILP32 case EOVERFLOW: /* From owner-svn-src-all@freebsd.org Mon Jan 22 00:19:51 2018 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 BFE85EC3D38; Mon, 22 Jan 2018 00:19:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A3D182FAC; Mon, 22 Jan 2018 00:19:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B78D012CFF; Mon, 22 Jan 2018 00:19:50 +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 w0M0Jolw020828; Mon, 22 Jan 2018 00:19:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M0JoaO020827; Mon, 22 Jan 2018 00:19:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220019.w0M0JoaO020827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 00:19: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: r328235 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 328235 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 00:19:51 -0000 Author: mav Date: Mon Jan 22 00:19:50 2018 New Revision: 328235 URL: https://svnweb.freebsd.org/changeset/base/328235 Log: MFC r322245: MFV r322242: 8373 TXG_WAIT in ZIL commit path illumos/illumos-gate@d28671a3b094af696bea87f52272d4c4d89321c7 https://github.com/illumos/illumos-gate/commit/d28671a3b094af696bea87f52272d4c4d89321c7 https://www.illumos.org/issues/8373 The code that writes ZIL blocks uses dmu_tx_assign(TXG_WAIT) to assign a transaction to a transaction group. That seems to be logically incorrect as writing of the ZIL block does not introduce any new dirty data. Also, when there is a lot of dirty data, the call can introduce significant delays into the ZIL commit path, thus affecting all synchronous writes. Additionally, ARC throttling may affect the ZIL writing. Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Approved by: Dan McDonald Author: Andriy Gapon Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Mon Jan 22 00:01:36 2018 (r328234) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Mon Jan 22 00:19:50 2018 (r328235) @@ -1227,7 +1227,24 @@ zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) */ tx = dmu_tx_create(zilog->zl_os); - VERIFY(dmu_tx_assign(tx, TXG_WAIT) == 0); + + /* + * Since we are not going to create any new dirty data and we can even + * help with clearing the existing dirty data, we should not be subject + * to the dirty data based delays. + * We (ab)use TXG_WAITED to bypass the delay mechanism. + * One side effect from using TXG_WAITED is that dmu_tx_assign() can + * fail if the pool is suspended. Those are dramatic circumstances, + * so we return NULL to signal that the normal ZIL processing is not + * possible and txg_wait_synced() should be used to ensure that the data + * is on disk. + */ + error = dmu_tx_assign(tx, TXG_WAITED); + if (error != 0) { + ASSERT3S(error, ==, EIO); + dmu_tx_abort(tx); + return (NULL); + } dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx); txg = dmu_tx_get_txg(tx); From owner-svn-src-all@freebsd.org Mon Jan 22 01:25:23 2018 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 F068BEC6AAD; Mon, 22 Jan 2018 01:25:23 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id D9CD3142B; Mon, 22 Jan 2018 01:25:23 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from blue.vangyzen.net (173-28-118-115.client.mchsi.com [173.28.118.115]) by smtp.vangyzen.net (Postfix) with ESMTPSA id C849B564BB; Sun, 21 Jan 2018 19:25:22 -0600 (CST) Subject: Re: svn commit: r328110 - head/sys/kern To: Wojciech Macek , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801180738.w0I7cswv054484@repo.freebsd.org> From: Eric van Gyzen Message-ID: <2d584386-f877-9c0b-214b-547928f8f50a@vangyzen.net> Date: Sun, 21 Jan 2018 19:25:22 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <201801180738.w0I7cswv054484@repo.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.25 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, 22 Jan 2018 01:25:24 -0000 On 01/18/2018 01:38, Wojciech Macek wrote: > Author: wma > Date: Thu Jan 18 07:38:54 2018 > New Revision: 328110 > URL: https://svnweb.freebsd.org/changeset/base/328110 > > Log: > KDB: restart only CPUs stopped by KDB > > @@ -707,8 +708,9 @@ kdb_trap(int type, int code, struct trapframe *tf) > kdb_active--; > > #ifdef SMP > + CPU_AND(&other_cpus, &stopped_cpus); Wojciech, Coverity told me that other_cpus is used uninitialized here (CID 1385265). Cheers, Eric From owner-svn-src-all@freebsd.org Mon Jan 22 01:50:12 2018 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 440BCEC78D5; Mon, 22 Jan 2018 01:50:12 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1FCAF1EB8; Mon, 22 Jan 2018 01:50:12 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57D8013B2E; Mon, 22 Jan 2018 01:50:11 +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 w0M1oBK0058259; Mon, 22 Jan 2018 01:50:11 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M1oAUE058257; Mon, 22 Jan 2018 01:50:10 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801220150.w0M1oAUE058257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 22 Jan 2018 01:50:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328237 - in head: include sys/sys X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in head: include sys/sys X-SVN-Commit-Revision: 328237 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 01:50:12 -0000 Author: pfg Date: Mon Jan 22 01:50:10 2018 New Revision: 328237 URL: https://svnweb.freebsd.org/changeset/base/328237 Log: Use the __alloc_size2 attribute where relevant. This follows the documented use in GCC. It is basically only relevant for calloc(3), reallocarray(3) and mallocarray(9). Suggested by: Mark Millard Reference: https://docs.freebsd.org/cgi/mid.cgi?9DE674C6-EAA3-4E8A-906F-446E74D82FC4 Modified: head/include/stdlib.h head/sys/sys/malloc.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Mon Jan 22 00:45:49 2018 (r328236) +++ head/include/stdlib.h Mon Jan 22 01:50:10 2018 (r328237) @@ -92,7 +92,7 @@ long atol(const char *); void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void * _Nonnull, const void *)); void *calloc(size_t, size_t) __malloc_like __result_use_check - __alloc_size(1) __alloc_size(2); + __alloc_size2(1, 2); div_t div(int, int) __pure2; _Noreturn void exit(int); void free(void *); @@ -302,8 +302,8 @@ void qsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *)); int radixsort(const unsigned char **, int, const unsigned char *, unsigned); -void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2) - __alloc_size(3); +void *reallocarray(void *, size_t, size_t) __result_use_check + __alloc_size2(2, 3); void *reallocf(void *, size_t) __result_use_check __alloc_size(2); int rpmatch(const char *); void setprogname(const char *); Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Mon Jan 22 00:45:49 2018 (r328236) +++ head/sys/sys/malloc.h Mon Jan 22 01:50:10 2018 (r328237) @@ -188,7 +188,7 @@ void *malloc_domain(unsigned long size, struct malloc_ __malloc_like __result_use_check __alloc_size(1); void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) __malloc_like __result_use_check - __alloc_size(1) __alloc_size(2); + __alloc_size2(1, 2); void malloc_init(void *); int malloc_last_fail(void); void malloc_type_allocated(struct malloc_type *type, unsigned long size); From owner-svn-src-all@freebsd.org Mon Jan 22 02:08:13 2018 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 5BDFBEC8273; Mon, 22 Jan 2018 02:08:13 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 356F328E6; Mon, 22 Jan 2018 02:08: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B32C13E75; Mon, 22 Jan 2018 02:08:12 +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 w0M28CfS066770; Mon, 22 Jan 2018 02:08:12 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M28AGH066757; Mon, 22 Jan 2018 02:08:10 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801220208.w0M28AGH066757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 22 Jan 2018 02:08:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328238 - in head/sys: cam/scsi dev/mps fs/cd9660 fs/nandfs fs/nfsclient kern netpfil/ipfw netsmb x86/x86 X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in head/sys: cam/scsi dev/mps fs/cd9660 fs/nandfs fs/nfsclient kern netpfil/ipfw netsmb x86/x86 X-SVN-Commit-Revision: 328238 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 02:08:13 -0000 Author: pfg Date: Mon Jan 22 02:08:10 2018 New Revision: 328238 URL: https://svnweb.freebsd.org/changeset/base/328238 Log: Unsign some values related to allocation. When allocating memory through malloc(9), we always expect the amount of memory requested to be unsigned as a negative value would either stand for an error or an overflow. Unsign some values, found when considering the use of mallocarray(9), to avoid unnecessary casting. Also consider that indexes should be of at least the same size/type as the upper limit they pretend to index. MFC after: 3 weeks Modified: head/sys/cam/scsi/scsi_ch.c head/sys/dev/mps/mps.c head/sys/fs/cd9660/cd9660_vnops.c head/sys/fs/nandfs/nandfs_vfsops.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/kern/kern_exec.c head/sys/kern/link_elf_obj.c head/sys/kern/subr_hash.c head/sys/kern/uipc_usrreq.c head/sys/netpfil/ipfw/ip_fw_sockopt.c head/sys/netpfil/ipfw/ip_fw_table_algo.c head/sys/netsmb/smb_crypt.c head/sys/x86/x86/mca.c Modified: head/sys/cam/scsi/scsi_ch.c ============================================================================== --- head/sys/cam/scsi/scsi_ch.c Mon Jan 22 01:50:10 2018 (r328237) +++ head/sys/cam/scsi/scsi_ch.c Mon Jan 22 02:08:10 2018 (r328238) @@ -1198,13 +1198,14 @@ chgetelemstatus(struct cam_periph *periph, int scsi_ve struct read_element_status_descriptor *desc; caddr_t data = NULL; size_t size, desclen; - int avail, i, error = 0; + u_int avail, i; int curdata, dvcid, sense_flags; int try_no_dvcid = 0; struct changer_element_status *user_data = NULL; struct ch_softc *softc; union ccb *ccb; int chet = cesr->cesr_element_type; + int error = 0; int want_voltags = (cesr->cesr_flags & CESR_VOLTAGS) ? 1 : 0; softc = (struct ch_softc *)periph->softc; Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Mon Jan 22 01:50:10 2018 (r328237) +++ head/sys/dev/mps/mps.c Mon Jan 22 02:08:10 2018 (r328238) @@ -1164,7 +1164,7 @@ static int mps_alloc_queues(struct mps_softc *sc) { struct mps_queue *q; - int nq, i; + u_int nq, i; nq = sc->msi_msgs; mps_dprint(sc, MPS_INIT|MPS_XINFO, "Allocating %d I/O queues\n", nq); Modified: head/sys/fs/cd9660/cd9660_vnops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vnops.c Mon Jan 22 01:50:10 2018 (r328237) +++ head/sys/fs/cd9660/cd9660_vnops.c Mon Jan 22 02:08:10 2018 (r328238) @@ -481,7 +481,7 @@ cd9660_readdir(ap) int error = 0; int reclen; u_short namelen; - int ncookies = 0; + u_int ncookies = 0; u_long *cookies = NULL; cd_ino_t ino; Modified: head/sys/fs/nandfs/nandfs_vfsops.c ============================================================================== --- head/sys/fs/nandfs/nandfs_vfsops.c Mon Jan 22 01:50:10 2018 (r328237) +++ head/sys/fs/nandfs/nandfs_vfsops.c Mon Jan 22 02:08:10 2018 (r328238) @@ -561,7 +561,7 @@ nandfs_read_structures(struct nandfs_device *fsdev) { struct nandfs_fsdata *fsdata, *fsdatat; struct nandfs_super_block *sblocks, *ssblock; - int nsbs, nfsds, i; + u_int nsbs, nfsds, i; int error = 0; int nrsbs; Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Mon Jan 22 01:50:10 2018 (r328237) +++ head/sys/fs/nfsclient/nfs_clvnops.c Mon Jan 22 02:08:10 2018 (r328238) @@ -2666,7 +2666,7 @@ ncl_flush(struct vnode *vp, int waitfor, struct thread #define NFS_COMMITBVECSIZ 20 #endif struct buf *bvec_on_stack[NFS_COMMITBVECSIZ]; - int bvecsize = 0, bveccount; + u_int bvecsize = 0, bveccount; if (called_from_renewthread != 0) slptimeo = hz; Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Jan 22 01:50:10 2018 (r328237) +++ head/sys/kern/kern_exec.c Mon Jan 22 02:08:10 2018 (r328238) @@ -1693,7 +1693,7 @@ int exec_register(const struct execsw *execsw_arg) { const struct execsw **es, **xs, **newexecsw; - int count = 2; /* New slot and trailing NULL */ + u_int count = 2; /* New slot and trailing NULL */ if (execsw) for (es = execsw; *es; es++) Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Mon Jan 22 01:50:10 2018 (r328237) +++ head/sys/kern/link_elf_obj.c Mon Jan 22 02:08:10 2018 (r328238) @@ -97,10 +97,10 @@ typedef struct elf_file { Elf_Shdr *e_shdr; Elf_progent *progtab; - int nprogtab; + u_int nprogtab; Elf_relaent *relatab; - int nrelatab; + u_int nrelatab; Elf_relent *reltab; int nreltab; @@ -985,7 +985,7 @@ static void link_elf_unload_file(linker_file_t file) { elf_file_t ef = (elf_file_t) file; - int i; + u_int i; /* Notify MD code that a module is being unloaded. */ elf_cpu_unload_file(file); Modified: head/sys/kern/subr_hash.c ============================================================================== --- head/sys/kern/subr_hash.c Mon Jan 22 01:50:10 2018 (r328237) +++ head/sys/kern/subr_hash.c Mon Jan 22 02:08:10 2018 (r328238) @@ -57,9 +57,8 @@ void * hashinit_flags(int elements, struct malloc_type *type, u_long *hashmask, int flags) { - long hashsize; + long hashsize, i; LIST_HEAD(generic, generic) *hashtbl; - int i; KASSERT(elements > 0, ("%s: bad elements", __func__)); /* Exactly one of HASH_WAITOK and HASH_NOWAIT must be set. */ @@ -114,9 +113,8 @@ static const int primes[] = { 1, 13, 31, 61, 127, 251, void * phashinit_flags(int elements, struct malloc_type *type, u_long *nentries, int flags) { - long hashsize; + long hashsize, i; LIST_HEAD(generic, generic) *hashtbl; - int i; KASSERT(elements > 0, ("%s: bad elements", __func__)); /* Exactly one of HASH_WAITOK and HASH_NOWAIT must be set. */ Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Mon Jan 22 01:50:10 2018 (r328237) +++ head/sys/kern/uipc_usrreq.c Mon Jan 22 02:08:10 2018 (r328238) @@ -1554,13 +1554,13 @@ unp_disconnect(struct unpcb *unp, struct unpcb *unp2) static int unp_pcblist(SYSCTL_HANDLER_ARGS) { - int error, i, n; - int freeunp; struct unpcb *unp, **unp_list; unp_gen_t gencnt; struct xunpgen *xug; struct unp_head *head; struct xunpcb *xu; + u_int i; + int freeunp, error, n; switch ((intptr_t)arg1) { case SOCK_STREAM: Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Mon Jan 22 01:50:10 2018 (r328237) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Mon Jan 22 02:08:10 2018 (r328238) @@ -355,7 +355,7 @@ get_map(struct ip_fw_chain *chain, int extra, int lock for (;;) { struct ip_fw **map; - int i, mflags; + u_int i, mflags; mflags = M_ZERO | ((locked != 0) ? M_NOWAIT : M_WAITOK); Modified: head/sys/netpfil/ipfw/ip_fw_table_algo.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_table_algo.c Mon Jan 22 01:50:10 2018 (r328237) +++ head/sys/netpfil/ipfw/ip_fw_table_algo.c Mon Jan 22 02:08:10 2018 (r328238) @@ -3266,10 +3266,10 @@ static int ta_init_fhash(struct ip_fw_chain *ch, void **ta_state, struct table_info *ti, char *data, uint8_t tflags) { - int i; struct fhash_cfg *cfg; struct fhashentry4 *fe4; struct fhashentry6 *fe6; + u_int i; cfg = malloc(sizeof(struct fhash_cfg), M_IPFW, M_WAITOK | M_ZERO); @@ -3672,7 +3672,7 @@ ta_prepare_mod_fhash(void *ta_buf, uint64_t *pflags) { struct mod_item *mi; struct fhashbhead *head; - int i; + u_int i; mi = (struct mod_item *)ta_buf; Modified: head/sys/netsmb/smb_crypt.c ============================================================================== --- head/sys/netsmb/smb_crypt.c Mon Jan 22 01:50:10 2018 (r328237) +++ head/sys/netsmb/smb_crypt.c Mon Jan 22 02:08:10 2018 (r328238) @@ -118,7 +118,7 @@ smb_ntencrypt(const u_char *apwd, u_char *C8, u_char * u_char S21[21]; u_int16_t *unipwd; MD4_CTX *ctxp; - int len; + u_int len; len = strlen(apwd); unipwd = malloc((len + 1) * sizeof(u_int16_t), M_SMBTEMP, M_WAITOK); @@ -148,7 +148,7 @@ smb_calcmackey(struct smb_vc *vcp) { const char *pwd; u_int16_t *unipwd; - int len; + u_int len; MD4_CTX md4; u_char S16[16], S21[21]; Modified: head/sys/x86/x86/mca.c ============================================================================== --- head/sys/x86/x86/mca.c Mon Jan 22 01:50:10 2018 (r328237) +++ head/sys/x86/x86/mca.c Mon Jan 22 02:08:10 2018 (r328238) @@ -841,7 +841,7 @@ cmci_setup(void) static void amd_thresholding_setup(void) { - int i; + u_int i; amd_et_state = malloc((mp_maxid + 1) * sizeof(struct amd_et_state *), M_MCA, M_WAITOK); From owner-svn-src-all@freebsd.org Mon Jan 22 02:26:11 2018 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 6133DEC8DEB; Mon, 22 Jan 2018 02:26:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3CD1E31B3; Mon, 22 Jan 2018 02:26:11 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8700814195; Mon, 22 Jan 2018 02:26:10 +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 w0M2QAkk074663; Mon, 22 Jan 2018 02:26:10 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M2QAuh074662; Mon, 22 Jan 2018 02:26:10 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801220226.w0M2QAuh074662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 22 Jan 2018 02:26:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328239 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 328239 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 02:26:11 -0000 Author: pfg Date: Mon Jan 22 02:26:10 2018 New Revision: 328239 URL: https://svnweb.freebsd.org/changeset/base/328239 Log: Forgot to sort here in r328238. Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Mon Jan 22 02:08:10 2018 (r328238) +++ head/sys/kern/uipc_usrreq.c Mon Jan 22 02:26:10 2018 (r328239) @@ -1560,7 +1560,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) struct unp_head *head; struct xunpcb *xu; u_int i; - int freeunp, error, n; + int error, freeunp, n; switch ((intptr_t)arg1) { case SOCK_STREAM: From owner-svn-src-all@freebsd.org Mon Jan 22 02:44:43 2018 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 F02AAEC9736; Mon, 22 Jan 2018 02:44:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B107F39DC; Mon, 22 Jan 2018 02:44:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9B54144C8; Mon, 22 Jan 2018 02:44:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0M2igDt083092; Mon, 22 Jan 2018 02:44:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M2if3I083081; Mon, 22 Jan 2018 02:44:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801220244.w0M2if3I083081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 22 Jan 2018 02:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328240 - in head: etc/mtree lib lib/libc/regex lib/libc/tests/regex lib/libregex lib/libregex/tests share/mk X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: etc/mtree lib lib/libc/regex lib/libc/tests/regex lib/libregex lib/libregex/tests share/mk X-SVN-Commit-Revision: 328240 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 02:44:44 -0000 Author: kevans Date: Mon Jan 22 02:44:41 2018 New Revision: 328240 URL: https://svnweb.freebsd.org/changeset/base/328240 Log: Add libregex, connect it to the build libregex is a regex(3) implementation intended to feature GNU extensions and any other non-POSIX compliant extensions that are deemed worthy. These extensions are separated out into a separate library for the sake of not cluttering up libc further with them as well as not deteriorating the speed (or lack thereof) of the libc implementation. libregex is implemented as a build of the libc implementation with LIBREGEX defined to distinguish this from a libc build. The reasons for implementation like this are two-fold: 1.) Maintenance- This reduces the overhead induced by adding yet another regex implementation to base. 2.) Ease of use- Flipping on GNU extensions will be as simple as linking against libregex, and POSIX-compliant compilations can be guaranteed with a REG_POSIX cflag that should be ignored by libc/regex and disables extensions in libregex. It is also easier to keep REG_POSIX sane and POSIX pure when implemented in this fashion. Tests are added for future functionality, but left disconnected for the time being while other testing is done. Reviewed by: cem (previous version) Differential Revision: https://reviews.freebsd.org/D12934 Added: head/lib/libc/tests/regex/Makefile.inc - copied, changed from r328136, head/lib/libc/tests/regex/Makefile head/lib/libregex/ head/lib/libregex/Makefile (contents, props changed) head/lib/libregex/tests/ head/lib/libregex/tests/Makefile (contents, props changed) head/lib/libregex/tests/gnuext.in (contents, props changed) head/lib/libregex/tests/libregex_test.sh (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/lib/Makefile head/lib/libc/regex/Makefile.inc head/lib/libc/tests/regex/Makefile head/share/mk/bsd.libnames.mk head/share/mk/src.libnames.mk Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Mon Jan 22 02:26:10 2018 (r328239) +++ head/etc/mtree/BSD.tests.dist Mon Jan 22 02:44:41 2018 (r328240) @@ -354,6 +354,10 @@ .. libproc .. + libregex + data + .. + .. librt .. libsbuf Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Mon Jan 22 02:26:10 2018 (r328239) +++ head/lib/Makefile Mon Jan 22 02:44:41 2018 (r328240) @@ -71,6 +71,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ libpjdlog \ ${_libproc} \ libprocstat \ + libregex \ librpcsvc \ librss \ librt \ Modified: head/lib/libc/regex/Makefile.inc ============================================================================== --- head/lib/libc/regex/Makefile.inc Mon Jan 22 02:26:10 2018 (r328239) +++ head/lib/libc/regex/Makefile.inc Mon Jan 22 02:44:41 2018 (r328240) @@ -10,8 +10,11 @@ SRCS+= regcomp.c regerror.c regexec.c regfree.c SYM_MAPS+=${LIBC_SRCTOP}/regex/Symbol.map +# manpages only included in libc version +.if ${LIB} == "c" MAN+= regex.3 MAN+= re_format.7 MLINKS+=regex.3 regcomp.3 regex.3 regexec.3 regex.3 regerror.3 MLINKS+=regexec.3 regfree.3 +.endif Modified: head/lib/libc/tests/regex/Makefile ============================================================================== --- head/lib/libc/tests/regex/Makefile Mon Jan 22 02:26:10 2018 (r328239) +++ head/lib/libc/tests/regex/Makefile Mon Jan 22 02:44:41 2018 (r328240) @@ -1,63 +1,7 @@ # $FreeBSD$ -.include - PACKAGE= tests -BINDIR= ${TESTSDIR} - -# SKIP_LEFTASSOC -> these testcases fail on FreeBSD. -IMPLEMENTATION?= -DREGEX_SPENCER -DSKIP_LEFTASSOC - -CFLAGS.h_regex+=-I${TESTSRC} -I${.CURDIR:H:H}/regex -PROGS+= h_regex -SRCS.h_regex= main.c split.c debug.c - -NETBSD_ATF_TESTS_SH= regex_test - -${PACKAGE}FILES+= README - -FILESGROUPS+= ${PACKAGE}DATA_FILES -${PACKAGE}DATA_FILESPACKAGE=${PACKAGE} - -${PACKAGE}DATA_FILESDIR= ${TESTSDIR}/data -${PACKAGE}DATA_FILES+= data/anchor.in -${PACKAGE}DATA_FILES+= data/backref.in -${PACKAGE}DATA_FILES+= data/basic.in -${PACKAGE}DATA_FILES+= data/bracket.in -${PACKAGE}DATA_FILES+= data/c_comments.in -${PACKAGE}DATA_FILES+= data/complex.in -${PACKAGE}DATA_FILES+= data/error.in -${PACKAGE}DATA_FILES+= data/meta.in -${PACKAGE}DATA_FILES+= data/nospec.in -${PACKAGE}DATA_FILES+= data/paren.in -${PACKAGE}DATA_FILES+= data/regress.in -${PACKAGE}DATA_FILES+= data/repet_bounded.in -${PACKAGE}DATA_FILES+= data/repet_multi.in -${PACKAGE}DATA_FILES+= data/repet_ordinary.in -${PACKAGE}DATA_FILES+= data/startend.in -${PACKAGE}DATA_FILES+= data/subexp.in -${PACKAGE}DATA_FILES+= data/subtle.in -${PACKAGE}DATA_FILES+= data/word_bound.in -${PACKAGE}DATA_FILES+= data/zero.in -#${PACKAGE}DATA_FILES+= data/att/README -${PACKAGE}DATA_FILES+= data/att/basic.dat -${PACKAGE}DATA_FILES+= data/att/categorization.dat -${PACKAGE}DATA_FILES+= data/att/forcedassoc.dat -${PACKAGE}DATA_FILES+= data/att/leftassoc.dat -${PACKAGE}DATA_FILES+= data/att/nullsubexpr.dat -${PACKAGE}DATA_FILES+= data/att/repetition.dat -${PACKAGE}DATA_FILES+= data/att/rightassoc.dat - -NETBSD_ATF_TESTS_C= exhaust_test -NETBSD_ATF_TESTS_C+= regex_att_test - -.for t in ${NETBSD_ATF_TESTS_C} -CFLAGS.$t+= -I${TESTSRC} ${IMPLEMENTATION} -.endfor - -.include "../Makefile.netbsd-tests" - -LIBADD.regex_att_test+= util - +.include "Makefile.inc" +.include "${.CURDIR:H}/Makefile.netbsd-tests" .include Copied and modified: head/lib/libc/tests/regex/Makefile.inc (from r328136, head/lib/libc/tests/regex/Makefile) ============================================================================== --- head/lib/libc/tests/regex/Makefile Thu Jan 18 20:45:41 2018 (r328136, copy source) +++ head/lib/libc/tests/regex/Makefile.inc Mon Jan 22 02:44:41 2018 (r328240) @@ -2,14 +2,12 @@ .include -PACKAGE= tests +BINDIR?= ${TESTSDIR} -BINDIR= ${TESTSDIR} - # SKIP_LEFTASSOC -> these testcases fail on FreeBSD. IMPLEMENTATION?= -DREGEX_SPENCER -DSKIP_LEFTASSOC -CFLAGS.h_regex+=-I${TESTSRC} -I${.CURDIR:H:H}/regex +CFLAGS.h_regex+=-I${TESTSRC} -I${SRCTOP}/lib/libc/regex PROGS+= h_regex SRCS.h_regex= main.c split.c debug.c @@ -56,8 +54,4 @@ NETBSD_ATF_TESTS_C+= regex_att_test CFLAGS.$t+= -I${TESTSRC} ${IMPLEMENTATION} .endfor -.include "../Makefile.netbsd-tests" - LIBADD.regex_att_test+= util - -.include Added: head/lib/libregex/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libregex/Makefile Mon Jan 22 02:44:41 2018 (r328240) @@ -0,0 +1,19 @@ +# $FreeBSD$ + +.include + +PACKAGE=lib${LIB} +LIB= regex +SHLIB_MAJOR= 1 +SHLIB_MINOR= 0 + +CFLAGS+= -DLIBREGEX +LIBC_SRCTOP= ${.CURDIR:H}/libc +SYMBOL_MAPS= ${SYM_MAPS} + +#HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + +.include "../Makefile.inc" +.include "${LIBC_SRCTOP}/regex/Makefile.inc" +.include Added: head/lib/libregex/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libregex/tests/Makefile Mon Jan 22 02:44:41 2018 (r328240) @@ -0,0 +1,20 @@ +# $FreeBSD$ + +PACKAGE= tests +TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libc/regex + +.PATH: ${SRCTOP}/tests + +.include "${SRCTOP}/lib/libc/tests/regex/Makefile.inc" + +ATF_TESTS_SH+= libregex_test + +${PACKAGE}DATA_FILES+= gnuext.in + +LIBADD.h_regex+=regex +.for t in ${NETBSD_ATF_TESTS_C} +LIBADD.$t+= regex +.endfor + +.include +.include Added: head/lib/libregex/tests/gnuext.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libregex/tests/gnuext.in Mon Jan 22 02:44:41 2018 (r328240) @@ -0,0 +1,30 @@ +# BRE Quantifiers +ab\?c b abc abc +ab\+c b abc abc +# BRE Branching +abc\|de b abc abc +a\|b\|c b abc a +\(ab\|bc\) b abcd ab +# ERE Backrefs +(ab)\1 - ab +(ab)\1 - abab abab +\1(ab) C ESUBREG +(a)(b)(c)(d)(e)(f)(g)(h)(i)\9 - abcdefghii abcdefghii +# \w, \W, \s, \S (alnum, ^alnum, space, ^space) +\w+ - -%@a0X- a0X +\w\+ b -%@a0X- a0X +\s+ - aSNTb SNT +\s\+ b aSNTb SNT +# Word boundaries (\b, \B, \<, \>, \`, \') +# (is/not boundary, start/end word, start/end subject string) +\babc\b & abc +\ & abc +\Babc\B & abc +\B[abc]\B & b +\B[abc]+ - bc +\B[abc]\+ b bc +\`abc\' & abc abc +\`.+\' - abNc abNc +\`.\+\' b abNc abNc +(\`a) - Na +(a\') - aN Added: head/lib/libregex/tests/libregex_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libregex/tests/libregex_test.sh Mon Jan 22 02:44:41 2018 (r328240) @@ -0,0 +1,55 @@ +# +# Copyright (c) 2017 Kyle Evans +# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ + +check() +{ + local dataname="${1}"; shift + + prog="$(atf_get_srcdir)/h_regex" + data="$(atf_get_srcdir)/data/${dataname}.in" + + atf_check -x "${prog} <${data}" + atf_check -x "${prog} -el <${data}" + atf_check -x "${prog} -er <${data}" +} + +create_tc() +{ + local name="${1}"; shift + local descr="${1}"; shift + + atf_test_case "${name}" + eval "${name}_head() { atf_set 'descr' '${descr}'; }" + eval "${name}_body() { check '${name}'; }" + + atf_add_test_case "${name}" +} + +atf_init_test_cases() +{ + create_tc gnuext "Check GNU extension functionality" +} Modified: head/share/mk/bsd.libnames.mk ============================================================================== --- head/share/mk/bsd.libnames.mk Mon Jan 22 02:26:10 2018 (r328239) +++ head/share/mk/bsd.libnames.mk Mon Jan 22 02:44:41 2018 (r328240) @@ -132,6 +132,7 @@ LIBPROCSTAT?= ${LIBDESTDIR}${LIBDIR_BASE}/libprocstat. LIBPTHREAD?= ${LIBDESTDIR}${LIBDIR_BASE}/libpthread.a LIBRADIUS?= ${LIBDESTDIR}${LIBDIR_BASE}/libradius.a LIBRDMACM?= ${LIBDESTDIR}${LIBDIR_BASE}/librdmacm.a +LIBREGEX?= ${LIBDESTDIR}${LIBDIR_BASE}/libregex.a LIBROKEN?= ${LIBDESTDIR}${LIBDIR_BASE}/libroken.a LIBRPCSEC_GSS?= ${LIBDESTDIR}${LIBDIR_BASE}/librpcsec_gss.a LIBRPCSVC?= ${LIBDESTDIR}${LIBDIR_BASE}/librpcsvc.a Modified: head/share/mk/src.libnames.mk ============================================================================== --- head/share/mk/src.libnames.mk Mon Jan 22 02:26:10 2018 (r328239) +++ head/share/mk/src.libnames.mk Mon Jan 22 02:44:41 2018 (r328240) @@ -148,6 +148,7 @@ _LIBRARIES= \ pthread \ radius \ readline \ + regex \ roken \ rpcsec_gss \ rpcsvc \ From owner-svn-src-all@freebsd.org Mon Jan 22 02:58:34 2018 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 AC202EC9E2B; Mon, 22 Jan 2018 02:58:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 874793FC6; Mon, 22 Jan 2018 02:58:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF69C1465E; Mon, 22 Jan 2018 02:58:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0M2wXSa087209; Mon, 22 Jan 2018 02:58:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M2wXdN087208; Mon, 22 Jan 2018 02:58:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801220258.w0M2wXdN087208@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 22 Jan 2018 02:58:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328241 - head/lib/libc/regex X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/regex X-SVN-Commit-Revision: 328241 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 02:58:34 -0000 Author: kevans Date: Mon Jan 22 02:58:33 2018 New Revision: 328241 URL: https://svnweb.freebsd.org/changeset/base/328241 Log: Add missing patch from r328240 regcomp uses some libc internal collation bits that are not available in the libregex context. It's easy enough to bring in the needed parts that can work in a libregex world, so do so. Pointy hat to: me Modified: head/lib/libc/regex/regcomp.c Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Mon Jan 22 02:44:41 2018 (r328240) +++ head/lib/libc/regex/regcomp.c Mon Jan 22 02:58:33 2018 (r328241) @@ -57,7 +57,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef LIBREGEX #include "collate.h" +#endif #include "utils.h" #include "regex2.h" @@ -124,6 +126,7 @@ static void p_re(struct parse *p, int end1, int end2); static bool p_simp_re(struct parse *p, struct branchc *bc); static int p_count(struct parse *p); static void p_bracket(struct parse *p); +static int p_range_cmp(wchar_t c1, wchar_t c2); static void p_b_term(struct parse *p, cset *cs); static void p_b_cclass(struct parse *p, cset *cs); static void p_b_eclass(struct parse *p, cset *cs); @@ -904,6 +907,23 @@ p_bracket(struct parse *p) EMIT(OANYOF, (int)(cs - p->g->sets)); } +static int +p_range_cmp(wchar_t c1, wchar_t c2) +{ +#ifndef LIBREGEX + return __wcollate_range_cmp(c1, c2); +#else + /* Copied from libc/collate __wcollate_range_cmp */ + wchar_t s1[2], s2[2]; + + s1[0] = c1; + s1[1] = L'\0'; + s2[0] = c2; + s2[1] = L'\0'; + return (wcscoll(s1, s2)); +#endif +} + /* - p_b_term - parse one term of a bracketed character list == static void p_b_term(struct parse *p, cset *cs); @@ -914,9 +934,10 @@ p_b_term(struct parse *p, cset *cs) char c; wint_t start, finish; wint_t i; +#ifndef LIBREGEX struct xlocale_collate *table = (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE]; - +#endif /* classify what we've got */ switch ((MORE()) ? PEEK() : '\0') { case '[': @@ -963,15 +984,18 @@ p_b_term(struct parse *p, cset *cs) if (start == finish) CHadd(p, cs, start); else { +#ifndef LIBREGEX if (table->__collate_load_error || MB_CUR_MAX > 1) { +#else + if (MB_CUR_MAX > 1) { +#endif (void)REQUIRE(start <= finish, REG_ERANGE); CHaddrange(p, cs, start, finish); } else { - (void)REQUIRE(__wcollate_range_cmp(start, finish) <= 0, REG_ERANGE); + (void)REQUIRE(p_range_cmp(start, finish) <= 0, REG_ERANGE); for (i = 0; i <= UCHAR_MAX; i++) { - if ( __wcollate_range_cmp(start, i) <= 0 - && __wcollate_range_cmp(i, finish) <= 0 - ) + if (p_range_cmp(start, i) <= 0 && + p_range_cmp(i, finish) <= 0 ) CHadd(p, cs, i); } } From owner-svn-src-all@freebsd.org Mon Jan 22 03:12:27 2018 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 AA7E3ECA876; Mon, 22 Jan 2018 03:12:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8564B63FFE; Mon, 22 Jan 2018 03:12:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C302314A33; Mon, 22 Jan 2018 03:12:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0M3CQZb096351; Mon, 22 Jan 2018 03:12:26 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M3CQsC096350; Mon, 22 Jan 2018 03:12:26 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801220312.w0M3CQsC096350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 22 Jan 2018 03:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328242 - head/lib/libregex X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libregex X-SVN-Commit-Revision: 328242 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 03:12:27 -0000 Author: kevans Date: Mon Jan 22 03:12:26 2018 New Revision: 328242 URL: https://svnweb.freebsd.org/changeset/base/328242 Log: libregex: Drop WARNS to 2 to match libc It's become clear that my armv7 builds didn't catch all of the warnings that other builds are picking up, drop WARNS to 2 to match libc until they're all caught. Modified: head/lib/libregex/Makefile Modified: head/lib/libregex/Makefile ============================================================================== --- head/lib/libregex/Makefile Mon Jan 22 02:58:33 2018 (r328241) +++ head/lib/libregex/Makefile Mon Jan 22 03:12:26 2018 (r328242) @@ -10,6 +10,7 @@ SHLIB_MINOR= 0 CFLAGS+= -DLIBREGEX LIBC_SRCTOP= ${.CURDIR:H}/libc SYMBOL_MAPS= ${SYM_MAPS} +WARNS?= 2 #HAS_TESTS= SUBDIR.${MK_TESTS}+= tests From owner-svn-src-all@freebsd.org Mon Jan 22 03:38:11 2018 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 D3F36ECB493; Mon, 22 Jan 2018 03:38:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AED526896F; Mon, 22 Jan 2018 03:38:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E42A514D67; Mon, 22 Jan 2018 03:38:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0M3cAZ9004584; Mon, 22 Jan 2018 03:38:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M3cAtb004583; Mon, 22 Jan 2018 03:38:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801220338.w0M3cAtb004583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 22 Jan 2018 03:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328243 - head/usr.sbin/service X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/service X-SVN-Commit-Revision: 328243 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 03:38:11 -0000 Author: kevans Date: Mon Jan 22 03:38:10 2018 New Revision: 328243 URL: https://svnweb.freebsd.org/changeset/base/328243 Log: usr.sbin/service: Fix -j to not be order dependant The introduced -j option is highly dependant on the ordering of arguments, and it exhibited broken behavior in some other circumstances. Fix these issues, and simplify the feature by removing the unneessary double parsing of options. Reviewed by: jilles Differential Revision: https://reviews.freebsd.org/D13952 Modified: head/usr.sbin/service/service.sh Modified: head/usr.sbin/service/service.sh ============================================================================== --- head/usr.sbin/service/service.sh Mon Jan 22 03:12:26 2018 (r328242) +++ head/usr.sbin/service/service.sh Mon Jan 22 03:38:10 2018 (r328243) @@ -49,39 +49,9 @@ usage () { echo '' } -accepted_argstr='jehlrRv' - -# Only deal with the -j option here. If found, JAIL is set and the opt and -# arg are shifted out. OPTIND is left untouched. We strip the -j option out -# here because we'll be proxying this invocation through to the jail via -# jls(8) instead of handling it ourselves. -while getopts ${accepted_argstr} COMMAND_LINE_ARGUMENT ; do +while getopts 'j:ehlrRv' COMMAND_LINE_ARGUMENT ; do case "${COMMAND_LINE_ARGUMENT}" in - j) JAIL="$2" ; shift ; shift ;; - esac -done - -# If -j was provided, then we pass everthing along to the jexec command -# and execute `service` within the named JAIL. Provided that the jail -# actually exists, as checked by `jls`. -# We do this so that if the jail does exist, we can then return the exit -# code of `jexec` and it should be the exit code of whatever ran in the jail. -# There is a race condition here in that the jail might exist at `jls` time -# and be gone by `jexec` time, but it shouldn't be a big deal. -if [ -n "$JAIL" ]; then - /usr/sbin/jls -j "$JAIL" 2>/dev/null >/dev/null - if [ $? -ne 0 ]; then - echo "Jail '$JAIL' does not exist." - exit 1 - fi - - /usr/sbin/jexec -l "$JAIL" /usr/sbin/service $* - exit $? -fi - -OPTIND=1 -while getopts ${accepted_argstr} COMMAND_LINE_ARGUMENT ; do - case "${COMMAND_LINE_ARGUMENT}" in + j) JAIL="${OPTARG}" ;; e) ENABLED=eopt ;; h) usage ; exit 0 ;; l) LIST=lopt ;; @@ -92,6 +62,22 @@ while getopts ${accepted_argstr} COMMAND_LINE_ARGUMENT esac done shift $(( $OPTIND - 1 )) + +if [ -n "${JAIL}" ]; then + # We need to rebuild the command line before passing it on. + # We do not send the -j argument into the jail. + args="" + [ -n "${ENABLED}" ] && args="${args} -e" + [ -n "${LIST}" ] && args="${args} -l" + [ -n "${RCORDER}" ] && args="${args} -r" + [ -n "${RESTART}" ] && args="${args} -R" + [ -n "${VERBOSE}" ] && args="${args} -v" + + # Call jexec(8) with the rebuild args and any positional args that + # were left in $@ + /usr/sbin/jexec -l "${JAIL}" /usr/sbin/service $args "$@" + exit $? +fi if [ -n "$RESTART" ]; then skip="-s nostart" From owner-svn-src-all@freebsd.org Mon Jan 22 04:15:14 2018 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 3BBCDECCA9C; Mon, 22 Jan 2018 04:15:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DDD969A07; Mon, 22 Jan 2018 04:15:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4397D153CD; Mon, 22 Jan 2018 04:15:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0M4FD68020871; Mon, 22 Jan 2018 04:15:13 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M4FDg5020870; Mon, 22 Jan 2018 04:15:13 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801220415.w0M4FDg5020870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 22 Jan 2018 04:15: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: r328244 - stable/11/usr.bin/units X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/units X-SVN-Commit-Revision: 328244 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 04:15:14 -0000 Author: eadler Date: Mon Jan 22 04:15:12 2018 New Revision: 328244 URL: https://svnweb.freebsd.org/changeset/base/328244 Log: MFC r328008: units(1) free savescr in error condition too CID: 978392 Modified: stable/11/usr.bin/units/units.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/units/units.c ============================================================================== --- stable/11/usr.bin/units/units.c Mon Jan 22 03:38:10 2018 (r328243) +++ stable/11/usr.bin/units/units.c Mon Jan 22 04:15:12 2018 (r328244) @@ -352,6 +352,7 @@ addunit(struct unittype * theunit, const char *toadd, num = atof(item); if (!num) { zeroerror(); + free(savescr); return 1; } if (doingtop ^ flip) { @@ -364,6 +365,7 @@ addunit(struct unittype * theunit, const char *toadd, num = atof(divider + 1); if (!num) { zeroerror(); + free(savescr); return 1; } if (doingtop ^ flip) { @@ -378,6 +380,7 @@ addunit(struct unittype * theunit, const char *toadd, num = atof(item); if (!num) { zeroerror(); + free(savescr); return 1; } if (doingtop ^ flip) { @@ -399,9 +402,12 @@ addunit(struct unittype * theunit, const char *toadd, repeat = item[strlen(item) - 1] - '0'; item[strlen(item) - 1] = 0; } - for (; repeat; repeat--) - if (addsubunit(doingtop ^ flip ? theunit->numerator : theunit->denominator, item)) + for (; repeat; repeat--) { + if (addsubunit(doingtop ^ flip ? theunit->numerator : theunit->denominator, item)) { + free(savescr); return 1; + } + } } item = strtok(NULL, " *\t/\n"); } From owner-svn-src-all@freebsd.org Mon Jan 22 04:21:56 2018 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 40D33ECCECE; Mon, 22 Jan 2018 04:21:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1AEA369D00; Mon, 22 Jan 2018 04:21:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 582151543C; Mon, 22 Jan 2018 04:21:55 +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 w0M4Lt4U021901; Mon, 22 Jan 2018 04:21:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M4LtYE021900; Mon, 22 Jan 2018 04:21:55 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220421.w0M4LtYE021900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 04:21:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328245 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 328245 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 04:21:56 -0000 Author: mav Date: Mon Jan 22 04:21:55 2018 New Revision: 328245 URL: https://svnweb.freebsd.org/changeset/base/328245 Log: 8856 arc_cksum_is_equal() doesn't take into account ABD-logic illumos/illumos-gate@01a059ee0cdece49f47fd4d70086dd5bc7d0b0ff https://www.illumos.org/issues/8856: arc_cksum_is_equal() calls zio_push_transform() that requires abd_t* (second arg), but a void* is passed. Reviewed by: Matthew Ahrens Reviewed by: George Wilson Approved by: Gordon Ross Author: Roman Strashkin Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Mon Jan 22 04:15:12 2018 (r328244) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Mon Jan 22 04:21:55 2018 (r328245) @@ -23,7 +23,7 @@ * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 by Saso Kiselkov. All rights reserved. - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. */ /* @@ -1547,8 +1547,9 @@ arc_cksum_is_equal(arc_buf_hdr_t *hdr, zio_t *zio) uint64_t lsize = HDR_GET_LSIZE(hdr); uint64_t csize; - void *cbuf = zio_buf_alloc(HDR_GET_PSIZE(hdr)); - csize = zio_compress_data(compress, zio->io_abd, cbuf, lsize); + abd_t *cdata = abd_alloc_linear(HDR_GET_PSIZE(hdr), B_TRUE); + csize = zio_compress_data(compress, zio->io_abd, + abd_to_buf(cdata), lsize); ASSERT3U(csize, <=, HDR_GET_PSIZE(hdr)); if (csize < HDR_GET_PSIZE(hdr)) { @@ -1564,10 +1565,10 @@ arc_cksum_is_equal(arc_buf_hdr_t *hdr, zio_t *zio) * and zero out any part that should not contain * data. */ - bzero((char *)cbuf + csize, HDR_GET_PSIZE(hdr) - csize); + abd_zero_off(cdata, csize, HDR_GET_PSIZE(hdr) - csize); csize = HDR_GET_PSIZE(hdr); } - zio_push_transform(zio, cbuf, csize, HDR_GET_PSIZE(hdr), NULL); + zio_push_transform(zio, cdata, csize, HDR_GET_PSIZE(hdr), NULL); } /* From owner-svn-src-all@freebsd.org Mon Jan 22 04:23:49 2018 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 908E4ECCFD6; Mon, 22 Jan 2018 04:23:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A68769FD7; Mon, 22 Jan 2018 04:23:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B92615574; Mon, 22 Jan 2018 04:23: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 w0M4NmFM025113; Mon, 22 Jan 2018 04:23:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M4NmYC025112; Mon, 22 Jan 2018 04:23:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220423.w0M4NmYC025112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 04:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328246 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 328246 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 04:23:49 -0000 Author: mav Date: Mon Jan 22 04:23:48 2018 New Revision: 328246 URL: https://svnweb.freebsd.org/changeset/base/328246 Log: MFV r328245: 8856 arc_cksum_is_equal() doesn't take into account ABD-logic illumos/illumos-gate@01a059ee0cdece49f47fd4d70086dd5bc7d0b0ff https://www.illumos.org/issues/8856: arc_cksum_is_equal() calls zio_push_transform() that requires abd_t* (second arg), but a void* is passed. Reviewed by: Matthew Ahrens Reviewed by: George Wilson Approved by: Gordon Ross Author: Roman Strashkin Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Jan 22 04:21:55 2018 (r328245) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Jan 22 04:23:48 2018 (r328246) @@ -23,7 +23,7 @@ * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 by Saso Kiselkov. All rights reserved. - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. */ /* @@ -1857,8 +1857,9 @@ arc_cksum_is_equal(arc_buf_hdr_t *hdr, zio_t *zio) uint64_t lsize = HDR_GET_LSIZE(hdr); uint64_t csize; - void *cbuf = zio_buf_alloc(HDR_GET_PSIZE(hdr)); - csize = zio_compress_data(compress, zio->io_abd, cbuf, lsize); + abd_t *cdata = abd_alloc_linear(HDR_GET_PSIZE(hdr), B_TRUE); + csize = zio_compress_data(compress, zio->io_abd, + abd_to_buf(cdata), lsize); ASSERT3U(csize, <=, HDR_GET_PSIZE(hdr)); if (csize < HDR_GET_PSIZE(hdr)) { @@ -1874,10 +1875,10 @@ arc_cksum_is_equal(arc_buf_hdr_t *hdr, zio_t *zio) * and zero out any part that should not contain * data. */ - bzero((char *)cbuf + csize, HDR_GET_PSIZE(hdr) - csize); + abd_zero_off(cdata, csize, HDR_GET_PSIZE(hdr) - csize); csize = HDR_GET_PSIZE(hdr); } - zio_push_transform(zio, cbuf, csize, HDR_GET_PSIZE(hdr), NULL); + zio_push_transform(zio, cdata, csize, HDR_GET_PSIZE(hdr), NULL); } /* From owner-svn-src-all@freebsd.org Mon Jan 22 04:27:06 2018 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 8FCE2ECD1F9; Mon, 22 Jan 2018 04:27:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FD8A6A19C; Mon, 22 Jan 2018 04:27: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 881DB15576; Mon, 22 Jan 2018 04:27:05 +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 w0M4R5ra025275; Mon, 22 Jan 2018 04:27:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M4R57H025273; Mon, 22 Jan 2018 04:27:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220427.w0M4R57H025273@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 04:27:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328247 - in vendor-sys/illumos/dist/uts/common: fs/zfs sys/sysevent X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common: fs/zfs sys/sysevent X-SVN-Commit-Revision: 328247 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 04:27:06 -0000 Author: mav Date: Mon Jan 22 04:27:05 2018 New Revision: 328247 URL: https://svnweb.freebsd.org/changeset/base/328247 Log: 8959 Add notifications when a scrub is paused or resumed illumos/illumos-gate@301fd1d6f25595cd8c6d6795f39c72d97aff8cd9 Reviewed by: Alek Pinchuk Reviewed by: Matthew Ahrens Approved by: Gordon Ross Author: Sean Eric Fagan Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/sys/sysevent/eventdefs.h Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Mon Jan 22 04:23:48 2018 (r328246) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Mon Jan 22 04:27:05 2018 (r328247) @@ -363,6 +363,7 @@ dsl_scan_cancel_sync(void *arg, dmu_tx_t *tx) dsl_scan_done(scn, B_FALSE, tx); dsl_scan_sync_state(scn, tx); + spa_event_notify(scn->scn_dp->dp_spa, NULL, NULL, ESC_ZFS_SCRUB_ABORT); } int @@ -417,6 +418,7 @@ dsl_scrub_pause_resume_sync(void *arg, dmu_tx_t *tx) spa->spa_scan_pass_scrub_pause = gethrestime_sec(); scn->scn_phys.scn_flags |= DSF_SCRUB_PAUSED; dsl_scan_sync_state(scn, tx); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_PAUSED); } else { ASSERT3U(*cmd, ==, POOL_SCRUB_NORMAL); if (dsl_scan_is_paused_scrub(scn)) { @@ -1986,8 +1988,10 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_t func) /* got scrub start cmd, resume paused scrub */ int err = dsl_scrub_set_pause_resume(scn->scn_dp, POOL_SCRUB_NORMAL); - if (err == 0) + if (err == 0) { + spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_RESUME); return (ECANCELED); + } return (SET_ERROR(err)); } Modified: vendor-sys/illumos/dist/uts/common/sys/sysevent/eventdefs.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/sysevent/eventdefs.h Mon Jan 22 04:23:48 2018 (r328246) +++ vendor-sys/illumos/dist/uts/common/sys/sysevent/eventdefs.h Mon Jan 22 04:27:05 2018 (r328247) @@ -203,6 +203,9 @@ extern "C" { #define ESC_ZFS_CONFIG_SYNC "ESC_ZFS_config_sync" #define ESC_ZFS_SCRUB_START "ESC_ZFS_scrub_start" #define ESC_ZFS_SCRUB_FINISH "ESC_ZFS_scrub_finish" +#define ESC_ZFS_SCRUB_ABORT "ESC_ZFS_scrub_abort" +#define ESC_ZFS_SCRUB_RESUME "ESC_ZFS_scrub_resume" +#define ESC_ZFS_SCRUB_PAUSED "ESC_ZFS_scrub_paused" #define ESC_ZFS_VDEV_SPARE "ESC_ZFS_vdev_spare" #define ESC_ZFS_BOOTFS_VDEV_ATTACH "ESC_ZFS_bootfs_vdev_attach" #define ESC_ZFS_POOL_REGUID "ESC_ZFS_pool_reguid" From owner-svn-src-all@freebsd.org Mon Jan 22 04:31:50 2018 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 84A04ECD4DD; Mon, 22 Jan 2018 04:31:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 43FFC6A520; Mon, 22 Jan 2018 04:31:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42105156D5; Mon, 22 Jan 2018 04:31:49 +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 w0M4Vn3U029424; Mon, 22 Jan 2018 04:31:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M4VnP2029422; Mon, 22 Jan 2018 04:31:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220431.w0M4VnP2029422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 04:31:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328248 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs sys/sysevent X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs sys/sysevent X-SVN-Commit-Revision: 328248 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 04:31:50 -0000 Author: mav Date: Mon Jan 22 04:31:48 2018 New Revision: 328248 URL: https://svnweb.freebsd.org/changeset/base/328248 Log: MFV r328247: 8959 Add notifications when a scrub is paused or resumed illumos/illumos-gate@301fd1d6f25595cd8c6d6795f39c72d97aff8cd9 Reviewed by: Alek Pinchuk Reviewed by: Matthew Ahrens Approved by: Gordon Ross Author: Sean Eric Fagan Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Jan 22 04:27:05 2018 (r328247) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Jan 22 04:31:48 2018 (r328248) @@ -387,6 +387,7 @@ dsl_scan_cancel_sync(void *arg, dmu_tx_t *tx) dsl_scan_done(scn, B_FALSE, tx); dsl_scan_sync_state(scn, tx); + spa_event_notify(scn->scn_dp->dp_spa, NULL, ESC_ZFS_SCRUB_ABORT); } int @@ -441,6 +442,7 @@ dsl_scrub_pause_resume_sync(void *arg, dmu_tx_t *tx) spa->spa_scan_pass_scrub_pause = gethrestime_sec(); scn->scn_phys.scn_flags |= DSF_SCRUB_PAUSED; dsl_scan_sync_state(scn, tx); + spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_PAUSED); } else { ASSERT3U(*cmd, ==, POOL_SCRUB_NORMAL); if (dsl_scan_is_paused_scrub(scn)) { @@ -2012,8 +2014,10 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_t func) /* got scrub start cmd, resume paused scrub */ int err = dsl_scrub_set_pause_resume(scn->scn_dp, POOL_SCRUB_NORMAL); - if (err == 0) + if (err == 0) { + spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_RESUME); return (ECANCELED); + } return (SET_ERROR(err)); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Mon Jan 22 04:27:05 2018 (r328247) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Mon Jan 22 04:31:48 2018 (r328248) @@ -262,6 +262,9 @@ extern "C" { #define ESC_ZFS_CONFIG_SYNC "ESC_ZFS_config_sync" #define ESC_ZFS_SCRUB_START "ESC_ZFS_scrub_start" #define ESC_ZFS_SCRUB_FINISH "ESC_ZFS_scrub_finish" +#define ESC_ZFS_SCRUB_ABORT "ESC_ZFS_scrub_abort" +#define ESC_ZFS_SCRUB_RESUME "ESC_ZFS_scrub_resume" +#define ESC_ZFS_SCRUB_PAUSED "ESC_ZFS_scrub_paused" #define ESC_ZFS_VDEV_SPARE "ESC_ZFS_vdev_spare" #define ESC_ZFS_BOOTFS_VDEV_ATTACH "ESC_ZFS_bootfs_vdev_attach" #define ESC_ZFS_POOL_REGUID "ESC_ZFS_pool_reguid" From owner-svn-src-all@freebsd.org Mon Jan 22 04:35:18 2018 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 96E37ECD6D1; Mon, 22 Jan 2018 04:35:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70CA86A749; Mon, 22 Jan 2018 04:35:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A528B15712; Mon, 22 Jan 2018 04:35:17 +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 w0M4ZHxS029608; Mon, 22 Jan 2018 04:35:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M4ZH4s029607; Mon, 22 Jan 2018 04:35:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220435.w0M4ZH4s029607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 04:35:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328249 - vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor/illumos/dist/lib/libzfs/common X-SVN-Commit-Revision: 328249 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 04:35:18 -0000 Author: mav Date: Mon Jan 22 04:35:17 2018 New Revision: 328249 URL: https://svnweb.freebsd.org/changeset/base/328249 Log: 8641 "zpool clear" and "zinject" don't work on "spare" or "replacing" vdevs illumos/illumos-gate@2ba5f978a4f9b02da9db1b8cdd9ea5498eb00ad9 https://www.illumos.org/issues/8641: "zpool clear" and "zinject -d" can both operate on specific vdevs, either leaf or interior. However, due to an oversight, neither works on a "spare" or "replacing" vdev. For example: sudo zpool create foo raidz1 c1t5000CCA000081D61d0 c1t5000CCA000186235d0 spare c1t5000CCA000094115d0 sudo zpool replace foo c1t5000CCA000186235d0 c1t5000CCA000094115d0 $ zpool status foo pool: foo state: ONLINE scan: resilvered 81.5K in 0h0m with 0 errors on Fri Sep 8 10:53:03 2017 config: NAME STATE READ WRITE CKSUM foo ONLINE 0 0 0 raidz1-0 ONLINE 0 0 0 c1t5000CCA000081D61d0 ONLINE 0 0 0 spare-1 ONLINE 0 0 0 c1t5000CCA000186235d0 ONLINE 0 0 0 c1t5000CCA000094115d0 ONLINE 0 0 0 spares c1t5000CCA000094115d0 INUSE currently in use $ sudo zinject -d spare-1 -A degrade foo cannot find device 'spare-1' in pool 'foo' $ sudo zpool clear foo spare-1 cannot clear errors for spare-1: no such device in pool Even though there was nothing to clear, those commands shouldn't have reported an error. by contrast, trying to clear "raidz1-0" works just fine: $ sudo zpool clear foo raidz1-0 Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Mon Jan 22 04:31:48 2018 (r328248) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Mon Jan 22 04:35:17 2018 (r328249) @@ -50,6 +50,7 @@ #include "zfeature_common.h" static int read_efi_label(nvlist_t *, diskaddr_t *, boolean_t *); +static boolean_t zpool_vdev_is_interior(const char *name); #define BACKUP_SLICE "s2" @@ -2072,10 +2073,7 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, bo break; } - verify(strncmp(type, VDEV_TYPE_RAIDZ, - strlen(VDEV_TYPE_RAIDZ)) == 0 || - strncmp(type, VDEV_TYPE_MIRROR, - strlen(VDEV_TYPE_MIRROR)) == 0); + verify(zpool_vdev_is_interior(type)); verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ID, &id) == 0); @@ -2182,10 +2180,13 @@ zpool_find_vdev_by_physpath(zpool_handle_t *zhp, const /* * Determine if we have an "interior" top-level vdev (i.e mirror/raidz). */ -boolean_t +static boolean_t zpool_vdev_is_interior(const char *name) { if (strncmp(name, VDEV_TYPE_RAIDZ, strlen(VDEV_TYPE_RAIDZ)) == 0 || + strncmp(name, VDEV_TYPE_SPARE, strlen(VDEV_TYPE_SPARE)) == 0 || + strncmp(name, + VDEV_TYPE_REPLACING, strlen(VDEV_TYPE_REPLACING)) == 0 || strncmp(name, VDEV_TYPE_MIRROR, strlen(VDEV_TYPE_MIRROR)) == 0) return (B_TRUE); return (B_FALSE); From owner-svn-src-all@freebsd.org Mon Jan 22 04:37:05 2018 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 CBB78ECD7A4; Mon, 22 Jan 2018 04:37:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A72956A8B0; Mon, 22 Jan 2018 04:37: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0418B15713; Mon, 22 Jan 2018 04:37:05 +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 w0M4b4fi029725; Mon, 22 Jan 2018 04:37:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M4b4V6029724; Mon, 22 Jan 2018 04:37:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220437.w0M4b4V6029724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 04:37:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328250 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 328250 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 04:37:05 -0000 Author: mav Date: Mon Jan 22 04:37:04 2018 New Revision: 328250 URL: https://svnweb.freebsd.org/changeset/base/328250 Log: MFV r328249: 8641 "zpool clear" and "zinject" don't work on "spare" or "replacing" vdevs illumos/illumos-gate@2ba5f978a4f9b02da9db1b8cdd9ea5498eb00ad9 https://www.illumos.org/issues/8641: "zpool clear" and "zinject -d" can both operate on specific vdevs, either leaf or interior. However, due to an oversight, neither works on a "spare" or "replacing" vdev. For example: sudo zpool create foo raidz1 c1t5000CCA000081D61d0 c1t5000CCA000186235d0 spare c 1t5000CCA000094115d0 sudo zpool replace foo c1t5000CCA000186235d0 c1t5000CCA000094115d0 $ zpool status foo pool: foo state: ONLINE scan: resilvered 81.5K in 0h0m with 0 errors on Fri Sep 8 10:53:03 2017 config: NAME STATE READ WRITE CKSUM foo ONLINE 0 0 0 raidz1-0 ONLINE 0 0 0 c1t5000CCA000081D61d0 ONLINE 0 0 0 spare-1 ONLINE 0 0 0 c1t5000CCA000186235d0 ONLINE 0 0 0 c1t5000CCA000094115d0 ONLINE 0 0 0 spares c1t5000CCA000094115d0 INUSE currently in use $ sudo zinject -d spare-1 -A degrade foo cannot find device 'spare-1' in pool 'foo' $ sudo zpool clear foo spare-1 cannot clear errors for spare-1: no such device in pool Even though there was nothing to clear, those commands shouldn't have reported an error. by contrast, trying to clear "raidz1-0" works just fine: $ sudo zpool clear foo raidz1-0 Reviewed by: Matthew Ahrens Approved by: Gordon Ross Author: Alan Somers Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Mon Jan 22 04:35:17 2018 (r328249) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Mon Jan 22 04:37:04 2018 (r328250) @@ -50,6 +50,7 @@ #include "zfeature_common.h" static int read_efi_label(nvlist_t *config, diskaddr_t *sb); +static boolean_t zpool_vdev_is_interior(const char *name); #define BACKUP_SLICE "s2" @@ -2065,10 +2066,7 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, bo break; } - verify(strncmp(type, VDEV_TYPE_RAIDZ, - strlen(VDEV_TYPE_RAIDZ)) == 0 || - strncmp(type, VDEV_TYPE_MIRROR, - strlen(VDEV_TYPE_MIRROR)) == 0); + verify(zpool_vdev_is_interior(type)); verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ID, &id) == 0); @@ -2175,10 +2173,13 @@ zpool_find_vdev_by_physpath(zpool_handle_t *zhp, const /* * Determine if we have an "interior" top-level vdev (i.e mirror/raidz). */ -boolean_t +static boolean_t zpool_vdev_is_interior(const char *name) { if (strncmp(name, VDEV_TYPE_RAIDZ, strlen(VDEV_TYPE_RAIDZ)) == 0 || + strncmp(name, VDEV_TYPE_SPARE, strlen(VDEV_TYPE_SPARE)) == 0 || + strncmp(name, + VDEV_TYPE_REPLACING, strlen(VDEV_TYPE_REPLACING)) == 0 || strncmp(name, VDEV_TYPE_MIRROR, strlen(VDEV_TYPE_MIRROR)) == 0) return (B_TRUE); return (B_FALSE); From owner-svn-src-all@freebsd.org Mon Jan 22 04:48:16 2018 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 2A878ECDEBD; Mon, 22 Jan 2018 04:48:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 014956AE37; Mon, 22 Jan 2018 04:48:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C181158A3; Mon, 22 Jan 2018 04:48: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 w0M4mFNC033775; Mon, 22 Jan 2018 04:48:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M4mEjB033773; Mon, 22 Jan 2018 04:48:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220448.w0M4mEjB033773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 04:48:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328251 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zpool vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zpool vendor/illumos/dist/lib/libzfs/common X-SVN-Commit-Revision: 328251 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 04:48:16 -0000 Author: mav Date: Mon Jan 22 04:48:14 2018 New Revision: 328251 URL: https://svnweb.freebsd.org/changeset/base/328251 Log: 8652 Tautological comparisons with ZPROP_INVAL illumos/illumos-gate@4ae5f5f06c6c2d1db8167480f7d9e3b5378ba2f2 https://www.illumos.org/issues/8652: Clang and GCC prefer to use unsigned ints to store enums. With Clang, that causes tautological comparison warnings when comparing a zfs_prop_t or zpool_prop_t variable to the macro ZPROP_INVAL. It's likely that error handling code is being silently removed as a result. Reviewed by: Matthew Ahrens Reviewed by: Igor Kozhukhov Approved by: Gordon Ross Author: Alan Somers Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_main.c Mon Jan 22 04:37:04 2018 (r328250) +++ vendor/illumos/dist/cmd/zpool/zpool_main.c Mon Jan 22 04:48:14 2018 (r328251) @@ -440,7 +440,7 @@ add_prop_list(const char *propname, char *propval, nvl * feature@ properties and version should not be specified * at the same time. */ - if ((prop == ZPROP_INVAL && zpool_prop_feature(propname) && + if ((prop == ZPOOL_PROP_INVAL && zpool_prop_feature(propname) && nvlist_exists(proplist, vname)) || (prop == ZPOOL_PROP_VERSION && prop_list_contains_feature(proplist))) { Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Mon Jan 22 04:37:04 2018 (r328250) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Mon Jan 22 04:48:14 2018 (r328251) @@ -445,7 +445,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char const char *propname = nvpair_name(elem); prop = zpool_name_to_prop(propname); - if (prop == ZPROP_INVAL && zpool_prop_feature(propname)) { + if (prop == ZPOOL_PROP_INVAL && zpool_prop_feature(propname)) { int err; char *fname = strchr(propname, '@') + 1; @@ -484,7 +484,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char /* * Make sure this property is valid and applies to this type. */ - if (prop == ZPROP_INVAL) { + if (prop == ZPOOL_PROP_INVAL) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "invalid property '%s'"), propname); (void) zfs_error(hdl, EZFS_BADPROP, errbuf); From owner-svn-src-all@freebsd.org Mon Jan 22 04:48:15 2018 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 D8C39ECDEBA; Mon, 22 Jan 2018 04:48:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B11886AE36; Mon, 22 Jan 2018 04:48: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E64E0158A2; Mon, 22 Jan 2018 04:48:14 +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 w0M4mEGb033768; Mon, 22 Jan 2018 04:48:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M4mEV1033766; Mon, 22 Jan 2018 04:48:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220448.w0M4mEV1033766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 04:48:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328251 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zpool vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zpool vendor/illumos/dist/lib/libzfs/common X-SVN-Commit-Revision: 328251 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 04:48:15 -0000 Author: mav Date: Mon Jan 22 04:48:14 2018 New Revision: 328251 URL: https://svnweb.freebsd.org/changeset/base/328251 Log: 8652 Tautological comparisons with ZPROP_INVAL illumos/illumos-gate@4ae5f5f06c6c2d1db8167480f7d9e3b5378ba2f2 https://www.illumos.org/issues/8652: Clang and GCC prefer to use unsigned ints to store enums. With Clang, that causes tautological comparison warnings when comparing a zfs_prop_t or zpool_prop_t variable to the macro ZPROP_INVAL. It's likely that error handling code is being silently removed as a result. Reviewed by: Matthew Ahrens Reviewed by: Igor Kozhukhov Approved by: Gordon Ross Author: Alan Somers Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Mon Jan 22 04:37:04 2018 (r328250) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Mon Jan 22 04:48:14 2018 (r328251) @@ -335,7 +335,7 @@ spa_prop_get(spa_t *spa, nvlist_t **nvp) zprop_source_t src = ZPROP_SRC_DEFAULT; zpool_prop_t prop; - if ((prop = zpool_name_to_prop(za.za_name)) == ZPROP_INVAL) + if ((prop = zpool_name_to_prop(za.za_name)) == ZPOOL_PROP_INVAL) continue; switch (za.za_integer_length) { @@ -423,7 +423,7 @@ spa_prop_validate(spa_t *spa, nvlist_t *props) zpool_prop_t prop = zpool_name_to_prop(propname); switch (prop) { - case ZPROP_INVAL: + case ZPOOL_PROP_INVAL: if (!zpool_prop_feature(propname)) { error = SET_ERROR(EINVAL); break; @@ -666,7 +666,7 @@ spa_prop_set(spa_t *spa, nvlist_t *nvp) prop == ZPOOL_PROP_READONLY) continue; - if (prop == ZPOOL_PROP_VERSION || prop == ZPROP_INVAL) { + if (prop == ZPOOL_PROP_VERSION || prop == ZPOOL_PROP_INVAL) { uint64_t ver; if (prop == ZPOOL_PROP_VERSION) { @@ -6313,7 +6313,7 @@ spa_sync_props(void *arg, dmu_tx_t *tx) spa_feature_t fid; switch (prop = zpool_name_to_prop(nvpair_name(elem))) { - case ZPROP_INVAL: + case ZPOOL_PROP_INVAL: /* * We checked this earlier in spa_prop_validate(). */ Modified: vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Mon Jan 22 04:37:04 2018 (r328250) +++ vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Mon Jan 22 04:48:14 2018 (r328251) @@ -87,7 +87,9 @@ typedef enum dmu_objset_type { * the property table in usr/src/common/zfs/zfs_prop.c. */ typedef enum { - ZFS_PROP_TYPE, + ZPROP_CONT = -2, + ZPROP_INVAL = -1, + ZFS_PROP_TYPE = 0, ZFS_PROP_CREATION, ZFS_PROP_USED, ZFS_PROP_AVAILABLE, @@ -179,6 +181,7 @@ extern const char *zfs_userquota_prop_prefixes[ZFS_NUM * the property table in usr/src/common/zfs/zpool_prop.c. */ typedef enum { + ZPOOL_PROP_INVAL = -1, ZPOOL_PROP_NAME, ZPOOL_PROP_SIZE, ZPOOL_PROP_CAPACITY, @@ -210,9 +213,6 @@ typedef enum { /* Small enough to not hog a whole line of printout in zpool(1M). */ #define ZPROP_MAX_COMMENT 32 - -#define ZPROP_CONT -2 -#define ZPROP_INVAL -1 #define ZPROP_VALUE "value" #define ZPROP_SOURCE "source" From owner-svn-src-all@freebsd.org Mon Jan 22 05:52:41 2018 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 066DFED0228; Mon, 22 Jan 2018 05:52:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BEB7C6C904; Mon, 22 Jan 2018 05:52:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1309E163E0; Mon, 22 Jan 2018 05:52:40 +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 w0M5qdk8062342; Mon, 22 Jan 2018 05:52:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M5qdxP062338; Mon, 22 Jan 2018 05:52:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220552.w0M5qdxP062338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 05:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328252 - in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/s... X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Commit-Revision: 328252 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 05:52:41 -0000 Author: mav Date: Mon Jan 22 05:52:39 2018 New Revision: 328252 URL: https://svnweb.freebsd.org/changeset/base/328252 Log: MFV r328251: 8652 Tautological comparisons with ZPROP_INVAL illumos/illumos-gate@4ae5f5f06c6c2d1db8167480f7d9e3b5378ba2f2 https://www.illumos.org/issues/8652: Clang and GCC prefer to use unsigned ints to store enums. With Clang, that causes tautological comparison warnings when comparing a zfs_prop_t or zpool_prop_t variable to the macro ZPROP_INVAL. It's likely that error handling code is being silently removed as a result. Reviewed by: Matthew Ahrens Reviewed by: Igor Kozhukhov Approved by: Gordon Ross Author: Alan Somers Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Mon Jan 22 04:48:14 2018 (r328251) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Mon Jan 22 05:52:39 2018 (r328252) @@ -441,7 +441,7 @@ add_prop_list(const char *propname, char *propval, nvl * feature@ properties and version should not be specified * at the same time. */ - if ((prop == ZPROP_INVAL && zpool_prop_feature(propname) && + if ((prop == ZPOOL_PROP_INVAL && zpool_prop_feature(propname) && nvlist_exists(proplist, vname)) || (prop == ZPOOL_PROP_VERSION && prop_list_contains_feature(proplist))) { Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Mon Jan 22 04:48:14 2018 (r328251) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Mon Jan 22 05:52:39 2018 (r328252) @@ -445,7 +445,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char const char *propname = nvpair_name(elem); prop = zpool_name_to_prop(propname); - if (prop == ZPROP_INVAL && zpool_prop_feature(propname)) { + if (prop == ZPOOL_PROP_INVAL && zpool_prop_feature(propname)) { int err; char *fname = strchr(propname, '@') + 1; @@ -484,7 +484,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char /* * Make sure this property is valid and applies to this type. */ - if (prop == ZPROP_INVAL) { + if (prop == ZPOOL_PROP_INVAL) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "invalid property '%s'"), propname); (void) zfs_error(hdl, EZFS_BADPROP, errbuf); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Jan 22 04:48:14 2018 (r328251) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Jan 22 05:52:39 2018 (r328252) @@ -349,7 +349,7 @@ spa_prop_get(spa_t *spa, nvlist_t **nvp) zprop_source_t src = ZPROP_SRC_DEFAULT; zpool_prop_t prop; - if ((prop = zpool_name_to_prop(za.za_name)) == ZPROP_INVAL) + if ((prop = zpool_name_to_prop(za.za_name)) == ZPOOL_PROP_INVAL) continue; switch (za.za_integer_length) { @@ -437,7 +437,7 @@ spa_prop_validate(spa_t *spa, nvlist_t *props) zpool_prop_t prop = zpool_name_to_prop(propname); switch (prop) { - case ZPROP_INVAL: + case ZPOOL_PROP_INVAL: if (!zpool_prop_feature(propname)) { error = SET_ERROR(EINVAL); break; @@ -680,7 +680,7 @@ spa_prop_set(spa_t *spa, nvlist_t *nvp) prop == ZPOOL_PROP_READONLY) continue; - if (prop == ZPOOL_PROP_VERSION || prop == ZPROP_INVAL) { + if (prop == ZPOOL_PROP_VERSION || prop == ZPOOL_PROP_INVAL) { uint64_t ver; if (prop == ZPOOL_PROP_VERSION) { @@ -6658,7 +6658,7 @@ spa_sync_props(void *arg, dmu_tx_t *tx) spa_feature_t fid; switch (prop = zpool_name_to_prop(nvpair_name(elem))) { - case ZPROP_INVAL: + case ZPOOL_PROP_INVAL: /* * We checked this earlier in spa_prop_validate(). */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Mon Jan 22 04:48:14 2018 (r328251) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Mon Jan 22 05:52:39 2018 (r328252) @@ -90,7 +90,9 @@ typedef enum dmu_objset_type { * the property table in usr/src/common/zfs/zfs_prop.c. */ typedef enum { - ZFS_PROP_TYPE, + ZPROP_CONT = -2, + ZPROP_INVAL = -1, + ZFS_PROP_TYPE = 0, ZFS_PROP_CREATION, ZFS_PROP_USED, ZFS_PROP_AVAILABLE, @@ -183,6 +185,7 @@ extern const char *zfs_userquota_prop_prefixes[ZFS_NUM * the property table in usr/src/common/zfs/zpool_prop.c. */ typedef enum { + ZPOOL_PROP_INVAL = -1, ZPOOL_PROP_NAME, ZPOOL_PROP_SIZE, ZPOOL_PROP_CAPACITY, @@ -213,9 +216,6 @@ typedef enum { /* Small enough to not hog a whole line of printout in zpool(1M). */ #define ZPROP_MAX_COMMENT 32 - -#define ZPROP_CONT -2 -#define ZPROP_INVAL -1 #define ZPROP_VALUE "value" #define ZPROP_SOURCE "source" From owner-svn-src-all@freebsd.org Mon Jan 22 05:55:44 2018 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 C9CD9ED03BD; Mon, 22 Jan 2018 05:55:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A2E766CA94; Mon, 22 Jan 2018 05:55: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B47B7163E2; Mon, 22 Jan 2018 05:55: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 w0M5thh8062501; Mon, 22 Jan 2018 05:55:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M5th55062500; Mon, 22 Jan 2018 05:55:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220555.w0M5th55062500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 05:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328253 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 328253 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 05:55:44 -0000 Author: mav Date: Mon Jan 22 05:55:43 2018 New Revision: 328253 URL: https://svnweb.freebsd.org/changeset/base/328253 Log: 8835 Speculative prefetch in ZFS not working for misaligned reads illumos/illumos-gate@5cb8d943bc8513c6230589aad5a409d58b0297cb https://www.illumos.org/issues/8835: Sequential reads not aligned to block size are not detected by ZFS prefetcher as sequential, killing prefetch and severely hurting performance. It is caused by dmu_zfetch() in case of misaligned sequential accesses being called with overlap of one block. Reviewed by: Matthew Ahrens Reviewed by: Allan Jude Approved by: Gordon Ross Author: Alexander Motin Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_zfetch.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_zfetch.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_zfetch.c Mon Jan 22 05:52:39 2018 (r328252) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_zfetch.c Mon Jan 22 05:55:43 2018 (r328253) @@ -224,19 +224,33 @@ dmu_zfetch(zfetch_t *zf, uint64_t blkid, uint64_t nblk rw_enter(&zf->zf_rwlock, RW_READER); + /* + * Find matching prefetch stream. Depending on whether the accesses + * are block-aligned, first block of the new access may either follow + * the last block of the previous access, or be equal to it. + */ for (zs = list_head(&zf->zf_stream); zs != NULL; zs = list_next(&zf->zf_stream, zs)) { - if (blkid == zs->zs_blkid) { + if (blkid == zs->zs_blkid || blkid + 1 == zs->zs_blkid) { mutex_enter(&zs->zs_lock); /* * zs_blkid could have changed before we * acquired zs_lock; re-check them here. */ - if (blkid != zs->zs_blkid) { - mutex_exit(&zs->zs_lock); - continue; + if (blkid == zs->zs_blkid) { + break; + } else if (blkid + 1 == zs->zs_blkid) { + blkid++; + nblks--; + if (nblks == 0) { + /* Already prefetched this before. */ + mutex_exit(&zs->zs_lock); + rw_exit(&zf->zf_rwlock); + return; + } + break; } - break; + mutex_exit(&zs->zs_lock); } } From owner-svn-src-all@freebsd.org Mon Jan 22 05:57:15 2018 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 9222EED04AE; Mon, 22 Jan 2018 05:57:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C3B26CC0A; Mon, 22 Jan 2018 05:57: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BADB8163F6; Mon, 22 Jan 2018 05:57:14 +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 w0M5vEnC062611; Mon, 22 Jan 2018 05:57:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M5vECt062610; Mon, 22 Jan 2018 05:57:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220557.w0M5vECt062610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 05:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328254 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 328254 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 05:57:15 -0000 Author: mav Date: Mon Jan 22 05:57:14 2018 New Revision: 328254 URL: https://svnweb.freebsd.org/changeset/base/328254 Log: MFV r328253: 8835 Speculative prefetch in ZFS not working for misaligned reads illumos/illumos-gate@5cb8d943bc8513c6230589aad5a409d58b0297cb https://www.illumos.org/issues/8835: Sequential reads not aligned to block size are not detected by ZFS prefetcher as sequential, killing prefetch and severely hurting performance. It is caused by dmu_zfetch() in case of misaligned sequential accesses being called with overlap of one block. Reviewed by: Matthew Ahrens Reviewed by: Allan Jude Approved by: Gordon Ross Author: Alexander Motin Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Mon Jan 22 05:55:43 2018 (r328253) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Mon Jan 22 05:57:14 2018 (r328254) @@ -240,19 +240,33 @@ dmu_zfetch(zfetch_t *zf, uint64_t blkid, uint64_t nblk rw_enter(&zf->zf_rwlock, RW_READER); + /* + * Find matching prefetch stream. Depending on whether the accesses + * are block-aligned, first block of the new access may either follow + * the last block of the previous access, or be equal to it. + */ for (zs = list_head(&zf->zf_stream); zs != NULL; zs = list_next(&zf->zf_stream, zs)) { - if (blkid == zs->zs_blkid) { + if (blkid == zs->zs_blkid || blkid + 1 == zs->zs_blkid) { mutex_enter(&zs->zs_lock); /* * zs_blkid could have changed before we * acquired zs_lock; re-check them here. */ - if (blkid != zs->zs_blkid) { - mutex_exit(&zs->zs_lock); - continue; + if (blkid == zs->zs_blkid) { + break; + } else if (blkid + 1 == zs->zs_blkid) { + blkid++; + nblks--; + if (nblks == 0) { + /* Already prefetched this before. */ + mutex_exit(&zs->zs_lock); + rw_exit(&zf->zf_rwlock); + return; + } + break; } - break; + mutex_exit(&zs->zs_lock); } } From owner-svn-src-all@freebsd.org Mon Jan 22 05:59:50 2018 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 1F3F6ED0675; Mon, 22 Jan 2018 05:59:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EFE146CDA3; Mon, 22 Jan 2018 05:59:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C844163F7; Mon, 22 Jan 2018 05:59:49 +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 w0M5xn1T062737; Mon, 22 Jan 2018 05:59:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M5xnbs062736; Mon, 22 Jan 2018 05:59:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220559.w0M5xnbs062736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 05:59:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328255 - vendor/illumos/dist/cmd/zfs X-SVN-Group: vendor X-SVN-Commit-Author: mav X-SVN-Commit-Paths: vendor/illumos/dist/cmd/zfs X-SVN-Commit-Revision: 328255 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 05:59:50 -0000 Author: mav Date: Mon Jan 22 05:59:48 2018 New Revision: 328255 URL: https://svnweb.freebsd.org/changeset/base/328255 Log: 8972 zfs holds: In scripted mode, do not pad columns with spaces illumos/illumos-gate@e9b7d6e7f7a6477679a35b73eb3934b096b3dd39 https://www.illumos.org/issues/8972: 'zfs holds -H' does not properly output content in scripted mode. It uses a tab instead of two spaces, but it still pads column widths with spaces when it should not. Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Allan Jude Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c ============================================================================== --- vendor/illumos/dist/cmd/zfs/zfs_main.c Mon Jan 22 05:57:14 2018 (r328254) +++ vendor/illumos/dist/cmd/zfs/zfs_main.c Mon Jan 22 05:59:48 2018 (r328255) @@ -5569,8 +5569,6 @@ print_holds(boolean_t scripted, size_t nwidth, size_t uint64_t val = 0; time_t time; struct tm t; - char sep = scripted ? '\t' : ' '; - size_t sepnum = scripted ? 1 : 2; (void) nvpair_value_uint64(nvp2, &val); time = (time_t)val; @@ -5578,8 +5576,13 @@ print_holds(boolean_t scripted, size_t nwidth, size_t (void) strftime(tsbuf, DATETIME_BUF_LEN, gettext(STRFTIME_FMT_STR), &t); - (void) printf("%-*s%*c%-*s%*c%s\n", nwidth, zname, - sepnum, sep, tagwidth, tagname, sepnum, sep, tsbuf); + if (scripted) { + (void) printf("%s\t%s\t%s\n", zname, + tagname, tsbuf); + } else { + (void) printf("%-*s %-*s %s\n", nwidth, + zname, tagwidth, tagname, tsbuf); + } } } } From owner-svn-src-all@freebsd.org Mon Jan 22 06:00:46 2018 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 C1257ED0725; Mon, 22 Jan 2018 06:00:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BE666CF02; Mon, 22 Jan 2018 06:00: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D170716403; Mon, 22 Jan 2018 06:00:45 +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 w0M60jIj062866; Mon, 22 Jan 2018 06:00:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M60jxv062865; Mon, 22 Jan 2018 06:00:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220600.w0M60jxv062865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 06:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328256 - head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 328256 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 06:00:46 -0000 Author: mav Date: Mon Jan 22 06:00:45 2018 New Revision: 328256 URL: https://svnweb.freebsd.org/changeset/base/328256 Log: MFV r328255: 8972 zfs holds: In scripted mode, do not pad columns with spaces illumos/illumos-gate@e9b7d6e7f7a6477679a35b73eb3934b096b3dd39 https://www.illumos.org/issues/8972: 'zfs holds -H' does not properly output content in scripted mode. It uses a tab instead of two spaces, but it still pads column widths with spaces when it should not. Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Allan Jude Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zfs/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Mon Jan 22 05:59:48 2018 (r328255) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Mon Jan 22 06:00:45 2018 (r328256) @@ -5636,8 +5636,6 @@ print_holds(boolean_t scripted, boolean_t literal, siz uint64_t val = 0; time_t time; struct tm t; - char sep = scripted ? '\t' : ' '; - size_t sepnum = scripted ? 1 : 2; (void) nvpair_value_uint64(nvp2, &val); if (literal) @@ -5649,8 +5647,13 @@ print_holds(boolean_t scripted, boolean_t literal, siz gettext(STRFTIME_FMT_STR), &t); } - (void) printf("%-*s%*c%-*s%*c%s\n", nwidth, zname, - sepnum, sep, tagwidth, tagname, sepnum, sep, tsbuf); + if (scripted) { + (void) printf("%s\t%s\t%s\n", zname, + tagname, tsbuf); + } else { + (void) printf("%-*s %-*s %s\n", nwidth, + zname, tagwidth, tagname, tsbuf); + } } } } From owner-svn-src-all@freebsd.org Mon Jan 22 06:32:11 2018 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 99255ED18E9; Mon, 22 Jan 2018 06:32:11 +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 78D886DE9E; Mon, 22 Jan 2018 06:32:11 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id A8A555462; Mon, 22 Jan 2018 06:32:10 +0000 (UTC) Date: Mon, 22 Jan 2018 06:32:10 +0000 From: Alexey Dokuchaev To: Jason Evans Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r319971 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src include lib/libc/stdlib/jemalloc Message-ID: <20180122063210.GA43383@FreeBSD.org> References: <201706150715.v5F7F6aT031218@repo.freebsd.org> <20180113170430.GA52597@FreeBSD.org> <20180118101031.GB21646@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180118101031.GB21646@FreeBSD.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 06:32:11 -0000 On Thu, Jan 18, 2018 at 10:10:31AM +0000, Alexey Dokuchaev wrote: > On Sat, Jan 13, 2018 at 05:04:30PM +0000, Alexey Dokuchaev wrote: > > On Thu, Jun 15, 2017 at 07:15:06AM +0000, Jason Evans wrote: > > > New Revision: 319971 > > > URL: https://svnweb.freebsd.org/changeset/base/319971 > > > > > > Log: > > > Update jemalloc to 5.0.0. > > > > I've finally bisected the problem of `games/quake2lnx' failing to start > > (hanging) in GLX mode down to this commit. Reverting it and making "all > > install" under `/usr/src/lib/libc' restores correct operation. > > > > If I run it as ``env LD_PRELOAD=/lib/libthr.so.3 quake2 ...'' it starts > > normally. Do you have any ideas what might have broken it? Is this a > > problem with how the Quake2 binary is linked, or with jemalloc? > > > > To reproduce: > > > > $ cd /usr/ports/games/quake2lnx && make all install > > $ quake2 +set vid_ref glx > > Last two comments in https://github.com/jemalloc/jemalloc/issues/907 > (October 10th-ish) could be related... I've just found out that similar bug was already reported back in July: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220767 ./danfe From owner-svn-src-all@freebsd.org Mon Jan 22 07:10:32 2018 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 68808ED2F22; Mon, 22 Jan 2018 07:10:32 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 339536EF11; Mon, 22 Jan 2018 07:10:32 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7496B16F47; Mon, 22 Jan 2018 07:10:31 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0M7AVmU091859; Mon, 22 Jan 2018 07:10:31 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M7AUm9091853; Mon, 22 Jan 2018 07:10:30 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201801220710.w0M7AUm9091853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Mon, 22 Jan 2018 07:10:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: in head/sys: arm/broadcom/bcm2835 dts/arm modules X-SVN-Commit-Revision: 328257 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 07:10:32 -0000 Author: phk Date: Mon Jan 22 07:10:30 2018 New Revision: 328257 URL: https://svnweb.freebsd.org/changeset/base/328257 Log: Add a skeleton Clock Manager for RPi2/3, and use that from pwm instead of frobbing the registers directly. As a hack the bcm2835_pwm kmod presently ignores the 'status="disabled"' in the RPI3 DTB, assuming that if you load the kld you probably want the PWM to work. Added: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c (contents, props changed) head/sys/arm/broadcom/bcm2835/bcm2835_clkman.h (contents, props changed) Modified: head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c head/sys/dts/arm/bcm2836.dtsi head/sys/modules/Makefile Added: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c Mon Jan 22 07:10:30 2018 (r328257) @@ -0,0 +1,212 @@ +/*- + * Copyright (C) 2013-2015 Daisuke Aoyama + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +static struct ofw_compat_data compat_data[] = { + {"brcm,bcm2835-cprman", 1}, + {"broadcom,bcm2835-cprman", 1}, + {NULL, 0} +}; + +struct bcm2835_clkman_softc { + device_t sc_dev; + + struct resource * sc_m_res; + bus_space_tag_t sc_m_bst; + bus_space_handle_t sc_m_bsh; +}; + +#define BCM_CLKMAN_WRITE(_sc, _off, _val) \ + bus_space_write_4(_sc->sc_m_bst, _sc->sc_m_bsh, _off, _val) +#define BCM_CLKMAN_READ(_sc, _off) \ + bus_space_read_4(_sc->sc_m_bst, _sc->sc_m_bsh, _off) + +#define W_CMCLK(_sc, unit, _val) BCM_CLKMAN_WRITE(_sc, unit, 0x5a000000 | (_val)) +#define R_CMCLK(_sc, unit) BCM_CLKMAN_READ(_sc, unit) +#define W_CMDIV(_sc, unit, _val) BCM_CLKMAN_WRITE(_sc, (unit) + 4, 0x5a000000 | (_val)) +#define R_CMDIV(_sc, unit) BCM_CLKMAN_READ(_sc, (unit) + 4) + +static int +bcm2835_clkman_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "BCM283x Clock Manager"); + + return (BUS_PROBE_DEFAULT); +} + +static int +bcm2835_clkman_attach(device_t dev) +{ + struct bcm2835_clkman_softc *sc; + int rid; + + if (device_get_unit(dev) != 0) { + device_printf(dev, "only one clk manager supported\n"); + return (ENXIO); + } + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + rid = 0; + sc->sc_m_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_m_res) { + device_printf(dev, "cannot allocate memory window\n"); + return (ENXIO); + } + + sc->sc_m_bst = rman_get_bustag(sc->sc_m_res); + sc->sc_m_bsh = rman_get_bushandle(sc->sc_m_res); + + return (bus_generic_attach(dev)); +} + +uint32_t +bcm2835_clkman_set_frequency(device_t dev, uint32_t unit, uint32_t hz) +{ + struct bcm2835_clkman_softc *sc; + int i; + uint32_t u; + + sc = device_get_softc(dev); + + if (unit != BCM_PWM_CLKSRC) { + device_printf(sc->sc_dev, + "Unsupported unit 0x%x", unit); + return (0); + } + + W_CMCLK(sc, unit, 6); + for (i = 0; i < 10; i++) { + u = R_CMCLK(sc, unit); + if (!(u&0x80)) + break; + DELAY(1000); + } + if (u & 0x80) { + device_printf(sc->sc_dev, + "Failed to stop clock for unit 0x%x", unit); + return (0); + } + if (hz == 0) + return (0); + + u = 500000000/hz; + if (u < 4) { + device_printf(sc->sc_dev, + "Frequency too high for unit 0x%x (max: 125MHz)", + unit); + return (0); + } + if (u > 0xfff) { + device_printf(sc->sc_dev, + "Frequency too low for unit 0x%x (min: 123Hz)", + unit); + return (0); + } + hz = 500000000/u; + W_CMDIV(sc, unit, u << 12); + + W_CMCLK(sc, unit, 0x16); + for (i = 0; i < 10; i++) { + u = R_CMCLK(sc, unit); + if ((u&0x80)) + break; + DELAY(1000); + } + if (!(u & 0x80)) { + device_printf(sc->sc_dev, + "Failed to start clock for unit 0x%x", unit); + return (0); + } + return (hz); +} + +static int +bcm2835_clkman_detach(device_t dev) +{ + struct bcm2835_clkman_softc *sc; + + bus_generic_detach(dev); + + sc = device_get_softc(dev); + if (sc->sc_m_res) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_m_res); + + return (0); +} + +static device_method_t bcm2835_clkman_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, bcm2835_clkman_probe), + DEVMETHOD(device_attach, bcm2835_clkman_attach), + DEVMETHOD(device_detach, bcm2835_clkman_detach), + + DEVMETHOD_END +}; + +static devclass_t bcm2835_clkman_devclass; +static driver_t bcm2835_clkman_driver = { + "bcm2835_clkman", + bcm2835_clkman_methods, + sizeof(struct bcm2835_clkman_softc), +}; + +DRIVER_MODULE(bcm2835_clkman, simplebus, bcm2835_clkman_driver, + bcm2835_clkman_devclass, 0, 0); +MODULE_VERSION(bcm2835_clkman, 1); Added: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/broadcom/bcm2835/bcm2835_clkman.h Mon Jan 22 07:10:30 2018 (r328257) @@ -0,0 +1,43 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017 Poul-Henning Kamp + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _BCM2835_CLKMAN_H_ +#define _BCM2835_CLKMAN_H_ + +// Offset into BAR0 for unit +enum bcm2835_clksrc { + BCM_GPIO0_CLKSRC = 0x70, + BCM_GPIO1_CLKSRC = 0x78, + BCM_GPIO2_CLKSRC = 0x80, + BCM_PWM_CLKSRC = 0xa0, +}; + +uint32_t bcm2835_clkman_set_frequency(device_t, uint32_t, uint32_t); + +#endif /* _BCM2835_CLKMAN_H_ */ Modified: head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Mon Jan 22 06:00:45 2018 (r328256) +++ head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Mon Jan 22 07:10:30 2018 (r328257) @@ -42,12 +42,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include +#include static struct ofw_compat_data compat_data[] = { {"broadcom,bcm2835-pwm", 1}, @@ -62,9 +62,7 @@ struct bcm_pwm_softc { bus_space_tag_t sc_m_bst; bus_space_handle_t sc_m_bsh; - struct resource * sc_clk_res; - bus_space_tag_t sc_c_bst; - bus_space_handle_t sc_c_bsh; + device_t clkman; uint32_t freq; uint32_t period; @@ -91,15 +89,9 @@ struct bcm_pwm_softc { #define W_DAT(_sc, _val) BCM_PWM_MEM_WRITE(_sc, 0x14, _val) #define R_DAT(_sc) BCM_PWM_MEM_READ(_sc, 0x14) -#define W_CMCLK(_sc, _val) BCM_PWM_CLK_WRITE(_sc, 0x00, 0x5a000000 | (_val)) -#define R_CMCLK(_sc) BCM_PWM_CLK_READ(_sc, 0x00) -#define W_CMDIV(_sc, _val) BCM_PWM_CLK_WRITE(_sc, 0x04, 0x5a000000 | (_val)) -#define R_CMDIV(_s) BCM_PWM_CLK_READ(_sc, 0x04) - static int bcm_pwm_reconf(struct bcm_pwm_softc *sc) { - int i; uint32_t u; device_t gpio; @@ -107,22 +99,10 @@ bcm_pwm_reconf(struct bcm_pwm_softc *sc) W_CTL(sc, 0); /* Stop PWM clock */ - W_CMCLK(sc, 6); - for (i = 0; i < 10; i++) { - u = R_CMCLK(sc); - if (!(u&0x80)) - break; - DELAY(1000); - } - if (u&0x80) { - device_printf(sc->sc_dev, "Failed to stop clock\n"); - return(EIO); - } + (void)bcm2835_clkman_set_frequency(sc->clkman, BCM_PWM_CLKSRC, 0); - if (sc->mode == 0) { - // XXX: GPIO cfg ? + if (sc->mode == 0) return (0); - } /* Ask GPIO0 to set ALT0 for pin 12 */ gpio = devclass_get_device(devclass_find("gpio"), 0); @@ -132,32 +112,11 @@ bcm_pwm_reconf(struct bcm_pwm_softc *sc) } bcm_gpio_set_alternate(gpio, 12, BCM_GPIO_ALT0); - /* Configure divider */ - u = 500000000/sc->freq; - if (u < 4) { - device_printf(sc->sc_dev, "Freq too high (max 125MHz)\n"); - return(EINVAL); - } - if (u > 0xfff) { - device_printf(sc->sc_dev, "Freq too low (min 123Hz)\n"); - return(EINVAL); - } - sc->freq = 500000000/u; - W_CMDIV(sc, u << 12); + u = bcm2835_clkman_set_frequency(sc->clkman, BCM_PWM_CLKSRC, sc->freq); + if (u == 0) + return (EINVAL); + sc->freq = u; - /* Start PWM clock */ - W_CMCLK(sc, 0x16); - for (i = 0; i < 10; i++) { - u = R_CMCLK(sc); - if ((u&0x80)) - break; - DELAY(1000); - } - if (!(u&0x80)) { - device_printf(sc->sc_dev, "Failed to start clock\n"); - return(EIO); - } - /* Config PWM */ W_RNG(sc, sc->period); if (sc->ratio > sc->period) @@ -266,19 +225,13 @@ bcm_pwm_reg_proc(SYSCTL_HANDLER_ARGS) int error; sc = (struct bcm_pwm_softc *)arg1; - if (arg2 & 0x100) - reg = BCM_PWM_CLK_READ(sc, arg2 & 0xff); - else - reg = BCM_PWM_MEM_READ(sc, arg2 & 0xff); + reg = BCM_PWM_MEM_READ(sc, arg2 & 0xff); error = sysctl_handle_int(oidp, ®, sizeof(reg), req); if (error != 0 || req->newptr == NULL) return (error); - if (arg2 & 0x100) - BCM_PWM_CLK_WRITE(sc, arg2 & 0xff, reg); - else - BCM_PWM_MEM_WRITE(sc, arg2, reg); + BCM_PWM_MEM_WRITE(sc, arg2, reg); return (0); } @@ -301,8 +254,6 @@ bcm_pwm_sysctl_init(struct bcm_pwm_softc *sc) CTLFLAG_RW | CTLTYPE_UINT, sc, 0x##x, \ bcm_pwm_reg_proc, "IU", "Register 0x" #x " " y); - RR(100, "PWMCTL") - RR(104, "PWMDIV") RR(24, "DAT2") RR(20, "RNG2") RR(18, "FIF1") @@ -335,8 +286,12 @@ static int bcm_pwm_probe(device_t dev) { +#if 0 + // XXX: default state is disabled in RPI3 DTB, assume for now + // XXX: that people want the PWM to work if the KLD this module. if (!ofw_bus_status_okay(dev)) return (ENXIO); +#endif if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); @@ -360,6 +315,12 @@ bcm_pwm_attach(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; + sc->clkman = devclass_get_device(devclass_find("bcm2835_clkman"), 0); + if (sc->clkman == NULL) { + device_printf(dev, "cannot find Clock Manager\n"); + return (ENXIO); + } + rid = 0; sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -371,16 +332,6 @@ bcm_pwm_attach(device_t dev) sc->sc_m_bst = rman_get_bustag(sc->sc_mem_res); sc->sc_m_bsh = rman_get_bushandle(sc->sc_mem_res); - rid = 1; - sc->sc_clk_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); - if (!sc->sc_clk_res) { - device_printf(dev, "cannot allocate clock window\n"); - return (ENXIO); - } - sc->sc_c_bst = rman_get_bustag(sc->sc_clk_res); - sc->sc_c_bsh = rman_get_bushandle(sc->sc_clk_res); - /* Add sysctl nodes. */ bcm_pwm_sysctl_init(sc); @@ -400,12 +351,10 @@ bcm_pwm_detach(device_t dev) bus_generic_detach(dev); sc = device_get_softc(dev); - sc->mode = 0; + sc->mode = 0; (void)bcm_pwm_reconf(sc); if (sc->sc_mem_res) bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); - if (sc->sc_clk_res) - bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_clk_res); return (0); } @@ -414,17 +363,15 @@ static phandle_t bcm_pwm_get_node(device_t bus, device_t dev) { - /* We only have one child, the SPI bus, which needs our own node. */ return (ofw_bus_get_node(bus)); } + static device_method_t bcm_pwm_methods[] = { /* Device interface */ DEVMETHOD(device_probe, bcm_pwm_probe), DEVMETHOD(device_attach, bcm_pwm_attach), DEVMETHOD(device_detach, bcm_pwm_detach), - - /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, bcm_pwm_get_node), DEVMETHOD_END @@ -439,3 +386,4 @@ static driver_t bcm_pwm_driver = { }; DRIVER_MODULE(bcm2835_pwm, simplebus, bcm_pwm_driver, bcm_pwm_devclass, 0, 0); +MODULE_DEPEND(bcm2835_pwm, bcm2835_clkman, 1, 1, 1); Modified: head/sys/dts/arm/bcm2836.dtsi ============================================================================== --- head/sys/dts/arm/bcm2836.dtsi Mon Jan 22 06:00:45 2018 (r328256) +++ head/sys/dts/arm/bcm2836.dtsi Mon Jan 22 07:10:30 2018 (r328257) @@ -389,6 +389,11 @@ }; }; + cprman { + compatible = "broadcom,bcm2835-cprman"; + reg = <0x101000 0x2000>; + }; + rng { compatible = "broadcom,bcm2835-rng", "broadcom,bcm2708-rng"; @@ -427,7 +432,7 @@ pwm0 { compatible = "broadcom,bcm2835-pwm"; - reg = <0x20c000 0x28>,<0x1010a0 8>; + reg = <0x20c000 0x28>; }; dma: dma { Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Mon Jan 22 06:00:45 2018 (r328256) +++ head/sys/modules/Makefile Mon Jan 22 07:10:30 2018 (r328257) @@ -60,6 +60,7 @@ SUBDIR= \ ${_autofs} \ ${_auxio} \ ${_bce} \ + ${_bcm283x_clkman} \ ${_bcm283x_pwm} \ bfe \ bge \ @@ -808,6 +809,7 @@ _cloudabi64= cloudabi64 .endif .if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64" +_bcm283x_clkman= bcm283x_clkman _bcm283x_pwm= bcm283x_pwm .endif From owner-svn-src-all@freebsd.org Mon Jan 22 07:15:26 2018 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 13C2DED32B0; Mon, 22 Jan 2018 07:15:26 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E30636F36A; Mon, 22 Jan 2018 07:15:25 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2449E170D2; Mon, 22 Jan 2018 07:15:25 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0M7FOj0095687; Mon, 22 Jan 2018 07:15:24 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M7FO6n095686; Mon, 22 Jan 2018 07:15:24 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201801220715.w0M7FO6n095686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Mon, 22 Jan 2018 07:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328258 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 328258 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 07:15:26 -0000 Author: phk Date: Mon Jan 22 07:15:24 2018 New Revision: 328258 URL: https://svnweb.freebsd.org/changeset/base/328258 Log: Forgot to edit copy&pasted copyright blurb. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c Mon Jan 22 07:10:30 2018 (r328257) +++ head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c Mon Jan 22 07:15:24 2018 (r328258) @@ -1,6 +1,7 @@ /*- - * Copyright (C) 2013-2015 Daisuke Aoyama - * All rights reserved. + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017 Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Mon Jan 22 07:10:30 2018 (r328257) +++ head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Mon Jan 22 07:15:24 2018 (r328258) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2017 Poul-Henning Kamp + * Copyright (c) 2017 Poul-Henning Kamp * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@freebsd.org Mon Jan 22 07:43:56 2018 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 03683ED4117; Mon, 22 Jan 2018 07:43:56 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5A506FF91; Mon, 22 Jan 2018 07:43:55 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E729C17593; Mon, 22 Jan 2018 07:43:54 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0M7hs5w008173; Mon, 22 Jan 2018 07:43:54 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M7hspG008170; Mon, 22 Jan 2018 07:43:54 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201801220743.w0M7hspG008170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Mon, 22 Jan 2018 07:43:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328259 - in head: share/man/man4 sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: in head: share/man/man4 sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 328259 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 07:43:56 -0000 Author: phk Date: Mon Jan 22 07:43:54 2018 New Revision: 328259 URL: https://svnweb.freebsd.org/changeset/base/328259 Log: Add skeleton manual page for bcm283x_pwm (Feel free to improve this) Added: head/share/man/man4/bcm283x_pwm.4 (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon Jan 22 07:15:24 2018 (r328258) +++ head/share/man/man4/Makefile Mon Jan 22 07:43:54 2018 (r328259) @@ -78,6 +78,7 @@ MAN= aac.4 \ axe.4 \ axge.4 \ bce.4 \ + ${_bcm283x_pwm.4} \ bcma.4 \ bfe.4 \ bge.4 \ @@ -881,6 +882,10 @@ _vmm.4= vmm.4 .if ${MACHINE_CPUARCH} == "mips" _nvram2env.4= nvram2env.4 +.endif + +.if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64" +_bcm283x_pwm.4= bcm283x_pwm.4 .endif .if exists(${.CURDIR}/man4.${MACHINE_CPUARCH}) Added: head/share/man/man4/bcm283x_pwm.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/bcm283x_pwm.4 Mon Jan 22 07:43:54 2018 (r328259) @@ -0,0 +1,97 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2017 Poul-Henning Kamp +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 22, 2017 +.Dt BCM283X_PWM 4 +.Os +.Sh NAME +.Nm bcm283x_pwm +.Nd bcm283x_pwm - driver for Raspberry Pi 2/3 PWM +.Sh SYNOPSIS +.Cd "kldload bcm283x_clkman" +.Cd "kldload bcm283x_pwm" +.Sh DESCRIPTION +The +.Nm +driver provides access to the PWM engine on GPIO12 of Rpi 2 and 3 hardware. +.Pp +The PWM hardware is controlled via the +.Xr sysctl 8 +interface: +.Bd -literal +dev.pwm.0.mode: 1 +dev.pwm.0.freq: 125000000 +dev.pwm.0.ratio: 2500 +dev.pwm.0.period: 10000 +dev.pwm.0.pwm_freq: 12500 +.Ed +.Bl -tag -width ".Va dev.pwm.0.mode" +.It Va dev.pwm.0.mode +Three modes exist, 0=off, 1=PWM, 2=N/M. +The N/M mode is a first order delta-sigma mode, which makes a quite +handy DAC output with a trivial RC lowpass filter. +.Pp +.It Va dev.pwm.0.freq +The input frequency to the PWM hardware in Hz. +Minmum frequency is 123 kHz, maximum frequency is 125 MHz. +.It Va dev.pwm.0.period +The period length in cycles. +In PWM mode, the output frequency will be +( +.Va dev.pwm.0.freq +/ +.Va dev.pwm.0.period . +) +In N/M mode this is the 'M' +.It Va dev.pwm.0.ratio +The "on" period in cycles. +In PWM mode, to get a 25% dutycycle, set this to 25% of +.Va dev.pwm.0.period . +In N/M mode this is the 'N' +.It Va dev.pwm.0.pwm_freq +The calculated PWM output frequency in PWM mode. +.El +.Pp +.Sh NOTES +Currently the +.Nm +driver ignores the 'status="disabled"' flag in the DTB, assuming that +if you load the driver, you want it to work. +.Sh SEE ALSO +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver and this manual page were written by +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . Modified: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c Mon Jan 22 07:15:24 2018 (r328258) +++ head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c Mon Jan 22 07:43:54 2018 (r328259) @@ -150,13 +150,13 @@ bcm2835_clkman_set_frequency(device_t dev, uint32_t un u = 500000000/hz; if (u < 4) { device_printf(sc->sc_dev, - "Frequency too high for unit 0x%x (max: 125MHz)", + "Frequency too high for unit 0x%x (max: 125 MHz)", unit); return (0); } if (u > 0xfff) { device_printf(sc->sc_dev, - "Frequency too low for unit 0x%x (min: 123Hz)", + "Frequency too low for unit 0x%x (min: 123 kHz)", unit); return (0); } From owner-svn-src-all@freebsd.org Mon Jan 22 07:48:38 2018 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 104C9ED4365; Mon, 22 Jan 2018 07:48:38 +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 E604D70189; Mon, 22 Jan 2018 07:48:37 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 430F161BF; Mon, 22 Jan 2018 07:48:37 +0000 (UTC) Date: Mon, 22 Jan 2018 07:48:37 +0000 From: Alexey Dokuchaev To: Poul-Henning Kamp Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328259 - in head: share/man/man4 sys/arm/broadcom/bcm2835 Message-ID: <20180122074837.GA39396@FreeBSD.org> References: <201801220743.w0M7hspG008170@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201801220743.w0M7hspG008170@repo.freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 07:48:38 -0000 On Mon, Jan 22, 2018 at 07:43:54AM +0000, Poul-Henning Kamp wrote: > New Revision: 328259 > URL: https://svnweb.freebsd.org/changeset/base/328259 > > Log: > Add skeleton manual page for bcm283x_pwm > > (Feel free to improve this) > > Added: > head/share/man/man4/bcm283x_pwm.4 (contents, props changed) > Modified: > head/share/man/man4/Makefile > head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c > > ... > Modified: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c > ============================================================================== > --- head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c Mon Jan 22 07:15:24 2018 (r328258) > +++ head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c Mon Jan 22 07:43:54 2018 (r328259) > @@ -150,13 +150,13 @@ bcm2835_clkman_set_frequency(device_t dev, uint32_t un > u = 500000000/hz; > if (u < 4) { > device_printf(sc->sc_dev, > - "Frequency too high for unit 0x%x (max: 125MHz)", > + "Frequency too high for unit 0x%x (max: 125 MHz)", > unit); > return (0); > } > if (u > 0xfff) { > device_printf(sc->sc_dev, > - "Frequency too low for unit 0x%x (min: 123Hz)", > + "Frequency too low for unit 0x%x (min: 123 kHz)", > unit); These changes look unrelated to the manual page. Is this intended? On a related note, this code contains a number of style bugs, you might want to do a quick sweep on fixing them. ./danfe From owner-svn-src-all@freebsd.org Mon Jan 22 07:51:18 2018 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 45BEDED46DC; Mon, 22 Jan 2018 07:51:18 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 0E64B70419; Mon, 22 Jan 2018 07:51:17 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id 0F9B52737A; Mon, 22 Jan 2018 07:51:10 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w0M7osTW086600 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 22 Jan 2018 07:50:55 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0M7oscC086599; Mon, 22 Jan 2018 07:50:54 GMT (envelope-from phk) To: Alexey Dokuchaev cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328259 - in head: share/man/man4 sys/arm/broadcom/bcm2835 In-reply-to: <20180122074837.GA39396@FreeBSD.org> From: "Poul-Henning Kamp" References: <201801220743.w0M7hspG008170@repo.freebsd.org> <20180122074837.GA39396@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <86597.1516607454.1@critter.freebsd.dk> Date: Mon, 22 Jan 2018 07:50:54 +0000 Message-ID: <86598.1516607454@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 07:51:18 -0000 -------- In message <20180122074837.GA39396@FreeBSD.org>, Alexey Dokuchaev writes: >These changes look unrelated to the manual page. Is this intended? Actually they're not unrelated, I spotted the units-error while writing the manual page. >On a related note, this code contains a number of style bugs, you might >want to do a quick sweep on fixing them. There will probably be other revisions to this code and I'll fold them in as I find them. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-all@freebsd.org Mon Jan 22 08:34:00 2018 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 4E3E4ED6279; Mon, 22 Jan 2018 08:34:00 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2958E71A29; Mon, 22 Jan 2018 08:34:00 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6659417D6F; Mon, 22 Jan 2018 08:33:59 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0M8XxP1028513; Mon, 22 Jan 2018 08:33:59 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M8Xx3i028512; Mon, 22 Jan 2018 08:33:59 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201801220833.w0M8Xx3i028512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Mon, 22 Jan 2018 08:33:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328260 - head/sys/modules/bcm283x_clkman X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: head/sys/modules/bcm283x_clkman X-SVN-Commit-Revision: 328260 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 08:34:00 -0000 Author: phk Date: Mon Jan 22 08:33:59 2018 New Revision: 328260 URL: https://svnweb.freebsd.org/changeset/base/328260 Log: Forgot to add the skeleton BCM283x Clock Manager Reminded by: lwhsu Added: head/sys/modules/bcm283x_clkman/ head/sys/modules/bcm283x_clkman/Makefile (contents, props changed) Added: head/sys/modules/bcm283x_clkman/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/bcm283x_clkman/Makefile Mon Jan 22 08:33:59 2018 (r328260) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/arm/broadcom/bcm2835/ + +KMOD= bcm283x_clkman +SRCS= bcm2835_clkman.c + +EXPORT_SYMS= bcm2835_clkman_set_frequency + +SRCS+= bus_if.h device_if.h ofw_bus_if.h + +.include From owner-svn-src-all@freebsd.org Mon Jan 22 08:46:39 2018 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 E1F18ED6864; Mon, 22 Jan 2018 08:46:39 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 02D7771FD6; Mon, 22 Jan 2018 08:46:38 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 45f82a18; Mon, 22 Jan 2018 09:46:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=eN/ABrEcWs4U9xm2Gqku0h17XiM=; b=sHuq+jeaKWeN8QTVM5mtjhBkvYPN WrNXlwpkGSs2Ce0U1QftOgYHXyYUcP/98TUIYhZuRR66I3GVOZj/qfSLgkMpl7XH 67k0MhSmdrg9skE43PmTnuzl2HeSZSCaISa2YGWwcgefyNY0VYxZNOLcybjJ93SF pJQZOzvhkj1tL/4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=FQAVGJ32dTXgIg3fqzu5xhJ4YOalXrNgBBaEKaAKqiE0XU+emVmpQszy T701nGIq3jzrmbftJuoj5s54J+mgHUoC2J4PQX8WqmWoFtNcsbeiNMqkEqpLCd8Z djSAv+svxhEFp9ywpr9XwHtjoWPXHcLBpU0nmstxB/T80qrN1HI= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 3f867227 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Mon, 22 Jan 2018 09:46:30 +0100 (CET) Date: Mon, 22 Jan 2018 09:46:29 +0100 From: Emmanuel Vadot To: Poul-Henning Kamp Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-Id: <20180122094629.f292f9f239174f0865b046ea@bidouilliste.com> In-Reply-To: <201801220710.w0M7AUm9091853@repo.freebsd.org> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 08:46:40 -0000 On Mon, 22 Jan 2018 07:10:30 +0000 (UTC) Poul-Henning Kamp wrote: > Author: phk > Date: Mon Jan 22 07:10:30 2018 > New Revision: 328257 > URL: https://svnweb.freebsd.org/changeset/base/328257 > > Log: > Add a skeleton Clock Manager for RPi2/3, and use that from pwm > instead of frobbing the registers directly. > > As a hack the bcm2835_pwm kmod presently ignores the 'status="disabled"' > in the RPI3 DTB, assuming that if you load the kld you probably > want the PWM to work. > > Added: > head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c (contents, props changed) > head/sys/arm/broadcom/bcm2835/bcm2835_clkman.h (contents, props changed) > Modified: > head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c > head/sys/dts/arm/bcm2836.dtsi > head/sys/modules/Makefile > > Added: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c Mon Jan 22 07:10:30 2018 (r328257) > @@ -0,0 +1,212 @@ > +/*- > + * Copyright (C) 2013-2015 Daisuke Aoyama Was is based on some file ? Also someone will probably complain about SDPX tag here :) > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#include > +#include > + > +#include > + > +static struct ofw_compat_data compat_data[] = { > + {"brcm,bcm2835-cprman", 1}, > + {"broadcom,bcm2835-cprman", 1}, > + {NULL, 0} > +}; > + > +struct bcm2835_clkman_softc { > + device_t sc_dev; > + > + struct resource * sc_m_res; > + bus_space_tag_t sc_m_bst; > + bus_space_handle_t sc_m_bsh; > +}; > + > +#define BCM_CLKMAN_WRITE(_sc, _off, _val) \ > + bus_space_write_4(_sc->sc_m_bst, _sc->sc_m_bsh, _off, _val) > +#define BCM_CLKMAN_READ(_sc, _off) \ > + bus_space_read_4(_sc->sc_m_bst, _sc->sc_m_bsh, _off) > + > +#define W_CMCLK(_sc, unit, _val) BCM_CLKMAN_WRITE(_sc, unit, 0x5a000000 | (_val)) > +#define R_CMCLK(_sc, unit) BCM_CLKMAN_READ(_sc, unit) > +#define W_CMDIV(_sc, unit, _val) BCM_CLKMAN_WRITE(_sc, (unit) + 4, 0x5a000000 | (_val)) > +#define R_CMDIV(_sc, unit) BCM_CLKMAN_READ(_sc, (unit) + 4) > + > +static int > +bcm2835_clkman_probe(device_t dev) > +{ > + > + if (!ofw_bus_status_okay(dev)) > + return (ENXIO); > + > + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) > + return (ENXIO); > + > + device_set_desc(dev, "BCM283x Clock Manager"); > + > + return (BUS_PROBE_DEFAULT); > +} > + > +static int > +bcm2835_clkman_attach(device_t dev) > +{ > + struct bcm2835_clkman_softc *sc; > + int rid; > + > + if (device_get_unit(dev) != 0) { > + device_printf(dev, "only one clk manager supported\n"); > + return (ENXIO); > + } > + > + sc = device_get_softc(dev); > + sc->sc_dev = dev; > + > + rid = 0; > + sc->sc_m_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, > + RF_ACTIVE); > + if (!sc->sc_m_res) { > + device_printf(dev, "cannot allocate memory window\n"); > + return (ENXIO); > + } > + > + sc->sc_m_bst = rman_get_bustag(sc->sc_m_res); > + sc->sc_m_bsh = rman_get_bushandle(sc->sc_m_res); > + > + return (bus_generic_attach(dev)); > +} > + > +uint32_t > +bcm2835_clkman_set_frequency(device_t dev, uint32_t unit, uint32_t hz) > +{ > + struct bcm2835_clkman_softc *sc; > + int i; > + uint32_t u; > + > + sc = device_get_softc(dev); > + > + if (unit != BCM_PWM_CLKSRC) { > + device_printf(sc->sc_dev, > + "Unsupported unit 0x%x", unit); > + return (0); > + } Uhg, this is ... ugly ... The proper way will be to introduce a real clock manager exposing a clock domain and clocks using the extres/clk framework. I'm still writing manpages for thoses but in the meantime you can look at arm/nvidia and arm/allwinner/clkng (or ask me/mmel@ questions about it). > + > + W_CMCLK(sc, unit, 6); > + for (i = 0; i < 10; i++) { > + u = R_CMCLK(sc, unit); > + if (!(u&0x80)) > + break; > + DELAY(1000); > + } > + if (u & 0x80) { > + device_printf(sc->sc_dev, > + "Failed to stop clock for unit 0x%x", unit); > + return (0); > + } > + if (hz == 0) > + return (0); > + > + u = 500000000/hz; > + if (u < 4) { > + device_printf(sc->sc_dev, > + "Frequency too high for unit 0x%x (max: 125MHz)", > + unit); > + return (0); > + } > + if (u > 0xfff) { > + device_printf(sc->sc_dev, > + "Frequency too low for unit 0x%x (min: 123Hz)", > + unit); > + return (0); > + } > + hz = 500000000/u; > + W_CMDIV(sc, unit, u << 12); > + > + W_CMCLK(sc, unit, 0x16); > + for (i = 0; i < 10; i++) { > + u = R_CMCLK(sc, unit); > + if ((u&0x80)) > + break; > + DELAY(1000); > + } > + if (!(u & 0x80)) { > + device_printf(sc->sc_dev, > + "Failed to start clock for unit 0x%x", unit); > + return (0); > + } > + return (hz); > +} > + > +static int > +bcm2835_clkman_detach(device_t dev) > +{ > + struct bcm2835_clkman_softc *sc; > + > + bus_generic_detach(dev); > + > + sc = device_get_softc(dev); > + if (sc->sc_m_res) > + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_m_res); > + > + return (0); > +} > + > +static device_method_t bcm2835_clkman_methods[] = { > + /* Device interface */ > + DEVMETHOD(device_probe, bcm2835_clkman_probe), > + DEVMETHOD(device_attach, bcm2835_clkman_attach), > + DEVMETHOD(device_detach, bcm2835_clkman_detach), > + > + DEVMETHOD_END > +}; > + > +static devclass_t bcm2835_clkman_devclass; > +static driver_t bcm2835_clkman_driver = { > + "bcm2835_clkman", > + bcm2835_clkman_methods, > + sizeof(struct bcm2835_clkman_softc), > +}; > + > +DRIVER_MODULE(bcm2835_clkman, simplebus, bcm2835_clkman_driver, > + bcm2835_clkman_devclass, 0, 0); > +MODULE_VERSION(bcm2835_clkman, 1); > > Added: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/arm/broadcom/bcm2835/bcm2835_clkman.h Mon Jan 22 07:10:30 2018 (r328257) > @@ -0,0 +1,43 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2017 Poul-Henning Kamp > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#ifndef _BCM2835_CLKMAN_H_ > +#define _BCM2835_CLKMAN_H_ > + > +// Offset into BAR0 for unit > +enum bcm2835_clksrc { > + BCM_GPIO0_CLKSRC = 0x70, > + BCM_GPIO1_CLKSRC = 0x78, > + BCM_GPIO2_CLKSRC = 0x80, > + BCM_PWM_CLKSRC = 0xa0, > +}; > + > +uint32_t bcm2835_clkman_set_frequency(device_t, uint32_t, uint32_t); > + > +#endif /* _BCM2835_CLKMAN_H_ */ > > Modified: head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c > ============================================================================== > --- head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Mon Jan 22 06:00:45 2018 (r328256) > +++ head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Mon Jan 22 07:10:30 2018 (r328257) > @@ -42,12 +42,12 @@ __FBSDID("$FreeBSD$"); > > #include > #include > -#include > > #include > #include > > #include > +#include > > static struct ofw_compat_data compat_data[] = { > {"broadcom,bcm2835-pwm", 1}, > @@ -62,9 +62,7 @@ struct bcm_pwm_softc { > bus_space_tag_t sc_m_bst; > bus_space_handle_t sc_m_bsh; > > - struct resource * sc_clk_res; > - bus_space_tag_t sc_c_bst; > - bus_space_handle_t sc_c_bsh; > + device_t clkman; > > uint32_t freq; > uint32_t period; > @@ -91,15 +89,9 @@ struct bcm_pwm_softc { > #define W_DAT(_sc, _val) BCM_PWM_MEM_WRITE(_sc, 0x14, _val) > #define R_DAT(_sc) BCM_PWM_MEM_READ(_sc, 0x14) > > -#define W_CMCLK(_sc, _val) BCM_PWM_CLK_WRITE(_sc, 0x00, 0x5a000000 | (_val)) > -#define R_CMCLK(_sc) BCM_PWM_CLK_READ(_sc, 0x00) > -#define W_CMDIV(_sc, _val) BCM_PWM_CLK_WRITE(_sc, 0x04, 0x5a000000 | (_val)) > -#define R_CMDIV(_s) BCM_PWM_CLK_READ(_sc, 0x04) > - > static int > bcm_pwm_reconf(struct bcm_pwm_softc *sc) > { > - int i; > uint32_t u; > device_t gpio; > > @@ -107,22 +99,10 @@ bcm_pwm_reconf(struct bcm_pwm_softc *sc) > W_CTL(sc, 0); > > /* Stop PWM clock */ > - W_CMCLK(sc, 6); > - for (i = 0; i < 10; i++) { > - u = R_CMCLK(sc); > - if (!(u&0x80)) > - break; > - DELAY(1000); > - } > - if (u&0x80) { > - device_printf(sc->sc_dev, "Failed to stop clock\n"); > - return(EIO); > - } > + (void)bcm2835_clkman_set_frequency(sc->clkman, BCM_PWM_CLKSRC, 0); > > - if (sc->mode == 0) { > - // XXX: GPIO cfg ? > + if (sc->mode == 0) > return (0); > - } > > /* Ask GPIO0 to set ALT0 for pin 12 */ > gpio = devclass_get_device(devclass_find("gpio"), 0); > @@ -132,32 +112,11 @@ bcm_pwm_reconf(struct bcm_pwm_softc *sc) > } > bcm_gpio_set_alternate(gpio, 12, BCM_GPIO_ALT0); > > - /* Configure divider */ > - u = 500000000/sc->freq; > - if (u < 4) { > - device_printf(sc->sc_dev, "Freq too high (max 125MHz)\n"); > - return(EINVAL); > - } > - if (u > 0xfff) { > - device_printf(sc->sc_dev, "Freq too low (min 123Hz)\n"); > - return(EINVAL); > - } > - sc->freq = 500000000/u; > - W_CMDIV(sc, u << 12); > + u = bcm2835_clkman_set_frequency(sc->clkman, BCM_PWM_CLKSRC, sc->freq); > + if (u == 0) > + return (EINVAL); > + sc->freq = u; > > - /* Start PWM clock */ > - W_CMCLK(sc, 0x16); > - for (i = 0; i < 10; i++) { > - u = R_CMCLK(sc); > - if ((u&0x80)) > - break; > - DELAY(1000); > - } > - if (!(u&0x80)) { > - device_printf(sc->sc_dev, "Failed to start clock\n"); > - return(EIO); > - } > - > /* Config PWM */ > W_RNG(sc, sc->period); > if (sc->ratio > sc->period) > @@ -266,19 +225,13 @@ bcm_pwm_reg_proc(SYSCTL_HANDLER_ARGS) > int error; > > sc = (struct bcm_pwm_softc *)arg1; > - if (arg2 & 0x100) > - reg = BCM_PWM_CLK_READ(sc, arg2 & 0xff); > - else > - reg = BCM_PWM_MEM_READ(sc, arg2 & 0xff); > + reg = BCM_PWM_MEM_READ(sc, arg2 & 0xff); > > error = sysctl_handle_int(oidp, ®, sizeof(reg), req); > if (error != 0 || req->newptr == NULL) > return (error); > > - if (arg2 & 0x100) > - BCM_PWM_CLK_WRITE(sc, arg2 & 0xff, reg); > - else > - BCM_PWM_MEM_WRITE(sc, arg2, reg); > + BCM_PWM_MEM_WRITE(sc, arg2, reg); > return (0); > } > > @@ -301,8 +254,6 @@ bcm_pwm_sysctl_init(struct bcm_pwm_softc *sc) > CTLFLAG_RW | CTLTYPE_UINT, sc, 0x##x, \ > bcm_pwm_reg_proc, "IU", "Register 0x" #x " " y); > > - RR(100, "PWMCTL") > - RR(104, "PWMDIV") > RR(24, "DAT2") > RR(20, "RNG2") > RR(18, "FIF1") > @@ -335,8 +286,12 @@ static int > bcm_pwm_probe(device_t dev) > { > > +#if 0 > + // XXX: default state is disabled in RPI3 DTB, assume for now > + // XXX: that people want the PWM to work if the KLD this module. > if (!ofw_bus_status_okay(dev)) > return (ENXIO); > +#endif > > if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) > return (ENXIO); > @@ -360,6 +315,12 @@ bcm_pwm_attach(device_t dev) > sc = device_get_softc(dev); > sc->sc_dev = dev; > > + sc->clkman = devclass_get_device(devclass_find("bcm2835_clkman"), 0); > + if (sc->clkman == NULL) { > + device_printf(dev, "cannot find Clock Manager\n"); > + return (ENXIO); > + } > + > rid = 0; > sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, > RF_ACTIVE); > @@ -371,16 +332,6 @@ bcm_pwm_attach(device_t dev) > sc->sc_m_bst = rman_get_bustag(sc->sc_mem_res); > sc->sc_m_bsh = rman_get_bushandle(sc->sc_mem_res); > > - rid = 1; > - sc->sc_clk_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, > - RF_ACTIVE); > - if (!sc->sc_clk_res) { > - device_printf(dev, "cannot allocate clock window\n"); > - return (ENXIO); > - } > - sc->sc_c_bst = rman_get_bustag(sc->sc_clk_res); > - sc->sc_c_bsh = rman_get_bushandle(sc->sc_clk_res); > - > /* Add sysctl nodes. */ > bcm_pwm_sysctl_init(sc); > > @@ -400,12 +351,10 @@ bcm_pwm_detach(device_t dev) > bus_generic_detach(dev); > > sc = device_get_softc(dev); > - sc->mode = 0; > + sc->mode = 0; > (void)bcm_pwm_reconf(sc); > if (sc->sc_mem_res) > bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); > - if (sc->sc_clk_res) > - bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_clk_res); > > return (0); > } > @@ -414,17 +363,15 @@ static phandle_t > bcm_pwm_get_node(device_t bus, device_t dev) > { > > - /* We only have one child, the SPI bus, which needs our own node. */ > return (ofw_bus_get_node(bus)); > } > > + > static device_method_t bcm_pwm_methods[] = { > /* Device interface */ > DEVMETHOD(device_probe, bcm_pwm_probe), > DEVMETHOD(device_attach, bcm_pwm_attach), > DEVMETHOD(device_detach, bcm_pwm_detach), > - > - /* ofw_bus interface */ > DEVMETHOD(ofw_bus_get_node, bcm_pwm_get_node), > > DEVMETHOD_END > @@ -439,3 +386,4 @@ static driver_t bcm_pwm_driver = { > }; > > DRIVER_MODULE(bcm2835_pwm, simplebus, bcm_pwm_driver, bcm_pwm_devclass, 0, 0); > +MODULE_DEPEND(bcm2835_pwm, bcm2835_clkman, 1, 1, 1); > > Modified: head/sys/dts/arm/bcm2836.dtsi > ============================================================================== > --- head/sys/dts/arm/bcm2836.dtsi Mon Jan 22 06:00:45 2018 (r328256) > +++ head/sys/dts/arm/bcm2836.dtsi Mon Jan 22 07:10:30 2018 (r328257) > @@ -389,6 +389,11 @@ > }; > }; > > + cprman { > + compatible = "broadcom,bcm2835-cprman"; > + reg = <0x101000 0x2000>; > + }; > + > rng { > compatible = "broadcom,bcm2835-rng", > "broadcom,bcm2708-rng"; > @@ -427,7 +432,7 @@ > > pwm0 { > compatible = "broadcom,bcm2835-pwm"; > - reg = <0x20c000 0x28>,<0x1010a0 8>; > + reg = <0x20c000 0x28>; > }; > > dma: dma { > > Modified: head/sys/modules/Makefile > ============================================================================== > --- head/sys/modules/Makefile Mon Jan 22 06:00:45 2018 (r328256) > +++ head/sys/modules/Makefile Mon Jan 22 07:10:30 2018 (r328257) > @@ -60,6 +60,7 @@ SUBDIR= \ > ${_autofs} \ > ${_auxio} \ > ${_bce} \ > + ${_bcm283x_clkman} \ > ${_bcm283x_pwm} \ > bfe \ > bge \ > @@ -808,6 +809,7 @@ _cloudabi64= cloudabi64 > .endif > > .if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64" > +_bcm283x_clkman= bcm283x_clkman > _bcm283x_pwm= bcm283x_pwm > .endif > -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Mon Jan 22 08:47:57 2018 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 7AC5DED6980; Mon, 22 Jan 2018 08:47:57 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id ED03B72161; Mon, 22 Jan 2018 08:47:56 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 67358D4AC13; Mon, 22 Jan 2018 19:18:45 +1100 (AEDT) Date: Mon, 22 Jan 2018 19:18:44 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Eric van Gyzen cc: Wojciech Macek , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328110 - head/sys/kern In-Reply-To: <2d584386-f877-9c0b-214b-547928f8f50a@vangyzen.net> Message-ID: <20180122182652.D1317@besplex.bde.org> References: <201801180738.w0I7cswv054484@repo.freebsd.org> <2d584386-f877-9c0b-214b-547928f8f50a@vangyzen.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=LKgWeNe9 c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=umzheXo2XnYyQPMFEt8A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 08:47:57 -0000 On Sun, 21 Jan 2018, Eric van Gyzen wrote: > On 01/18/2018 01:38, Wojciech Macek wrote: >> Author: wma >> Date: Thu Jan 18 07:38:54 2018 >> New Revision: 328110 >> URL: https://svnweb.freebsd.org/changeset/base/328110 >> >> Log: >> KDB: restart only CPUs stopped by KDB >> > >> @@ -707,8 +708,9 @@ kdb_trap(int type, int code, struct trapframe *tf) >> kdb_active--; >> #ifdef SMP >> + CPU_AND(&other_cpus, &stopped_cpus); > > Wojciech, > > Coverity told me that other_cpus is used uninitialized here (CID 1385265). This is harmless in practice (though in theory using an uninitialized variable gives undefined behaviour) since stopped_cpus is only used (2 lines later) when other_cpus was initialized. The quick fix is to move this AND under the condition where stopped_cpus will be used. However this AND is either unnecessary or racy. other_cpus (if we stopped anything) already has the map of cpus that we tried to stop. If we didn't stop them all, then there are various bugs. If we did stop them all but some restarted, then this is due to race bugs, but starting them again is harmless unless it gives further races. Many of these bugs are fixed in my version by: - not giving up trying to stop cpus - holding the stopping_cpu lock across stop/restart. It is an error to modify stopped_cpus here at all in -current, since the stopping_cpus lock is not held yet. CPU_AND() is not even atomic. CPU_AND_ATOMIC() would be less racy. However, in the usual case which was the only case before the previous commit, other_cpus is all other cpus so no other cpu can race with us except in the buggy case where we gave up waiting. It is also an error to just access stopped_cpus here. The access was restart_cpus(stopped_cpus). stopped_cpus is a (rather large) struct which is passed by copying it. There is no locking or even atomic accesses for the copying. stopped_cpus is volatile, but that doesn't do anything useful. These bugs were missing for the restart_cpus(other_cpus) operation. other_cpus was just all_cpus less the current cpu. all_cpus isn't volatile and is hopefully stable at this point. The previous commit added an unlocked non-atomic CPU_NAND(&other_cpus, &stopped_cpus). This might be racy precisely when it is not null -- that is, when stopped_cpus is non-empty. When stopped_cpus is non-empty, that might be because it is under construction and is changing underneath us. My fixes probably make the non-empty initial stopped_cpus case a deadlocked or sure race case. Whatever stopped the cpus should still be holding the stopping_cpus lock. stop_cpus() will wither deadlock waiting for the cpu holding the lock, or the other cpu will drop the lock only after restarting all the cpus that it stopped, so stopped_cpus changes from nonempty to empty underneath ys. generic_restart_cpus() has similar races in -current. It doesn't even re-acquire the stopped_cpus lock. It modifies stopped_cpus indirectly by setting started_cpus to direct the stopped cpus to leave their loop and clear their stopped bit. This races with generic_stop_cpus(). kdb entry can give a thundering herd of cpus entering and exiting kdb for the same breakpoint. Restarting always gives races of the herd members doing restarting with the single herd member allowed to do stopping. Bruce From owner-svn-src-all@freebsd.org Mon Jan 22 09:02:42 2018 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 A174CEB4654; Mon, 22 Jan 2018 09:02:42 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 6680672B8A; Mon, 22 Jan 2018 09:02:42 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id D41B927378; Mon, 22 Jan 2018 09:02:39 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w0M92OFj086941 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 22 Jan 2018 09:02:24 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0M92Ota086940; Mon, 22 Jan 2018 09:02:24 GMT (envelope-from phk) To: Emmanuel Vadot cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: <20180122094629.f292f9f239174f0865b046ea@bidouilliste.com> From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <20180122094629.f292f9f239174f0865b046ea@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <86938.1516611744.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Mon, 22 Jan 2018 09:02:24 +0000 Message-ID: <86939.1516611744@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 09:02:42 -0000 -------- In message <20180122094629.f292f9f239174f0865b046ea@bidouilliste.com>, Emm= anuel Vadot writes: >> + * Copyright (C) 2013-2015 Daisuke Aoyama > > Was is based on some file ? > Also someone will probably complain about SDPX tag here :) Yes, I grabbed the blurp from a nearby file and forgot to edit it, it's fixed now. >> + if (unit !=3D BCM_PWM_CLKSRC) { >> + device_printf(sc->sc_dev, >> + "Unsupported unit 0x%x", unit); >> + return (0); >> + } > > Uhg, this is ... ugly ... Yes, very much so. > The proper way will be to introduce a real clock manager exposing a >clock domain and clocks using the extres/clk framework. Yes, Somebody[tm] should really do that[1], just like Somebody[tm] should write drivers for all sorts of other stuff on all sorts of platforms. Eventually Somebody[tm] may even get around to that, but in the meantime people who play with FreeBSD on Rpi's can at least get the PWM output to work. Poul-Henning [1] Are you tired of Nice & Accurate[tm] chip documentation which leaves no room for creativity and exploration? Do you love to extrapolate and second-guess chip-designers mental process from random snippets of incompetently written code ? If so, you may find welcome relief trying to write a device driver for the "BCM283x - Documentation - Scmockumentation!" family of devices! -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-svn-src-all@freebsd.org Mon Jan 22 09:25:36 2018 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 0EEF5EB581B; Mon, 22 Jan 2018 09:25:36 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 3F5B77398E; Mon, 22 Jan 2018 09:25:32 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 2B5D3D6E52D; Mon, 22 Jan 2018 20:25:21 +1100 (AEDT) Date: Mon, 22 Jan 2018 20:25:20 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexander Motin cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: Re: svn commit: r328251 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zpool vendor/illumos/dist/lib/libzfs/common In-Reply-To: <201801220448.w0M4mEjB033773@repo.freebsd.org> Message-ID: <20180122201244.M1317@besplex.bde.org> References: <201801220448.w0M4mEjB033773@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=DIX/22Fb c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=DSHT9BU3AAAA:8 a=ltDKUUI1AAAA:8 a=XWMXhlxvoWOi9kvSVkMA:9 a=CjuIK1q_8ugA:10 a=8ljxv5-TN0tg3ptMfEC3:22 a=zPa3363zVR52QbuIqfxu:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 09:25:36 -0000 On Mon, 22 Jan 2018, Alexander Motin wrote: > Log: > 8652 Tautological comparisons with ZPROP_INVAL > > illumos/illumos-gate@4ae5f5f06c6c2d1db8167480f7d9e3b5378ba2f2 > > https://www.illumos.org/issues/8652: > Clang and GCC prefer to use unsigned ints to store enums. With Clang, that > causes tautological comparison warnings when comparing a zfs_prop_t or > zpool_prop_t variable to the macro ZPROP_INVAL. It's likely that error > handling code is being silently removed as a result. This shows another reason to never use enums. emum constants have type int, but enum variables have an implementation-defined type capable of respresenting the values of all of the members of the enumeration. Inexperienced programmers use unsigned types to implement unsign extension bugs and bugs like this. If you use basic types or even your own typedefs, then unsigned types are easy to avoid. APIs tend to have too many unsigned types, but only especially badly designed ones allow the signedness to vary with the implementation or don't document what it is. The implementation's definition of this is hard to find. gcc.info has a second that clearly documents that it is required to document this (C99 6.7.2.2), but I couldn't find where it actually documents this. clang has no useful installed documentation. The type of an enum can be forced to be signed by putting a negative enum value in it. ZPROP_INVAL = -1 as an enum value would do this. This wouldn't work with a generic INVAL value used with different enums. This is the fix used here -- another recent commit added ZPOOL_PROP_INVAL as an enum value and this commit uses it. I think this changes the type of the enum from u_int to int, so it risks sign extension bugs instead of unsign extension bugs. Unsigned types might be used to pack 256 enum values in 8 bits, but gcc and clang on x86 use uint32_t for even 1-bit enums like "enum foo { ZERO, ONE, };", just like inexperienced programmers. gcc and clang have an option -fshort-enums which makes unsigned types give better packing in a few cases -- "enum foo { N = 256 };" can be fitted in 1 byte, and "enum foo { N = 65536 };" can be fitted in 2 byte. With 32-bit ints, uint32_t enums just give the unsign extension bugs since enum values have type int so "enum foo { N = 0xffffffff };" is invalid. A similar class of unsign extension bugs augmented by wrong fixes is when you have an opaque type with careful range checking of the form: opaque_t v = foo(); if (v < MIN || v > MAX) error(); First v is misimplemented an unsigned type. When MIN == 0, (v < MIN) becomes tautologous. Then the warning is "fixed" by removing this check. Then when v is correctly implemented by fixing its type in this implemenation or never breaking it in other implementations, the code is broken. Changing a single typedef or enum in a header file can uncover many latent sign extension, unsign extension, spurious warning, or missing range checking bugs. Bruce From owner-svn-src-all@freebsd.org Mon Jan 22 10:26:49 2018 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 0293AEB8478; Mon, 22 Jan 2018 10:26:49 +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 72F7075AC9; Mon, 22 Jan 2018 10:26:48 +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 w0MAQe4b078817 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 22 Jan 2018 12:26:43 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w0MAQe4b078817 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w0MAQdr7078816; Mon, 22 Jan 2018 12:26:40 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 22 Jan 2018 12:26:39 +0200 From: Konstantin Belousov To: Kyle Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328240 - in head: etc/mtree lib lib/libc/regex lib/libc/tests/regex lib/libregex lib/libregex/tests share/mk Message-ID: <20180122102639.GD55707@kib.kiev.ua> References: <201801220244.w0M2if3I083081@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201801220244.w0M2if3I083081@repo.freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) 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.25 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, 22 Jan 2018 10:26:49 -0000 On Mon, Jan 22, 2018 at 02:44:41AM +0000, Kyle Evans wrote: > Author: kevans > Date: Mon Jan 22 02:44:41 2018 > New Revision: 328240 > URL: https://svnweb.freebsd.org/changeset/base/328240 > > Log: > Add libregex, connect it to the build > > libregex is a regex(3) implementation intended to feature GNU extensions and > any other non-POSIX compliant extensions that are deemed worthy. > > These extensions are separated out into a separate library for the sake of > not cluttering up libc further with them as well as not deteriorating the > speed (or lack thereof) of the libc implementation. > > libregex is implemented as a build of the libc implementation with LIBREGEX > defined to distinguish this from a libc build. The reasons for > implementation like this are two-fold: > > 1.) Maintenance- This reduces the overhead induced by adding yet another > regex implementation to base. > > 2.) Ease of use- Flipping on GNU extensions will be as simple as linking > against libregex, and POSIX-compliant compilations can be guaranteed with a > REG_POSIX cflag that should be ignored by libc/regex and disables extensions > in libregex. It is also easier to keep REG_POSIX sane and POSIX pure when > implemented in this fashion. You are doing very fragile and unmaintainable trick on all consumers there. Your libregex.so exports the same symbols under the same version as the libc does. In other words, we now provide two binary-incompatible callable symbols, and selection of the symbol by the consumer depends on the DT_NEEDED order and interposing. For instance, if some program loads a module linked to your libregex, the program behaviour suddenly changes. Since the library provides incompatible implementation, it must use different versions for the symbols, at least to save others time to debug the mess. From owner-svn-src-all@freebsd.org Mon Jan 22 12:59:10 2018 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 A9411EBFF44; Mon, 22 Jan 2018 12:59:10 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 904BA7AD37; Mon, 22 Jan 2018 12:59:08 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 53b11d82; Mon, 22 Jan 2018 13:59:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=S4R8iJp5zSxm4RXAXHsY7Hit3EQ=; b=BK7nKdTFNV47UmgPPEz6H5uGp28g kt9rUwMlR0GCSCTv3u7c0E3UqQ+RJ57kBjcJKvFXfpnKccHRHQEBWQJTx6CBiHib RnkB6Q4Cl6UvCrVtzl9iGdyIv8Od5fN+g2cQ36L5n5IXqpozSVO1rtFZ1HHM14kX TwPZUdogtuDm4jI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=mleGRd0rXByu9sIyn/zWxFkcSRzezt5pE+nVadhzdosC79q5wXyLiE0/ D5bVCpkfaqUCAX0PSyM9beJZ7y6Gfb+M/9hazqmFa6N6IM6bRPGmzU8cYDw0JofF DUNVBWWttJ/mAiGkgyKY0WQpFprj3l25/phJngH1zpZ4JpRyj0Y= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id eef36079 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Mon, 22 Jan 2018 13:59:05 +0100 (CET) Date: Mon, 22 Jan 2018 13:59:05 +0100 From: Emmanuel Vadot To: Poul-Henning Kamp Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-Id: <20180122135905.203e19ce94510854777dff63@bidouilliste.com> In-Reply-To: <201801220710.w0M7AUm9091853@repo.freebsd.org> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 12:59:10 -0000 On Mon, 22 Jan 2018 07:10:30 +0000 (UTC) Poul-Henning Kamp wrote: > Author: phk > Date: Mon Jan 22 07:10:30 2018 > New Revision: 328257 > URL: https://svnweb.freebsd.org/changeset/base/328257 > > Log: > Add a skeleton Clock Manager for RPi2/3, and use that from pwm > instead of frobbing the registers directly. > > As a hack the bcm2835_pwm kmod presently ignores the 'status="disabled"' > in the RPI3 DTB, assuming that if you load the kld you probably > want the PWM to work. > > Added: > head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c (contents, props changed) > head/sys/arm/broadcom/bcm2835/bcm2835_clkman.h (contents, props changed) > Modified: > head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c > head/sys/dts/arm/bcm2836.dtsi > head/sys/modules/Makefile > > bcm_pwm_probe(device_t dev) > { > > +#if 0 > + // XXX: default state is disabled in RPI3 DTB, assume for now > + // XXX: that people want the PWM to work if the KLD this module. > if (!ofw_bus_status_okay(dev)) > return (ENXIO); > +#endif This is really bad, one need to use overlay to enable the node. Leaving this I will predict that in the near futur you will have someone complaining that he set to load the module at boot, unplug is pwm testing gear and plug another type of HAT and that it makes funny thing. Can you please revert this part ? -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Mon Jan 22 13:39:05 2018 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 C2FDDEC1722; Mon, 22 Jan 2018 13:39:05 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 876FF7C1E3; Mon, 22 Jan 2018 13:39:05 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id 6DEBE27376; Mon, 22 Jan 2018 13:39:03 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w0MDclsI088072 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 22 Jan 2018 13:38:47 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0MDclF9088071; Mon, 22 Jan 2018 13:38:47 GMT (envelope-from phk) To: Emmanuel Vadot cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: <20180122135905.203e19ce94510854777dff63@bidouilliste.com> From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <20180122135905.203e19ce94510854777dff63@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <88069.1516628327.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Mon, 22 Jan 2018 13:38:47 +0000 Message-ID: <88070.1516628327@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 13:39:05 -0000 -------- In message <20180122135905.203e19ce94510854777dff63@bidouilliste.com>, Emm= anuel Vadot writes: >> +#if 0 >> + // XXX: default state is disabled in RPI3 DTB, assume for now >> + // XXX: that people want the PWM to work if the KLD this module. >> if (!ofw_bus_status_okay(dev)) >> return (ENXIO); >> +#endif > > This is really bad, one need to use overlay to enable the node. > Leaving this I will predict that in the near futur you will have >someone complaining that he set to load the module at boot, unplug is >pwm testing gear and plug another type of HAT and that it makes funny >thing. As long as you don't set any of dev.pwm.0.* sysctls, the bcm283x_pwm driver doesn't do anything, so that situation is harmless. > Can you please revert this part ? Once I find out how to get similar behaviour, ie: kldload without having to reboot to load a DT-overlay. My preference would be that DT-overlays could be compiled into kmods, but I'm fine with any reasonable commahd that can load an overlay without a reboot. Or alternatively, a command which will change the "status=3Ddisable" to "status=3Dokay" in the already loaded DT ? -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-svn-src-all@freebsd.org Mon Jan 22 13:51:21 2018 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 B1015EC214A; Mon, 22 Jan 2018 13:51:21 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D8AB17CC32; Mon, 22 Jan 2018 13:51:20 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 15bd167e; Mon, 22 Jan 2018 14:51:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=A7iRD423PMUZBTMQP8uZQI0vg4U=; b=W1iiauWfkhOJLLgcY30/TI1l4yZR gFvrZ90CzOqcq40snq9IdhPph+9xCCLuhoXIqqJ60Fdcf0tp3aGQpV/sYgXUNcxw K5037pbiWCipCRC4V1Qv2KAasQ0dKAOuvtylGtpDXRU/2sqk3qITnyLHgFnkk66d 9bfC/yu5bbttcWw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=HaAEx0KddM8uCMavJMmO6UoUQwwbJYqBGsV5WkQrx55sYNG/foqsHWwN YH3LBFRcJdfir919wI4Nocf19L8RXrzWKRDogUFjusPzOun70wIhy0+CMryXMfn0 I6gl3c4/S6pNij6AeSlQgdStTK4w3TH759jRgrvXh4KiFK9WLIc= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 49631e87 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Mon, 22 Jan 2018 14:51:17 +0100 (CET) Date: Mon, 22 Jan 2018 14:51:17 +0100 From: Emmanuel Vadot To: "Poul-Henning Kamp" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-Id: <20180122145117.08173be547f5dd6fef296732@bidouilliste.com> In-Reply-To: <88070.1516628327@critter.freebsd.dk> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <20180122135905.203e19ce94510854777dff63@bidouilliste.com> <88070.1516628327@critter.freebsd.dk> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 13:51:21 -0000 On Mon, 22 Jan 2018 13:38:47 +0000 "Poul-Henning Kamp" wrote: > -------- > In message <20180122135905.203e19ce94510854777dff63@bidouilliste.com>, Emmanuel > Vadot writes: > > >> +#if 0 > >> + // XXX: default state is disabled in RPI3 DTB, assume for now > >> + // XXX: that people want the PWM to work if the KLD this module. > >> if (!ofw_bus_status_okay(dev)) > >> return (ENXIO); > >> +#endif > > > > This is really bad, one need to use overlay to enable the node. > > Leaving this I will predict that in the near futur you will have > >someone complaining that he set to load the module at boot, unplug is > >pwm testing gear and plug another type of HAT and that it makes funny > >thing. > > As long as you don't set any of dev.pwm.0.* sysctls, the bcm283x_pwm > driver doesn't do anything, so that situation is harmless. Using the same logic as before one could have a script starting some pwm stuff (or simply using /etc/sysctl.conf) Also this is not how DT is suppose to work, if the status == 'disabled' no driver should attach. > > Can you please revert this part ? > > Once I find out how to get similar behaviour, ie: kldload without > having to reboot to load a DT-overlay. Nobody is working on that right now (that I know of). > My preference would be that DT-overlays could be compiled into > kmods, but I'm fine with any reasonable commahd that can load > an overlay without a reboot. If we have a way to modify in-kernel DT I don't now if kmods is the way to go. > Or alternatively, a command which will change the "status=disable" > to "status=okay" in the already loaded DT ? Every modification of the DT should go thought overlays. > -- > Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 > phk@FreeBSD.ORG | TCP/IP since RFC 956 > FreeBSD committer | BSD since 4.3-tahoe > Never attribute to malice what can adequately be explained by incompetence. -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Mon Jan 22 14:05:53 2018 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 E7319EC2B84; Mon, 22 Jan 2018 14:05:53 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-it0-f50.google.com (mail-it0-f50.google.com [209.85.214.50]) (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 B7C3D7D4A0; Mon, 22 Jan 2018 14:05:53 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-it0-f50.google.com with SMTP id w14so9815145itc.3; Mon, 22 Jan 2018 06:05:53 -0800 (PST) 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=WQdKB8qoqmKy9P2EtM8/yxIko0OzDoWzdEkM08fLKcI=; b=N5vNaiJKDT3e3NO29v+MsXyKlCseNK3KsKIKcRcT8IFGTT9BtKFgww/juCSWcgngjl 7sUSV29RCUTIgxHjk/dvJX48LB10j6qug9ADITQWvvZjsV67En880Mnta7jQnW3G5uiq OZ1a+eFLNWo+BnE8usxGBGicMVXgcxNkTOqtCsL0WG39rL18cYQfDgXCGWin6qR3XElF ZotV2j26rQArz3XgIl42IwdkXcIGtCtP0CDVV1uMFR17FGwLnKRgDy5PEZNs+luYamoV IoprkE/N/hp4n2bA8BM5E7ZRf009FxqNPE1TWyPXc6OGEr0h6bMdHqlQx+mKHUApjNc0 82mw== X-Gm-Message-State: AKwxytflPXvj5NHAdJoIH+yoH7qXvTR7S55+QlL7aForQpKF5c/1FGHp 6JeePL40uyP4WMjjurLVONJ6rGFb X-Google-Smtp-Source: AH8x226O75yt6LZ1jiDRmRHuldSrMwi8a6co+uAc9B5hy8P2K9Z7H6K2F9H+ZZLABxni4W/K4w30+g== X-Received: by 10.36.211.142 with SMTP id n136mr7929656itg.146.1516629951724; Mon, 22 Jan 2018 06:05:51 -0800 (PST) Received: from mail-it0-f51.google.com (mail-it0-f51.google.com. [209.85.214.51]) by smtp.gmail.com with ESMTPSA id c194sm3826988itb.20.2018.01.22.06.05.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 06:05:51 -0800 (PST) Received: by mail-it0-f51.google.com with SMTP id x42so9967715ita.4; Mon, 22 Jan 2018 06:05:51 -0800 (PST) X-Received: by 10.36.52.8 with SMTP id z8mr7788909itz.130.1516629950818; Mon, 22 Jan 2018 06:05:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.157.12 with HTTP; Mon, 22 Jan 2018 06:05:30 -0800 (PST) In-Reply-To: <20180122102639.GD55707@kib.kiev.ua> References: <201801220244.w0M2if3I083081@repo.freebsd.org> <20180122102639.GD55707@kib.kiev.ua> From: Kyle Evans Date: Mon, 22 Jan 2018 08:05:30 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328240 - in head: etc/mtree lib lib/libc/regex lib/libc/tests/regex lib/libregex lib/libregex/tests share/mk To: Konstantin Belousov 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.25 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, 22 Jan 2018 14:05:54 -0000 On Mon, Jan 22, 2018 at 4:26 AM, Konstantin Belousov wrote: > On Mon, Jan 22, 2018 at 02:44:41AM +0000, Kyle Evans wrote: >> Author: kevans >> Date: Mon Jan 22 02:44:41 2018 >> New Revision: 328240 >> URL: https://svnweb.freebsd.org/changeset/base/328240 >> >> Log: >> Add libregex, connect it to the build >> >> libregex is a regex(3) implementation intended to feature GNU extensions and >> any other non-POSIX compliant extensions that are deemed worthy. >> >> These extensions are separated out into a separate library for the sake of >> not cluttering up libc further with them as well as not deteriorating the >> speed (or lack thereof) of the libc implementation. >> >> libregex is implemented as a build of the libc implementation with LIBREGEX >> defined to distinguish this from a libc build. The reasons for >> implementation like this are two-fold: >> >> 1.) Maintenance- This reduces the overhead induced by adding yet another >> regex implementation to base. >> >> 2.) Ease of use- Flipping on GNU extensions will be as simple as linking >> against libregex, and POSIX-compliant compilations can be guaranteed with a >> REG_POSIX cflag that should be ignored by libc/regex and disables extensions >> in libregex. It is also easier to keep REG_POSIX sane and POSIX pure when >> implemented in this fashion. > You are doing very fragile and unmaintainable trick on all consumers > there. Your libregex.so exports the same symbols under the same version > as the libc does. In other words, we now provide two binary-incompatible > callable symbols, and selection of the symbol by the consumer depends on > the DT_NEEDED order and interposing. For instance, if some program loads > a module linked to your libregex, the program behaviour suddenly changes. > > Since the library provides incompatible implementation, it must use > different versions for the symbols, at least to save others time to > debug the mess. What's the best way that you see, going forward? I'm inclined to throw a Symbol.map into libregex using FBSD_1.1... these interfaces are otherwise stable stable within the two respective libraries, so I don't see that causing too much pain in the future because symbol version changes should be rare. On the other hand, I could see wanting to use something more like FBSD_LIBREGEX_1.0 so that if the situation does come up one doesn't need to double-check that they're not colliding with the other implementation. From owner-svn-src-all@freebsd.org Mon Jan 22 14:07:48 2018 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 5FA94EC2CF2; Mon, 22 Jan 2018 14:07:48 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 26EF67D633; Mon, 22 Jan 2018 14:07:47 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id 34B812739D; Mon, 22 Jan 2018 14:07:46 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w0ME7UPM088260 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 22 Jan 2018 14:07:30 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0ME7UP8088259; Mon, 22 Jan 2018 14:07:30 GMT (envelope-from phk) To: Emmanuel Vadot cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: <20180122145117.08173be547f5dd6fef296732@bidouilliste.com> From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <20180122135905.203e19ce94510854777dff63@bidouilliste.com> <88070.1516628327@critter.freebsd.dk> <20180122145117.08173be547f5dd6fef296732@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <88257.1516630050.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Mon, 22 Jan 2018 14:07:30 +0000 Message-ID: <88258.1516630050@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 14:07:48 -0000 -------- In message <20180122145117.08173be547f5dd6fef296732@bidouilliste.com>, Emm= anuel Vadot writes: > Using the same logic as before one could have a script starting some >pwm stuff (or simply using /etc/sysctl.conf) > Also this is not how DT is suppose to work, if the status =3D=3D >'disabled' no driver should attach. That doesn't make *any* UX sense. "disabled" indicates that it can be enabled, and there is absolutely no reason to force users to reboot, when all that stands between them and using their hardware is a random setting in a file. Explicitly kldload'ing a device-driver is as clear a "Enable it, please" instruction as you can get from the user. If you want to lock down this DT-device because some other device/pin-mux/whatever makes its use impossible, then status should not be "disabled" but "locked" or "impossible". In particular it is *horrible* UX, that you kldload a device-driver for hardware you know is there, and it just silently doesn't do anything. At the very least it should give a diagnostic. Maybe something like: "For no good reason this device is disabled, google for an hour, try to come up with a device tree overlay, reboot to install it and see if you get lucky." :-) >> > Can you please revert this part ? >> = >> Once I find out how to get similar behaviour, ie: kldload without >> having to reboot to load a DT-overlay. > > Nobody is working on that right now (that I know of). Let me know when it works, and I'll remove my hack then. In the meantime, don't load bcm283x_pwm if you don't plan on using the PWM on GPIO12 on your RPI[23]. -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-svn-src-all@freebsd.org Mon Jan 22 14:30:07 2018 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 DCDA8EC3B5E; Mon, 22 Jan 2018 14:30:07 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0BC867E34B; Mon, 22 Jan 2018 14:30:06 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 22826d53; Mon, 22 Jan 2018 15:30:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=xf50KYifUkOM9MVAQjwhr5b1bQk=; b=r6M4Oqui02J3niOrshzwnF7d2p9U 81WUP1YRcIndO6TMQW24ymO5NT7+yYyfLDfjLAjzalpaoHSmfMH9k0X28/CJFeCZ S3aF0+ZfAGOJgLtZEszM+2QmUCod0NL4lf4gCWE2iZGCsHj7ffOSLZ7jeSxKAnBy +wP7KNOiHKtXCwI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=al7yVU6eoXVTVEYy+s5BrmI9eQF4PItws6YjLFVqj5y2jT8fXwdYzJLP E+ttUup3l72AX2ygwmAZOR2UtgcrdPpTY/kkX2OA9xF7o1fRIP+vMFxdrqmOnabl kpFoZgOOzs+xUnfgBWPWqt0P992zGD3IgVD4jMC2/Nmrb+pMxxA= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 85eaee72 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Mon, 22 Jan 2018 15:30:03 +0100 (CET) Date: Mon, 22 Jan 2018 15:30:03 +0100 From: Emmanuel Vadot To: "Poul-Henning Kamp" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-Id: <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> In-Reply-To: <88258.1516630050@critter.freebsd.dk> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <20180122135905.203e19ce94510854777dff63@bidouilliste.com> <88070.1516628327@critter.freebsd.dk> <20180122145117.08173be547f5dd6fef296732@bidouilliste.com> <88258.1516630050@critter.freebsd.dk> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 14:30:08 -0000 On Mon, 22 Jan 2018 14:07:30 +0000 "Poul-Henning Kamp" wrote: > -------- > In message <20180122145117.08173be547f5dd6fef296732@bidouilliste.com>, Emmanuel > Vadot writes: > > > Using the same logic as before one could have a script starting some > >pwm stuff (or simply using /etc/sysctl.conf) > > Also this is not how DT is suppose to work, if the status == > >'disabled' no driver should attach. > > That doesn't make *any* UX sense. > > "disabled" indicates that it can be enabled, and there is absolutely > no reason to force users to reboot, when all that stands between > them and using their hardware is a random setting in a file. To be more clear, disabled mean that the node should not be used. In a industrial board you will always have every usable node enabled, in the SBC world where you have a way to plug daughter card and exchange them or even use the exposed pins directly there is no way to know what the user will do so every node not used by the SBC must be disabled. This is the overlay part of DT that is responsible to enable them > Explicitly kldload'ing a device-driver is as clear a "Enable it, please" > instruction as you can get from the user. But device driver != DT node > If you want to lock down this DT-device because some other > device/pin-mux/whatever makes its use impossible, then > status should not be "disabled" but "locked" or "impossible". Feel free to talk to the DT guys. > In particular it is *horrible* UX, that you kldload a device-driver > for hardware you know is there, and it just silently doesn't do > anything. At the very least it should give a diagnostic. > > Maybe something like: > > "For no good reason this device is disabled, google for > an hour, try to come up with a device tree overlay, reboot > to install it and see if you get lucky." > > :-) > > >> > Can you please revert this part ? > >> > >> Once I find out how to get similar behaviour, ie: kldload without > >> having to reboot to load a DT-overlay. > > > > Nobody is working on that right now (that I know of). > > Let me know when it works, and I'll remove my hack then. > > In the meantime, don't load bcm283x_pwm if you don't plan on > using the PWM on GPIO12 on your RPI[23]. > > -- > Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 > phk@FreeBSD.ORG | TCP/IP since RFC 956 > FreeBSD committer | BSD since 4.3-tahoe > Never attribute to malice what can adequately be explained by incompetence. -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Mon Jan 22 15:52:59 2018 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 C73AFEC7B34; Mon, 22 Jan 2018 15:52:59 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 8B54882020; Mon, 22 Jan 2018 15:52:59 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id 9306127342; Mon, 22 Jan 2018 15:52:57 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w0MFqfel088558 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 22 Jan 2018 15:52:41 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0MFqf8t088557; Mon, 22 Jan 2018 15:52:41 GMT (envelope-from phk) To: Emmanuel Vadot cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <20180122135905.203e19ce94510854777dff63@bidouilliste.com> <88070.1516628327@critter.freebsd.dk> <20180122145117.08173be547f5dd6fef296732@bidouilliste.com> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <88555.1516636361.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Mon, 22 Jan 2018 15:52:41 +0000 Message-ID: <88556.1516636361@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 15:52:59 -0000 -------- In message <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com>, Emm= anuel Vadot writes: >[...] there is no way to >know what the user will do so every node not used by the SBC must be >disabled. [...] until the user explicitly tells us, for instance with the command: kldload /boot/kernel/bcm283x_pwm.ko I'm not sure who was the first to run 386BSD on a laptop 25 years ago, I was certainly one of the first five. Ever since then our explicit goal has been to *not* require reboots for reconfiguration, unless there was no way to avoid it. Nothing you or the "DT guys" can say, can convince me that we should reverse that course. I don't care how it works, but enabling and using PWM on an out-of-the-box RPi should not require a reboot. Over&Out -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-svn-src-all@freebsd.org Mon Jan 22 15:53:20 2018 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 7D85DEC7BA6; Mon, 22 Jan 2018 15:53:20 +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 2415A82165; Mon, 22 Jan 2018 15:53:19 +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 w0MFr7Sx051799 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 22 Jan 2018 17:53:10 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w0MFr7Sx051799 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w0MFr704051798; Mon, 22 Jan 2018 17:53:07 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 22 Jan 2018 17:53:07 +0200 From: Konstantin Belousov To: Kyle Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328240 - in head: etc/mtree lib lib/libc/regex lib/libc/tests/regex lib/libregex lib/libregex/tests share/mk Message-ID: <20180122155307.GG55707@kib.kiev.ua> References: <201801220244.w0M2if3I083081@repo.freebsd.org> <20180122102639.GD55707@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) 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.25 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, 22 Jan 2018 15:53:20 -0000 On Mon, Jan 22, 2018 at 08:05:30AM -0600, Kyle Evans wrote: > On Mon, Jan 22, 2018 at 4:26 AM, Konstantin Belousov > wrote: > > On Mon, Jan 22, 2018 at 02:44:41AM +0000, Kyle Evans wrote: > >> Author: kevans > >> Date: Mon Jan 22 02:44:41 2018 > >> New Revision: 328240 > >> URL: https://svnweb.freebsd.org/changeset/base/328240 > >> > >> Log: > >> Add libregex, connect it to the build > >> > >> libregex is a regex(3) implementation intended to feature GNU extensions and > >> any other non-POSIX compliant extensions that are deemed worthy. > >> > >> These extensions are separated out into a separate library for the sake of > >> not cluttering up libc further with them as well as not deteriorating the > >> speed (or lack thereof) of the libc implementation. > >> > >> libregex is implemented as a build of the libc implementation with LIBREGEX > >> defined to distinguish this from a libc build. The reasons for > >> implementation like this are two-fold: > >> > >> 1.) Maintenance- This reduces the overhead induced by adding yet another > >> regex implementation to base. > >> > >> 2.) Ease of use- Flipping on GNU extensions will be as simple as linking > >> against libregex, and POSIX-compliant compilations can be guaranteed with a > >> REG_POSIX cflag that should be ignored by libc/regex and disables extensions > >> in libregex. It is also easier to keep REG_POSIX sane and POSIX pure when > >> implemented in this fashion. > > You are doing very fragile and unmaintainable trick on all consumers > > there. Your libregex.so exports the same symbols under the same version > > as the libc does. In other words, we now provide two binary-incompatible > > callable symbols, and selection of the symbol by the consumer depends on > > the DT_NEEDED order and interposing. For instance, if some program loads > > a module linked to your libregex, the program behaviour suddenly changes. > > > > Since the library provides incompatible implementation, it must use > > different versions for the symbols, at least to save others time to > > debug the mess. > > What's the best way that you see, going forward? > > I'm inclined to throw a Symbol.map into libregex using FBSD_1.1... > these interfaces are otherwise stable stable within the two respective > libraries, so I don't see that causing too much pain in the future > because symbol version changes should be rare. I do not think this is wise to create contention on the standard FreeBSD' version namespace. > > On the other hand, I could see wanting to use something more like > FBSD_LIBREGEX_1.0 so that if the situation does come up one doesn't > need to double-check that they're not colliding with the other > implementation. I like this more. We still have to carry that symbols with the current behaviour forever, but at least they would no longer conflict with the libc' symbols for dynamic linking. From owner-svn-src-all@freebsd.org Mon Jan 22 15:55:52 2018 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 CF751EC7CEC; Mon, 22 Jan 2018 15:55:52 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AAADB822FC; Mon, 22 Jan 2018 15:55:52 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8B141C47B; Mon, 22 Jan 2018 15:55:51 +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 w0MFtpEX014957; Mon, 22 Jan 2018 15:55:51 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0MFtpeU014956; Mon, 22 Jan 2018 15:55:51 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801221555.w0MFtpeU014956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 22 Jan 2018 15:55:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328261 - head/sys/dev/drm2 X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/dev/drm2 X-SVN-Commit-Revision: 328261 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 15:55:52 -0000 Author: pfg Date: Mon Jan 22 15:55:51 2018 New Revision: 328261 URL: https://svnweb.freebsd.org/changeset/base/328261 Log: drm2: Basic use of mallocarray(9). These functions deal the same type of overflows we do with mallocarray(9). Using our mallocarray will panic, which different from the previous behavior (returning NULL), but neither behavior is more correct. As a sidenote, drm_calloc_large() is not currently used at all. Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D13835 Modified: head/sys/dev/drm2/drm_mem_util.h Modified: head/sys/dev/drm2/drm_mem_util.h ============================================================================== --- head/sys/dev/drm2/drm_mem_util.h Mon Jan 22 08:33:59 2018 (r328260) +++ head/sys/dev/drm2/drm_mem_util.h Mon Jan 22 15:55:51 2018 (r328261) @@ -36,19 +36,15 @@ __FBSDID("$FreeBSD$"); static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) { - if (size != 0 && nmemb > SIZE_MAX / size) - return NULL; - return malloc(nmemb * size, DRM_MEM_DRIVER, M_NOWAIT | M_ZERO); + return mallocarray(nmemb, size, DRM_MEM_DRIVER, M_NOWAIT | M_ZERO); } /* Modeled after cairo's malloc_ab, it's like calloc but without the zeroing. */ static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size) { - if (size != 0 && nmemb > SIZE_MAX / size) - return NULL; - return malloc(nmemb * size, DRM_MEM_DRIVER, M_NOWAIT); + return mallocarray(nmemb, size, DRM_MEM_DRIVER, M_NOWAIT); } static __inline void drm_free_large(void *ptr) From owner-svn-src-all@freebsd.org Mon Jan 22 17:44:03 2018 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 A4D1BECC47F; Mon, 22 Jan 2018 17:44:03 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-io0-f172.google.com (mail-io0-f172.google.com [209.85.223.172]) (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 74A091A71; Mon, 22 Jan 2018 17:44:02 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-io0-f172.google.com with SMTP id f34so10265285ioi.13; Mon, 22 Jan 2018 09:44:02 -0800 (PST) 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=Il8IB0g1YOtriJfkxf3Xj90IzkB3R2nxM8oLG0PSpio=; b=BXxFVRGqlP5Pipw1bjoC8kdZinVhZxv7M7OH4Seoavv+4WPwdry45Y1qr5gD/skpRZ 0K5+goNd/rD6iUCkwg9HyJxK5SOyxIYlOY48Ie8O0S7tRki9UKHRLhC83wZkL/7hRvno 7uxkujCuRi3KznpEE/kXJX+Kn3XBsVyip7p7ulekAT3NRG7HFJe2hZw8bVbIMRdjk3hV Djpc/+NisUO1n1ez5etj6FA+hItvLhF05cIMWB6V0jnfcUXcbrId4j4y81yn3N2ljLlN XzqKQYOJQ7mn3RilZKarpSHc1vbddCEyOg27Ap0Vqa4IvaGHBfRMnDexaIA7pXPBOHbD H9eA== X-Gm-Message-State: AKwxyteevMIOclNNy8Q8M9qtvq8GyE8KTOiq2O91z9S1pDlKrFJxLlTX 0SlBKinOEXsIpwUzJcqLJM+98+ZP X-Google-Smtp-Source: AH8x226Y/mZmNsV3la1GrtHGyrMlDK74XTAh++wEdI6q310ahfUTIc+GPwJSZYfpLghHFZVIv8LcEw== X-Received: by 10.107.83.12 with SMTP id h12mr8397891iob.277.1516643035763; Mon, 22 Jan 2018 09:43:55 -0800 (PST) Received: from mail-it0-f52.google.com (mail-it0-f52.google.com. [209.85.214.52]) by smtp.gmail.com with ESMTPSA id a202sm4016177ita.4.2018.01.22.09.43.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 09:43:55 -0800 (PST) Received: by mail-it0-f52.google.com with SMTP id p124so10633107ite.1; Mon, 22 Jan 2018 09:43:55 -0800 (PST) X-Received: by 10.36.36.66 with SMTP id f63mr9445248ita.41.1516643034999; Mon, 22 Jan 2018 09:43:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.157.12 with HTTP; Mon, 22 Jan 2018 09:43:34 -0800 (PST) In-Reply-To: <20180122155307.GG55707@kib.kiev.ua> References: <201801220244.w0M2if3I083081@repo.freebsd.org> <20180122102639.GD55707@kib.kiev.ua> <20180122155307.GG55707@kib.kiev.ua> From: Kyle Evans Date: Mon, 22 Jan 2018 11:43:34 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328240 - in head: etc/mtree lib lib/libc/regex lib/libc/tests/regex lib/libregex lib/libregex/tests share/mk To: Konstantin Belousov 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.25 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, 22 Jan 2018 17:44:03 -0000 On Mon, Jan 22, 2018 at 9:53 AM, Konstantin Belousov wrote: > On Mon, Jan 22, 2018 at 08:05:30AM -0600, Kyle Evans wrote: >> On Mon, Jan 22, 2018 at 4:26 AM, Konstantin Belousov >> wrote: >> > On Mon, Jan 22, 2018 at 02:44:41AM +0000, Kyle Evans wrote: >> >> Author: kevans >> >> Date: Mon Jan 22 02:44:41 2018 >> >> New Revision: 328240 >> >> URL: https://svnweb.freebsd.org/changeset/base/328240 >> >> >> >> Log: >> >> Add libregex, connect it to the build >> >> >> >> libregex is a regex(3) implementation intended to feature GNU extensions and >> >> any other non-POSIX compliant extensions that are deemed worthy. >> >> >> >> These extensions are separated out into a separate library for the sake of >> >> not cluttering up libc further with them as well as not deteriorating the >> >> speed (or lack thereof) of the libc implementation. >> >> >> >> libregex is implemented as a build of the libc implementation with LIBREGEX >> >> defined to distinguish this from a libc build. The reasons for >> >> implementation like this are two-fold: >> >> >> >> 1.) Maintenance- This reduces the overhead induced by adding yet another >> >> regex implementation to base. >> >> >> >> 2.) Ease of use- Flipping on GNU extensions will be as simple as linking >> >> against libregex, and POSIX-compliant compilations can be guaranteed with a >> >> REG_POSIX cflag that should be ignored by libc/regex and disables extensions >> >> in libregex. It is also easier to keep REG_POSIX sane and POSIX pure when >> >> implemented in this fashion. >> > You are doing very fragile and unmaintainable trick on all consumers >> > there. Your libregex.so exports the same symbols under the same version >> > as the libc does. In other words, we now provide two binary-incompatible >> > callable symbols, and selection of the symbol by the consumer depends on >> > the DT_NEEDED order and interposing. For instance, if some program loads >> > a module linked to your libregex, the program behaviour suddenly changes. >> > >> > Since the library provides incompatible implementation, it must use >> > different versions for the symbols, at least to save others time to >> > debug the mess. >> >> What's the best way that you see, going forward? >> >> I'm inclined to throw a Symbol.map into libregex using FBSD_1.1... >> these interfaces are otherwise stable stable within the two respective >> libraries, so I don't see that causing too much pain in the future >> because symbol version changes should be rare. > I do not think this is wise to create contention on the standard FreeBSD' > version namespace. > >> >> On the other hand, I could see wanting to use something more like >> FBSD_LIBREGEX_1.0 so that if the situation does come up one doesn't >> need to double-check that they're not colliding with the other >> implementation. > I like this more. We still have to carry that symbols with the current > behaviour forever, but at least they would no longer conflict with the > libc' symbols for dynamic linking. Right- that makes sense. Would you object to the following patch? The versioning was botched in the first place because of no VERSION_DEF. I've also dropped the FBSD_ prefix from my previous mention of it because there seems to be no good justification or precedent for it elsewhere in the tree that I've found. diff --git a/lib/libregex/Makefile b/lib/libregex/Makefile index eb6b0b64650..8ac496dd9f7 100644 --- a/lib/libregex/Makefile +++ b/lib/libregex/Makefile @@ -9,7 +9,8 @@ SHLIB_MINOR= 0 CFLAGS+= -DLIBREGEX LIBC_SRCTOP= ${.CURDIR:H}/libc -SYMBOL_MAPS= ${SYM_MAPS} +VERSION_DEF= ${.CURDIR}/Versions.def +SYMBOL_MAPS= ${.CURDIR}/Symbol.map WARNS?= 2 #HAS_TESTS= diff --git a/lib/libregex/Symbol.map b/lib/libregex/Symbol.map new file mode 100644 index 00000000000..1b77bd85aca --- /dev/null +++ b/lib/libregex/Symbol.map @@ -0,0 +1,10 @@ +/* + * $FreeBSD$ + */ + +LIBREGEX_1.0 { + regcomp; + regerror; + regexec; + regfree; +}; diff --git a/lib/libregex/Versions.def b/lib/libregex/Versions.def new file mode 100644 index 00000000000..b6c84200762 --- /dev/null +++ b/lib/libregex/Versions.def @@ -0,0 +1,5 @@ +# $FreeBSD$ + +LIBREGEX_1.0 { +}; + From owner-svn-src-all@freebsd.org Mon Jan 22 17:47:51 2018 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 1D341ECC6E6; Mon, 22 Jan 2018 17:47:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D9A6D1E18; Mon, 22 Jan 2018 17:47:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFCAB1D680; Mon, 22 Jan 2018 17:47:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0MHln73061117; Mon, 22 Jan 2018 17:47:49 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0MHlnrC061116; Mon, 22 Jan 2018 17:47:49 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801221747.w0MHlnrC061116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 22 Jan 2018 17:47:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328262 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 328262 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 17:47:51 -0000 Author: imp Date: Mon Jan 22 17:47:49 2018 New Revision: 328262 URL: https://svnweb.freebsd.org/changeset/base/328262 Log: This comment is bogus. This is a legit release. Reviewed by: scottl@, ken@ Sponsored by: Netflix Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Jan 22 15:55:51 2018 (r328261) +++ head/sys/cam/scsi/scsi_da.c Mon Jan 22 17:47:49 2018 (r328262) @@ -2965,7 +2965,7 @@ more: if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); - cam_periph_release_locked(periph); /* XXX is this still valid? I think so but unverified */ + cam_periph_release_locked(periph); } if ((bp->bio_flags & BIO_ORDERED) != 0 || From owner-svn-src-all@freebsd.org Mon Jan 22 18:05:00 2018 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 0F1F8ECD118; Mon, 22 Jan 2018 18:05:00 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 17F6C2A38; Mon, 22 Jan 2018 18:04:58 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 613995bb; Mon, 22 Jan 2018 19:04:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=5RzWa9Qjn42wXa1GtJRD1uAqsrw=; b=Vf/gSkWcXENhn0rDRtNpYZfMqq9q e7NzYtOGuf3YnD7wGFX+RklJ9Jf98/8u//0gwaojfO1+WeLgZWflzRjGGLs8VMST eRIiI6Ojrp0QcM8zeLgswu4SXoMjPJF8Wl35W6CbtVDmmxBOJx+1S6Vgffp7SKaf ltMlm8SK0+JaNto= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=DJym8rAfoxDBbEgMhd/yoUFxzS+njnXk5Ml85WOA5eWKCAHgl/jkuosX QA/CgWX85CQL5Wzr8h2bLUBrDUgeCPJftg9PBkoQpi7SuEjBbW19jpPeULkpw5gh p2SQ2v8xsl5cHutP9EpATS1qlYU7IuZUznEllEOOR1ZWAU2+XPs= Received: from arcadia.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 2935b70e TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Mon, 22 Jan 2018 19:04:55 +0100 (CET) Date: Mon, 22 Jan 2018 19:04:54 +0100 From: Emmanuel Vadot To: "Poul-Henning Kamp" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-Id: <20180122190454.7d71e565259ca721d705ce38@bidouilliste.com> In-Reply-To: <88556.1516636361@critter.freebsd.dk> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <20180122135905.203e19ce94510854777dff63@bidouilliste.com> <88070.1516628327@critter.freebsd.dk> <20180122145117.08173be547f5dd6fef296732@bidouilliste.com> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> <88556.1516636361@critter.freebsd.dk> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 18:05:00 -0000 On Mon, 22 Jan 2018 15:52:41 +0000 "Poul-Henning Kamp" wrote: > -------- > In message <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com>, Emmanuel > Vadot writes: > > >[...] there is no way to > >know what the user will do so every node not used by the SBC must be > >disabled. > > [...] until the user explicitly tells us, for instance with the command: > > kldload /boot/kernel/bcm283x_pwm.ko > > I'm not sure who was the first to run 386BSD on a laptop 25 years > ago, I was certainly one of the first five. 25 years ago I was trying to finish Ghouls and Ghosts on my Sega Megadrive and had no idea what BSD was. Now I write code for FreeBSD for arm SoCs which is not a violation of how stuff works. Time isn't always relevant. > Ever since then our explicit goal has been to *not* require reboots > for reconfiguration, unless there was no way to avoid it. Nothing > you or the "DT guys" can say, can convince me that we should reverse > that course. > > I don't care how it works, but enabling and using PWM on an > out-of-the-box RPi should not require a reboot. But you are not providing a good way to do it, this is a selfish commit because you just want to use PWM on your RPI and this is not how we should do things in FreeBSD. > Over&Out P.S.: I still can't finish Ghouls And Ghosts, someone please help me. -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Mon Jan 22 18:05:32 2018 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 BBB8AECD1E2; Mon, 22 Jan 2018 18:05:32 +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 473552BA1; Mon, 22 Jan 2018 18:05:32 +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 w0MI5N0Z081213 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 22 Jan 2018 20:05:26 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w0MI5N0Z081213 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w0MI5N0e081211; Mon, 22 Jan 2018 20:05:23 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 22 Jan 2018 20:05:23 +0200 From: Konstantin Belousov To: Kyle Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328240 - in head: etc/mtree lib lib/libc/regex lib/libc/tests/regex lib/libregex lib/libregex/tests share/mk Message-ID: <20180122180523.GH55707@kib.kiev.ua> References: <201801220244.w0M2if3I083081@repo.freebsd.org> <20180122102639.GD55707@kib.kiev.ua> <20180122155307.GG55707@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) 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.25 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, 22 Jan 2018 18:05:32 -0000 On Mon, Jan 22, 2018 at 11:43:34AM -0600, Kyle Evans wrote: > On Mon, Jan 22, 2018 at 9:53 AM, Konstantin Belousov > wrote: > > On Mon, Jan 22, 2018 at 08:05:30AM -0600, Kyle Evans wrote: > >> On Mon, Jan 22, 2018 at 4:26 AM, Konstantin Belousov > >> wrote: > >> > On Mon, Jan 22, 2018 at 02:44:41AM +0000, Kyle Evans wrote: > >> >> Author: kevans > >> >> Date: Mon Jan 22 02:44:41 2018 > >> >> New Revision: 328240 > >> >> URL: https://svnweb.freebsd.org/changeset/base/328240 > >> >> > >> >> Log: > >> >> Add libregex, connect it to the build > >> >> > >> >> libregex is a regex(3) implementation intended to feature GNU extensions and > >> >> any other non-POSIX compliant extensions that are deemed worthy. > >> >> > >> >> These extensions are separated out into a separate library for the sake of > >> >> not cluttering up libc further with them as well as not deteriorating the > >> >> speed (or lack thereof) of the libc implementation. > >> >> > >> >> libregex is implemented as a build of the libc implementation with LIBREGEX > >> >> defined to distinguish this from a libc build. The reasons for > >> >> implementation like this are two-fold: > >> >> > >> >> 1.) Maintenance- This reduces the overhead induced by adding yet another > >> >> regex implementation to base. > >> >> > >> >> 2.) Ease of use- Flipping on GNU extensions will be as simple as linking > >> >> against libregex, and POSIX-compliant compilations can be guaranteed with a > >> >> REG_POSIX cflag that should be ignored by libc/regex and disables extensions > >> >> in libregex. It is also easier to keep REG_POSIX sane and POSIX pure when > >> >> implemented in this fashion. > >> > You are doing very fragile and unmaintainable trick on all consumers > >> > there. Your libregex.so exports the same symbols under the same version > >> > as the libc does. In other words, we now provide two binary-incompatible > >> > callable symbols, and selection of the symbol by the consumer depends on > >> > the DT_NEEDED order and interposing. For instance, if some program loads > >> > a module linked to your libregex, the program behaviour suddenly changes. > >> > > >> > Since the library provides incompatible implementation, it must use > >> > different versions for the symbols, at least to save others time to > >> > debug the mess. > >> > >> What's the best way that you see, going forward? > >> > >> I'm inclined to throw a Symbol.map into libregex using FBSD_1.1... > >> these interfaces are otherwise stable stable within the two respective > >> libraries, so I don't see that causing too much pain in the future > >> because symbol version changes should be rare. > > I do not think this is wise to create contention on the standard FreeBSD' > > version namespace. > > > >> > >> On the other hand, I could see wanting to use something more like > >> FBSD_LIBREGEX_1.0 so that if the situation does come up one doesn't > >> need to double-check that they're not colliding with the other > >> implementation. > > I like this more. We still have to carry that symbols with the current > > behaviour forever, but at least they would no longer conflict with the > > libc' symbols for dynamic linking. > > Right- that makes sense. Would you object to the following patch? The > versioning was botched in the first place because of no VERSION_DEF. > I've also dropped the FBSD_ prefix from my previous mention of it > because there seems to be no good justification or precedent for it > elsewhere in the tree that I've found. This looks fine. I would suggest to add the explanation why a different version name was used there, in particular, to highlight that the symbols otherwise conflict with the symbols from libc. > > diff --git a/lib/libregex/Makefile b/lib/libregex/Makefile > index eb6b0b64650..8ac496dd9f7 100644 > --- a/lib/libregex/Makefile > +++ b/lib/libregex/Makefile > @@ -9,7 +9,8 @@ SHLIB_MINOR= 0 > > CFLAGS+= -DLIBREGEX > LIBC_SRCTOP= ${.CURDIR:H}/libc > -SYMBOL_MAPS= ${SYM_MAPS} > +VERSION_DEF= ${.CURDIR}/Versions.def > +SYMBOL_MAPS= ${.CURDIR}/Symbol.map > WARNS?= 2 > > #HAS_TESTS= > diff --git a/lib/libregex/Symbol.map b/lib/libregex/Symbol.map > new file mode 100644 > index 00000000000..1b77bd85aca > --- /dev/null > +++ b/lib/libregex/Symbol.map > @@ -0,0 +1,10 @@ > +/* > + * $FreeBSD$ > + */ > + > +LIBREGEX_1.0 { > + regcomp; > + regerror; > + regexec; > + regfree; > +}; > diff --git a/lib/libregex/Versions.def b/lib/libregex/Versions.def > new file mode 100644 > index 00000000000..b6c84200762 > --- /dev/null > +++ b/lib/libregex/Versions.def > @@ -0,0 +1,5 @@ > +# $FreeBSD$ > + > +LIBREGEX_1.0 { > +}; > + From owner-svn-src-all@freebsd.org Mon Jan 22 18:40:21 2018 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 08916ECED1C; Mon, 22 Jan 2018 18:40:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D7ACC63B41; Mon, 22 Jan 2018 18:40:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 212FD1DF18; Mon, 22 Jan 2018 18:40:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0MIeJGJ082589; Mon, 22 Jan 2018 18:40:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0MIeJls082586; Mon, 22 Jan 2018 18:40:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801221840.w0MIeJls082586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 22 Jan 2018 18:40:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328263 - head/lib/libregex X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libregex X-SVN-Commit-Revision: 328263 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 18:40:21 -0000 Author: kevans Date: Mon Jan 22 18:40:19 2018 New Revision: 328263 URL: https://svnweb.freebsd.org/changeset/base/328263 Log: libregex: Add a symbol map kib points out that trying to re-use symbol versioning from libc is dirty and wrong. The implementation in libregex is incompatible by design with the implementation in libc. Using the symbol versions from libc can and likely will cause confusions for linkers and bring unexpected behavior for consumers that unwillingly (transitively) link against libregex. Reported by: kib Added: head/lib/libregex/Symbol.map (contents, props changed) head/lib/libregex/Versions.def (contents, props changed) Modified: head/lib/libregex/Makefile Modified: head/lib/libregex/Makefile ============================================================================== --- head/lib/libregex/Makefile Mon Jan 22 17:47:49 2018 (r328262) +++ head/lib/libregex/Makefile Mon Jan 22 18:40:19 2018 (r328263) @@ -9,8 +9,10 @@ SHLIB_MINOR= 0 CFLAGS+= -DLIBREGEX LIBC_SRCTOP= ${.CURDIR:H}/libc -SYMBOL_MAPS= ${SYM_MAPS} WARNS?= 2 + +VERSION_DEF= ${.CURDIR}/Versions.def +SYMBOL_MAPS= ${.CURDIR}/Symbol.map #HAS_TESTS= SUBDIR.${MK_TESTS}+= tests Added: head/lib/libregex/Symbol.map ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libregex/Symbol.map Mon Jan 22 18:40:19 2018 (r328263) @@ -0,0 +1,16 @@ +/* + * $FreeBSD$ + */ + +/* + * libregex uses a different version name because its symbols are not strictly + * compatible with those provided by libc. Re-using the version name from libc + * could cause linking headaches and make debugging more difficult than it needs + * to be. + */ +LIBREGEX_1.0 { + regcomp; + regerror; + regexec; + regfree; +}; Added: head/lib/libregex/Versions.def ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libregex/Versions.def Mon Jan 22 18:40:19 2018 (r328263) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +LIBREGEX_1.0 { +}; + From owner-svn-src-all@freebsd.org Mon Jan 22 18:42:12 2018 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 D250AECF1F6; Mon, 22 Jan 2018 18:42:12 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-io0-f177.google.com (mail-io0-f177.google.com [209.85.223.177]) (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 0C0F36805C; Mon, 22 Jan 2018 18:42:10 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-io0-f177.google.com with SMTP id l17so10478555ioc.3; Mon, 22 Jan 2018 10:42:10 -0800 (PST) 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=tGX1vRMYT/o4Hqf8hBePcSGUxfKKAvns0qCSpD2X/eo=; b=YzP2Rqsis/TLBnXV8WeIca4VNaxO8+2pGtskCSLvm+q9a/iX+BERvQ7m77NtM+L1+W L0liPEqcmWXsHNnR14hctVd8Zn82m4SYtEYE32hbBG5vGmfCcVN5LH+Gh7/41qu6qWjK Ldh2X76rPePYoo8MocuJ4wr7ZtqbEdhIkgq++IzIXH/eao3E4kSgxbDnhJzqlijyecXu u6bHk2vn5AjxSyfXQk0TlilKPueIafQ/FCbp2NW+up4h3LmNQmNeYo6svmBK6zdy8cJM wO9XL7emjPnZ8HGu6oKq1coTGcjzhWIN+nVqjQMKGvLpyCSIvq07y3mu+RdNJGam9+e4 j+eA== X-Gm-Message-State: AKwxytdCPMGfZqcpYzkOnphXIk6jWfS23PyvYAWoecSVpillswkXCpqK ELMCnINn3WlGTNwNaes4knBEL23H X-Google-Smtp-Source: AH8x2254VvivIfKucCxq+8mMeCTF4z31yySyx/re6+v1lD89YUNLwnok4gcahBFkWGoCiHeXeSm74A== X-Received: by 10.107.8.148 with SMTP id h20mr9302520ioi.204.1516646523582; Mon, 22 Jan 2018 10:42:03 -0800 (PST) Received: from mail-io0-f174.google.com (mail-io0-f174.google.com. [209.85.223.174]) by smtp.gmail.com with ESMTPSA id f7sm8494226iod.60.2018.01.22.10.42.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 10:42:03 -0800 (PST) Received: by mail-io0-f174.google.com with SMTP id t22so10461435ioa.7; Mon, 22 Jan 2018 10:42:02 -0800 (PST) X-Received: by 10.107.20.200 with SMTP id 191mr9547916iou.239.1516646522583; Mon, 22 Jan 2018 10:42:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.157.12 with HTTP; Mon, 22 Jan 2018 10:41:41 -0800 (PST) In-Reply-To: <20180122180523.GH55707@kib.kiev.ua> References: <201801220244.w0M2if3I083081@repo.freebsd.org> <20180122102639.GD55707@kib.kiev.ua> <20180122155307.GG55707@kib.kiev.ua> <20180122180523.GH55707@kib.kiev.ua> From: Kyle Evans Date: Mon, 22 Jan 2018 12:41:41 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328240 - in head: etc/mtree lib lib/libc/regex lib/libc/tests/regex lib/libregex lib/libregex/tests share/mk To: Konstantin Belousov Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 18:42:13 -0000 On Mon, Jan 22, 2018 at 12:05 PM, Konstantin Belousov wrote: > On Mon, Jan 22, 2018 at 11:43:34AM -0600, Kyle Evans wrote: >> On Mon, Jan 22, 2018 at 9:53 AM, Konstantin Belousov >> wrote: >> > On Mon, Jan 22, 2018 at 08:05:30AM -0600, Kyle Evans wrote: >> >> On Mon, Jan 22, 2018 at 4:26 AM, Konstantin Belousov >> >> wrote: >> >> > On Mon, Jan 22, 2018 at 02:44:41AM +0000, Kyle Evans wrote: >> >> >> Author: kevans >> >> >> Date: Mon Jan 22 02:44:41 2018 >> >> >> New Revision: 328240 >> >> >> URL: https://svnweb.freebsd.org/changeset/base/328240 >> >> >> >> >> >> Log: >> >> >> Add libregex, connect it to the build >> >> >> >> >> >> libregex is a regex(3) implementation intended to feature GNU extensions and >> >> >> any other non-POSIX compliant extensions that are deemed worthy. >> >> >> >> >> >> These extensions are separated out into a separate library for the sake of >> >> >> not cluttering up libc further with them as well as not deteriorating the >> >> >> speed (or lack thereof) of the libc implementation. >> >> >> >> >> >> libregex is implemented as a build of the libc implementation with LIBREGEX >> >> >> defined to distinguish this from a libc build. The reasons for >> >> >> implementation like this are two-fold: >> >> >> >> >> >> 1.) Maintenance- This reduces the overhead induced by adding yet another >> >> >> regex implementation to base. >> >> >> >> >> >> 2.) Ease of use- Flipping on GNU extensions will be as simple as linking >> >> >> against libregex, and POSIX-compliant compilations can be guaranteed with a >> >> >> REG_POSIX cflag that should be ignored by libc/regex and disables extensions >> >> >> in libregex. It is also easier to keep REG_POSIX sane and POSIX pure when >> >> >> implemented in this fashion. >> >> > You are doing very fragile and unmaintainable trick on all consumers >> >> > there. Your libregex.so exports the same symbols under the same version >> >> > as the libc does. In other words, we now provide two binary-incompatible >> >> > callable symbols, and selection of the symbol by the consumer depends on >> >> > the DT_NEEDED order and interposing. For instance, if some program loads >> >> > a module linked to your libregex, the program behaviour suddenly changes. >> >> > >> >> > Since the library provides incompatible implementation, it must use >> >> > different versions for the symbols, at least to save others time to >> >> > debug the mess. >> >> >> >> What's the best way that you see, going forward? >> >> >> >> I'm inclined to throw a Symbol.map into libregex using FBSD_1.1... >> >> these interfaces are otherwise stable stable within the two respective >> >> libraries, so I don't see that causing too much pain in the future >> >> because symbol version changes should be rare. >> > I do not think this is wise to create contention on the standard FreeBSD' >> > version namespace. >> > >> >> >> >> On the other hand, I could see wanting to use something more like >> >> FBSD_LIBREGEX_1.0 so that if the situation does come up one doesn't >> >> need to double-check that they're not colliding with the other >> >> implementation. >> > I like this more. We still have to carry that symbols with the current >> > behaviour forever, but at least they would no longer conflict with the >> > libc' symbols for dynamic linking. >> >> Right- that makes sense. Would you object to the following patch? The >> versioning was botched in the first place because of no VERSION_DEF. >> I've also dropped the FBSD_ prefix from my previous mention of it >> because there seems to be no good justification or precedent for it >> elsewhere in the tree that I've found. > This looks fine. > > I would suggest to add the explanation why a different version name was > used there, in particular, to highlight that the symbols otherwise > conflict with the symbols from libc. >> Committed as r328263 with explanation in the symbol map for the difference from libc. Thanks! From owner-svn-src-all@freebsd.org Mon Jan 22 18:43:38 2018 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 0C225ECF417 for ; Mon, 22 Jan 2018 18:43:38 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-it0-f53.google.com (mail-it0-f53.google.com [209.85.214.53]) (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 D0F6A68368 for ; Mon, 22 Jan 2018 18:43:37 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-it0-f53.google.com with SMTP id u62so11001595ita.2 for ; Mon, 22 Jan 2018 10:43:37 -0800 (PST) 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:cc; bh=jE/Kjbu+DOTvsBLMHx2mpUGDeq+BWsHzyuCohIz62RM=; b=kv9ByHy9EscG5/c5aVVkdWHthGc6I7Ejajj20YOjqLF/qkopsYxC6NpOFuHFFSyT0C wPKnwctmkbHy9cyawUhItV0tf3Ra7EMR8V+1iVUYvLbKYrFPJvo51Y0IKrnmoVMbbdZ+ slsFrji3P54i/oYsDNEYKrKz8vkZUkT5YBoS/EErtK1I4D6ggRLBUzz62EY1HTmjRKTj g/trVkL7l9YD8FaO4vdUgQbzXuwHLYT3Om5l8hODjzsL27oJOPaoX/Ly+uGYeXdEXQRk GvqVhTwF31h55Ap2rxkMeieDtrttV3XX2yreYzy56EQEY1+iYxQT19PVrkoQLsIMAdlJ eZ7A== X-Gm-Message-State: AKwxyteJke/LXb5GkGT3SsVTTAhx/+JkclZ1oLJMXusY92IZalwFODhp LibjLWw96hy1Y0egOX4T7dSYn6Xe X-Google-Smtp-Source: AH8x225I0FjdXiauy4HMQ2yGwEHfOloH8GFerRufjHFHbD9QVPqOFAfRuRelF2lgIHWvRKAcgtHrpA== X-Received: by 10.36.104.210 with SMTP id v201mr8732921itb.64.1516646611140; Mon, 22 Jan 2018 10:43:31 -0800 (PST) Received: from mail-io0-f181.google.com (mail-io0-f181.google.com. [209.85.223.181]) by smtp.gmail.com with ESMTPSA id m82sm8192553ioe.36.2018.01.22.10.43.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 10:43:31 -0800 (PST) Received: by mail-io0-f181.google.com with SMTP id p188so10450483ioe.12 for ; Mon, 22 Jan 2018 10:43:30 -0800 (PST) X-Received: by 10.107.20.200 with SMTP id 191mt10133122iou.239.1516646610576; Mon, 22 Jan 2018 10:43:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.157.12 with HTTP; Mon, 22 Jan 2018 10:43:10 -0800 (PST) In-Reply-To: <201801221840.w0MIeJls082586@repo.freebsd.org> References: <201801221840.w0MIeJls082586@repo.freebsd.org> From: Kyle Evans Date: Mon, 22 Jan 2018 12:43:10 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328263 - head/lib/libregex 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.25 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, 22 Jan 2018 18:43:38 -0000 On Mon, Jan 22, 2018 at 12:40 PM, Kyle Evans wrote: > Author: kevans > Date: Mon Jan 22 18:40:19 2018 > New Revision: 328263 > URL: https://svnweb.freebsd.org/changeset/base/328263 > > Log: > libregex: Add a symbol map > > kib points out that trying to re-use symbol versioning from libc is dirty > and wrong. The implementation in libregex is incompatible by design with the > implementation in libc. Using the symbol versions from libc can and likely > will cause confusions for linkers and bring unexpected behavior for > consumers that unwillingly (transitively) link against libregex. > > Reported by: kib > Another thing I forgot to note here: libregex symbol versioning was actually not happening prior to this commit due to failure to define VERSION_DEF. This has also been corrected in this commit. From owner-svn-src-all@freebsd.org Mon Jan 22 18:57:37 2018 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 1C0D6ED00FD; Mon, 22 Jan 2018 18:57:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (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 EDA6468E14; Mon, 22 Jan 2018 18:57:36 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (astound-66-234-199-215.ca.astound.net [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id A551810A7DB; Mon, 22 Jan 2018 13:57:35 -0500 (EST) From: John Baldwin To: Emmanuel Vadot Cc: Poul-Henning Kamp , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Date: Mon, 22 Jan 2018 10:57:28 -0800 Message-ID: <52374125.OgxafgljNu@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> 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); Mon, 22 Jan 2018 13:57:35 -0500 (EST) 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.25 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, 22 Jan 2018 18:57:37 -0000 On Monday, January 22, 2018 03:30:03 PM Emmanuel Vadot wrote: > On Mon, 22 Jan 2018 14:07:30 +0000 > "Poul-Henning Kamp" wrote: > > > -------- > > In message <20180122145117.08173be547f5dd6fef296732@bidouilliste.com>, Emmanuel > > Vadot writes: > > > > > Using the same logic as before one could have a script starting some > > >pwm stuff (or simply using /etc/sysctl.conf) > > > Also this is not how DT is suppose to work, if the status == > > >'disabled' no driver should attach. > > > > That doesn't make *any* UX sense. > > > > "disabled" indicates that it can be enabled, and there is absolutely > > no reason to force users to reboot, when all that stands between > > them and using their hardware is a random setting in a file. > > To be more clear, disabled mean that the node should not be used. > In a industrial board you will always have every usable node enabled, > in the SBC world where you have a way to plug daughter card and > exchange them or even use the exposed pins directly there is no way to > know what the user will do so every node not used by the SBC must be > disabled. > This is the overlay part of DT that is responsible to enable them > > > Explicitly kldload'ing a device-driver is as clear a "Enable it, please" > > instruction as you can get from the user. > > But device driver != DT node I have a suggestion. In the "hints" world we allow devices to be disabled via 'hint.foo.0.disabled=1' and that results in the code that creates the device disabling it via 'device_disable(dev)'. This avoids having to check that the device is disabled in every driver. However, we also provide the ability (recentish as in 10.x) to override that setting via 'devctl enable', so that you can now choose to enable a device that was disabled by hints via 'devctl enable foo0'. I would suggest that you do something similar for FDT. Create the corresponding device_t but device_disable() it when there is a disabled property. A user can then use 'devctl enable ' to enable it before (or even after) loading a device driver. To make this work well you probably want to allow devctl to name devices via FDT handles as you can currently name them via ACPI handles or PCI addresses. I can give some pointers on how to do that, though I think the ACPI code for that is pretty easy to follow. -- John Baldwin From owner-svn-src-all@freebsd.org Mon Jan 22 18:57:38 2018 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 3B482ED0108; Mon, 22 Jan 2018 18:57:38 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (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 14DEF68E15; Mon, 22 Jan 2018 18:57:38 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (astound-66-234-199-215.ca.astound.net [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 25E7F10A87D; Mon, 22 Jan 2018 13:57:37 -0500 (EST) From: John Baldwin To: Alexey Dokuchaev Cc: Jason Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r319971 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src include lib/libc/stdlib/jemalloc Date: Mon, 22 Jan 2018 10:50:06 -0800 Message-ID: <1981273.UqQzroY0xG@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <20180122063210.GA43383@FreeBSD.org> References: <201706150715.v5F7F6aT031218@repo.freebsd.org> <20180118101031.GB21646@FreeBSD.org> <20180122063210.GA43383@FreeBSD.org> 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); Mon, 22 Jan 2018 13:57:37 -0500 (EST) 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.25 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, 22 Jan 2018 18:57:38 -0000 On Monday, January 22, 2018 06:32:10 AM Alexey Dokuchaev wrote: > On Thu, Jan 18, 2018 at 10:10:31AM +0000, Alexey Dokuchaev wrote: > > On Sat, Jan 13, 2018 at 05:04:30PM +0000, Alexey Dokuchaev wrote: > > > On Thu, Jun 15, 2017 at 07:15:06AM +0000, Jason Evans wrote: > > > > New Revision: 319971 > > > > URL: https://svnweb.freebsd.org/changeset/base/319971 > > > > > > > > Log: > > > > Update jemalloc to 5.0.0. > > > > > > I've finally bisected the problem of `games/quake2lnx' failing to start > > > (hanging) in GLX mode down to this commit. Reverting it and making "all > > > install" under `/usr/src/lib/libc' restores correct operation. > > > > > > If I run it as ``env LD_PRELOAD=/lib/libthr.so.3 quake2 ...'' it starts > > > normally. Do you have any ideas what might have broken it? Is this a > > > problem with how the Quake2 binary is linked, or with jemalloc? > > > > > > To reproduce: > > > > > > $ cd /usr/ports/games/quake2lnx && make all install > > > $ quake2 +set vid_ref glx > > > > Last two comments in https://github.com/jemalloc/jemalloc/issues/907 > > (October 10th-ish) could be related... > > I've just found out that similar bug was already reported back in July: > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220767 > > ./danfe I wonder if it is tripping over pthread_once not working in libc. The stub for pthread_once in libc is a nop and has been for a long time. I added a functioning stub (called _libc_once) to libc for it's internal use (there is a _once() wrapper that will call _pthread_once when using libpthread and _libc_once otherwise). It might be interesting to build jemalloc with '-Dpthread_once=_once' to see if that makes a difference? -- John Baldwin From owner-svn-src-all@freebsd.org Mon Jan 22 19:13:53 2018 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 E26D1ED0C27 for ; Mon, 22 Jan 2018 19:13:53 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (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 C501269B00 for ; Mon, 22 Jan 2018 19:13:53 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 2974b9a3-ffa8-11e7-8486-0934409070aa X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 2974b9a3-ffa8-11e7-8486-0934409070aa; Mon, 22 Jan 2018 19:12:17 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w0MJCh9F004082; Mon, 22 Jan 2018 12:12:43 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1516648363.42536.134.camel@freebsd.org> Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules From: Ian Lepore To: John Baldwin , Emmanuel Vadot Cc: Poul-Henning Kamp , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 22 Jan 2018 12:12:43 -0700 In-Reply-To: <52374125.OgxafgljNu@ralph.baldwin.cx> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> <52374125.OgxafgljNu@ralph.baldwin.cx> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 19:13:54 -0000 On Mon, 2018-01-22 at 10:57 -0800, John Baldwin wrote: > On Monday, January 22, 2018 03:30:03 PM Emmanuel Vadot wrote: > > > > On Mon, 22 Jan 2018 14:07:30 +0000 > > "Poul-Henning Kamp" wrote: > > > > > > > > -------- > > > In message <20180122145117.08173be547f5dd6fef296732@bidouilliste. > > > com>, Emmanuel > > > Vadot writes: > > > > > > > > > > > Using the same logic as before one could have a script starting > > > > some > > > > pwm stuff (or simply using /etc/sysctl.conf) > > > > Also this is not how DT is suppose to work, if the status == > > > > 'disabled' no driver should attach. > > > That doesn't make *any* UX sense. > > > > > > "disabled" indicates that it can be enabled, and there is > > > absolutely > > > no reason to force users to reboot, when all that stands between > > > them and using their hardware is a random setting in a file. > > To be more clear, disabled mean that the node should not be used. > > In a industrial board you will always have every usable node > > enabled, > > in the SBC world where you have a way to plug daughter card and > > exchange them or even use the exposed pins directly there is no way > > to > > know what the user will do so every node not used by the SBC must > > be > > disabled. > > This is the overlay part of DT that is responsible to enable them > > > > > > > > Explicitly kldload'ing a device-driver is as clear a "Enable it, > > > please" > > > instruction as you can get from the user. > > But device driver != DT node > I have a suggestion.In the "hints" world we allow devices to be > disabled > via 'hint.foo.0.disabled=1' and that results in the code that creates > the > device disabling it via 'device_disable(dev)'.This avoids having to > check > that the device is disabled in every driver.However, we also > provide the > ability (recentish as in 10.x) to override that setting via 'devctl > enable', > so that you can now choose to enable a device that was disabled by > hints > via 'devctl enable foo0'.I would suggest that you do something > similar for > FDT.Create the corresponding device_t but device_disable() it when > there > is a disabled property.A user can then use 'devctl enable ' > to enable > it before (or even after) loading a device driver. > > To make this work well you probably want to allow devctl to name > devices > via FDT handles as you can currently name them via ACPI handles or > PCI > addresses.I can give some pointers on how to do that, though I > think the > ACPI code for that is pretty easy to follow. > The status property of an fdt node controls more than just device instantiation. For example, it also controls whether that device's pinmux setup is done at boot time by the pinmux driver. That's why this misguided attempt to ignore the rules and conventions for using fdt in freebsd is doomed to failure in the long run. (It appears to be working now because the driver also incorrectly works around the lack of a proper pinctrl driver for rpi by doing its own incorrect pinctrl stuff. That house of cards will collapse when someone eventually writes the rpi pinctrl driver.) -- Ian From owner-svn-src-all@freebsd.org Mon Jan 22 19:24:46 2018 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 F3DA2ED1365; Mon, 22 Jan 2018 19:24:45 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id B77906A227; Mon, 22 Jan 2018 19:24:45 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id D22A727395; Mon, 22 Jan 2018 19:24:43 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w0MJORTB089104 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 22 Jan 2018 19:24:28 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0MJORtl089103; Mon, 22 Jan 2018 19:24:27 GMT (envelope-from phk) To: John Baldwin cc: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: <52374125.OgxafgljNu@ralph.baldwin.cx> From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> <52374125.OgxafgljNu@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <89101.1516649067.1@critter.freebsd.dk> Date: Mon, 22 Jan 2018 19:24:27 +0000 Message-ID: <89102.1516649067@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 19:24:46 -0000 -------- In message <52374125.OgxafgljNu@ralph.baldwin.cx>, John Baldwin writes: >Create the corresponding device_t but device_disable() it when there >is a disabled property. That also removes a couple of boilerplate lines from all FDT device drivers. >A user can then use 'devctl enable ' to enable >it before (or even after) loading a device driver. That would work for me. I wonder if it would be too noisy if we allowed ->probe() to run on disabled devices and reported something like: "foobar0: Matched disabled device <...>" (without calling ->attach()) That way you would know you loaded the right driver, rather than have to guess. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-all@freebsd.org Mon Jan 22 19:27:06 2018 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 82CB1ED1558 for ; Mon, 22 Jan 2018 19:27:06 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22b.google.com (mail-it0-x22b.google.com [IPv6:2607:f8b0:4001:c0b::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 4F17F6A4A1 for ; Mon, 22 Jan 2018 19:27:06 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22b.google.com with SMTP id 196so10971526iti.5 for ; Mon, 22 Jan 2018 11:27:06 -0800 (PST) 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=ipiFz0MulOIP2+PANkqQ8XBpoe8gU8WWWkanuqJnM14=; b=nEcjiiRt+FmbDPB3tLepIIcZIPOVbHBYWZtLxiq2RQdg+R1AEkQYuVu0iqOMQPd6ZQ IXACdcu5pq3jGH12R7Q24z2t6hbewSv25CewwsIOZ+sZh32fU6t2PwtS76xpeJ4c25Vk sLJcolIc/o9GnXRbkLDv7sw8bBqp/7E5H4UFYeckdgsNMZyLwM16Mn5jKR0NW8BQH1np PNVllAFdBMyh/FHgulYSSEGgwY5jv7RqqMil4F4FD4IuAI7B8mB5DBRqwWhzckLBCb7l yJQyUWqcoeBjYR+8sDYtKZNlgq3Qpv3HCsGtLbmEQ7Ru4qHrb94NH1c9psqGWeTJhdxD pd4w== 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=ipiFz0MulOIP2+PANkqQ8XBpoe8gU8WWWkanuqJnM14=; b=BOpdQZ4Kb6Kc17lz1aJl+8HT+K8PA2iguZ/COU3f24U6KyQdCadh5KRFjHRpPbvwMP L+H59kv1hfXtiuFa1eMg98Ca83BlWm/CEcEtxt+AnYDgIepuerXQ6T8MGSy4o/W1V+LH vs8cQSo08XHpilbfGBrMJK5sqpmQJ4ktDwGlJzsU3M4yGHvdbJNclDkSdoeBM8hd3i7p SgmTfS2nYjYvG3ZBP7PIqdSmYh9xlo1WbAvCIJtd8THwAj/ISehUqi8Is6lE9SCjTupr mLjqIzy2l6Is5M8lBCh4t1IwsYwG0cpMc9OFa2P7VB/5Cbo4ozqGCkzWZFy3sEImhSKZ sBdQ== X-Gm-Message-State: AKwxytcW0djuqx0iQpjr5m9vCXww9KR563h8yfZ3SD1u6h4Hv7UGCEyb 4Z2HYbu4BHhYEwYHoY0p7ldw9ROilxU56qBONYomzA== X-Google-Smtp-Source: AH8x226iDeZF22TXHMslTFz8joZfKWbkqG8VDf0NO3peiPSBPcAxC4SWBHybfCL4nCOPhLpGfYA0TWSFR3ghyqgwzQU= X-Received: by 10.36.104.210 with SMTP id v201mr8925403itb.64.1516649225458; Mon, 22 Jan 2018 11:27:05 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Mon, 22 Jan 2018 11:27:04 -0800 (PST) X-Originating-IP: [50.227.106.226] In-Reply-To: <1516648363.42536.134.camel@freebsd.org> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> <52374125.OgxafgljNu@ralph.baldwin.cx> <1516648363.42536.134.camel@freebsd.org> From: Warner Losh Date: Mon, 22 Jan 2018 12:27:04 -0700 X-Google-Sender-Auth: TKfqPeGzzRVuitu-QNHRSglzg30 Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: Ian Lepore Cc: John Baldwin , Emmanuel Vadot , Poul-Henning Kamp , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 19:27:06 -0000 On Mon, Jan 22, 2018 at 12:12 PM, Ian Lepore wrote: > On Mon, 2018-01-22 at 10:57 -0800, John Baldwin wrote: > > On Monday, January 22, 2018 03:30:03 PM Emmanuel Vadot wrote: > > > > > > On Mon, 22 Jan 2018 14:07:30 +0000 > > > "Poul-Henning Kamp" wrote: > > > > > > > > > > > -------- > > > > In message <20180122145117.08173be547f5dd6fef296732@bidouilliste. > > > > com>, Emmanuel > > > > Vadot writes: > > > > > > > > > > > > > > Using the same logic as before one could have a script starting > > > > > some > > > > > pwm stuff (or simply using /etc/sysctl.conf) > > > > > Also this is not how DT is suppose to work, if the status == > > > > > 'disabled' no driver should attach. > > > > That doesn't make *any* UX sense. > > > > > > > > "disabled" indicates that it can be enabled, and there is > > > > absolutely > > > > no reason to force users to reboot, when all that stands between > > > > them and using their hardware is a random setting in a file. > > > To be more clear, disabled mean that the node should not be used. > > > In a industrial board you will always have every usable node > > > enabled, > > > in the SBC world where you have a way to plug daughter card and > > > exchange them or even use the exposed pins directly there is no way > > > to > > > know what the user will do so every node not used by the SBC must > > > be > > > disabled. > > > This is the overlay part of DT that is responsible to enable them > > > > > > > > > > > Explicitly kldload'ing a device-driver is as clear a "Enable it, > > > > please" > > > > instruction as you can get from the user. > > > But device driver != DT node > > I have a suggestion. In the "hints" world we allow devices to be > > disabled > > via 'hint.foo.0.disabled=1' and that results in the code that creates > > the > > device disabling it via 'device_disable(dev)'. This avoids having to > > check > > that the device is disabled in every driver. However, we also > > provide the > > ability (recentish as in 10.x) to override that setting via 'devctl > > enable', > > so that you can now choose to enable a device that was disabled by > > hints > > via 'devctl enable foo0'. I would suggest that you do something > > similar for > > FDT. Create the corresponding device_t but device_disable() it when > > there > > is a disabled property. A user can then use 'devctl enable ' > > to enable > > it before (or even after) loading a device driver. > > > > To make this work well you probably want to allow devctl to name > > devices > > via FDT handles as you can currently name them via ACPI handles or > > PCI > > addresses. I can give some pointers on how to do that, though I > > think the > > ACPI code for that is pretty easy to follow. > > > > The status property of an fdt node controls more than just device > instantiation. For example, it also controls whether that device's > pinmux setup is done at boot time by the pinmux driver. That's why > this misguided attempt to ignore the rules and conventions for using > fdt in freebsd is doomed to failure in the long run. (It appears to be > working now because the driver also incorrectly works around the lack > of a proper pinctrl driver for rpi by doing its own incorrect pinctrl > stuff. That house of cards will collapse when someone eventually > writes the rpi pinctrl driver.) > Yes. There's several issues here. The first issue is that RPi is the only popular platform[*] that doesn't do pinctl/pinmux per the FDT standards. So hacks here aren't any worse than what's there now, but they will be ripped out with extreme prejudice when pinmux arrives. The next issue is that RPi doesn't have the proper clock management hooked into our clock framework. That needs to be properly fixed. The next issue is that you need to change the state of the device by an overlay. This will allow pinmux to work (well, would if we had a proper pinmux driver). In the FDT world, you'd need to transition between two different states. To do this dynamically at runtime (which we all agree is desirable), we need to create the proper protocols so that if, say, a GPIO is deactivated that any users are notified. This is a lot trickier than you might think because there can be a cascade of dependencies that need to be notified of the change. And that's tough. So this is a lot more complicated case than the old-devices where devctl enable/disable was more than enough to do things. This is a DAG of change, not a single bit flip. Warner From owner-svn-src-all@freebsd.org Mon Jan 22 19:29:42 2018 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 15D02ED16BC for ; Mon, 22 Jan 2018 19:29:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x234.google.com (mail-io0-x234.google.com [IPv6:2607:f8b0:4001:c06::234]) (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 C40286A690 for ; Mon, 22 Jan 2018 19:29:41 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x234.google.com with SMTP id d13so6058751iog.5 for ; Mon, 22 Jan 2018 11:29:41 -0800 (PST) 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=AUZAiSbms4OOeAkMxsuc7Fib+YVY0+SjYBrlHV1S05s=; b=EvSN6r59XIM9nfEVOjypv8Hj7AVbgPqvITYU6G+80dDKCRKvyM4pw/UaN2JGH2ZBov fNhNrMcpfzaMekBRzzdlkeYpyHd9iY8rZqaJyI/Xeavodn6lu/Sy5Hk6THQR9OMVb8gW PH36SOQrt0cEOC6nH7Fz2md0hDhGzZ2NgEfpFsmpbZwVk0utEV5E5CVEMxxKErVj2r1X B/fv83PGmcb30VeF+YgxEabK0dCYCQM/q0GxhfaWVW/HeN7he6JhP1lUa9NLpi/EIEGZ hP8gu6WfKxgWuTy/9OwZtHHzFazqi67dpju7xJKXM44OpR6pK6wJ4h+i+uMWjYndtXSM WzqA== 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=AUZAiSbms4OOeAkMxsuc7Fib+YVY0+SjYBrlHV1S05s=; b=oyUVlutk1DtzhOodLB0U6fz/MYRWYnMs9MZ6tWmpytE5jy5TY02CylPoBUH2KTgm7O 5WcyCrbrOElgETsVx/WNtg2+jCLkXemddWRzgWcm9peuZV1frrZL2GvLjO/jJjcdgT2h rVmW70IgvhEixCkfxeoofcH4Od/E4CKadD4N+KznTQZ4RyVH32o80AI/LOYRK9jytum4 b5NuuTaLpWa+dc685uLGuhEQCJLY5SnpvIeawkB26tIlbjMfD82Kg5ntimmOW+ItrXfs zEGfhAIJZZjooCi/jQuux5Nn1nbQdw8eobALNuAJjRfmBabUvM1QfB2WXxXDDALFWJgE rqhQ== X-Gm-Message-State: AKwxytefhlQkzFpm3UQ6On7LZW5/qnvjGsPKVODwAFvf72MR46s6enIK PFI56WxK9gFRsaKeEqBA9ghNrl4B8Yx1hRTm7mgMyg== X-Google-Smtp-Source: AH8x226NN6rclRcVHzS0zgCAeq1kbBR8eNdKx/8MPX/mvnmMWlnOfmzpvzqMhRbk1cWORcOdlB/Ysr2MmknE7qQKSfo= X-Received: by 10.107.88.12 with SMTP id m12mr8848678iob.136.1516649380973; Mon, 22 Jan 2018 11:29:40 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Mon, 22 Jan 2018 11:29:40 -0800 (PST) X-Originating-IP: [50.227.106.226] In-Reply-To: <89102.1516649067@critter.freebsd.dk> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> <52374125.OgxafgljNu@ralph.baldwin.cx> <89102.1516649067@critter.freebsd.dk> From: Warner Losh Date: Mon, 22 Jan 2018 12:29:40 -0700 X-Google-Sender-Auth: fpk2Y6_B9G-O4zPYtIuH6PAR8Jg Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: Poul-Henning Kamp Cc: John Baldwin , Emmanuel Vadot , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 19:29:42 -0000 On Mon, Jan 22, 2018 at 12:24 PM, Poul-Henning Kamp wrote: > -------- > In message <52374125.OgxafgljNu@ralph.baldwin.cx>, John Baldwin writes: > > >Create the corresponding device_t but device_disable() it when there > >is a disabled property. > > That also removes a couple of boilerplate lines from all FDT device > drivers. That would be useful, but the status bit is so much more than on/off. >A user can then use 'devctl enable ' to enable > >it before (or even after) loading a device driver. > > That would work for me. > > I wonder if it would be too noisy if we allowed ->probe() to run > on disabled devices and reported something like: > > "foobar0: Matched disabled device <...>" > > (without calling ->attach()) > > That way you would know you loaded the right driver, rather > than have to guess. I suspect that would be too noisy. It would be better to just run probe, but then have newbus report it's disabled so we never go onto attach. Though, there's more fundamental issues at play since FDT is tricky and a lot more interrelated than other enumeration platforms. Warner From owner-svn-src-all@freebsd.org Mon Jan 22 19:50:08 2018 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 A08CBED247C; Mon, 22 Jan 2018 19:50:08 +0000 (UTC) (envelope-from kevans91@ksu.edu) Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on061d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe49::61d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT TLS CA 4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CAAB6B563; Mon, 22 Jan 2018 19:50:08 +0000 (UTC) (envelope-from kevans91@ksu.edu) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ksu.edu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LGBnIXsEAkyW5FO22DoxMZBSfgONdzAM+35+HjcpTtk=; b=SQKJR7hCeemt0GezTFBmx6FAVAzlshM/kwpUvThEVP9z0la6eP37uj9UbdfT7vxflMYq0GvaJAZmn1uWbuURlea/OBAhGTiku24nr7vJkKnM+h2PVHysNQc3z7tE6/wEUnU/9E4Ur6FJc6aLNWc9ZZXAnaoDB+D2vMzxPGKh9Ug= Received: from BY1PR0501CA0012.namprd05.prod.outlook.com (10.162.139.22) by DM5PR05MB2985.namprd05.prod.outlook.com (10.168.176.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.5; Mon, 22 Jan 2018 19:50:05 +0000 Received: from CY1NAM02FT041.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::207) by BY1PR0501CA0012.outlook.office365.com (2a01:111:e400:4821::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.444.5 via Frontend Transport; Mon, 22 Jan 2018 19:50:05 +0000 Received-SPF: Pass (protection.outlook.com: domain of ksu.edu designates 129.130.18.151 as permitted sender) receiver=protection.outlook.com; client-ip=129.130.18.151; helo=ome-vm-smtp1.campus.ksu.edu; Received: from ome-vm-smtp1.campus.ksu.edu (129.130.18.151) by CY1NAM02FT041.mail.protection.outlook.com (10.152.74.156) with Microsoft SMTP Server id 15.20.428.12 via Frontend Transport; Mon, 22 Jan 2018 19:50:04 +0000 Received: from calypso.engg.ksu.edu (calypso.engg.ksu.edu [129.130.43.181]) by ome-vm-smtp1.campus.ksu.edu (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id w0MJo27l001992; Mon, 22 Jan 2018 13:50:04 -0600 Received: by calypso.engg.ksu.edu (Postfix, from userid 110) id 9D0EB248307; Mon, 22 Jan 2018 13:43:54 -0600 (CST) Received: from mail-io0-f170.google.com (mail-io0-f170.google.com [209.85.223.170]) by calypso.engg.ksu.edu (Postfix) with ESMTPA id 7F15D248308; Mon, 22 Jan 2018 13:43:52 -0600 (CST) Received: by mail-io0-f170.google.com with SMTP id n7so10685457iob.0; Mon, 22 Jan 2018 11:43:52 -0800 (PST) X-Gm-Message-State: AKwxytfERR/4yP2r87vVTJ7fWQwlGt4Tiet/RLZUTLNwnhlXqNGSkDbl vOLta+XapkqcUi3z7+AqPtTPncdAR8uv0J8DGJ0= X-Google-Smtp-Source: AH8x225PmcI68Fa8ldRxVkg/ID0Tgro+MfOnInL2nXDljEBiLsSBpuRMiQbSM9IOkrLs9YyxE9fyDg606gSwulfENTs= X-Received: by 10.107.53.221 with SMTP id k90mr9618ioo.6.1516650232053; Mon, 22 Jan 2018 11:43:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.157.12 with HTTP; Mon, 22 Jan 2018 11:43:31 -0800 (PST) In-Reply-To: References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> <52374125.OgxafgljNu@ralph.baldwin.cx> <1516648363.42536.134.camel@freebsd.org> From: Kyle Evans Date: Mon, 22 Jan 2018 13:43:31 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: Warner Losh CC: Ian Lepore , src-committers , Emmanuel Vadot , John Baldwin , , Poul-Henning Kamp , Content-Type: text/plain; charset="UTF-8" X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:129.130.18.151; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(39380400002)(396003)(346002)(39860400002)(376002)(2980300002)(438002)(31014005)(377424004)(189003)(199004)(55446002)(478600001)(5890100001)(75432002)(54206008)(5820100001)(61726006)(336011)(93516011)(106466001)(26005)(23676004)(59450400001)(305945005)(53546011)(93886005)(2906002)(6346003)(33896004)(2950100002)(88552002)(356003)(9896002)(6246003)(8676002)(90966002)(47776003)(16586007)(54906003)(6862004)(61266001)(8936002)(95326003)(76176011)(450100002)(4326008)(106002)(9686003)(786003)(86362001)(59536001)(42186006)(316002)(246002)(229853002)(498394004)(5660300001)(50466002)(55456009)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR05MB2985; H:ome-vm-smtp1.campus.ksu.edu; FPR:; SPF:Pass; PTR:ip-18-151.net.ksu.edu; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1NAM02FT041; 1:UcjvxYHnJKoG3O7gZy65C41fXbkVvAjT8GnotaBUnV6kzJFH9Cvf2JYs9RELN8VdMCa/Wmtv+ebP9kRycpehS/vBryh8UUmkJAMevLKE9VhmF4wSzzUfPcy7/YSTYEGA X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0f5286b4-ca69-4a31-854f-08d561d1554f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989060)(5600026)(4604075)(4608076)(4534125)(4602075)(4627221)(201703031133081)(201702281549075)(8990040)(2017052603307)(7153060); SRVR:DM5PR05MB2985; X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB2985; 3:RA5e6CR7HfDfm5xVxdOSFfL01DFMFqPpvxJ0GBZaiuMu/AlM+7M9DcoblKFsbIl2bjw3i/JeH6UPENuZcSGeNpkbV3AxoaE4wWrWlrJ4AFBADobU+q7vmrkLspc70JUesSzj7/DZjdfIAyVqnVFVC6moWYmyxzR7Cn/RDozs5RclBHm1SXjDeOQbdxHOiEqd9CqEDjHyFueKESdwNDunueXqtr+VD03k1Byi2ymPqzxRKjvO5524kg6TFz1q0tLdRM6b/6hIP8AWflELaxJAkHJSvZtv8tH7c4YIljiZzS/OasCqxqZ/U1LR3Wk5+2fpRSXsRHf7rDRSBHm6nCGhl1FG9JWv0oj32Pbgy6DrdKk=; 25:mL2F6THdIFvie7OFqp+avkrTGHC+OlGnHl/OmEgGq5aX7qP6Wa1rNlONDlpgVyUxzGT7QKrIGJPDoKypFmqdKO1DlVPR2ZsRKb4twytOz3h4dgxHgfDOdujX/AfzCTEbgCLub6LupxqFRKfHyb72hBV5Jcju9e0hT3bzUqKjJDbaTChgDijXlsGdE03yZ7AdnBdzSziVzBRHWas3D3EK17iSt7DCL2TOTb3K+ZMSDzu+8ci3OV0DTwLJSLQEUTSe3wkKH0rLMcU6UqM2bJEEv3f00kpZk600TFqkUK5wEStD3Ph+UNdlZQbQ7ExuGUkpXyrB8wuQA6rnzSppohhLeA== X-MS-TrafficTypeDiagnostic: DM5PR05MB2985: X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB2985; 31:6r/7uUbg55AxROYf0YplkpWyGFsolxhFpYjAwe50cop2zbTuntBNIjuBeYBPJ7MNmAZxLZmpUmpsaPvEBjFSBD4QN+3kA2gS9MmuxxvtmOnIB42U0HsyOs4zksGM0rHV226GZalJ88L4rBSOppeSCfJ8iat2LC8ChpvRhYoZHBSUd3NSeSwx+1a4vrT+OqybwQjeOJI4LRdFiinzAYBZgkcXSAF1kNnhYZN8B1eLK8Y=; 20:dM/NgsQo+afApfSsFeEnwaT+4qlXKRaciTCgnsLuroL6eebPAd2xiAFrkBhDFCZVlWj3HFaSKLC4+01hJ0HL8vM1C5j4LORd/h1dNI6QUcCju8jRbQWCYPj/dJ/ahaqxBxG9Dc7oGKZjK3o1v3TvKvXDkz5yWNiqvdnmI2OtsyzVWRr3SM7GA15ej6LipNx0JZS6Z+o5UAvSj+7De679p1bPljtxBrPUdM0cTwONDY4XE0n6me7/xVdQhZmkLAdiZcbO3KQj2W6/FGwLmvdSYLoVKymMv0ay1nQMJ2hoDVtSA65HWWAAtIEUsvnD5blcutltegKvT0bNSUA/pjjE1XCe+TGz/eaYTS4zhqsFq40+2jF8UMFPXUSHVcQgBVs2bOv22hYB61sz/f3237fsIqlaPIEZfs3wJmIkrjXAKafvpKdLkly+OPcVnoiHV1SIvOpHETssudsImp8hA3sRok/w80F9tKshFLvxozKxtzO1oBxGQ8rAoeBZFw8j+S4j X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93004095)(3231046)(2400081)(944501161)(6041288)(20161123560045)(201703131423095)(201702281529075)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:DM5PR05MB2985; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR05MB2985; X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB2985; 4:C9VaHk4bHMWBA8Jz+ZxIFHV22qHBjupS4C9degeiHVdxBtbKzy4DxyvnrKL3ym+kaJNoCXArhzKHlf9+h4DjD7laTNMP4VGBF3aviCTsZAEGDRI9DqtI21HkTQP2b6U5t9+kt0n6m38WkD4pwY9IpuFnNz/ndJ8Dd8lfEeoVL36mYpcwIC1WXf3u1ObLDmGZVluxnxBbBN5GRhDltqAvNL0bsjc+7tJUaUoXF12fSF8hTtxSPDzDP3pYln3ahANoSLh3sNV6M6r0ZZri1YufuA== X-Forefront-PRVS: 0560A2214D X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjA1TUIyOTg1OzIzOkFoMGl5ZkMxVzVvUENhR2JkczdaQ3pGR0lG?= =?utf-8?B?OExsdm0xVUk0amQwbWVVdjRRSnptdmxhQU9RelZxQ05FZE1ra3hwUStkUlM3?= =?utf-8?B?aGlOVlc3emFvNmw5UzF1OUZ0Q0NaMW5xZG1sUlBRbys4V3NzdGRacUtoRGJG?= =?utf-8?B?UWx3ay9rVjZRYkFHYXVkakl3bnYzZ0JoVjBwUGJNOXVoenpYc0s0VzQyYisz?= =?utf-8?B?K25FbmxjV3JLSnJOeUZ5bzRlYVJUcExPSGxSS0hJTmluOWJQelNJVm90S3Uz?= =?utf-8?B?d0pWbGZCNVFDemJ5VEkvSU00WU11WnhKd3VHTjk3Vy9ST2k5YU9MK0pkb0tR?= =?utf-8?B?aHVLRUluS005SFFnVVUzbXhXbG81U0tMeTFwVnVJbzRkelFYSzhTdVl0N0Z3?= =?utf-8?B?QkNERThMbHNaS2JCNjBlWG91c1FGV1hIZVNBN2tMNkhIVGJzNm1MU3ptakRE?= =?utf-8?B?RnJTd2EydGtBNkRpM280Sm4rVTM5dWRuRkRpK00rbjV5UWdsOENxcTlmK1dp?= =?utf-8?B?WmtodFJ2K2c5TVRaV1pHQmc2M2VQaGRPU25NSUJOVEdWM1M2WHcyTFZjR2pS?= =?utf-8?B?RzFXTVBoa0ttVVVSd1prR3ZqR1VKZmx6QXFZcjBwOGhYVVdqUUdxWkFzTFJR?= =?utf-8?B?Wk05WlpVUmZpd1QzamNsamxaWE5reko5Zkxrc3lORkZlM0duQ0VsbXp4TUly?= =?utf-8?B?ZUNQOE93Y1gvYXc2OU40Q1NWUUZOSG1MeDhwTm5EUEVZblVpck5QQVQ5b2wz?= =?utf-8?B?eksvTUxTejJWWUl1M0JlTU9qdXBXcGhzUWQzWTJZaVgzam5SSE9HdU1qWnFX?= =?utf-8?B?TFVTNVZCSEQxV1VDMzhISEM1UlJLc3BQYkk0Z21xU1J0dXdhdkZ1ekZmbjJj?= =?utf-8?B?U2l6aXVTVlpDaEVFTGw2QUlkazhJK0c2RHg4M0tQWjhLSDZnaGh2OGRwcVlC?= =?utf-8?B?K0xUMXBJYWJYem1ucUI2NUF3YnhqNWYyVjk2WDZkUHBxZmdGSjF2SmRJdXNZ?= =?utf-8?B?S2FnRnNYamZjTUExRnV6bG9RUE5HeFEwSVQ1ZmpteDdnRzZocm9TVFphMmRj?= =?utf-8?B?cEwwNzYyWTZ1RHZIOGVDd0lSQmU1K3Z5WU1wVFFYdFAzUVMvODFXRW9sTGFC?= =?utf-8?B?YVVjYmlvbEV3MHdhL2hCYjU0cGVseFhJN05WKzhRVHJ0Uyt4VkJqWUpLVC95?= =?utf-8?B?c29ZMEtXR25ZR0NwQXBxeUptczZQVVhuTGo5ckVpUVZobEFNSFRBRmFFSTRE?= =?utf-8?B?cHd6amI1NkRwT2c4cUJZd2drck1Qb1Ztb0VYNmxlQUpCM3ZOVUVvV1hHZ3pO?= =?utf-8?B?MmNaYWZjWVd4TmVEdE5UcHV0VzRRckttN0Y3VVhMcDVUUkp4NmhvK0ltS25E?= =?utf-8?B?c3pzTC9UT05EbjdtTG9QMEt3cDZGNTBNTUJ6LzlTcStocHRNVktWVVhiaEo2?= =?utf-8?B?SHRaWUU2VkZsUEQ3K1J3Q0YwQjlmcUNncjZSbERrMjQxU0I3blNPTWRMVGZY?= =?utf-8?B?MlNQQnNMZWVoVktOR2dJTUlyd21uZTNYT201QmhhVXdoRDZzZWo5VVRDUmFh?= =?utf-8?B?SzVtZ2FiUnBWOTFYREx0Y3F5OTBsT2JNdk80aHZJODlZVlM4ekFWeHgvNEt6?= =?utf-8?B?Z3c0dHNBSG9XUElsQmdzaFViVmptZXZSR3FMeUExN29VZXdPRW53L1MwUk8r?= =?utf-8?B?Tll5RHE1QWkwWSt3Q09zYUJ4OXEzZjN2bmJBcEI5a3NzR2lhK0llTXNKTDNi?= =?utf-8?B?b3g0WVZxTDVVVldycVcvcXVZK205TFhLWmtCQ1NOblNiVTZjNktIb0VBYlM2?= =?utf-8?B?YVQyS2dvZ1Rka0dwdm9CTFkrNG5WbXUwMVFLa2ZtYTFVVGV6c0Rxc0FVYlhk?= =?utf-8?B?MDRaZlVLOFlNWjFEcFluL3hBSUEwcDd1dktlNEJlL05YUURzSFI3bG5zVTNJ?= =?utf-8?B?WFpOYnhDaVovbFhyYWRsSVV2eVdMTnZucGFZWk1JRkhiR0NHWGJtcHFkclJ3?= =?utf-8?B?bE00U2xNVnBnWE9oVFFMRnliZnpJWlc3QjNGZz09?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB2985; 6:BxQShCsvC+7UaMcAtUpDDyAN0qL1ohpFbkEQTRSFYGUY+323thXy8mK9LXgJR420DVgh5P/JvMa5098blW6U/CO55YlKZO6Y0w3E0EQnbWNp4hjzIoI2/xV1C4Cke+9CpY0RmHlwjOePRlkrTY7HlaKwo12mlyoumRSZ4Vumm/fspwcPy4lJd0IAQi29si8RgJslfzk/16HuzTC++xeaLQxJATvgbJMEBRg2h7T2vb873cX6wxHnFbByJS3k+E0FAlk4tiNI2cKepWMT3vIe8W7odS855LtW4QpL2R0yZJChA6raQI9ia7/g87UNnD0jZL7yxr5kgLie5odlJrtgmzl4c6L9VXhmGBC4wj95Tb8=; 5:DzamOr8bJJ8B5BX6rs80Cx8NARpRPqzStpDtg2gbuDPqp1n87odyclbQP0Kdqhm0TifbCvplNq5f+pCxqo20GHCGBx9TcecNSh8jALr13IevRHM7nn1Njy8vYrVqb+1Jh2KP94XZ0NB0suQHi9klZmEOvaC4+C42zIhde/JcJV4=; 24:UZLXiheyvzqXHX2fy78+C5S+uic8lPMSjRJq8zubw+k9PImOVq+bS4A3rKXR5cBEAXoAThkG9VGb8rAxC3NwvKAnOyNPP/DBnfJTyOar0Ss=; 7:sU0VItQA01p+reRTFJombxDjh2ans0VASbMjzwpy7LrNyoscvRDS+Wnxv1oApkUjOCz21DrKmXoa5ttpBYnThl6SYwqA+l2TTp7tlqJvv4xDe/N4s1reJhkwvw3xWjDjKB7sRMs533IyzLBNtoQ91VQV2eX9ezOY5QDx2jCmvtNP6Qb3fKY14tAy/8ZQq9tTEmmSxdYxctQrsZpyg0lEg7UU3jQ4pFfKAEo+PbpQuk4cZc0gufwT7CjnWM3+7O6R SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB2985; 20:bij9vlMeQjGtixdbt7qHeG7lP3UsqhyPAIip/00xaMV2fZl1jJPSEec7xKHok0Fx7otv5mzEVuCFcS68vnPMq5B6mBVQFd8do9u3ykgYZ3gxHeJwBoxVD5aG9VztjRZdNdKYczUnqpFELNKh7yC6WVYka+BFZrV82uPNdOptHP0= X-OriginatorOrg: ksu.edu X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2018 19:50:04.6845 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f5286b4-ca69-4a31-854f-08d561d1554f X-MS-Exchange-CrossTenant-Id: d9a2fa71-d67d-4cb6-b541-06ccaa8013fb X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d9a2fa71-d67d-4cb6-b541-06ccaa8013fb; Ip=[129.130.18.151]; Helo=[ome-vm-smtp1.campus.ksu.edu] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR05MB2985 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 19:50:08 -0000 On Mon, Jan 22, 2018 at 1:27 PM, Warner Losh wrote: > On Mon, Jan 22, 2018 at 12:12 PM, Ian Lepore wrote: > >> On Mon, 2018-01-22 at 10:57 -0800, John Baldwin wrote: >> > On Monday, January 22, 2018 03:30:03 PM Emmanuel Vadot wrote: >> > > >> > > On Mon, 22 Jan 2018 14:07:30 +0000 >> > > "Poul-Henning Kamp" wrote: >> > > >> > > > >> > > > -------- >> > > > In message <20180122145117.08173be547f5dd6fef296732@bidouilliste. >> > > > com>, Emmanuel >> > > > Vadot writes: >> > > > >> > > > > >> > > > > Using the same logic as before one could have a script starting >> > > > > some >> > > > > pwm stuff (or simply using /etc/sysctl.conf) >> > > > > Also this is not how DT is suppose to work, if the status == >> > > > > 'disabled' no driver should attach. >> > > > That doesn't make *any* UX sense. >> > > > >> > > > "disabled" indicates that it can be enabled, and there is >> > > > absolutely >> > > > no reason to force users to reboot, when all that stands between >> > > > them and using their hardware is a random setting in a file. >> > > To be more clear, disabled mean that the node should not be used. >> > > In a industrial board you will always have every usable node >> > > enabled, >> > > in the SBC world where you have a way to plug daughter card and >> > > exchange them or even use the exposed pins directly there is no way >> > > to >> > > know what the user will do so every node not used by the SBC must >> > > be >> > > disabled. >> > > This is the overlay part of DT that is responsible to enable them >> > > >> > > > >> > > > Explicitly kldload'ing a device-driver is as clear a "Enable it, >> > > > please" >> > > > instruction as you can get from the user. >> > > But device driver != DT node >> > I have a suggestion. In the "hints" world we allow devices to be >> > disabled >> > via 'hint.foo.0.disabled=1' and that results in the code that creates >> > the >> > device disabling it via 'device_disable(dev)'. This avoids having to >> > check >> > that the device is disabled in every driver. However, we also >> > provide the >> > ability (recentish as in 10.x) to override that setting via 'devctl >> > enable', >> > so that you can now choose to enable a device that was disabled by >> > hints >> > via 'devctl enable foo0'. I would suggest that you do something >> > similar for >> > FDT. Create the corresponding device_t but device_disable() it when >> > there >> > is a disabled property. A user can then use 'devctl enable ' >> > to enable >> > it before (or even after) loading a device driver. >> > >> > To make this work well you probably want to allow devctl to name >> > devices >> > via FDT handles as you can currently name them via ACPI handles or >> > PCI >> > addresses. I can give some pointers on how to do that, though I >> > think the >> > ACPI code for that is pretty easy to follow. >> > >> >> The status property of an fdt node controls more than just device >> instantiation. For example, it also controls whether that device's >> pinmux setup is done at boot time by the pinmux driver. That's why >> this misguided attempt to ignore the rules and conventions for using >> fdt in freebsd is doomed to failure in the long run. (It appears to be >> working now because the driver also incorrectly works around the lack >> of a proper pinctrl driver for rpi by doing its own incorrect pinctrl >> stuff. That house of cards will collapse when someone eventually >> writes the rpi pinctrl driver.) >> > > Yes. There's several issues here. > > The first issue is that RPi is the only popular platform[*] that doesn't do > pinctl/pinmux per the FDT standards. So hacks here aren't any worse than > what's there now, but they will be ripped out with extreme prejudice when > pinmux arrives. > > The next issue is that RPi doesn't have the proper clock management hooked > into our clock framework. That needs to be properly fixed. > > The next issue is that you need to change the state of the device by an > overlay. This will allow pinmux to work (well, would if we had a proper > pinmux driver). In the FDT world, you'd need to transition between two > different states. To do this dynamically at runtime (which we all agree is > desirable), we need to create the proper protocols so that if, say, a GPIO > is deactivated that any users are notified. This is a lot trickier than you > might think because there can be a cascade of dependencies that need to be > notified of the change. And that's tough. > FWIW- The mainline Linux guys are trying to fight this problem by way of major restriction. My understanding is that as of now, they're planning to restrict what kind of overlays can be applied at runtime to things that adhere to a kind of connector protocol, and the overlays aren't really allowed to access on-board resources beyond what the connector already provides. Flipping these connectors on or anything besides attaching to a connector would need to be an overlay applied at boot time, and those cannot be unapplied. From owner-svn-src-all@freebsd.org Mon Jan 22 20:25:11 2018 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 EC6B7ED3F23; Mon, 22 Jan 2018 20:25:11 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id AEAF46CFC2; Mon, 22 Jan 2018 20:25:11 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id 038162739F; Mon, 22 Jan 2018 20:25:09 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w0MKOs5l089480 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 22 Jan 2018 20:24:54 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0MKOrcN089479; Mon, 22 Jan 2018 20:24:53 GMT (envelope-from phk) To: Warner Losh cc: John Baldwin , Emmanuel Vadot , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> <52374125.OgxafgljNu@ralph.baldwin.cx> <89102.1516649067@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <89477.1516652693.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Mon, 22 Jan 2018 20:24:53 +0000 Message-ID: <89478.1516652693@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 20:25:12 -0000 -------- In message , Warner Losh writes: >> That also removes a couple of boilerplate lines from all FDT device >> drivers. > >That would be useful, but the status bit is so much more than on/off. The boilerplate code in all the ->probe() functions don't seem to think so= ? -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-svn-src-all@freebsd.org Mon Jan 22 20:49:19 2018 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 15AAEED4E06; Mon, 22 Jan 2018 20:49:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E5CC06DEF6; Mon, 22 Jan 2018 20:49:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1ABDA1F442; Mon, 22 Jan 2018 20:49:18 +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 w0MKnHPa037960; Mon, 22 Jan 2018 20:49:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0MKnHHE037959; Mon, 22 Jan 2018 20:49:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801222049.w0MKnHHE037959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 22 Jan 2018 20:49:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328264 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 328264 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 20:49:19 -0000 Author: kib Date: Mon Jan 22 20:49:17 2018 New Revision: 328264 URL: https://svnweb.freebsd.org/changeset/base/328264 Log: Fix compat32 for sysctl net.PF_ROUTE...NET_RT_IFLISTL. Route messages are aligned to the host long type alignment, which breaks 32bit. Reported and tested by: lwhsu Diagnosed by: Yuri Pankov Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/net/rtsock.c Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Mon Jan 22 18:40:19 2018 (r328263) +++ head/sys/net/rtsock.c Mon Jan 22 20:49:17 2018 (r328264) @@ -112,6 +112,12 @@ struct ifa_msghdrl32 { int32_t ifam_metric; struct if_data ifam_data; }; + +#define SA_SIZE32(sa) \ + ( (((struct sockaddr *)(sa))->sa_len == 0) ? \ + sizeof(int) : \ + 1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(int) - 1) ) ) + #endif /* COMPAT_FREEBSD32 */ MALLOC_DEFINE(M_RTABLE, "routetbl", "routing tables"); @@ -1116,6 +1122,9 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo struct sockaddr_storage ss; struct sockaddr_in6 *sin6; #endif +#ifdef COMPAT_FREEBSD32 + bool compat32 = false; +#endif switch (type) { @@ -1123,9 +1132,10 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo case RTM_NEWADDR: if (w != NULL && w->w_op == NET_RT_IFLISTL) { #ifdef COMPAT_FREEBSD32 - if (w->w_req->flags & SCTL_MASK32) + if (w->w_req->flags & SCTL_MASK32) { len = sizeof(struct ifa_msghdrl32); - else + compat32 = true; + } else #endif len = sizeof(struct ifa_msghdrl); } else @@ -1139,6 +1149,7 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo len = sizeof(struct if_msghdrl32); else len = sizeof(struct if_msghdr32); + compat32 = true; break; } #endif @@ -1169,7 +1180,12 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo if ((sa = rtinfo->rti_info[i]) == NULL) continue; rtinfo->rti_addrs |= (1 << i); - dlen = SA_SIZE(sa); +#ifdef COMPAT_FREEBSD32 + if (compat32) + dlen = SA_SIZE32(sa); + else +#endif + dlen = SA_SIZE(sa); if (cp != NULL && buflen >= dlen) { #ifdef INET6 if (V_deembed_scopeid && sa->sa_family == AF_INET6) { From owner-svn-src-all@freebsd.org Mon Jan 22 20:56:23 2018 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 075CBED526A; Mon, 22 Jan 2018 20:56:23 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D6DF66E3FB; Mon, 22 Jan 2018 20:56:22 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 189FA1F5DE; Mon, 22 Jan 2018 20:56:22 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0MKuLfO042392; Mon, 22 Jan 2018 20:56:21 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0MKuLE1042391; Mon, 22 Jan 2018 20:56:21 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201801222056.w0MKuLE1042391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Mon, 22 Jan 2018 20:56:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328265 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 328265 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 20:56:23 -0000 Author: erj Date: Mon Jan 22 20:56:21 2018 New Revision: 328265 URL: https://svnweb.freebsd.org/changeset/base/328265 Log: ixv(4): Stop setting editing ifnet flags in ixv_if_init() In iflib, the device-specific init() function isn't supposed to edit the struct ifnet driver flags. If it does, it'll cause an MPASS() assert in iflib to fail. PR: 225312 Reported by: bhughes@ Modified: head/sys/dev/ixgbe/if_ixv.c Modified: head/sys/dev/ixgbe/if_ixv.c ============================================================================== --- head/sys/dev/ixgbe/if_ixv.c Mon Jan 22 20:49:17 2018 (r328264) +++ head/sys/dev/ixgbe/if_ixv.c Mon Jan 22 20:56:21 2018 (r328265) @@ -662,10 +662,6 @@ ixv_if_init(if_ctx_t ctx) /* And now turn on interrupts */ ixv_if_enable_intr(ctx); - /* Now inform the stack we're ready */ - ifp->if_drv_flags |= IFF_DRV_RUNNING; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - return; } /* ixv_if_init */ From owner-svn-src-all@freebsd.org Mon Jan 22 21:42:18 2018 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 A9293ED7247; Mon, 22 Jan 2018 21:42:18 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp004.me.com (mr11p00im-asmtp004.me.com [17.110.69.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A3DE705C9; Mon, 22 Jan 2018 21:42:18 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp004.me.com by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P2Z00E0054YS900@mr11p00im-asmtp004.me.com>; Mon, 22 Jan 2018 20:41:08 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1516653668; bh=rBwwA5TBBXISAwewmlXX3GiRK1RiOL2EA9yvMBBX2nk=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=sWPxIOCNjANpVKw0sj56F8tcpUcQvcA1ACb69tnyGa7OoXNZQSZr8PwrT/U2xI5xX YNUcPxXAbmuo8FxSw3cAX+/NBcYmjhS03pS1hJ3Oufst/F+qj4b11SlxcSFKmNWb65 vqUiG5YKWF5MdqAHESBoZp8AxEQHAh+KXsQ4vam06t+dDhAHxqgq6dSk0u7RpDgXA8 w0idghfvH89Mo76cC6/ZXN9FQSL/lO/nTN9sJhG8SS/e67tDJFU02NndUhqVP/GUsz Wz2BjUUDZZ+pb/UOW92BE/ICRFi2dhz4da3TUOpkqeWqy5K6jFHtOnVw7mRvDSor+6 h9BLheOgeR9fA== Received: from icloud.com ([127.0.0.1]) by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P2Z00H6L5GHP110@mr11p00im-asmtp004.me.com>; Mon, 22 Jan 2018 20:41:07 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-22_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1801220282 User-Agent: Microsoft-MacOutlook/10.9.0.180116 Date: Mon, 22 Jan 2018 12:41:05 -0800 Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules From: Ravi Pokala To: Warner Losh , Poul-Henning Kamp Cc: John Baldwin , Emmanuel Vadot , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <607B50C2-883C-4CAB-8860-483EC4E9A668@mac.com> Thread-topic: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> <52374125.OgxafgljNu@ralph.baldwin.cx> <89102.1516649067@critter.freebsd.dk> In-reply-to: MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 21:42:18 -0000 >> I wonder if it would be too noisy if we allowed ->probe() to run on disa= bled devices and reported something like: >>=20 >> "foobar0: Matched disabled device <...>" >>=20 >> (without calling ->attach()) >>=20 >> That way you would know you loaded the right driver, rather than have to= guess >=20 > I suspect that would be too noisy. It would be better to just run probe, = but then have newbus report it's disabled so we never go onto attach. I think a "Matched disabled device" message under bootverbose would be reas= onable. -Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: on behalf of Warner Losh Date: 2018-01-22, Monday at 11:29 To: Poul-Henning Kamp Cc: John Baldwin , Emmanuel Vadot ,= src-committers , , Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/ar= m modules On Mon, Jan 22, 2018 at 12:24 PM, Poul-Henning Kamp wr= ote: -------- In message <52374125.OgxafgljNu@ralph.baldwin.cx>, John Baldwin writes: >Create the corresponding device_t but device_disable() it when there >is a disabled property. That also removes a couple of boilerplate lines from all FDT device drivers. That would be useful, but the status bit is so much more than on/off.=20 >A user can then use 'devctl enable ' to enable >it before (or even after) loading a device driver. That would work for me. I wonder if it would be too noisy if we allowed ->probe() to run on disabled devices and reported something like: "foobar0: Matched disabled device <...>" (without calling ->attach()) That way you would know you loaded the right driver, rather than have to guess. I suspect that would be too noisy. It would be better to just run probe, bu= t then have newbus report it's disabled so we never go onto attach. Though, there's more fundamental issues at play since FDT is tricky and a l= ot more interrelated than other enumeration platforms. Warner From owner-svn-src-all@freebsd.org Mon Jan 22 21:45:55 2018 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 D2ABCED752A; Mon, 22 Jan 2018 21:45:55 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AD233707D6; Mon, 22 Jan 2018 21:45:55 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCD341FE40; Mon, 22 Jan 2018 21:45:54 +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 w0MLjs6a063502; Mon, 22 Jan 2018 21:45:54 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0MLjsAm063500; Mon, 22 Jan 2018 21:45:54 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201801222145.w0MLjsAm063500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 22 Jan 2018 21:45:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328266 - in head: contrib/netbsd-tests/lib/libc/sys lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: contrib/netbsd-tests/lib/libc/sys lib/libc/sys X-SVN-Commit-Revision: 328266 X-SVN-Commit-Repository: base 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.25 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, 22 Jan 2018 21:45:55 -0000 Author: asomers Date: Mon Jan 22 21:45:54 2018 New Revision: 328266 URL: https://svnweb.freebsd.org/changeset/base/328266 Log: mlock(2): correct documentation for error conditions. The man page is years out of date regarding errors. Our implementation _does_ allow unaligned addresses, and it _does_not_ check for negative lengths, because the length is unsigned. It checks for overflow instead. Update the tests accordingly. Reviewed by: bcr MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D13826 Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c head/lib/libc/sys/mlock.2 Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Mon Jan 22 20:56:21 2018 (r328265) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Mon Jan 22 21:45:54 2018 (r328266) @@ -133,38 +133,43 @@ ATF_TC_BODY(mlock_err, tc) ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)0, page) == -1); errno = 0; - ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)-1, page) == -1); - - errno = 0; ATF_REQUIRE_ERRNO(ENOMEM, munlock(NULL, page) == -1); errno = 0; ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)0, page) == -1); +#ifdef __FreeBSD__ + /* Wrap around should return EINVAL */ errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, mlock((char *)-1, page) == -1); + errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, munlock((char *)-1, page) == -1); +#else + errno = 0; + ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)-1, page) == -1); + errno = 0; ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)-1, page) == -1); +#endif - buf = malloc(page); + buf = malloc(page); /* Get a valid address */ ATF_REQUIRE(buf != NULL); - - /* - * unlocking memory that is not locked is an error... - */ - +#ifdef __FreeBSD__ errno = 0; - ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1); + /* Wrap around should return EINVAL */ + ATF_REQUIRE_ERRNO(EINVAL, mlock(buf, -page) == -1); + errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, munlock(buf, -page) == -1); +#else + errno = 0; + ATF_REQUIRE_ERRNO(ENOMEM, mlock(buf, -page) == -1); + errno = 0; + ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, -page) == -1); +#endif + (void)free(buf); /* There is no sbrk on AArch64 and RISC-V */ #if !defined(__aarch64__) && !defined(__riscv) /* - * These are permitted to fail (EINVAL) but do not on NetBSD - */ - ATF_REQUIRE(mlock((void *)(((uintptr_t)buf) + page/3), page/5) == 0); - ATF_REQUIRE(munlock((void *)(((uintptr_t)buf) + page/3), page/5) == 0); - - (void)free(buf); - - /* * Try to create a pointer to an unmapped page - first after current * brk will likely do. */ @@ -360,6 +365,80 @@ ATF_TC_CLEANUP(mlock_nested, tc) } #endif +#ifdef __FreeBSD__ +ATF_TC_WITH_CLEANUP(mlock_unaligned); +#else +ATF_TC(mlock_unaligned); +#endif +ATF_TC_HEAD(mlock_unaligned, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that mlock(2) can lock page-unaligned memory"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.config", "allow_sysctl_side_effects"); + atf_tc_set_md_var(tc, "require.user", "root"); +#endif +} + +ATF_TC_BODY(mlock_unaligned, tc) +{ + void *buf, *addr; + +#ifdef __FreeBSD__ + /* Set max_wired really really high to avoid EAGAIN */ + set_vm_max_wired(INT_MAX); +#endif + + buf = malloc(page); + ATF_REQUIRE(buf != NULL); + + if ((uintptr_t)buf & ((uintptr_t)page - 1)) + addr = buf; + else + addr = (void *)(((uintptr_t)buf) + page/3); + + ATF_REQUIRE_EQ(mlock(addr, page/5), 0); + ATF_REQUIRE_EQ(munlock(addr, page/5), 0); + + (void)free(buf); +} + +#ifdef __FreeBSD__ +ATF_TC_CLEANUP(mlock_unaligned, tc) +{ + + restore_vm_max_wired(); +} +#endif + +ATF_TC(munlock_unlocked); +ATF_TC_HEAD(munlock_unlocked, tc) +{ + atf_tc_set_md_var(tc, "descr", +#ifdef __FreeBSD__ + "munlock(2) accepts unlocked memory"); +#else + "munlock(2) of unlocked memory is an error"); +#endif + atf_tc_set_md_var(tc, "require.user", "root"); +} + +ATF_TC_BODY(munlock_unlocked, tc) +{ + void *buf; + + buf = malloc(page); + ATF_REQUIRE(buf != NULL); + +#ifdef __FreeBSD__ + ATF_REQUIRE_EQ(munlock(buf, page), 0); +#else + errno = 0; + ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1); +#endif + (void)free(buf); +} + ATF_TP_ADD_TCS(tp) { @@ -371,6 +450,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, mlock_limits); ATF_TP_ADD_TC(tp, mlock_mmap); ATF_TP_ADD_TC(tp, mlock_nested); + ATF_TP_ADD_TC(tp, mlock_unaligned); + ATF_TP_ADD_TC(tp, munlock_unlocked); return atf_no_error(); } Modified: head/lib/libc/sys/mlock.2 ============================================================================== --- head/lib/libc/sys/mlock.2 Mon Jan 22 20:56:21 2018 (r328265) +++ head/lib/libc/sys/mlock.2 Mon Jan 22 21:45:54 2018 (r328266) @@ -28,7 +28,7 @@ .\" @(#)mlock.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd May 17, 2014 +.Dd Jan 22, 2018 .Dt MLOCK 2 .Os .Sh NAME @@ -125,7 +125,7 @@ will fail if: .Va security.bsd.unprivileged_mlock is set to 0 and the caller is not the super-user. .It Bq Er EINVAL -The address given is not page aligned or the length is negative. +The address range given wraps around zero. .It Bq Er EAGAIN Locking the indicated range would exceed the system limit for locked memory. .It Bq Er ENOMEM @@ -143,7 +143,7 @@ will fail if: .Va security.bsd.unprivileged_mlock is set to 0 and the caller is not the super-user. .It Bq Er EINVAL -The address given is not page aligned or the length is negative. +The address range given wraps around zero. .It Bq Er ENOMEM Some or all of the address range specified by the addr and len arguments does not correspond to valid mapped pages in the address space From owner-svn-src-all@freebsd.org Mon Jan 22 22:59:05 2018 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 AE49FEB5741 for ; Mon, 22 Jan 2018 22:59:05 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::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 6FD177316B for ; Mon, 22 Jan 2018 22:59:05 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22e.google.com with SMTP id c17so11239828iod.1 for ; Mon, 22 Jan 2018 14:59:05 -0800 (PST) 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=cb3vP7AG4ACfwiok+5uoTymr+UxeRNbcXwI1FcygR3w=; b=pZcUkFKFkSEUQ+cUkMovue463WC0uhCEztsg7ztq+LpGc7pbfxioFOB2wWqow9j0R/ TadYBP1Rp9LMRVKpHueSt0RfnmDVz5N/XCv/ZkAJ4mtuLOHGpW0QnqNZH028IUMwnk89 ddIUYqPviIrwomN2wKcAP5Cvb10vnNEc7MIajKQgaFU7erlm+3iprR+b/GVFT7toWEjv A9WNAvwoITBAsnauGctcp/cyPJm3hODZwkcsM51kwHNCZEMJTp1HyzN1/L+F7LaVrW92 2PkieaxyvaXb8oZw7qbq8la4KJzW3I62OE+pct+iLPoSub4V6UFuYM4jF9ufew+FdvcZ UrbA== 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=cb3vP7AG4ACfwiok+5uoTymr+UxeRNbcXwI1FcygR3w=; b=AjXCppRQ2ejPoXjTn99qscYfx9fiqZTixUPS0fOWkJ09uD2H+yISGGREQ4bAKotJqv pe32XzX3mZePL8sif7MpqYpyzL2CsFRhy4BSSzBZh+Fd8bLPpn0Su30xgMvJygN+cdGu 99tFVjOFOcAnB0kjXPNJ3+Nu66TesV8paPP8m/ymDqdccy6x4+GqilLc2Emh+/5cFQIQ FqyF2Yw8BNtteb0MBQam0MJVKwrcmOxjvm7m4vRRYpmCKZHLPr/gWoWfmkjDVaviczXN VVWAwfe+dqgjH/DfCyXuBthCB8X/QiK5Ilfj4zkPqhtP46c78ogy53PSLu3wPd5qCNJo BhZw== X-Gm-Message-State: AKwxytczALFZS/JBTg6nPL2RdY7oDbkAO4g35bkZu3mdgrkTcN6JA55C DdJS0mPjMEaNVT34w860uTPpZEHgvsJsQ65AAHIsmg== X-Google-Smtp-Source: AH8x226SaNgrBPrTRgRTA3Huc0qXBboPGI34xc8C+nBb8LWUb4XX+yXi2Jt9wOhbEa+dnFnhHRx7TRnmzgICE1lOIXw= X-Received: by 10.107.88.12 with SMTP id m12mr790051iob.136.1516661944691; Mon, 22 Jan 2018 14:59:04 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Mon, 22 Jan 2018 14:59:04 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <89478.1516652693@critter.freebsd.dk> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> <52374125.OgxafgljNu@ralph.baldwin.cx> <89102.1516649067@critter.freebsd.dk> <89478.1516652693@critter.freebsd.dk> From: Warner Losh Date: Mon, 22 Jan 2018 15:59:04 -0700 X-Google-Sender-Auth: hpBIe6afc0SnD6vlMfJjc0vED8U Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: Poul-Henning Kamp Cc: John Baldwin , Emmanuel Vadot , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 22:59:05 -0000 On Mon, Jan 22, 2018 at 1:24 PM, Poul-Henning Kamp wrote: > -------- > In message dpfg@mail.gmail.com> > , Warner Losh writes: > > >> That also removes a couple of boilerplate lines from all FDT device > >> drivers. > > > >That would be useful, but the status bit is so much more than on/off. > > The boilerplate code in all the ->probe() functions don't seem to think so > ? This represents a partial understanding of what's required. It's base level only. Don't mistake it for full understanding of what needs to be done. Warner From owner-svn-src-all@freebsd.org Mon Jan 22 23:00:32 2018 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 433A0EB59C8 for ; Mon, 22 Jan 2018 23:00:32 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (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 03CA7733DF for ; Mon, 22 Jan 2018 23:00:32 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x231.google.com with SMTP id e1so11618866ita.0 for ; Mon, 22 Jan 2018 15:00:31 -0800 (PST) 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=N8n8hKIE/s93LGpF+0iDd6HcbKoo7keqLoQ2tZAVDGo=; b=bQSIjaeTTWUxIcSTrDwhZTF/jO9vLKmS7oyoNdiCzpKNVTqKcxA7CcfyFyoR+MArkx HbZdbeyJ2aS2phu3I5oUHnCFMa2VeM3C7Z+CO0Z9K62Cl2rVfxH8N/sNio1E5PR0fx4D eRFAh/EQLRafcD3l3AQMcw0J/gvwv8XCB6cvvXQAXXrlg0a+IlGTisWFvZLMZaSVrNYk 3OvY2L01q/f00Hk0SLwJWxemdCbkYCSxj2BA2tSxDpLdM/a+UE2d5Mf+BAgsyHGT29J2 umNGDA1277+5nzHF5Yx80+vcWKazZgqiK65JYtdO+TZaSPt3kJXn03aLRljCwt7W7TyY GrOQ== 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=N8n8hKIE/s93LGpF+0iDd6HcbKoo7keqLoQ2tZAVDGo=; b=uLptW9H1dH1bJcP2YzVG12ADXEnMfVSdj7LnpaXXLZH803F3Mjeg66IaZPpjRmc67t z/OJZbONXkuraI7009kqnKUjW9lJO7j5TXt6+F8jCEO3GLRGsSl324H1O8LK1vo31ukc wghwR5+MPqebdBUdKNynGCVW/Ym97xVS4LXwvPh+qfkBmkUSuMaSbFJaS0/MfQQphjj3 FueaJlVZOYt7WaTk30DnNEmA60JN3rZcgpXBfa32ISWoEEYthvLS/SH0j2+NZ5nhXmve uZN8hC3dq5Ug7x/KVcyPyxECyxyj5bmpRkhhBeqLJVsZkAnKy0las6A3wi5EjsY+9tbD 4zFw== X-Gm-Message-State: AKwxytePzR+cnG/Zp/evLqpkEHCkcKHHPgyWx7YMcVHFw1XwHC14iCkG z0AX4CDsmQHtvIqafA/CrgXlMfiyAAz4jWA9mvPzog== X-Google-Smtp-Source: AH8x224NSlSzWTiDeTlR8v77xtrdhieTHz0u47wLAHqG++G/sav0cl4s0pXvFbcR5KvwQdl50Oi5PGfU4M/b90NVReU= X-Received: by 10.36.74.200 with SMTP id k191mr782733itb.69.1516662031199; Mon, 22 Jan 2018 15:00:31 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Mon, 22 Jan 2018 15:00:27 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <607B50C2-883C-4CAB-8860-483EC4E9A668@mac.com> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> <52374125.OgxafgljNu@ralph.baldwin.cx> <89102.1516649067@critter.freebsd.dk> <607B50C2-883C-4CAB-8860-483EC4E9A668@mac.com> From: Warner Losh Date: Mon, 22 Jan 2018 16:00:27 -0700 X-Google-Sender-Auth: CFZ7uwNsZZtD0VgLnpcveev73jU Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: Ravi Pokala Cc: Poul-Henning Kamp , John Baldwin , Emmanuel Vadot , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 23:00:32 -0000 On Mon, Jan 22, 2018 at 1:41 PM, Ravi Pokala wrote: > >> I wonder if it would be too noisy if we allowed ->probe() to run on > disabled devices and reported something like: > >> > >> "foobar0: Matched disabled device <...>" > >> > >> (without calling ->attach()) > >> > >> That way you would know you loaded the right driver, rather than have > to guess > > > > I suspect that would be too noisy. It would be better to just run probe, > but then have newbus report it's disabled so we never go onto attach. > > I think a "Matched disabled device" message under bootverbose would be > reasonable. > I think even bootverbose it's insane. Or I don't understand what the real ask is. Warner From owner-svn-src-all@freebsd.org Mon Jan 22 23:06:12 2018 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 4F3C2EB5EC2; Mon, 22 Jan 2018 23:06:12 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 10C7D73937; Mon, 22 Jan 2018 23:06:11 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id 423802739D; Mon, 22 Jan 2018 23:06:08 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w0MN5q6P090382 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 22 Jan 2018 23:05:52 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0MN5qDU090381; Mon, 22 Jan 2018 23:05:52 GMT (envelope-from phk) To: Warner Losh cc: John Baldwin , Emmanuel Vadot , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> <52374125.OgxafgljNu@ralph.baldwin.cx> <89102.1516649067@critter.freebsd.dk> <89478.1516652693@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <90379.1516662352.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Mon, 22 Jan 2018 23:05:52 +0000 Message-ID: <90380.1516662352@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 23:06:12 -0000 -------- In message , Warner Losh writes: >This represents a partial understanding of what's required. It's base lev= el >only. Don't mistake it for full understanding of what needs to be done. I would love not to, but learning "what needs to be done" have so far eluded me, apart from some people pointing out that "somebody should write XYZ" for severely underdocumented values of XYZ. And now I *really* think this thread should end... -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-svn-src-all@freebsd.org Mon Jan 22 23:12:23 2018 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 30E12EB639B for ; Mon, 22 Jan 2018 23:12:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x234.google.com (mail-it0-x234.google.com [IPv6:2607:f8b0:4001:c0b::234]) (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 E74A073DB6 for ; Mon, 22 Jan 2018 23:12:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x234.google.com with SMTP id e1so11648859ita.0 for ; Mon, 22 Jan 2018 15:12:22 -0800 (PST) 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=EaaZdC4eUU82PaWXcF63yzQT8wq5YWKfaxi2u6Sx+b8=; b=PQfIZ7v72g9B8eObOSbLGMqbqoM/tfSfzbVaVCet7vPicsrq16xh3U4XWbX4GoewFt f2a16+B7p4NZu7hS9TrxHrN4s2lMl6KVF32T5HPIbtiQYoXlSJM0e4awymWZX8l2BHaB eufoL4waeG06TbJbEJvClVNO5oi4j+kPo2ejMyDVH37rMp5FLeVCIRYQ5wxK+asP4t+/ YI1D5y7V+fm4REqVoeiRfVO5uM+mBFibAAJ2vY8kcy+aQkaQCX0CV9z/49kHsp0HYIvk YQkZHkDsHjaHfJCSZRhF1s8NzlmZ0Ne7nRS+6weWKaS7KQODvcUYDFgP3q4BJmHX/63x nI0Q== 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=EaaZdC4eUU82PaWXcF63yzQT8wq5YWKfaxi2u6Sx+b8=; b=V30x8JdkI8SjjtUpfE4S3AmLOfzI3GNm5FHW8y6FHzEiIJNssdvp7oejRwD8p2FfU9 BSEdhHE7O0kOi05VPOAvtuW3UmwANguPTont5Rd4UJU7KadAxhxywGKGY+sGV5iCNzlV jqEjrM0t56h8XIX1+wR3MsHVcLb637l+7Z+qj81ZUn5Rp+kL9lUtpMybc0A6mdh8oZXI azb/d3OsUvmmSrB/9VtPqThhsIkYsxvwjhdSfERRjvlSuheBfzeDgpXRzxI3mE2acv/q CY8DjhGYc9RM57+Gt5jMRBsFuZ1fRRGdRjpDslxe3O9nSrgEBAKPynvlclHM8xWM9e+o NRSg== X-Gm-Message-State: AKwxyteHwTKFy7mDuBSWEa14hEdb0ru7I9QfvdCZrmFsGiW+bAFRMB9Q Ck+QfgTJubWV8zb/pWdpZnn/X+6frNdRDT4Fwg5TGQ== X-Google-Smtp-Source: AH8x227BLenG4eqaJbj9v4YXpuoI3e1L3AGyIhMjmQHj0WDlkzA+YwOy+o9/w3OyIUU+3z6dEQPsuuAkzugotkvRTMQ= X-Received: by 10.36.238.68 with SMTP id b65mr777341iti.97.1516662742215; Mon, 22 Jan 2018 15:12:22 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Mon, 22 Jan 2018 15:12:21 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <88258.1516630050@critter.freebsd.dk> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <20180122135905.203e19ce94510854777dff63@bidouilliste.com> <88070.1516628327@critter.freebsd.dk> <20180122145117.08173be547f5dd6fef296732@bidouilliste.com> <88258.1516630050@critter.freebsd.dk> From: Warner Losh Date: Mon, 22 Jan 2018 16:12:21 -0700 X-Google-Sender-Auth: FV840TE6N0nPbQg9VFkGRa1C5Dg Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: Poul-Henning Kamp Cc: Emmanuel Vadot , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 23:12:23 -0000 On Mon, Jan 22, 2018 at 7:07 AM, Poul-Henning Kamp wrote: > -------- > In message <20180122145117.08173be547f5dd6fef296732@bidouilliste.com>, > Emmanuel > Vadot writes: > > > Using the same logic as before one could have a script starting some > >pwm stuff (or simply using /etc/sysctl.conf) > > Also this is not how DT is suppose to work, if the status == > >'disabled' no driver should attach. > > That doesn't make *any* UX sense. > > "disabled" indicates that it can be enabled, and there is absolutely > no reason to force users to reboot, when all that stands between > them and using their hardware is a random setting in a file. > It is a state of being. The state is not enabled, and maybe not possible to enable. > Explicitly kldload'ing a device-driver is as clear a "Enable it, please" > instruction as you can get from the user. > > If you want to lock down this DT-device because some other > device/pin-mux/whatever makes its use impossible, then > status should not be "disabled" but "locked" or "impossible". > This is an external interface. What you ask is impossible. > In particular it is *horrible* UX, that you kldload a device-driver > for hardware you know is there, and it just silently doesn't do > anything. At the very least it should give a diagnostic. > It's the FDT standard. Words have specific meanings, but maybe not the more normal meaning. Maybe something like: > > "For no good reason this device is disabled, google for > an hour, try to come up with a device tree overlay, reboot > to install it and see if you get lucky. No sense being a jerk about it. It's how FDT works. It's more complex than you might naively think. At least now documentation is published about the standard, though it's still not as complete as we'd like. >> > Can you please revert this part ? > >> > >> Once I find out how to get similar behaviour, ie: kldload without > >> having to reboot to load a DT-overlay. > > > > Nobody is working on that right now (that I know of). > > Let me know when it works, and I'll remove my hack then. > > In the meantime, don't load bcm283x_pwm if you don't plan on > using the PWM on GPIO12 on your RPI[23]. That's less than completely useful, but at least it's a start. Warner From owner-svn-src-all@freebsd.org Mon Jan 22 23:17:11 2018 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 036E7EB66D3 for ; Mon, 22 Jan 2018 23:17:11 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22b.google.com (mail-it0-x22b.google.com [IPv6:2607:f8b0:4001:c0b::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 B7D977407F for ; Mon, 22 Jan 2018 23:17:10 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22b.google.com with SMTP id c102so13261792itd.0 for ; Mon, 22 Jan 2018 15:17:10 -0800 (PST) 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=xVlsp108l3CitKTltaJx+mdN/pnm8Wy5jig6AF3DxVc=; b=LRkH+4XX2vVvqwPU1GeCqGH1M88GnE2vFOmKw6r6mueNLbUY/wY1dKrtMSurPtLJfw COJTzgEOPcpI7AzcM6JKmbzQnnby7GSu8fkjqsJDJPJ312Jas7NJBWrkTpphCyBgrdoX KKsuUvxPbtROHEHvhFgHisXfoQbTom2OvwkuevgQILS+VDjDeLtjD6OOX0GwfYkL3+nk oAkc7V6pf0NU43078kXvRVVj5MNdrKsFYOICqyNEsJP8x1azQa+efZlM+tS/mSBOrpD8 +B4rKYfZVWsjaiNOuKjZ61Hgly44UWI9WJBIXtkrcUDq1jn30hiUIW3QA9UxiwekjErI /p/g== 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=xVlsp108l3CitKTltaJx+mdN/pnm8Wy5jig6AF3DxVc=; b=QCGEPCwc5EE12S7lTFA2Ar/2Cbe4FLXQ9sInsxoe9MGqTPbk6G+U7SkFdK8lVwKaxF qGk2n+Izza5FnRgEm8lBWnkL0GXJXHRolbPtvVCpki/jUeoe8DQktrCt5LtDgcCdyYxq hxsY4QUlJfBiUFz80B4IZR1oRBIPiwVDOGKwncwpP7G+WrxBt/qmVgyiLMjuUzoAO6Bv qrsxbJsO1I3bhTfmmLk67nnlZbxJDEGdNj1rKAt+NRYKH/l4P8WF1Ialvkga+79BZ49u Uji4TOxHSryiE16FXTQdoDzlSHm/ZFbUnLKO7DCIHgHOyHWcaaBkfCuZVgw6MjNZ1QWv 9AWQ== X-Gm-Message-State: AKwxytePB1xHqYd7e0ptMhsZMgE3XVID1aKGINbqwTmLmwANLgTjLUeR 98us5C3Y2v7QMvCf7+8Jm0XV0/2tM0t3mNF6F3UZoQ== X-Google-Smtp-Source: AH8x225H1M9MAsllWejdjomZkevhA9nTP/PUix5JD2KxVAmVIrSkIO+boSSaQ8CXDAf6MALAlsc7r2xjzwpCV3ctsvc= X-Received: by 10.36.238.68 with SMTP id b65mr799444iti.97.1516663030034; Mon, 22 Jan 2018 15:17:10 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Mon, 22 Jan 2018 15:17:09 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <90380.1516662352@critter.freebsd.dk> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> <52374125.OgxafgljNu@ralph.baldwin.cx> <89102.1516649067@critter.freebsd.dk> <89478.1516652693@critter.freebsd.dk> <90380.1516662352@critter.freebsd.dk> From: Warner Losh Date: Mon, 22 Jan 2018 16:17:09 -0700 X-Google-Sender-Auth: UTclZwdQNtVUDwi5cEwLiH09A5Y Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: Poul-Henning Kamp Cc: John Baldwin , Emmanuel Vadot , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 23:17:11 -0000 On Mon, Jan 22, 2018 at 4:05 PM, Poul-Henning Kamp wrote: > -------- > In message f4gz7+KpKQFA@mail.gmail.com> > , Warner Losh writes: > > >This represents a partial understanding of what's required. It's base > level > >only. Don't mistake it for full understanding of what needs to be done. > > I would love not to, but learning "what needs to be done" have so > far eluded me, apart from some people pointing out that "somebody > should write XYZ" for severely underdocumented values of XYZ. > > And now I *really* think this thread should end... I'm happy to point you at such docs as there are and answer as many questions on this. It's not ideal, but it's what we have. We've made the decision to use the FDT standard, which forces us down certain paths. When I wrote the pinmux / pinctl stuff for Atmel, it took me about two days to complete, most of that was understanding what needed to be done. Part of the problem is that the original RPi port pre-dated a lot of these efforts, and the followon ports have been incremental efforts to add in missing bits incrementally w/o regard to modernizing, but no one has gone back and put in the effort to modernize. You're running up against that issue right now, if you want to help revitalize the rpi port. Warner From owner-svn-src-all@freebsd.org Mon Jan 22 23:20:44 2018 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 AAC82EB6AAC; Mon, 22 Jan 2018 23:20:44 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 50DD3743DB; Mon, 22 Jan 2018 23:20:43 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id F3A3A27342; Mon, 22 Jan 2018 23:20:41 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w0MNKe9C090453 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 22 Jan 2018 23:20:41 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0MNKeAV090452; Mon, 22 Jan 2018 23:20:40 GMT (envelope-from phk) To: Warner Losh cc: Ravi Pokala , John Baldwin , Emmanuel Vadot , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <88258.1516630050@critter.freebsd.dk> <20180122153003.664e1613bbf70ab49c5c1541@bidouilliste.com> <52374125.OgxafgljNu@ralph.baldwin.cx> <89102.1516649067@critter.freebsd.dk> <607B50C2-883C-4CAB-8860-483EC4E9A668@mac.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <90450.1516663240.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Mon, 22 Jan 2018 23:20:40 +0000 Message-ID: <90451.1516663240@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 22 Jan 2018 23:20:44 -0000 -------- In message , Warner Losh writes: >I think even bootverbose it's insane. Or I don't understand what the real >ask is. What I think would be a good idea, is when a driver is kldloaded the user will be told if there were hardware present which it could drive (ie: probe() matches), but for some reason and somehow, it as marked as unavailable/conflicting/disabled, so attach() didn't. Today you load the device driver and if the hardware is "status=3Ddisabled= " in the FDT, nothing happens, and you get no information about why nothing happened, leaving the user to guess... I've seen people resort to kldload /boot/kernel/*.ko in an attempt to find out if were using the right device driver. I suspect moving the boilerplate if (!ofw_bus_status_okay(dev)) return (ENXIO); To the attach() function would do it, but we could avoid that boilerplate in all the drivers, if it was done one level up with a consistent device_printf() and not calling attach() at all. What I don't know is how noisy that would be in practice ? -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-svn-src-all@freebsd.org Mon Jan 22 23:54:22 2018 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 5E80CEB8353; Mon, 22 Jan 2018 23:54:22 +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 390D575515; Mon, 22 Jan 2018 23:54:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (astound-66-234-199-215.ca.astound.net [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id D217F10A87D; Mon, 22 Jan 2018 18:54:19 -0500 (EST) From: John Baldwin To: Poul-Henning Kamp Cc: Warner Losh , Ravi Pokala , Emmanuel Vadot , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Date: Mon, 22 Jan 2018 15:54:05 -0800 Message-ID: <2987003.eeGRFBb6N8@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <90451.1516663240@critter.freebsd.dk> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> 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); Mon, 22 Jan 2018 18:54:19 -0500 (EST) 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.25 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, 22 Jan 2018 23:54:22 -0000 On Monday, January 22, 2018 11:20:40 PM Poul-Henning Kamp wrote: > -------- > In message > , Warner Losh writes: > > >I think even bootverbose it's insane. Or I don't understand what the real > >ask is. > > What I think would be a good idea, is when a driver is kldloaded > the user will be told if there were hardware present which it could > drive (ie: probe() matches), but for some reason and somehow, > it as marked as unavailable/conflicting/disabled, so attach() didn't. > > Today you load the device driver and if the hardware is "status=disabled" > in the FDT, nothing happens, and you get no information about why > nothing happened, leaving the user to guess... > > I've seen people resort to kldload /boot/kernel/*.ko in an > attempt to find out if were using the right device driver. > > I suspect moving the boilerplate > > if (!ofw_bus_status_okay(dev)) > return (ENXIO); > > To the attach() function would do it, but we could avoid that > boilerplate in all the drivers, if it was done one level up with > a consistent device_printf() and not calling attach() at all. > > What I don't know is how noisy that would be in practice ? I think the better solution to this problem is the devmatch stuff Warner is already working on where one can say "for this given device info (e.g. PCI IDs or FDT properties), which drivers support this"). There is enough of that already existing now in HEAD I think it would be better to extend it to support whatever input mode it needs to handle disabled devices as input to run through its existing matching engine. -- John Baldwin From owner-svn-src-all@freebsd.org Tue Jan 23 02:16:07 2018 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 D74C2EC3137; Tue, 23 Jan 2018 02:16:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B350B7B8DC; Tue, 23 Jan 2018 02:16:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0851022B76; Tue, 23 Jan 2018 02:16:07 +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 w0N2G6vH077538; Tue, 23 Jan 2018 02:16:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N2G6Yb077537; Tue, 23 Jan 2018 02:16:06 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801230216.w0N2G6Yb077537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 23 Jan 2018 02:16:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328267 - stable/10/sys/dev/nand X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/dev/nand X-SVN-Commit-Revision: 328267 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 02:16:08 -0000 Author: emaste Date: Tue Jan 23 02:16:06 2018 New Revision: 328267 URL: https://svnweb.freebsd.org/changeset/base/328267 Log: MFC r317806 by glebius: The nandsim(4) simulator driver doesn't have any protection against races at least in its ioctl handler, and at the same time it creates device entry with 0666 permissions. To plug possible issues in it: - Mark it as needing Giant. - Switch device mode to 0600. Submitted by: C Turt Reviewed by: imp Security: Possible double free in ioctl handler Modified: stable/10/sys/dev/nand/nandsim.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/nand/nandsim.c ============================================================================== --- stable/10/sys/dev/nand/nandsim.c Mon Jan 22 21:45:54 2018 (r328266) +++ stable/10/sys/dev/nand/nandsim.c Tue Jan 23 02:16:06 2018 (r328267) @@ -71,6 +71,7 @@ static struct nandsim_chip *get_nandsim_chip(uint8_t, static struct cdevsw nandsim_cdevsw = { .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = nandsim_ioctl, .d_name = "nandsim", }; @@ -639,7 +640,7 @@ nandsim_modevent(module_t mod __unused, int type, void switch (type) { case MOD_LOAD: nandsim_dev = make_dev(&nandsim_cdevsw, 0, - UID_ROOT, GID_WHEEL, 0666, "nandsim.ioctl"); + UID_ROOT, GID_WHEEL, 0600, "nandsim.ioctl"); break; case MOD_UNLOAD: for (i = 0; i < MAX_SIM_DEV; i++) { From owner-svn-src-all@freebsd.org Tue Jan 23 02:29:41 2018 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 60A69EC4A4E; Tue, 23 Jan 2018 02:29:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3BAD17C63C; Tue, 23 Jan 2018 02:29:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63CEB22DA0; Tue, 23 Jan 2018 02:29:40 +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 w0N2Tefe081673; Tue, 23 Jan 2018 02:29:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N2TeGI081670; Tue, 23 Jan 2018 02:29:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801230229.w0N2TeGI081670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 23 Jan 2018 02:29:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328268 - in stable/10/sys/dev: hpt27xx hptnr hptrr X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/10/sys/dev: hpt27xx hptnr hptrr X-SVN-Commit-Revision: 328268 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 02:29:41 -0000 Author: emaste Date: Tue Jan 23 02:29:39 2018 New Revision: 328268 URL: https://svnweb.freebsd.org/changeset/base/328268 Log: MFC r327497, r327498: fix memory disclosure in hpt* ioctls r327497: hpt27xx: plug info leak in hpt_ioctl The hpt27xx ioctl handler allocates a buffer without M_ZERO and calls hpt_do_ioctl(), which might not overwrite the entire buffer. Also zero bytesReturned in case it is not written by hpt_do_ioctl(). The hpt27xx device has permissions only for root so this is not urgent, and the fix can be MFCd and considered for a future EN. Reported by: Ilja van Sprundel Submitted by: Domagoj Stolfa (M_ZERO) r327498: hpt{nr,rr}: plug info leak in hpt_ioctl The hpt{nr,rr} ioctl handler allocates a buffer without M_ZERO and calls hpt_do_ioctl(), which might not overwrite the entire buffer. Also zero bytesReturned in case it is not written by hpt_do_ioctl(). The hpt27{nr,rr} device has permissions only for root so this is not urgent, and the fix can be MFCd and considered for a future EN. The same issue was reported in the hpt27xx driver by Ilja Van Sprundel. Security: memory disclosure in root-only ioctls Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/dev/hpt27xx/hpt27xx_osm_bsd.c stable/10/sys/dev/hptnr/hptnr_osm_bsd.c stable/10/sys/dev/hptrr/hptrr_osm_bsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hpt27xx/hpt27xx_osm_bsd.c ============================================================================== --- stable/10/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Tue Jan 23 02:16:06 2018 (r328267) +++ stable/10/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Tue Jan 23 02:29:39 2018 (r328268) @@ -1402,7 +1402,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad { PHPT_IOCTL_PARAM piop=(PHPT_IOCTL_PARAM)data; IOCTL_ARG ioctl_args; - HPT_U32 bytesReturned; + HPT_U32 bytesReturned = 0; switch (cmd){ case HPT_DO_IOCONTROL: @@ -1432,7 +1432,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad } if (ioctl_args.nOutBufferSize) { - ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK); + ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK | M_ZERO); if (!ioctl_args.lpOutBuffer) goto invalid; } Modified: stable/10/sys/dev/hptnr/hptnr_osm_bsd.c ============================================================================== --- stable/10/sys/dev/hptnr/hptnr_osm_bsd.c Tue Jan 23 02:16:06 2018 (r328267) +++ stable/10/sys/dev/hptnr/hptnr_osm_bsd.c Tue Jan 23 02:29:39 2018 (r328268) @@ -1584,7 +1584,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad { PHPT_IOCTL_PARAM piop=(PHPT_IOCTL_PARAM)data; IOCTL_ARG ioctl_args; - HPT_U32 bytesReturned; + HPT_U32 bytesReturned = 0; switch (cmd){ case HPT_DO_IOCONTROL: @@ -1614,7 +1614,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad } if (ioctl_args.nOutBufferSize) { - ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK); + ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK | M_ZERO); if (!ioctl_args.lpOutBuffer) goto invalid; } Modified: stable/10/sys/dev/hptrr/hptrr_osm_bsd.c ============================================================================== --- stable/10/sys/dev/hptrr/hptrr_osm_bsd.c Tue Jan 23 02:16:06 2018 (r328267) +++ stable/10/sys/dev/hptrr/hptrr_osm_bsd.c Tue Jan 23 02:29:39 2018 (r328268) @@ -1231,7 +1231,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad { PHPT_IOCTL_PARAM piop=(PHPT_IOCTL_PARAM)data; IOCTL_ARG ioctl_args; - HPT_U32 bytesReturned; + HPT_U32 bytesReturned = 0; switch (cmd){ case HPT_DO_IOCONTROL: @@ -1261,7 +1261,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad } if (ioctl_args.nOutBufferSize) { - ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK); + ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK | M_ZERO); if (!ioctl_args.lpOutBuffer) goto invalid; } From owner-svn-src-all@freebsd.org Tue Jan 23 02:52:13 2018 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 657B2EC6FF7; Tue, 23 Jan 2018 02:52:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 410B17DD14; Tue, 23 Jan 2018 02:52:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B838232DA; Tue, 23 Jan 2018 02:52:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0N2qCG1091842; Tue, 23 Jan 2018 02:52:12 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N2qCHK091841; Tue, 23 Jan 2018 02:52:12 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201801230252.w0N2qCHK091841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 23 Jan 2018 02:52:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328269 - head/sys/powerpc/include X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/include X-SVN-Commit-Revision: 328269 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 02:52:13 -0000 Author: jhibbits Date: Tue Jan 23 02:52:12 2018 New Revision: 328269 URL: https://svnweb.freebsd.org/changeset/base/328269 Log: Fix 64-bit booke kernel builds after the ldscript changes Commits r326203 and r326978 broke 64-bit booke kernels by introducing a 1MB zero-pad between the ELF header and the start of the kernel. This didn't cause a build failure, but caused kernels to need to be loaded into memory 1MB lower, which could easily break scripts expecting previous behavior. This change matches the similar change made to AIM in r327358. Modified: head/sys/powerpc/include/vmparam.h Modified: head/sys/powerpc/include/vmparam.h ============================================================================== --- head/sys/powerpc/include/vmparam.h Tue Jan 23 02:29:39 2018 (r328268) +++ head/sys/powerpc/include/vmparam.h Tue Jan 23 02:52:12 2018 (r328269) @@ -134,9 +134,9 @@ #ifdef __powerpc64__ #ifndef LOCORE -#define KERNBASE 0xc000000000000000UL /* start of kernel virtual */ +#define KERNBASE 0xc000000000000100UL /* start of kernel virtual */ #else -#define KERNBASE 0xc000000000000000 /* start of kernel virtual */ +#define KERNBASE 0xc000000000000100 /* start of kernel virtual */ #endif #else #define KERNBASE 0xc0000000 /* start of kernel virtual */ From owner-svn-src-all@freebsd.org Tue Jan 23 07:10:15 2018 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 C7129EB5FC9; Tue, 23 Jan 2018 07:10:15 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E22B3203; Tue, 23 Jan 2018 07:10:15 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A37D25BFB; Tue, 23 Jan 2018 04:30:46 +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 w0N4Uklf036501; Tue, 23 Jan 2018 04:30:46 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N4Ukku036500; Tue, 23 Jan 2018 04:30:46 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201801230430.w0N4Ukku036500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 23 Jan 2018 04:30: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: r328275 - stable/11/sys/netpfil/pf X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/11/sys/netpfil/pf X-SVN-Commit-Revision: 328275 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 07:10:15 -0000 Author: kp Date: Tue Jan 23 04:30:46 2018 New Revision: 328275 URL: https://svnweb.freebsd.org/changeset/base/328275 Log: MFC r327675 pf: Avoid integer overflow issues by using mallocarray() iso. malloc() pfioctl() handles several ioctl that takes variable length input, these include: - DIOCRADDTABLES - DIOCRDELTABLES - DIOCRGETTABLES - DIOCRGETTSTATS - DIOCRCLRTSTATS - DIOCRSETTFLAGS All of them take a pfioc_table struct as input from userland. One of its elements (pfrio_size) is used in a buffer length calculation. The calculation contains an integer overflow which if triggered can lead to out of bound reads and writes later on. Reported by: Ilja Van Sprundel Modified: stable/11/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/11/sys/netpfil/pf/pf_ioctl.c Tue Jan 23 04:01:48 2018 (r328274) +++ stable/11/sys/netpfil/pf/pf_ioctl.c Tue Jan 23 04:30:46 2018 (r328275) @@ -2524,7 +2524,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2548,7 +2553,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2572,7 +2582,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_tables(&io->pfrio_table, pfrts, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2593,7 +2608,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_tstats); - pfrtstats = malloc(totlen, M_TEMP, M_WAITOK); + pfrtstats = mallocarray(io->pfrio_size, + sizeof(struct pfr_tstats), M_TEMP, M_WAITOK); + if (! pfrtstats) { + error = ENOMEM; + break; + } PF_RULES_WLOCK(); error = pfr_get_tstats(&io->pfrio_table, pfrtstats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2614,7 +2634,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2638,7 +2663,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2677,7 +2707,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2704,7 +2739,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2732,7 +2772,12 @@ DIOCCHANGEADDR_error: } count = max(io->pfrio_size, io->pfrio_size2); totlen = count * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(count, sizeof(struct pfr_addr), M_TEMP, + M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2760,7 +2805,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_addrs(&io->pfrio_table, pfras, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2781,7 +2831,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_astats); - pfrastats = malloc(totlen, M_TEMP, M_WAITOK); + pfrastats = mallocarray(io->pfrio_size, + sizeof(struct pfr_astats), M_TEMP, M_WAITOK); + if (! pfrastats) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_astats(&io->pfrio_table, pfrastats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2802,7 +2857,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2829,7 +2889,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2856,7 +2921,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2898,7 +2968,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -2964,7 +3039,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -3030,7 +3110,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -3231,7 +3316,12 @@ DIOCCHANGEADDR_error: } bufsiz = io->pfiio_size * sizeof(struct pfi_kif); - ifstore = malloc(bufsiz, M_TEMP, M_WAITOK); + ifstore = mallocarray(io->pfiio_size, sizeof(struct pfi_kif), + M_TEMP, M_WAITOK); + if (! ifstore) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); pfi_get_ifaces(io->pfiio_name, ifstore, &io->pfiio_size); PF_RULES_RUNLOCK(); From owner-svn-src-all@freebsd.org Tue Jan 23 07:15:17 2018 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 1EDC3EB6581; Tue, 23 Jan 2018 07:15:17 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D7CBD3C31; Tue, 23 Jan 2018 07:15:16 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 925962372F; Tue, 23 Jan 2018 03:15:44 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0N3Fiv7007010; Tue, 23 Jan 2018 03:15:44 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N3FiAr007009; Tue, 23 Jan 2018 03:15:44 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201801230315.w0N3FiAr007009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Tue, 23 Jan 2018 03:15:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328272 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: rstone X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 328272 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 07:15:17 -0000 Author: rstone Date: Tue Jan 23 03:15:44 2018 New Revision: 328272 URL: https://svnweb.freebsd.org/changeset/base/328272 Log: Increment the route table gen count after a modify Increment the route table generation count after modifying a route. This signals back to TCP connections that they need to update their L2 caches as the gateway for their route may have changed. This is a heavier hammer than is needed, strictly speaking, but route changes will be unlikely enough that the performance effects of invalidating all connection route caches should be negligible. MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D13990 Reviewed by: karels Modified: head/sys/net/route.c Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Tue Jan 23 03:15:39 2018 (r328271) +++ head/sys/net/route.c Tue Jan 23 03:15:44 2018 (r328272) @@ -1733,6 +1733,8 @@ rtrequest1_fib_change(struct rib_head *rnh, struct rt_ int family, mtu; struct if_mtuinfo ifmtu; + RIB_WLOCK_ASSERT(rnh); + rt = (struct rtentry *)rnh->rnh_lookup(info->rti_info[RTAX_DST], info->rti_info[RTAX_NETMASK], &rnh->head); @@ -1822,6 +1824,13 @@ rtrequest1_fib_change(struct rib_head *rnh, struct rt_ if_updatemtu_cb(rt->rt_nodes, &ifmtu); } } + + /* + * This route change may have modified the route's gateway. In that + * case, any inpcbs that have cached this route need to invalidate their + * llentry cache. + */ + rnh->rnh_gen++; if (ret_nrt) { *ret_nrt = rt; From owner-svn-src-all@freebsd.org Tue Jan 23 07:15:15 2018 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 B9A5AEB6544; Tue, 23 Jan 2018 07:15:15 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 950C83BFE; Tue, 23 Jan 2018 07:15:15 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 662D023722; Tue, 23 Jan 2018 03:15:35 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0N3FZHP006909; Tue, 23 Jan 2018 03:15:35 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N3FZMH006908; Tue, 23 Jan 2018 03:15:35 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201801230315.w0N3FZMH006908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Tue, 23 Jan 2018 03:15:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328270 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: rstone X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 328270 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 07:15:15 -0000 Author: rstone Date: Tue Jan 23 03:15:35 2018 New Revision: 328270 URL: https://svnweb.freebsd.org/changeset/base/328270 Log: Invalidate inpcb LLE cache if cached route is invalidated When the inpcb route cache is invalidated after a change to the routing tables, we need to invalidate the LLE cache as well. Previous to this change packets for the connection would continue to use the old L2 information from the old L3 gateway, and the packets for the connection would likely be blackholed. MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D13988 Reviewed by: karels Modified: head/sys/net/route.h Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Tue Jan 23 02:52:12 2018 (r328269) +++ head/sys/net/route.h Tue Jan 23 03:15:35 2018 (r328270) @@ -428,6 +428,10 @@ struct rt_addrinfo { RTFREE((ro)->ro_rt); \ (ro)->ro_rt = NULL; \ } \ + if ((ro)->ro_lle != NULL) { \ + LLE_FREE((ro)->ro_lle); \ + (ro)->ro_lle = NULL; \ + } \ *(cookiep) = cookie; \ } \ } while (0) From owner-svn-src-all@freebsd.org Tue Jan 23 07:15:15 2018 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 AAD0BEB653F; Tue, 23 Jan 2018 07:15:15 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D4163BF3; Tue, 23 Jan 2018 07:15:15 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D20923729; Tue, 23 Jan 2018 03:15:40 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0N3FeIr006961; Tue, 23 Jan 2018 03:15:40 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N3FdWE006958; Tue, 23 Jan 2018 03:15:39 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201801230315.w0N3FdWE006958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Tue, 23 Jan 2018 03:15:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328271 - in head/sys: net netinet X-SVN-Group: head X-SVN-Commit-Author: rstone X-SVN-Commit-Paths: in head/sys: net netinet X-SVN-Commit-Revision: 328271 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 07:15:15 -0000 Author: rstone Date: Tue Jan 23 03:15:39 2018 New Revision: 328271 URL: https://svnweb.freebsd.org/changeset/base/328271 Log: Reduce code duplication for inpcb route caching Add a new macro to clear both the L3 and L2 route caches, to hopefully prevent future instances where only the L3 cache was cleared when both should have been. MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D13989 Reviewed by: karels Modified: head/sys/net/route.h head/sys/netinet/in_pcb.c head/sys/netinet/ip_output.c Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Tue Jan 23 03:15:35 2018 (r328270) +++ head/sys/net/route.h Tue Jan 23 03:15:39 2018 (r328271) @@ -416,6 +416,14 @@ struct rt_addrinfo { } \ } while (0) +#define RO_INVALIDATE_CACHE(ro) do { \ + RO_RTFREE(ro); \ + if ((ro)->ro_lle != NULL) { \ + LLE_FREE((ro)->ro_lle); \ + (ro)->ro_lle = NULL; \ + } \ + } while (0) + /* * Validate a cached route based on a supplied cookie. If there is an * out-of-date cache, simply free it. Update the generation number @@ -424,14 +432,7 @@ struct rt_addrinfo { #define RT_VALIDATE(ro, cookiep, fibnum) do { \ rt_gen_t cookie = RT_GEN(fibnum, (ro)->ro_dst.sa_family); \ if (*(cookiep) != cookie) { \ - if ((ro)->ro_rt != NULL) { \ - RTFREE((ro)->ro_rt); \ - (ro)->ro_rt = NULL; \ - } \ - if ((ro)->ro_lle != NULL) { \ - LLE_FREE((ro)->ro_lle); \ - (ro)->ro_lle = NULL; \ - } \ + RO_INVALIDATE_CACHE(ro); \ *(cookiep) = cookie; \ } \ } while (0) Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Tue Jan 23 03:15:35 2018 (r328270) +++ head/sys/netinet/in_pcb.c Tue Jan 23 03:15:39 2018 (r328271) @@ -1319,9 +1319,7 @@ in_pcbfree(struct inpcb *inp) if (inp->inp_moptions != NULL) inp_freemoptions(inp->inp_moptions); #endif - RO_RTFREE(&inp->inp_route); - if (inp->inp_route.ro_lle) - LLE_FREE(inp->inp_route.ro_lle); /* zeros ro_lle */ + RO_INVALIDATE_CACHE(&inp->inp_route); inp->inp_vflag = 0; inp->inp_flags2 |= INP_FREED; @@ -2259,9 +2257,7 @@ void in_losing(struct inpcb *inp) { - RO_RTFREE(&inp->inp_route); - if (inp->inp_route.ro_lle) - LLE_FREE(inp->inp_route.ro_lle); /* zeros ro_lle */ + RO_INVALIDATE_CACHE(&inp->inp_route); return; } Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Tue Jan 23 03:15:35 2018 (r328270) +++ head/sys/netinet/ip_output.c Tue Jan 23 03:15:39 2018 (r328271) @@ -302,11 +302,8 @@ again: !RT_LINK_IS_UP(rte->rt_ifp) || dst->sin_family != AF_INET || dst->sin_addr.s_addr != ip->ip_dst.s_addr)) { - RTFREE(rte); - rte = ro->ro_rt = (struct rtentry *)NULL; - if (ro->ro_lle) - LLE_FREE(ro->ro_lle); /* zeros ro_lle */ - ro->ro_lle = (struct llentry *)NULL; + RO_INVALIDATE_CACHE(ro); + rte = NULL; } ia = NULL; have_ia_ref = 0; From owner-svn-src-all@freebsd.org Tue Jan 23 07:05:20 2018 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 C9393EB5C6A; Tue, 23 Jan 2018 07:05:20 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D2D42CA6; Tue, 23 Jan 2018 07:05:20 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E420325E3B; Tue, 23 Jan 2018 04:37:31 +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 w0N4bVxB040508; Tue, 23 Jan 2018 04:37:31 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N4bVr1040504; Tue, 23 Jan 2018 04:37:31 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201801230437.w0N4bVr1040504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 23 Jan 2018 04:37:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328276 - in stable/10: share/man/man9 sys/kern sys/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in stable/10: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 328276 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 07:05:20 -0000 Author: kp Date: Tue Jan 23 04:37:31 2018 New Revision: 328276 URL: https://svnweb.freebsd.org/changeset/base/328276 Log: MFC r327674, r327796 Introduce mallocarray() in the kernel Similar to calloc() the mallocarray() function checks for integer overflows before allocating memory. It does not zero memory, unless the M_ZERO flag is set. Additionally, move the overflow check logic out to WOULD_OVERFLOW() for consumers to have a common means of testing for overflowing allocations. WOULD_OVERFLOW() should be a secondary check -- on 64-bit platforms, just because an allocation won't overflow size_t does not mean it is a sane size to request. Callers should be imposing reasonable allocation limits far, far, below overflow. Obtained from: OpenBSD Modified: stable/10/share/man/man9/malloc.9 stable/10/sys/kern/kern_malloc.c stable/10/sys/sys/malloc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/malloc.9 ============================================================================== --- stable/10/share/man/man9/malloc.9 Tue Jan 23 04:30:46 2018 (r328275) +++ stable/10/share/man/man9/malloc.9 Tue Jan 23 04:37:31 2018 (r328276) @@ -29,7 +29,7 @@ .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $ .\" $FreeBSD$ .\" -.Dd November 15, 2012 +.Dd January 10, 2018 .Dt MALLOC 9 .Os .Sh NAME @@ -45,6 +45,8 @@ .In sys/malloc.h .Ft void * .Fn malloc "unsigned long size" "struct malloc_type *type" "int flags" +.Ft void * +.Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags" .Ft void .Fn free "void *addr" "struct malloc_type *type" .Ft void * @@ -64,6 +66,14 @@ object whose size is specified by .Fa size . .Pp The +.Fn mallocarray +function allocates uninitialized memory in kernel address space for an +array of +.Fa nmemb +entries whose size is specified by +.Fa size . +.Pp +The .Fn free function releases memory at address .Fa addr @@ -144,6 +154,7 @@ If the request cannot be immediately fulfilled, the cu to sleep to wait for resources to be released by other processes. The .Fn malloc , +.Fn mallocarray , .Fn realloc , and .Fn reallocf @@ -152,6 +163,13 @@ functions cannot return if .Dv M_WAITOK is specified. +if the multiplication of +.Fa nmemb +and +.Fa size +would cause an integer overflow, the +.Fn mallocarray +function induces a panic. .It Dv M_USE_RESERVE Indicates that the system can use its reserve of memory to satisfy the request. Modified: stable/10/sys/kern/kern_malloc.c ============================================================================== --- stable/10/sys/kern/kern_malloc.c Tue Jan 23 04:30:46 2018 (r328275) +++ stable/10/sys/kern/kern_malloc.c Tue Jan 23 04:37:31 2018 (r328276) @@ -2,6 +2,7 @@ * Copyright (c) 1987, 1991, 1993 * The Regents of the University of California. * Copyright (c) 2005-2009 Robert N. M. Watson + * Copyright (c) 2008 Otto Moerbeek (mallocarray) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -527,6 +528,16 @@ malloc(unsigned long size, struct malloc_type *mtp, in va = redzone_setup(va, osize); #endif return ((void *) va); +} + +void * +mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) +{ + + if (WOULD_OVERFLOW(nmemb, size)) + panic("mallocarray: %zu * %zu overflowed", nmemb, size); + + return (malloc(size * nmemb, type, flags)); } /* Modified: stable/10/sys/sys/malloc.h ============================================================================== --- stable/10/sys/sys/malloc.h Tue Jan 23 04:30:46 2018 (r328275) +++ stable/10/sys/sys/malloc.h Tue Jan 23 04:37:31 2018 (r328276) @@ -39,6 +39,7 @@ #include #include #include +#include #define MINALLOCSIZE UMA_SMALLEST_UNIT @@ -176,6 +177,8 @@ void *contigmalloc(unsigned long size, struct malloc_t vm_paddr_t boundary) __malloc_like; void free(void *addr, struct malloc_type *type); void *malloc(unsigned long size, struct malloc_type *type, int flags) __malloc_like; +void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, + int flags) __malloc_like __result_use_check; void malloc_init(void *); int malloc_last_fail(void); void malloc_type_allocated(struct malloc_type *type, unsigned long size); @@ -188,6 +191,20 @@ void *reallocf(void *addr, unsigned long size, struct int flags); struct malloc_type *malloc_desc2type(const char *desc); + +/* + * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX + * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW + */ +#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 8 / 2)) +static inline bool +WOULD_OVERFLOW(size_t nmemb, size_t size) +{ + + return ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && + nmemb > 0 && __SIZE_T_MAX / nmemb < size); +} +#undef MUL_NO_OVERFLOW #endif /* _KERNEL */ #endif /* !_SYS_MALLOC_H_ */ From owner-svn-src-all@freebsd.org Tue Jan 23 07:15:18 2018 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 955EDEB65D8; Tue, 23 Jan 2018 07:15:18 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6994C3C82; Tue, 23 Jan 2018 07:15:18 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CBF224129; Tue, 23 Jan 2018 03:36:50 +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 w0N3anWg015436; Tue, 23 Jan 2018 03:36:49 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N3anOn015435; Tue, 23 Jan 2018 03:36:49 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201801230336.w0N3anOn015435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 23 Jan 2018 03:36:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328273 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 328273 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 07:15:18 -0000 Author: delphij Date: Tue Jan 23 03:36:49 2018 New Revision: 328273 URL: https://svnweb.freebsd.org/changeset/base/328273 Log: Document how to load nmdm(4) from a kernel module. Submitted by: kevlo MFC after: 2 weeks Modified: head/share/man/man4/nmdm.4 Modified: head/share/man/man4/nmdm.4 ============================================================================== --- head/share/man/man4/nmdm.4 Tue Jan 23 03:15:44 2018 (r328272) +++ head/share/man/man4/nmdm.4 Tue Jan 23 03:36:49 2018 (r328273) @@ -21,14 +21,26 @@ .\" .\" $FreeBSD$ .\" -.Dd January 27, 2005 +.Dd January 23, 2018 .Dt NMDM 4 .Os .Sh NAME .Nm nmdm .Nd nullmodem terminal driver .Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent .Cd "device nmdm" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +nmdm_load="YES" +.Ed .Sh DESCRIPTION The .Nm From owner-svn-src-all@freebsd.org Tue Jan 23 07:40:14 2018 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 9E34BEB78B3; Tue, 23 Jan 2018 07:40:14 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 77F9568CC3; Tue, 23 Jan 2018 07:40:14 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A22924DFB; Tue, 23 Jan 2018 04:01:49 +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 w0N41nZR027899; Tue, 23 Jan 2018 04:01:49 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N41nfE027898; Tue, 23 Jan 2018 04:01:49 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201801230401.w0N41nfE027898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 23 Jan 2018 04:01:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328274 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 328274 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 07:40:14 -0000 Author: cy Date: Tue Jan 23 04:01:48 2018 New Revision: 328274 URL: https://svnweb.freebsd.org/changeset/base/328274 Log: MFC r327718: When growing the state, also grow the seed array. Otherwise memory that was not allocated will be accessed. This necessitated refactoring state seed allocation from ipf_state_soft_init() into a new common ipf_state_seed_alloc() function as it is now also used by ipf_state_rehash() when changing the size of the state hash table in addition to by ipf_state_soft_init() during initialization. According to Christos Zoulas : The bug was encountered by a NetBSD vendor who's customer machines had large ipfilter states. The bug was reliably triggered by resizing the state variables using "ipf -T". Submitted by: Christos Zoulas Reviewed by: delphij, rgrimes Obtained from: NetBSD ip_state.c CVS revs r1.9 and r1.10 Differential Revision: https://reviews.freebsd.org/D13755 Modified: 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/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_state.c Tue Jan 23 03:36:49 2018 (r328273) +++ stable/10/sys/contrib/ipfilter/netinet/ip_state.c Tue Jan 23 04:01:48 2018 (r328274) @@ -301,7 +301,33 @@ ipf_state_soft_destroy(softc, arg) KFREE(softs); } +static void * +ipf_state_seed_alloc(u_int state_size, u_int state_max) +{ + u_int i; + u_long *state_seed; + KMALLOCS(state_seed, u_long *, state_size * sizeof(*state_seed)); + if (state_seed == NULL) + return NULL; + for (i = 0; i < state_size; i++) { + /* + * XXX - ipf_state_seed[X] should be a random number of sorts. + */ +#if FREEBSD_GE_REV(400000) + state_seed[i] = arc4random(); +#else + state_seed[i] = ((u_long)state_seed + i) * state_size; + state_seed[i] ^= 0xa5a55a5a; + state_seed[i] *= (u_long)state_seed; + state_seed[i] ^= 0x5a5aa5a5; + state_seed[i] *= state_max; +#endif + } + return state_seed; +} + + /* ------------------------------------------------------------------------ */ /* Function: ipf_state_soft_init */ /* Returns: int - 0 == success, -1 == failure */ @@ -333,27 +359,11 @@ ipf_state_soft_init(softc, arg) bzero((char *)softs->ipf_state_table, softs->ipf_state_size * sizeof(ipstate_t *)); - KMALLOCS(softs->ipf_state_seed, u_long *, - softs->ipf_state_size * sizeof(*softs->ipf_state_seed)); + softs->ipf_state_seed = ipf_state_seed_alloc(softs->ipf_state_size, + softs->ipf_state_max); if (softs->ipf_state_seed == NULL) return -2; - for (i = 0; i < softs->ipf_state_size; i++) { - /* - * XXX - ipf_state_seed[X] should be a random number of sorts. - */ -#if FREEBSD_GE_REV(400000) - softs->ipf_state_seed[i] = arc4random(); -#else - softs->ipf_state_seed[i] = ((u_long)softs->ipf_state_seed + i) * - softs->ipf_state_size; - softs->ipf_state_seed[i] ^= 0xa5a55a5a; - softs->ipf_state_seed[i] *= (u_long)softs->ipf_state_seed; - softs->ipf_state_seed[i] ^= 0x5a5aa5a5; - softs->ipf_state_seed[i] *= softs->ipf_state_max; -#endif - } - KMALLOCS(softs->ipf_state_stats.iss_bucketlen, u_int *, softs->ipf_state_size * sizeof(u_int)); if (softs->ipf_state_stats.iss_bucketlen == NULL) @@ -5253,6 +5263,7 @@ ipf_state_rehash(softc, t, p) { ipf_state_softc_t *softs = softc->ipf_state_soft; ipstate_t **newtab, *is; + u_long *newseed; u_int *bucketlens; u_int maxbucket; u_int newsize; @@ -5279,6 +5290,14 @@ ipf_state_rehash(softc, t, p) return ENOMEM; } + newseed = ipf_state_seed_alloc(newsize, softs->ipf_state_max); + if (newseed == NULL) { + KFREES(bucketlens, newsize * sizeof(*bucketlens)); + KFREES(newtab, newsize * sizeof(*newtab)); + IPFERROR(100037); + return ENOMEM; + } + for (maxbucket = 0, i = newsize; i > 0; i >>= 1) maxbucket++; maxbucket *= 2; @@ -5293,6 +5312,12 @@ ipf_state_rehash(softc, t, p) softs->ipf_state_size * sizeof(*softs->ipf_state_table)); } softs->ipf_state_table = newtab; + + if (softs->ipf_state_seed != NULL) { + KFREES(softs->ipf_state_seed, + softs->ipf_state_size * sizeof(*softs->ipf_state_seed)); + } + softs->ipf_state_seed = newseed; if (softs->ipf_state_stats.iss_bucketlen != NULL) { KFREES(softs->ipf_state_stats.iss_bucketlen, From owner-svn-src-all@freebsd.org Tue Jan 23 07:30:16 2018 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 F34B9EB7295; Tue, 23 Jan 2018 07:30:16 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CDE1968280; Tue, 23 Jan 2018 07:30:16 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 555B226C8E; Tue, 23 Jan 2018 05:03:26 +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 w0N53QrA052842; Tue, 23 Jan 2018 05:03:26 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N53Quc052841; Tue, 23 Jan 2018 05:03:26 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201801230503.w0N53Quc052841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 23 Jan 2018 05:03: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: r328277 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/10/sys/netpfil/pf X-SVN-Commit-Revision: 328277 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 07:30:17 -0000 Author: kp Date: Tue Jan 23 05:03:26 2018 New Revision: 328277 URL: https://svnweb.freebsd.org/changeset/base/328277 Log: MFC r327675 pf: Avoid integer overflow issues by using mallocarray() iso. malloc() pfioctl() handles several ioctl that takes variable length input, these include: - DIOCRADDTABLES - DIOCRDELTABLES - DIOCRGETTABLES - DIOCRGETTSTATS - DIOCRCLRTSTATS - DIOCRSETTFLAGS All of them take a pfioc_table struct as input from userland. One of its elements (pfrio_size) is used in a buffer length calculation. The calculation contains an integer overflow which if triggered can lead to out of bound reads and writes later on. Reported by: Ilja Van Sprundel Modified: stable/10/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jan 23 04:37:31 2018 (r328276) +++ stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jan 23 05:03:26 2018 (r328277) @@ -2514,7 +2514,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2538,7 +2543,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2562,7 +2572,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_tables(&io->pfrio_table, pfrts, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2583,7 +2598,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_tstats); - pfrtstats = malloc(totlen, M_TEMP, M_WAITOK); + pfrtstats = mallocarray(io->pfrio_size, + sizeof(struct pfr_tstats), M_TEMP, M_WAITOK); + if (! pfrtstats) { + error = ENOMEM; + break; + } PF_RULES_WLOCK(); error = pfr_get_tstats(&io->pfrio_table, pfrtstats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2604,7 +2624,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2628,7 +2653,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2667,7 +2697,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2694,7 +2729,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2722,7 +2762,12 @@ DIOCCHANGEADDR_error: } count = max(io->pfrio_size, io->pfrio_size2); totlen = count * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(count, sizeof(struct pfr_addr), M_TEMP, + M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2750,7 +2795,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_addrs(&io->pfrio_table, pfras, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2771,7 +2821,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_astats); - pfrastats = malloc(totlen, M_TEMP, M_WAITOK); + pfrastats = mallocarray(io->pfrio_size, + sizeof(struct pfr_astats), M_TEMP, M_WAITOK); + if (! pfrastats) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_astats(&io->pfrio_table, pfrastats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2792,7 +2847,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2819,7 +2879,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2846,7 +2911,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2888,7 +2958,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -2954,7 +3029,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -3020,7 +3100,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -3221,7 +3306,12 @@ DIOCCHANGEADDR_error: } bufsiz = io->pfiio_size * sizeof(struct pfi_kif); - ifstore = malloc(bufsiz, M_TEMP, M_WAITOK); + ifstore = mallocarray(io->pfiio_size, sizeof(struct pfi_kif), + M_TEMP, M_WAITOK); + if (! ifstore) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); pfi_get_ifaces(io->pfiio_name, ifstore, &io->pfiio_size); PF_RULES_RUNLOCK(); From owner-svn-src-all@freebsd.org Tue Jan 23 07:43:57 2018 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 CAA80EB7B50; Tue, 23 Jan 2018 07:43:57 +0000 (UTC) (envelope-from danfe@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 A48AE695A5; Tue, 23 Jan 2018 07:43:57 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 445621E588; Tue, 23 Jan 2018 07:43:56 +0000 (UTC) Date: Tue, 23 Jan 2018 07:43:56 +0000 From: Alexey Dokuchaev To: John Baldwin Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Jason Evans Subject: Re: svn commit: r319971 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src include lib/libc/stdlib/jemalloc Message-ID: <20180123074356.GA10499@FreeBSD.org> References: <201706150715.v5F7F6aT031218@repo.freebsd.org> <20180118101031.GB21646@FreeBSD.org> <20180122063210.GA43383@FreeBSD.org> <1981273.UqQzroY0xG@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1981273.UqQzroY0xG@ralph.baldwin.cx> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 23 Jan 2018 07:43:57 -0000 On Mon, Jan 22, 2018 at 10:50:06AM -0800, John Baldwin wrote: > On Monday, January 22, 2018 06:32:10 AM Alexey Dokuchaev wrote: > > ... > > I've just found out that similar bug was already reported back in July: > > > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220767 > > I wonder if it is tripping over pthread_once not working in libc. The stub > for pthread_once in libc is a nop and has been for a long time. I added > a functioning stub (called _libc_once) to libc for it's internal use (there > is a _once() wrapper that will call _pthread_once when using libpthread and > _libc_once otherwise). It might be interesting to build jemalloc with > '-Dpthread_once=_once' to see if that makes a difference? I've tried to replace pthread_once -> _once in `src/background_thread.c' directly (passing `-Dpthread_once=_once' would conflict with existing definition in /mnt/src/head/lib/libc/include/namespace.h), it didn't help. But thanks anyway, I appreciate more people taking a look in the issue. ./danfe From owner-svn-src-all@freebsd.org Tue Jan 23 07:40:36 2018 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 011C8EB7940; Tue, 23 Jan 2018 07:40:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4C6D68FD7; Tue, 23 Jan 2018 07:40:35 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 386BF24DF9; Tue, 23 Jan 2018 04:01:49 +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 w0N41nwb027892; Tue, 23 Jan 2018 04:01:49 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N41nVe027891; Tue, 23 Jan 2018 04:01:49 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201801230401.w0N41nVe027891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 23 Jan 2018 04:01:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328274 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 328274 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 07:40:36 -0000 Author: cy Date: Tue Jan 23 04:01:48 2018 New Revision: 328274 URL: https://svnweb.freebsd.org/changeset/base/328274 Log: MFC r327718: When growing the state, also grow the seed array. Otherwise memory that was not allocated will be accessed. This necessitated refactoring state seed allocation from ipf_state_soft_init() into a new common ipf_state_seed_alloc() function as it is now also used by ipf_state_rehash() when changing the size of the state hash table in addition to by ipf_state_soft_init() during initialization. According to Christos Zoulas : The bug was encountered by a NetBSD vendor who's customer machines had large ipfilter states. The bug was reliably triggered by resizing the state variables using "ipf -T". Submitted by: Christos Zoulas Reviewed by: delphij, rgrimes Obtained from: NetBSD ip_state.c CVS revs r1.9 and r1.10 Differential Revision: https://reviews.freebsd.org/D13755 Modified: 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/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_state.c Tue Jan 23 03:36:49 2018 (r328273) +++ stable/11/sys/contrib/ipfilter/netinet/ip_state.c Tue Jan 23 04:01:48 2018 (r328274) @@ -301,7 +301,33 @@ ipf_state_soft_destroy(softc, arg) KFREE(softs); } +static void * +ipf_state_seed_alloc(u_int state_size, u_int state_max) +{ + u_int i; + u_long *state_seed; + KMALLOCS(state_seed, u_long *, state_size * sizeof(*state_seed)); + if (state_seed == NULL) + return NULL; + for (i = 0; i < state_size; i++) { + /* + * XXX - ipf_state_seed[X] should be a random number of sorts. + */ +#if FREEBSD_GE_REV(400000) + state_seed[i] = arc4random(); +#else + state_seed[i] = ((u_long)state_seed + i) * state_size; + state_seed[i] ^= 0xa5a55a5a; + state_seed[i] *= (u_long)state_seed; + state_seed[i] ^= 0x5a5aa5a5; + state_seed[i] *= state_max; +#endif + } + return state_seed; +} + + /* ------------------------------------------------------------------------ */ /* Function: ipf_state_soft_init */ /* Returns: int - 0 == success, -1 == failure */ @@ -333,27 +359,11 @@ ipf_state_soft_init(softc, arg) bzero((char *)softs->ipf_state_table, softs->ipf_state_size * sizeof(ipstate_t *)); - KMALLOCS(softs->ipf_state_seed, u_long *, - softs->ipf_state_size * sizeof(*softs->ipf_state_seed)); + softs->ipf_state_seed = ipf_state_seed_alloc(softs->ipf_state_size, + softs->ipf_state_max); if (softs->ipf_state_seed == NULL) return -2; - for (i = 0; i < softs->ipf_state_size; i++) { - /* - * XXX - ipf_state_seed[X] should be a random number of sorts. - */ -#if FREEBSD_GE_REV(400000) - softs->ipf_state_seed[i] = arc4random(); -#else - softs->ipf_state_seed[i] = ((u_long)softs->ipf_state_seed + i) * - softs->ipf_state_size; - softs->ipf_state_seed[i] ^= 0xa5a55a5a; - softs->ipf_state_seed[i] *= (u_long)softs->ipf_state_seed; - softs->ipf_state_seed[i] ^= 0x5a5aa5a5; - softs->ipf_state_seed[i] *= softs->ipf_state_max; -#endif - } - KMALLOCS(softs->ipf_state_stats.iss_bucketlen, u_int *, softs->ipf_state_size * sizeof(u_int)); if (softs->ipf_state_stats.iss_bucketlen == NULL) @@ -5259,6 +5269,7 @@ ipf_state_rehash(softc, t, p) { ipf_state_softc_t *softs = softc->ipf_state_soft; ipstate_t **newtab, *is; + u_long *newseed; u_int *bucketlens; u_int maxbucket; u_int newsize; @@ -5285,6 +5296,14 @@ ipf_state_rehash(softc, t, p) return ENOMEM; } + newseed = ipf_state_seed_alloc(newsize, softs->ipf_state_max); + if (newseed == NULL) { + KFREES(bucketlens, newsize * sizeof(*bucketlens)); + KFREES(newtab, newsize * sizeof(*newtab)); + IPFERROR(100037); + return ENOMEM; + } + for (maxbucket = 0, i = newsize; i > 0; i >>= 1) maxbucket++; maxbucket *= 2; @@ -5299,6 +5318,12 @@ ipf_state_rehash(softc, t, p) softs->ipf_state_size * sizeof(*softs->ipf_state_table)); } softs->ipf_state_table = newtab; + + if (softs->ipf_state_seed != NULL) { + KFREES(softs->ipf_state_seed, + softs->ipf_state_size * sizeof(*softs->ipf_state_seed)); + } + softs->ipf_state_seed = newseed; if (softs->ipf_state_stats.iss_bucketlen != NULL) { KFREES(softs->ipf_state_stats.iss_bucketlen, From owner-svn-src-all@freebsd.org Tue Jan 23 08:07:01 2018 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 B5885EBA178; Tue, 23 Jan 2018 08:07:01 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 91F6D6A7A5; Tue, 23 Jan 2018 08:07:01 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA5983C31; Tue, 23 Jan 2018 08:07:00 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0N870fQ027522; Tue, 23 Jan 2018 08:07:00 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N870XH027521; Tue, 23 Jan 2018 08:07:00 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801230807.w0N870XH027521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Tue, 23 Jan 2018 08:07:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328278 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 328278 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 08:07:01 -0000 Author: wma Date: Tue Jan 23 08:07:00 2018 New Revision: 328278 URL: https://svnweb.freebsd.org/changeset/base/328278 Log: PowerNV: send MSI_EOI always after MSI unmask MSI/MSI-x interrupts are edge-triggered. If an interrupt arrives when IRQ line is masked, it will be lost and will never recover. Perform MSI_EOI always after unmask to give a chance for PHB/XICS to send an interrupt again if MSI/MSI-x pending bit is set in MSI/MSI-x BAR space. Submitted by: Wojciech Macek Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Modified: head/sys/powerpc/powernv/opal_pci.c Modified: head/sys/powerpc/powernv/opal_pci.c ============================================================================== --- head/sys/powerpc/powernv/opal_pci.c Tue Jan 23 05:03:26 2018 (r328277) +++ head/sys/powerpc/powernv/opal_pci.c Tue Jan 23 08:07:00 2018 (r328278) @@ -601,7 +601,13 @@ static void opalpic_pic_mask(device_t dev, u_int irq) static void opalpic_pic_unmask(device_t dev, u_int irq) { + struct opalpci_softc *sc; + + sc = device_get_softc(dev); + PIC_UNMASK(root_pic, irq); + + opal_call(OPAL_PCI_MSI_EOI, sc->phb_id, irq); } From owner-svn-src-all@freebsd.org Tue Jan 23 13:03:48 2018 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 CEE95ED2E9B; Tue, 23 Jan 2018 13:03:48 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A90DC7A9C3; Tue, 23 Jan 2018 13:03:48 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCB116EAD; Tue, 23 Jan 2018 13:03:47 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0ND3lIL052957; Tue, 23 Jan 2018 13:03:47 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0ND3lTa052955; Tue, 23 Jan 2018 13:03:47 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201801231303.w0ND3lTa052955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 23 Jan 2018 13:03:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328279 - head/usr.bin/sockstat X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/usr.bin/sockstat X-SVN-Commit-Revision: 328279 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 13:03:48 -0000 Author: manu Date: Tue Jan 23 13:03:47 2018 New Revision: 328279 URL: https://svnweb.freebsd.org/changeset/base/328279 Log: sockstat: Add -q option to suppress the header line MFC after: 1 week Sponsored by: Gandi.net Modified: head/usr.bin/sockstat/sockstat.1 head/usr.bin/sockstat/sockstat.c Modified: head/usr.bin/sockstat/sockstat.1 ============================================================================== --- head/usr.bin/sockstat/sockstat.1 Tue Jan 23 08:07:00 2018 (r328278) +++ head/usr.bin/sockstat/sockstat.1 Tue Jan 23 13:03:47 2018 (r328279) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 12, 2017 +.Dd January 23, 2018 .Dt SOCKSTAT 1 .Os .Sh NAME @@ -83,6 +83,8 @@ The argument is a comma-separated list of protocol names, as they are defined in .Xr protocols 5 . +.It Fl q +Quiet mode, do not print the header line. .It Fl S Display the protocol stack, if applicable. This is currently only implemented for TCP. Modified: head/usr.bin/sockstat/sockstat.c ============================================================================== --- head/usr.bin/sockstat/sockstat.c Tue Jan 23 08:07:00 2018 (r328278) +++ head/usr.bin/sockstat/sockstat.c Tue Jan 23 13:03:47 2018 (r328279) @@ -76,6 +76,7 @@ static int opt_c; /* Show connected sockets */ static int opt_j; /* Show specified jail */ static int opt_L; /* Don't show IPv4 or IPv6 loopback sockets */ static int opt_l; /* Show listening sockets */ +static int opt_q; /* Don't show header */ static int opt_S; /* Show protocol stack if applicable */ static int opt_s; /* Show protocol state if applicable */ static int opt_U; /* Show remote UDP encapsulation port number */ @@ -1155,19 +1156,21 @@ display(void) struct sock *s; int hash, n, pos; - printf("%-8s %-10s %-5s %-2s %-6s %-*s %-*s", - "USER", "COMMAND", "PID", "FD", "PROTO", - opt_w ? 45 : 21, "LOCAL ADDRESS", - opt_w ? 45 : 21, "FOREIGN ADDRESS"); - if (opt_U) - printf(" %-6s", "ENCAPS"); - if (opt_s) { - printf(" %-12s", "PATH STATE"); - printf(" %-12s", "CONN STATE"); + if (opt_q != 1) { + printf("%-8s %-10s %-5s %-2s %-6s %-*s %-*s", + "USER", "COMMAND", "PID", "FD", "PROTO", + opt_w ? 45 : 21, "LOCAL ADDRESS", + opt_w ? 45 : 21, "FOREIGN ADDRESS"); + if (opt_U) + printf(" %-6s", "ENCAPS"); + if (opt_s) { + printf(" %-12s", "PATH STATE"); + printf(" %-12s", "CONN STATE"); + } + if (opt_S) + printf(" %.*s", TCP_FUNCTION_NAME_LEN_MAX, "STACK"); + printf("\n"); } - if (opt_S) - printf(" %.*s", TCP_FUNCTION_NAME_LEN_MAX, "STACK"); - printf("\n"); setpassent(1); for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) { if (xf->xf_data == NULL) @@ -1248,7 +1251,7 @@ main(int argc, char *argv[]) int o, i; opt_j = -1; - while ((o = getopt(argc, argv, "46cj:Llp:P:SsUuvw")) != -1) + while ((o = getopt(argc, argv, "46cj:Llp:P:qSsUuvw")) != -1) switch (o) { case '4': opt_4 = 1; @@ -1274,6 +1277,8 @@ main(int argc, char *argv[]) case 'P': protos_defined = parse_protos(optarg); break; + case 'q': + opt_q = 1; case 'S': opt_S = 1; break; From owner-svn-src-all@freebsd.org Tue Jan 23 14:02:40 2018 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 9AA8BED589B for ; Tue, 23 Jan 2018 14:02:40 +0000 (UTC) (envelope-from haddie@f-leads.com) Received: from IND01-MA1-obe.outbound.protection.outlook.com (mail-ma1ind01on0138.outbound.protection.outlook.com [104.47.100.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT TLS CA 4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C62F37CD96 for ; Tue, 23 Jan 2018 14:02:38 +0000 (UTC) (envelope-from haddie@f-leads.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NETORGFT2437315.onmicrosoft.com; s=selector1-fleads-com0c; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=328oM1mpmFEyu2YRP1k0dk6lpxbM813K3yfNdRxfywQ=; b=WnlMQfNzX2KclDFfz32U4cdBB8lQu3J03e9psascqikncKGs7qtTeIUbMwTwu3GgvsyXkGIxZqMvxIxVoDMxLBcKkffsCk2fLlFveITKJhyrb9kqsGVUYBuLT6UMKyc8U0NsccJDxkjY+ib0R6v0cje4QV0ZiMYBpUVyyydDTUQ= Received: from MA1PR0101MB1639.INDPRD01.PROD.OUTLOOK.COM (52.134.141.22) by MA1PR0101MB1639.INDPRD01.PROD.OUTLOOK.COM (52.134.141.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Tue, 23 Jan 2018 14:02:36 +0000 Received: from MA1PR0101MB1639.INDPRD01.PROD.OUTLOOK.COM ([fe80::6c34:87dc:24d9:5ea9]) by MA1PR0101MB1639.INDPRD01.PROD.OUTLOOK.COM ([fe80::6c34:87dc:24d9:5ea9%17]) with mapi id 15.20.0428.023; Tue, 23 Jan 2018 14:02:35 +0000 From: Haddie Dion To: "svn-src-all@freebsd.org" Subject: Education Management Thread-Topic: Education Management Thread-Index: AdOUUhu/F0Hd/iNdR8eXpOX0T+1Tgw== Date: Tue, 23 Jan 2018 14:00:27 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=haddie@f-leads.com; x-originating-ip: [49.205.218.20] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MA1PR0101MB1639; 7:VBRm7SZqBA5dCaeCuBMjjAMHUJVflP+3ollUTF3W4eAHLMr7LZR32iijaqZ4odApW33K/OPikf3dWmX2nYZ1rGOF7AmogRAzf0JmenR60E2TmK2c9b7LQYpfz5rVlDa8sKDPlA/jKhk8NU7WbdfMKohwWQc1VXbybwK24EWKWzSkqzJfO2PjPeJmIyN7HeX6ABf8c3zpnBHn+/8fd5bQrjyQjBjhzvnIz0pTUwaWDrz+P3VnwPJtet0iIvjiFCIk x-ms-office365-filtering-correlation-id: f9d3954d-592c-4561-4c0e-08d56269f4bc x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(7021125)(4534165)(7022125)(4603075)(4627221)(201702281549075)(7048125)(7024125)(7027125)(7028125)(7023125)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:MA1PR0101MB1639; x-ms-traffictypediagnostic: MA1PR0101MB1639: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(21748063052155); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3231023)(2400081)(944501161)(10201501046)(3002001)(93006095)(93001095)(6041288)(20161123564045)(20161123558120)(2016111802025)(20161123560045)(20161123562045)(6043046)(6072148)(201708071742011); SRVR:MA1PR0101MB1639; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MA1PR0101MB1639; x-forefront-prvs: 05610E64EE x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(346002)(396003)(376002)(366004)(39380400002)(199004)(189003)(5250100002)(2501003)(86362001)(5630700001)(3660700001)(3280700002)(2351001)(2900100001)(97736004)(33656002)(55016002)(105586002)(106356001)(5640700003)(6436002)(9686003)(54896002)(6306002)(7696005)(53936002)(25786009)(59450400001)(102836004)(6506007)(74316002)(66066001)(3480700004)(81156014)(2906002)(8676002)(316002)(81166006)(99286004)(9326002)(478600001)(790700001)(7736002)(6116002)(3846002)(8936002)(4743002)(68736007)(7116003)(9406002)(26005)(5660300001)(6666003)(6916009)(14454004)(9476002)(202454002); DIR:OUT; SFP:1102; SCL:1; SRVR:MA1PR0101MB1639; H:MA1PR0101MB1639.INDPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: f-leads.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: N5P8N7tsHJ04ZbrsxShdQTy2E8eaIMp+rkyUNHzILQPEnubJMtwyz6FhmAa3f2IIvnZ74arfzKIzmHZ8uh69Ng== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: f-leads.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9d3954d-592c-4561-4c0e-08d56269f4bc X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2018 14:00:27.8617 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 10d42f6f-1cc3-4240-bc4e-ddc259a1e015 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MA1PR0101MB1639 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 23 Jan 2018 14:02:40 -0000 Hi, Would you be interested in an email leads from your target market? We can h= elp you reach out to: Industry: ? K 12 Schools ? Colleges and Universities Job Titles: ? Principals ? Superintendents ? Deans ? Administrators ? IT Decision Makers The list comes with complete contact information like Contact name, Email a= ddress, Title, Company name, Phone number, Mailing address, etc. I'd be happy to send over few sample records on your request, and set up a = time to discuss in detail. If there is a more appropriate contact for me to speak with, please let me = know so that I can contact them directly. Have a great day! Regards, Haddie Dion / Info Solutions If you don't wish to receive emails from us reply back with "Unsubscribe". From owner-svn-src-all@freebsd.org Tue Jan 23 14:17:06 2018 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 16499ED60EA; Tue, 23 Jan 2018 14:17:06 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E47267D693; Tue, 23 Jan 2018 14:17:05 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D39E7A07; Tue, 23 Jan 2018 14:17:05 +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 w0NEH5fm083072; Tue, 23 Jan 2018 14:17:05 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NEH46E083069; Tue, 23 Jan 2018 14:17:04 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801231417.w0NEH46E083069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 23 Jan 2018 14:17:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328280 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 328280 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 14:17:06 -0000 Author: pfg Date: Tue Jan 23 14:17:04 2018 New Revision: 328280 URL: https://svnweb.freebsd.org/changeset/base/328280 Log: extfs: Remove unused variables. Found by: scan-build Reviewed by: fsu Differential Revision: https://reviews.freebsd.org/D14017 Modified: head/sys/fs/ext2fs/ext2_csum.c head/sys/fs/ext2fs/ext2_extents.c head/sys/fs/ext2fs/ext2_lookup.c Modified: head/sys/fs/ext2fs/ext2_csum.c ============================================================================== --- head/sys/fs/ext2fs/ext2_csum.c Tue Jan 23 13:03:47 2018 (r328279) +++ head/sys/fs/ext2fs/ext2_csum.c Tue Jan 23 14:17:04 2018 (r328280) @@ -535,12 +535,11 @@ static uint32_t ext2_ei_csum(struct inode *ip, struct ext2fs_dinode *ei) { struct m_ext2fs *fs; - uint16_t old_lo, old_hi; + uint16_t old_hi; uint32_t inum, gen, crc; fs = ip->i_e2fs; - old_lo = ei->e2di_chksum_lo; ei->e2di_chksum_lo = 0; if ((EXT2_INODE_SIZE(ip->i_e2fs) > E2FS_REV0_INODE_SIZE && ei->e2di_extra_isize >= EXT2_INODE_CSUM_HI_EXTRA_END)) { Modified: head/sys/fs/ext2fs/ext2_extents.c ============================================================================== --- head/sys/fs/ext2fs/ext2_extents.c Tue Jan 23 13:03:47 2018 (r328279) +++ head/sys/fs/ext2fs/ext2_extents.c Tue Jan 23 14:17:04 2018 (r328280) @@ -125,10 +125,8 @@ ext4_ext_print_path(struct inode *ip, struct ext4_exte void ext4_ext_print_extent_tree_status(struct inode * ip) { - struct m_ext2fs *fs; struct ext4_extent_header *ehp; - fs = ip->i_e2fs; ehp = (struct ext4_extent_header *)(char *)ip->i_db; printf("Extent status:ip=%d\n", ip->i_number); @@ -882,7 +880,6 @@ ext4_ext_grow_indepth(struct inode *ip, struct ext4_ex struct m_ext2fs *fs; struct ext4_extent_path *curpath; struct ext4_extent_header *neh; - struct ext4_extent_index *fidx; struct buf *bp; e4fs_daddr_t newblk; int error = 0; @@ -925,7 +922,6 @@ ext4_ext_grow_indepth(struct inode *ip, struct ext4_ex ext4_index_store_pblock(curpath->ep_index, newblk); neh = ext4_ext_inode_header(ip); - fidx = EXT_FIRST_INDEX(neh); neh->eh_depth = path->ep_depth + 1; ext4_ext_dirty(ip, curpath); out: @@ -938,12 +934,9 @@ static int ext4_ext_create_new_leaf(struct inode *ip, struct ext4_extent_path *path, struct ext4_extent *newext) { - struct m_ext2fs *fs; struct ext4_extent_path *curpath; int depth, i, error; - fs = ip->i_e2fs; - repeat: i = depth = ext4_ext_inode_depth(ip); @@ -1033,13 +1026,11 @@ static int ext4_ext_insert_extent(struct inode *ip, struct ext4_extent_path *path, struct ext4_extent *newext) { - struct m_ext2fs *fs; struct ext4_extent_header * eh; struct ext4_extent *ex, *nex, *nearex; struct ext4_extent_path *npath; int depth, len, error, next; - fs = ip->i_e2fs; depth = ext4_ext_inode_depth(ip); ex = path[depth].ep_ext; npath = NULL; @@ -1166,11 +1157,9 @@ ext4_new_blocks(struct inode *ip, daddr_t lbn, e4fs_da struct ucred *cred, unsigned long *count, int *perror) { struct m_ext2fs *fs; - struct ext2mount *ump; e4fs_daddr_t newblk; fs = ip->i_e2fs; - ump = ip->i_ump; /* * We will allocate only single block for now. Modified: head/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- head/sys/fs/ext2fs/ext2_lookup.c Tue Jan 23 13:03:47 2018 (r328279) +++ head/sys/fs/ext2fs/ext2_lookup.c Tue Jan 23 14:17:04 2018 (r328280) @@ -869,8 +869,8 @@ ext2_direnter(struct inode *ip, struct vnode *dvp, str struct inode *dp; struct ext2fs_direct_2 newdir; struct buf *bp; - int error, newentrysize; int DIRBLKSIZ = ip->i_e2fs->e2fs_bsize; + int error; #ifdef INVARIANTS @@ -886,7 +886,6 @@ ext2_direnter(struct inode *ip, struct vnode *dvp, str else newdir.e2d_type = EXT2_FT_UNKNOWN; bcopy(cnp->cn_nameptr, newdir.e2d_name, (unsigned)cnp->cn_namelen + 1); - newentrysize = EXT2_DIR_REC_LEN(newdir.e2d_namlen); if (ext2_htree_has_idx(dp)) { error = ext2_htree_add_entry(dvp, &newdir, cnp); From owner-svn-src-all@freebsd.org Tue Jan 23 14:23:04 2018 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 3DC0BED661D; Tue, 23 Jan 2018 14:23:04 +0000 (UTC) (envelope-from garga.bsd@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 DFCDD7DE15; Tue, 23 Jan 2018 14:23:03 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by mail-qt0-x22e.google.com with SMTP id o35so1587745qtj.13; Tue, 23 Jan 2018 06:23:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=OEaAf2hzWI0rTM515ys7Tr8uYRjBqmOqXaRPimgrGNo=; b=M60OguaIaohu+qKfOwKL8Iosec2eHa2MRDZKpZ31xrDD9EL2nZvGJy8Ne5hjQm+fbe 3Q2jSFHGUKiDHIsXHWgDwVgwbJSvRVh6yI760PkEakdv6q1uIGiS04F1T/R6i4I1dbA+ /q5GmGOEZ1qCtXe+U6ZJjMPpwOfspMUCF7eEOMK7kfUn1hbxCpWlCk/vnDym5yRVzQBw 8d0j26e3wXaXlxQEJa5Iw8e+EOHllVdzOwb85DFwYrBmj/sb/TJ1eQtNJs0KzlGJQ1xv 4R+L7UyO9cbEjyYbMBP0CYAhoODokqecwaIw4i6GBjPuMsw/U/rZrqa+fi+eGYylarIk ZKMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OEaAf2hzWI0rTM515ys7Tr8uYRjBqmOqXaRPimgrGNo=; b=dDboiMEbuV5jHo9dOX/YqDA7lqZ87vn0BAs9gGstdIwtkPbsTxJD+gvCbe7zFxADvV lOGhGLGFwjtmsqvfumG4OxcGr8uM//NJBsUmtI/jEQIHjcLFGuKFlKVPQo+5uhVBWubv QIdkWP9Ce7cMvwtXM8nfuuPEdkvMzo3oTaUEqqdMMAIV9QfgPhNgQS72TNXrJB5Lg36t zlNQWLAUIcfRl6+3wb+4FFcDiLsslH8CIC18RwPMohicEeltDMXF97xPBm1z1T5d3ZyP 8NA744vxSbWgixhfVeigc0w3Gx2B9X0CYbbbaRzDDWknQh6BvsydbW0HH6Fi0BOxjJtQ 9p5g== X-Gm-Message-State: AKwxyteEFZLySJZEZH4M1PlRMwCqAKp7fZCq2JPNviwe/RcuLalavX6e GQBpHQpYVJcYjSgjBX2jU4qb3oAD X-Google-Smtp-Source: AH8x225dXWwrOtFm49yYTSaq+2QoU3WLzh6SemN5RJJ0Er7JWHv7Ty23t7e64bt/8FK2YUaen367IQ== X-Received: by 10.237.58.226 with SMTP id o89mr3841046qte.207.1516717382710; Tue, 23 Jan 2018 06:23:02 -0800 (PST) Received: from MacBook-Pro-3.local ([152.249.225.88]) by smtp.gmail.com with ESMTPSA id d76sm11853216qkb.84.2018.01.23.06.23.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jan 2018 06:23:01 -0800 (PST) Subject: Re: svn commit: r328279 - head/usr.bin/sockstat To: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801231303.w0ND3lTa052955@repo.freebsd.org> From: Renato Botelho Message-ID: <6f80ba97-945c-7617-b520-614e54375ae6@gmail.com> Date: Tue, 23 Jan 2018 12:22:58 -0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801231303.w0ND3lTa052955@repo.freebsd.org> 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.25 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, 23 Jan 2018 14:23:04 -0000 On 23/01/18 11:03, Emmanuel Vadot wrote: > Author: manu > Date: Tue Jan 23 13:03:47 2018 > New Revision: 328279 > URL: https://svnweb.freebsd.org/changeset/base/328279 > > Log: > sockstat: Add -q option to suppress the header line > > MFC after: 1 week > Sponsored by: Gandi.net > > Modified: > head/usr.bin/sockstat/sockstat.1 > head/usr.bin/sockstat/sockstat.c > > Modified: head/usr.bin/sockstat/sockstat.1 > ============================================================================== > --- head/usr.bin/sockstat/sockstat.1 Tue Jan 23 08:07:00 2018 (r328278) > +++ head/usr.bin/sockstat/sockstat.1 Tue Jan 23 13:03:47 2018 (r328279) > @@ -27,7 +27,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd September 12, 2017 > +.Dd January 23, 2018 > .Dt SOCKSTAT 1 > .Os > .Sh NAME > @@ -83,6 +83,8 @@ The > argument is a comma-separated list of protocol names, > as they are defined in > .Xr protocols 5 . > +.It Fl q > +Quiet mode, do not print the header line. > .It Fl S > Display the protocol stack, if applicable. > This is currently only implemented for TCP. > > Modified: head/usr.bin/sockstat/sockstat.c > ============================================================================== > --- head/usr.bin/sockstat/sockstat.c Tue Jan 23 08:07:00 2018 (r328278) > +++ head/usr.bin/sockstat/sockstat.c Tue Jan 23 13:03:47 2018 (r328279) > @@ -76,6 +76,7 @@ static int opt_c; /* Show connected sockets */ > static int opt_j; /* Show specified jail */ > static int opt_L; /* Don't show IPv4 or IPv6 loopback sockets */ > static int opt_l; /* Show listening sockets */ > +static int opt_q; /* Don't show header */ > static int opt_S; /* Show protocol stack if applicable */ > static int opt_s; /* Show protocol state if applicable */ > static int opt_U; /* Show remote UDP encapsulation port number */ > @@ -1155,19 +1156,21 @@ display(void) > struct sock *s; > int hash, n, pos; > > - printf("%-8s %-10s %-5s %-2s %-6s %-*s %-*s", > - "USER", "COMMAND", "PID", "FD", "PROTO", > - opt_w ? 45 : 21, "LOCAL ADDRESS", > - opt_w ? 45 : 21, "FOREIGN ADDRESS"); > - if (opt_U) > - printf(" %-6s", "ENCAPS"); > - if (opt_s) { > - printf(" %-12s", "PATH STATE"); > - printf(" %-12s", "CONN STATE"); > + if (opt_q != 1) { > + printf("%-8s %-10s %-5s %-2s %-6s %-*s %-*s", > + "USER", "COMMAND", "PID", "FD", "PROTO", > + opt_w ? 45 : 21, "LOCAL ADDRESS", > + opt_w ? 45 : 21, "FOREIGN ADDRESS"); > + if (opt_U) > + printf(" %-6s", "ENCAPS"); > + if (opt_s) { > + printf(" %-12s", "PATH STATE"); > + printf(" %-12s", "CONN STATE"); > + } > + if (opt_S) > + printf(" %.*s", TCP_FUNCTION_NAME_LEN_MAX, "STACK"); > + printf("\n"); > } > - if (opt_S) > - printf(" %.*s", TCP_FUNCTION_NAME_LEN_MAX, "STACK"); > - printf("\n"); > setpassent(1); > for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) { > if (xf->xf_data == NULL) > @@ -1248,7 +1251,7 @@ main(int argc, char *argv[]) > int o, i; > > opt_j = -1; > - while ((o = getopt(argc, argv, "46cj:Llp:P:SsUuvw")) != -1) > + while ((o = getopt(argc, argv, "46cj:Llp:P:qSsUuvw")) != -1) > switch (o) { > case '4': > opt_4 = 1; > @@ -1274,6 +1277,8 @@ main(int argc, char *argv[]) > case 'P': > protos_defined = parse_protos(optarg); > break; > + case 'q': > + opt_q = 1; Isn't it missing a break here? > case 'S': > opt_S = 1; > break; > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > -- Renato Botelho From owner-svn-src-all@freebsd.org Tue Jan 23 14:33:21 2018 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 0C209ED6BA6; Tue, 23 Jan 2018 14:33:21 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D97607E47D; Tue, 23 Jan 2018 14:33:20 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16DF87D1F; Tue, 23 Jan 2018 14:33:20 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NEXJVQ091328; Tue, 23 Jan 2018 14:33:19 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NEXJDN091327; Tue, 23 Jan 2018 14:33:19 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201801231433.w0NEXJDN091327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 23 Jan 2018 14:33:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328281 - head/usr.bin/sockstat X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/usr.bin/sockstat X-SVN-Commit-Revision: 328281 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 14:33:21 -0000 Author: manu Date: Tue Jan 23 14:33:19 2018 New Revision: 328281 URL: https://svnweb.freebsd.org/changeset/base/328281 Log: sockstat: add break that was forgot in 328279 Reported by: garga@ MFC after: 1 week X-MFC With: 328279 Sponsored by: Gandi.net Modified: head/usr.bin/sockstat/sockstat.c Modified: head/usr.bin/sockstat/sockstat.c ============================================================================== --- head/usr.bin/sockstat/sockstat.c Tue Jan 23 14:17:04 2018 (r328280) +++ head/usr.bin/sockstat/sockstat.c Tue Jan 23 14:33:19 2018 (r328281) @@ -1279,6 +1279,7 @@ main(int argc, char *argv[]) break; case 'q': opt_q = 1; + break; case 'S': opt_S = 1; break; From owner-svn-src-all@freebsd.org Tue Jan 23 14:34:11 2018 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 45FE0ED6C59; Tue, 23 Jan 2018 14:34:11 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 334367E5E5; Tue, 23 Jan 2018 14:34:09 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 737d2d12; Tue, 23 Jan 2018 15:34:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=lyv3P2NVl3bRFo+jheJbqGYd1N0=; b=ap3U5sdf1SI0LOirPjuIqKnQZ22O YKGVs11SbH6TpDt2Bh8w28kIduIwKTWDYvr1oef7Q+7rPE2QK0LfVM29mbx/No+R RzyoL4VyWprRY8QSYsdZS4srS7TP/N+UTdp1P/u4wJ8YEo8oYJtFekvbCWzgiqWR h7UJFoMGqkQauCo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=MhAO7u9kUQRaqdcb32T2Q0glpSojHJnTXe58Pq6WD+auDtFmxbmo332H U3KVMJSixS6aapjWFnOWKRcIRZOSEwkr8kSrw8+BjCX5+dXipkvAYqJNZrdoc32Y Rmv+yNtI4zwff1MhfgHgibxlXNAhiqs2kufUT8g8JKIaaVZZcbs= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id f0c37c5a TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Tue, 23 Jan 2018 15:34:00 +0100 (CET) Date: Tue, 23 Jan 2018 15:33:59 +0100 From: Emmanuel Vadot To: Renato Botelho Cc: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328279 - head/usr.bin/sockstat Message-Id: <20180123153359.08922eb393817c1667d2b1d4@bidouilliste.com> In-Reply-To: <6f80ba97-945c-7617-b520-614e54375ae6@gmail.com> References: <201801231303.w0ND3lTa052955@repo.freebsd.org> <6f80ba97-945c-7617-b520-614e54375ae6@gmail.com> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 23 Jan 2018 14:34:11 -0000 On Tue, 23 Jan 2018 12:22:58 -0200 Renato Botelho wrote: > On 23/01/18 11:03, Emmanuel Vadot wrote: > > Author: manu > > Date: Tue Jan 23 13:03:47 2018 > > New Revision: 328279 > > URL: https://svnweb.freebsd.org/changeset/base/328279 > > > > Log: > > sockstat: Add -q option to suppress the header line > > > > MFC after: 1 week > > Sponsored by: Gandi.net > > > > Modified: > > head/usr.bin/sockstat/sockstat.1 > > head/usr.bin/sockstat/sockstat.c > > > > Modified: head/usr.bin/sockstat/sockstat.1 > > ============================================================================== > > --- head/usr.bin/sockstat/sockstat.1 Tue Jan 23 08:07:00 2018 (r328278) > > +++ head/usr.bin/sockstat/sockstat.1 Tue Jan 23 13:03:47 2018 (r328279) > > @@ -27,7 +27,7 @@ > > .\" > > .\" $FreeBSD$ > > .\" > > -.Dd September 12, 2017 > > +.Dd January 23, 2018 > > .Dt SOCKSTAT 1 > > .Os > > .Sh NAME > > @@ -83,6 +83,8 @@ The > > argument is a comma-separated list of protocol names, > > as they are defined in > > .Xr protocols 5 . > > +.It Fl q > > +Quiet mode, do not print the header line. > > .It Fl S > > Display the protocol stack, if applicable. > > This is currently only implemented for TCP. > > > > Modified: head/usr.bin/sockstat/sockstat.c > > ============================================================================== > > --- head/usr.bin/sockstat/sockstat.c Tue Jan 23 08:07:00 2018 (r328278) > > +++ head/usr.bin/sockstat/sockstat.c Tue Jan 23 13:03:47 2018 (r328279) > > @@ -76,6 +76,7 @@ static int opt_c; /* Show connected sockets */ > > static int opt_j; /* Show specified jail */ > > static int opt_L; /* Don't show IPv4 or IPv6 loopback sockets */ > > static int opt_l; /* Show listening sockets */ > > +static int opt_q; /* Don't show header */ > > static int opt_S; /* Show protocol stack if applicable */ > > static int opt_s; /* Show protocol state if applicable */ > > static int opt_U; /* Show remote UDP encapsulation port number */ > > @@ -1155,19 +1156,21 @@ display(void) > > struct sock *s; > > int hash, n, pos; > > > > - printf("%-8s %-10s %-5s %-2s %-6s %-*s %-*s", > > - "USER", "COMMAND", "PID", "FD", "PROTO", > > - opt_w ? 45 : 21, "LOCAL ADDRESS", > > - opt_w ? 45 : 21, "FOREIGN ADDRESS"); > > - if (opt_U) > > - printf(" %-6s", "ENCAPS"); > > - if (opt_s) { > > - printf(" %-12s", "PATH STATE"); > > - printf(" %-12s", "CONN STATE"); > > + if (opt_q != 1) { > > + printf("%-8s %-10s %-5s %-2s %-6s %-*s %-*s", > > + "USER", "COMMAND", "PID", "FD", "PROTO", > > + opt_w ? 45 : 21, "LOCAL ADDRESS", > > + opt_w ? 45 : 21, "FOREIGN ADDRESS"); > > + if (opt_U) > > + printf(" %-6s", "ENCAPS"); > > + if (opt_s) { > > + printf(" %-12s", "PATH STATE"); > > + printf(" %-12s", "CONN STATE"); > > + } > > + if (opt_S) > > + printf(" %.*s", TCP_FUNCTION_NAME_LEN_MAX, "STACK"); > > + printf("\n"); > > } > > - if (opt_S) > > - printf(" %.*s", TCP_FUNCTION_NAME_LEN_MAX, "STACK"); > > - printf("\n"); > > setpassent(1); > > for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) { > > if (xf->xf_data == NULL) > > @@ -1248,7 +1251,7 @@ main(int argc, char *argv[]) > > int o, i; > > > > opt_j = -1; > > - while ((o = getopt(argc, argv, "46cj:Llp:P:SsUuvw")) != -1) > > + while ((o = getopt(argc, argv, "46cj:Llp:P:qSsUuvw")) != -1) > > switch (o) { > > case '4': > > opt_4 = 1; > > @@ -1274,6 +1277,8 @@ main(int argc, char *argv[]) > > case 'P': > > protos_defined = parse_protos(optarg); > > break; > > + case 'q': > > + opt_q = 1; > > Isn't it missing a break here? Fixed in 328281, thanks and sorry. > > > case 'S': > > opt_S = 1; > > break; > > _______________________________________________ > > svn-src-head@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/svn-src-head > > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > > > > > -- > Renato Botelho -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Tue Jan 23 14:47:42 2018 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 E447EED7433 for ; Tue, 23 Jan 2018 14:47:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::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 72C667F0EF for ; Tue, 23 Jan 2018 14:47:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x22d.google.com with SMTP id j21so13786256wmh.1 for ; Tue, 23 Jan 2018 06:47:42 -0800 (PST) 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=Ogxy/K+eh/7vFG8vPVHq0vVuc6t5+f+VqwSyhOipMnY=; b=CVBJ7qdoKcwi0naHN3tFWgOx0dwvtfPsCB5nxmXrxTKR+UzDM9S/YxcrSkL7IoJAM9 WUbQIHNBB/2IEfV+g6/PlQ+JkRXq5/wJKf+71n1++6kXet91Hpe5h706AFfKs9GhFqxG zVGPhv3Fi96V/jNuoo6LFcrYwK4kSKw/CjJuMXjDe06qmmd6sLQ0PhOmyVwO21Znp9Ve B19MCeg8mgETEDAeZffxpM4V+tx1kdQuwBLxjwz8CqayJ8UfH4AnctqRVShnq3EZPxMD qMb4ivJE2HtsoNbjBNIerh7K1lIkiL3r+/Av4Esu6sPPpQOnGDEdWEPLcpWP6UX7+wNR r9zw== 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=Ogxy/K+eh/7vFG8vPVHq0vVuc6t5+f+VqwSyhOipMnY=; b=kQNvoqO55xmZjqPjbiu1qLEmCcTrqq6eEX22AwaM+tttecarOJ3/eaTvwN3MDSGcml MsajrEV+QlZYK4ICleg6lz8I8hhoci0GCBjbepY9LhprLM8nkXdosPeNtNNUZ9YuJ7NC J+7479VnfihtXFM68OynL776lC9OqFlpLXwf6U3YgUIVEtJDtYX26ZzLm8lidYo5qF6a ga5JRLqkGcO6r2rve5/RRAcb0Ori0T+ulyxGZGzHwi60vi2h/VGZJ8HN2SvFNpURZKcb 6cGv+EikB1t0wlgHCJQdTcWAGrJQRis3/KrvVoMtk3MBAabc6jn021DQLHI0cIkZm8/X q/ag== X-Gm-Message-State: AKwxytdKWXl49Y8A6Bwp9/MZZxjbfcKYA9m5jpatIqYr1jWurDg61/nQ QE142OACVs+RmClW2HsT6LENouUrBWTbRTxxm7uW8Q== X-Google-Smtp-Source: AH8x226+++GK6ErxEkVQP1Wdu5A+XnopcUbJT2vcdOc7Kh/2koPwBB4OI/SKZZt4Suo0sMzFr1QMDP9PxL/K5owcRTA= X-Received: by 10.80.217.202 with SMTP id x10mr13747515edj.118.1516718860525; Tue, 23 Jan 2018 06:47:40 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.133.195 with HTTP; Tue, 23 Jan 2018 06:47:40 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <2987003.eeGRFBb6N8@ralph.baldwin.cx> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> From: Warner Losh Date: Tue, 23 Jan 2018 07:47:40 -0700 X-Google-Sender-Auth: cyxzoRthe1T1_Tr_GhSOlyAupQk Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: John Baldwin Cc: Poul-Henning Kamp , Ravi Pokala , Emmanuel Vadot , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 23 Jan 2018 14:47:43 -0000 On Mon, Jan 22, 2018 at 4:54 PM, John Baldwin wrote: > On Monday, January 22, 2018 11:20:40 PM Poul-Henning Kamp wrote: > > -------- > > In message gmail.com> > > , Warner Losh writes: > > > > >I think even bootverbose it's insane. Or I don't understand what the > real > > >ask is. > > > > What I think would be a good idea, is when a driver is kldloaded > > the user will be told if there were hardware present which it could > > drive (ie: probe() matches), but for some reason and somehow, > > it as marked as unavailable/conflicting/disabled, so attach() didn't. > > > > Today you load the device driver and if the hardware is "status=disabled" > > in the FDT, nothing happens, and you get no information about why > > nothing happened, leaving the user to guess... > > > > I've seen people resort to kldload /boot/kernel/*.ko in an > > attempt to find out if were using the right device driver. > > > > I suspect moving the boilerplate > > > > if (!ofw_bus_status_okay(dev)) > > return (ENXIO); > > > > To the attach() function would do it, but we could avoid that > > boilerplate in all the drivers, if it was done one level up with > > a consistent device_printf() and not calling attach() at all. > > > > What I don't know is how noisy that would be in practice ? > > I think the better solution to this problem is the devmatch stuff Warner > is already working on where one can say "for this given device info > (e.g. PCI IDs or FDT properties), which drivers support this"). There > is enough of that already existing now in HEAD I think it would be better > to extend it to support whatever input mode it needs to handle disabled > devices as input to run through its existing matching engine. > I'm actually thinking the right thing is to remove the checks everywhere. We then create a couple of new simplebus methods: int ok_for_state(device_t dev, const char *state) which returns 0 if the device should be enabled in this state, or an errno for why not. It's called on boot and if it returns true, the device will be attached. Defaults to something akin to ofw_bus_status_okay. Devices can override this for whatever reasons they may need to. int change_state(device_t dev, const char *old_state, const char *new_state) which tells the device we're entering a new state. The device is expected to cope. The default is to call ok_for_state and return that result. By default, if there's an error in the new state, the device's detach routine will be called. Devices are free to override this. This will allow us to do things like load overlays at runtime that change the status of devices (and maybe pinmux items) and have an ordered way to cope. It will also allow us to implement a policy of 'all devices must be cool with the new state or the overlay is rejected'. If we do that, then devmatch will work like everywhere else. Otherwise you'll have the frustrating situation where you kldload foo, see nothing and have devmatch tell you to load foo... Warner From owner-svn-src-all@freebsd.org Tue Jan 23 15:34:35 2018 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 866E0ED97E3; Tue, 23 Jan 2018 15:34:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F9E1823D7; Tue, 23 Jan 2018 15:34:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1B291071A; Tue, 23 Jan 2018 15:34:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NFYYPo020159; Tue, 23 Jan 2018 15:34:34 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NFYY7k020158; Tue, 23 Jan 2018 15:34:34 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801231534.w0NFYY7k020158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 23 Jan 2018 15:34:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328282 - head/bin/date X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/bin/date X-SVN-Commit-Revision: 328282 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 15:34:35 -0000 Author: imp Date: Tue Jan 23 15:34:34 2018 New Revision: 328282 URL: https://svnweb.freebsd.org/changeset/base/328282 Log: Fill in ut_id. While it's not relevant to the {OLD,NEW}_TIME entries, we shouldn't leak stack garbage into the field. Sponsored by: Netflix Modified: head/bin/date/date.c Modified: head/bin/date/date.c ============================================================================== --- head/bin/date/date.c Tue Jan 23 14:33:19 2018 (r328281) +++ head/bin/date/date.c Tue Jan 23 15:34:34 2018 (r328282) @@ -301,6 +301,7 @@ setthetime(const char *fmt, const char *p, int jflag, /* set the time */ if (nflag || netsettime(tval)) { utx.ut_type = OLD_TIME; + memset(utx.ut_id, 0, sizeof(utx.ut_id)); (void)gettimeofday(&utx.ut_tv, NULL); pututxline(&utx); tv.tv_sec = tval; From owner-svn-src-all@freebsd.org Tue Jan 23 16:41:32 2018 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 672F1EB7145; Tue, 23 Jan 2018 16:41:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 42C9D7D2; Tue, 23 Jan 2018 16:41:32 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8334E11136; Tue, 23 Jan 2018 16:41:31 +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 w0NGfVWv050317; Tue, 23 Jan 2018 16:41:31 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NGfVTG050316; Tue, 23 Jan 2018 16:41:31 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201801231641.w0NGfVTG050316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 23 Jan 2018 16:41:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328283 - head/release X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release X-SVN-Commit-Revision: 328283 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 16:41:32 -0000 Author: gjb Date: Tue Jan 23 16:41:31 2018 New Revision: 328283 URL: https://svnweb.freebsd.org/changeset/base/328283 Log: When CHROOTBUILD_SKIP is set, evaluate the existence of /bin/sh within the CHROOTDIR. If it does not exist, unset CHROOTBUILD_SKIP to prevent build failures. Requested by: swills MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/release.sh Modified: head/release/release.sh ============================================================================== --- head/release/release.sh Tue Jan 23 15:34:34 2018 (r328282) +++ head/release/release.sh Tue Jan 23 16:41:31 2018 (r328283) @@ -203,6 +203,11 @@ env_check() { exit 1 fi + # Unset CHROOTBUILD_SKIP if the chroot(8) does not appear to exist. + if [ ! -z "${CHROOTBUILD_SKIP}" -a ! -e ${CHROOTDIR}/bin/sh ]; then + CHROOTBUILD_SKIP= + fi + CHROOT_MAKEENV="${CHROOT_MAKEENV} \ MAKEOBJDIRPREFIX=${CHROOTDIR}/tmp/obj" CHROOT_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${CONF_FILES}" From owner-svn-src-all@freebsd.org Tue Jan 23 16:48:32 2018 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 C87CEEB765C; Tue, 23 Jan 2018 16:48:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A3E0CB7B; Tue, 23 Jan 2018 16:48:32 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0AB91129E; Tue, 23 Jan 2018 16:48:31 +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 w0NGmVFb051276; Tue, 23 Jan 2018 16:48:31 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NGmVUH051275; Tue, 23 Jan 2018 16:48:31 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201801231648.w0NGmVUH051275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 23 Jan 2018 16:48:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328284 - head/release X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release X-SVN-Commit-Revision: 328284 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 16:48:32 -0000 Author: gjb Date: Tue Jan 23 16:48:31 2018 New Revision: 328284 URL: https://svnweb.freebsd.org/changeset/base/328284 Log: Bump Copyright year following r328283. MFC after: 3 days MFC with: r328283 Sponsored by: The FreeBSD Foundation Modified: head/release/release.sh Modified: head/release/release.sh ============================================================================== --- head/release/release.sh Tue Jan 23 16:41:31 2018 (r328283) +++ head/release/release.sh Tue Jan 23 16:48:31 2018 (r328284) @@ -1,6 +1,6 @@ #!/bin/sh #- -# Copyright (c) 2013-2017 The FreeBSD Foundation +# Copyright (c) 2013-2018 The FreeBSD Foundation # Copyright (c) 2013 Glen Barber # Copyright (c) 2011 Nathan Whitehorn # All rights reserved. From owner-svn-src-all@freebsd.org Tue Jan 23 17:54:40 2018 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 B0604EBBB29; Tue, 23 Jan 2018 17:54:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A37E321D; Tue, 23 Jan 2018 17:54:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9C0811DD3; Tue, 23 Jan 2018 17:54:39 +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 w0NHsd7k080238; Tue, 23 Jan 2018 17:54:39 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NHsdpK080237; Tue, 23 Jan 2018 17:54:39 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801231754.w0NHsdpK080237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 23 Jan 2018 17:54:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328286 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 328286 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 17:54:40 -0000 Author: emaste Date: Tue Jan 23 17:54:39 2018 New Revision: 328286 URL: https://svnweb.freebsd.org/changeset/base/328286 Log: lld: Don't mark a shared library as needed because of a lazy symbol. Obtained from: LLVM r323221 by Rafael Espíndola Modified: head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Modified: head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Tue Jan 23 16:52:39 2018 (r328285) +++ head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Tue Jan 23 17:54:39 2018 (r328286) @@ -491,12 +491,13 @@ void SymbolTable::addShared(StringRef Name, SharedFile if (WasInserted || ((S->isUndefined() || S->isLazy()) && S->getVisibility() == STV_DEFAULT)) { uint8_t Binding = S->Binding; + bool WasUndefined = S->isUndefined(); replaceSymbol(S, File, Name, Sym.getBinding(), Sym.st_other, Sym.getType(), Sym.st_value, Sym.st_size, Alignment, VerdefIndex); if (!WasInserted) { S->Binding = Binding; - if (!S->isWeak() && !Config->GcSections) + if (!S->isWeak() && !Config->GcSections && WasUndefined) File.IsNeeded = true; } } From owner-svn-src-all@freebsd.org Tue Jan 23 17:59:07 2018 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 CF72EEBBE5C; Tue, 23 Jan 2018 17:59:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA9703496; Tue, 23 Jan 2018 17:59:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4A5C11DD7; Tue, 23 Jan 2018 17:59:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NHx6n6080453; Tue, 23 Jan 2018 17:59:06 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NHx6Qq080451; Tue, 23 Jan 2018 17:59:06 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801231759.w0NHx6Qq080451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 23 Jan 2018 17:59:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328287 - in head/etc: . mtree X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/etc: . mtree X-SVN-Commit-Revision: 328287 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 17:59:07 -0000 Author: kevans Date: Tue Jan 23 17:59:06 2018 New Revision: 328287 URL: https://svnweb.freebsd.org/changeset/base/328287 Log: Add /boot/overlays to runtime pkg, fix distrib-dirs METALOG generation /boot/overlays was recently added without belonging to a package. It's only used by bootloaders at the moment, so add it to the 'runtime' package to get added with ubldr and friends. Fix distrib-dirs METALOG generation while we're here. History elsewhere seems to indicate that bapt@ fixed this to pull in all attributes from mtrees while generating the METALOG. This fix got clobbered somewhere later, so restore it. Reviewed by: bapt, gjb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D13996 Modified: head/etc/Makefile head/etc/mtree/BSD.root.dist Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Tue Jan 23 17:54:39 2018 (r328286) +++ head/etc/Makefile Tue Jan 23 17:59:06 2018 (r328287) @@ -379,10 +379,10 @@ distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY d=${DISTBASE}$$d; \ shift; \ test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \ - ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \ + ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \ "sed s#^\.#.$$d# | ${METALOG.add}" ; \ ${MTREE_FILTER} $$m | \ - ${MTREE_CMD:N-W} -C -K uname,gname | sed s#^\.#.$$d# | \ + ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \ ${METALOG.add} ; \ done; true .endif Modified: head/etc/mtree/BSD.root.dist ============================================================================== --- head/etc/mtree/BSD.root.dist Tue Jan 23 17:54:39 2018 (r328286) +++ head/etc/mtree/BSD.root.dist Tue Jan 23 17:59:06 2018 (r328287) @@ -18,7 +18,7 @@ .. modules .. - overlays + overlays tags=package=runtime .. zfs .. From owner-svn-src-all@freebsd.org Tue Jan 23 18:01:19 2018 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 1A8F3EBD0AA; Tue, 23 Jan 2018 18:01:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EBCF037F6; Tue, 23 Jan 2018 18:01:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4167F11F01; Tue, 23 Jan 2018 18:01:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NI1IoE082053; Tue, 23 Jan 2018 18:01:18 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NI1IYb082052; Tue, 23 Jan 2018 18:01:18 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801231801.w0NI1IYb082052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 23 Jan 2018 18:01:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328288 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 328288 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 18:01:19 -0000 Author: imp Date: Tue Jan 23 18:01:17 2018 New Revision: 328288 URL: https://svnweb.freebsd.org/changeset/base/328288 Log: Fix some resource leaks. Always free dev and fstyp before strduping new values to assign to them. Free them at the end of the loop. This keeps them from leaking for mal-formed /etc/fstab lines. CID: 1007777, 1007778, 1007779 Sponsored by: Netflix Modified: head/stand/common/boot.c Modified: head/stand/common/boot.c ============================================================================== --- head/stand/common/boot.c Tue Jan 23 17:59:06 2018 (r328287) +++ head/stand/common/boot.c Tue Jan 23 18:01:17 2018 (r328288) @@ -319,6 +319,8 @@ getrootmount(char *rootdev) goto notfound; /* loop reading lines from /etc/fstab What was that about sscanf again? */ + fstyp = NULL; + dev = NULL; while (fgetstr(lbuf, sizeof(lbuf), fd) >= 0) { if ((lbuf[0] == 0) || (lbuf[0] == '#')) continue; @@ -330,6 +332,7 @@ getrootmount(char *rootdev) continue; /* delimit and save */ *cp++ = 0; + free(dev); dev = strdup(lbuf); /* skip whitespace up to mountpoint */ @@ -349,6 +352,7 @@ getrootmount(char *rootdev) while ((*cp != 0) && !isspace(*cp)) cp++; *cp = 0; + free(fstyp); fstyp = strdup(ep); /* skip whitespace up to mount options */ @@ -365,8 +369,6 @@ getrootmount(char *rootdev) options = strdup(ep); /* Build the : and save it in vfs.root.mountfrom */ sprintf(lbuf, "%s:%s", fstyp, dev); - free(dev); - free(fstyp); setenv("vfs.root.mountfrom", lbuf, 0); /* Don't override vfs.root.mountfrom.options if it is already set */ @@ -379,6 +381,8 @@ getrootmount(char *rootdev) break; } close(fd); + free(dev); + free(fstyp); notfound: if (error) { @@ -390,6 +394,7 @@ notfound: cp[strlen(cp) - 1] = '\0'; setenv("vfs.root.mountfrom", cp, 0); error = 0; + free(cp); } } From owner-svn-src-all@freebsd.org Tue Jan 23 18:01:30 2018 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 1723FEBD0EB; Tue, 23 Jan 2018 18:01:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5599938A8; Tue, 23 Jan 2018 18:01:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47D2C11F0B; Tue, 23 Jan 2018 18:01:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NI1SV2082107; Tue, 23 Jan 2018 18:01:28 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NI1S4u082106; Tue, 23 Jan 2018 18:01:28 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801231801.w0NI1S4u082106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 23 Jan 2018 18:01:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328289 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 328289 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 18:01:30 -0000 Author: imp Date: Tue Jan 23 18:01:27 2018 New Revision: 328289 URL: https://svnweb.freebsd.org/changeset/base/328289 Log: Don't leak memory when displaying help. Right now, we'll leak memory when we display a help topic because we don't free t, s, d that we've just used when breaking out of the loop. NB: coverity just reported t, but s and d also leak. CID: 1007776 Modified: head/stand/common/commands.c Modified: head/stand/common/commands.c ============================================================================== --- head/stand/common/commands.c Tue Jan 23 18:01:17 2018 (r328288) +++ head/stand/common/commands.c Tue Jan 23 18:01:27 2018 (r328289) @@ -91,10 +91,8 @@ help_getnext(int fd, char **topic, char **subtopic, ch cp = ep; } if (*topic == NULL) { - if (*subtopic != NULL) - free(*subtopic); - if (*desc != NULL) - free(*desc); + free(*subtopic); + free(*desc); continue; } return(1); @@ -169,7 +167,7 @@ command_help(int argc, char *argv[]) } else if (strcmp(topic, t)) { /* topic mismatch */ - if(matched) /* nothing more on this topic, stop scanning */ + if (matched) /* nothing more on this topic, stop scanning */ break; } else { @@ -178,7 +176,7 @@ command_help(int argc, char *argv[]) if (((subtopic == NULL) && (s == NULL)) || ((subtopic != NULL) && (s != NULL) && !strcmp(subtopic, s))) { /* exact match, print text */ - while((fgetstr(buf, 80, hfd) >= 0) && (buf[0] != '#')) { + while ((fgetstr(buf, 80, hfd) >= 0) && (buf[0] != '#')) { if (pager_output(buf)) break; if (pager_output("\n")) @@ -193,23 +191,24 @@ command_help(int argc, char *argv[]) free(t); free(s); free(d); + t = s = d = NULL; } + free(t); + free(s); + free(d); pager_close(); close(hfd); if (!matched) { snprintf(command_errbuf, sizeof(command_errbuf), "no help available for '%s'", topic); free(topic); - if (subtopic) - free(subtopic); + free(subtopic); return(CMD_ERROR); } free(topic); - if (subtopic) - free(subtopic); + free(subtopic); return(CMD_OK); } - COMMAND_SET(commandlist, "?", "list commands", command_commandlist); From owner-svn-src-all@freebsd.org Tue Jan 23 18:01:33 2018 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 8057CEBD104; Tue, 23 Jan 2018 18:01:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E79F3952; Tue, 23 Jan 2018 18:01:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 78C0F11F15; Tue, 23 Jan 2018 18:01:32 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NI1WEk082159; Tue, 23 Jan 2018 18:01:32 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NI1Wxq082158; Tue, 23 Jan 2018 18:01:32 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801231801.w0NI1Wxq082158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 23 Jan 2018 18:01:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328290 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 328290 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 18:01:33 -0000 Author: imp Date: Tue Jan 23 18:01:32 2018 New Revision: 328290 URL: https://svnweb.freebsd.org/changeset/base/328290 Log: On malloc failure, be sure to close the include file that triggered it. CID: 1007775 Sponsored by: Netflix Modified: head/stand/common/interp.c Modified: head/stand/common/interp.c ============================================================================== --- head/stand/common/interp.c Tue Jan 23 18:01:27 2018 (r328289) +++ head/stand/common/interp.c Tue Jan 23 18:01:32 2018 (r328290) @@ -250,6 +250,7 @@ include(const char *filename) snprintf(command_errbuf, sizeof(command_errbuf), "file '%s' line %d: memory allocation failure - aborting", filename, line); + close(fd); return (CMD_ERROR); } strcpy(sp->text, cp); From owner-svn-src-all@freebsd.org Tue Jan 23 18:01:37 2018 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 ABF53EBD144; Tue, 23 Jan 2018 18:01:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8637F39A8; Tue, 23 Jan 2018 18:01:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C55E311F1E; Tue, 23 Jan 2018 18:01:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NI1aoD082212; Tue, 23 Jan 2018 18:01:36 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NI1awp082211; Tue, 23 Jan 2018 18:01:36 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801231801.w0NI1awp082211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 23 Jan 2018 18:01:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328291 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 328291 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 18:01:37 -0000 Author: imp Date: Tue Jan 23 18:01:36 2018 New Revision: 328291 URL: https://svnweb.freebsd.org/changeset/base/328291 Log: getenv does not return tainted data in the boot loader. Attempt to clue Coverity into that fact. Sponsored by: Netflix Modified: head/stand/libsa/environment.c Modified: head/stand/libsa/environment.c ============================================================================== --- head/stand/libsa/environment.c Tue Jan 23 18:01:32 2018 (r328290) +++ head/stand/libsa/environment.c Tue Jan 23 18:01:36 2018 (r328291) @@ -138,6 +138,7 @@ env_setenv(const char *name, int flags, const void *va return(0); } +/* coverity[ -tainted_string_return_content ] */ char * getenv(const char *name) { From owner-svn-src-all@freebsd.org Tue Jan 23 18:01:43 2018 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 8474BEBD1AA; Tue, 23 Jan 2018 18:01:43 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E4C8B3AC9; Tue, 23 Jan 2018 18:01:42 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 590DF11F25; Tue, 23 Jan 2018 18:01:41 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NI1fLi082269; Tue, 23 Jan 2018 18:01:41 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NI1flp082268; Tue, 23 Jan 2018 18:01:41 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801231801.w0NI1flp082268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 23 Jan 2018 18:01:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328292 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 328292 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 18:01:44 -0000 Author: imp Date: Tue Jan 23 18:01:40 2018 New Revision: 328292 URL: https://svnweb.freebsd.org/changeset/base/328292 Log: There's no tainted data here, tag it as such to avoid the slew of false positives. The files the boot loader reads are assumed to be good. CID: 1006663,1006665,1265013, 1265014 (possibly more) Sponsored by: Netflix Modified: head/stand/common/misc.c Modified: head/stand/common/misc.c ============================================================================== --- head/stand/common/misc.c Tue Jan 23 18:01:36 2018 (r328291) +++ head/stand/common/misc.c Tue Jan 23 18:01:40 2018 (r328292) @@ -138,6 +138,7 @@ kern_pread(int fd, vm_offset_t dest, size_t len, off_t * Read the specified part of a file to a malloced buffer. The file * pointer is advanced to the end of the read data. */ +/* coverity[ -tainted_data_return ] */ void * alloc_pread(int fd, off_t off, size_t len) { From owner-svn-src-all@freebsd.org Tue Jan 23 18:03:14 2018 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 91AE6EBD5C2; Tue, 23 Jan 2018 18:03:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 68F3363360; Tue, 23 Jan 2018 18:03:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9321D11F6D; Tue, 23 Jan 2018 18:03:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NI3DYh084534; Tue, 23 Jan 2018 18:03:13 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NI3D1M084533; Tue, 23 Jan 2018 18:03:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801231803.w0NI3D1M084533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 23 Jan 2018 18:03:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328293 - head/stand/fdt X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/fdt X-SVN-Commit-Revision: 328293 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 18:03:14 -0000 Author: kevans Date: Tue Jan 23 18:03:13 2018 New Revision: 328293 URL: https://svnweb.freebsd.org/changeset/base/328293 Log: stand/fdt: Fallback to `name` + ".dtbo" if we fail to load `name` This behavior also matches a Linux-ism by allowing fdt_overlays to specify names of overlays without an extension, e.g. fdt-overlays="sunxi-h3-h5-emac" If we fail to load the file given by a name in fdt_overlays, try again with ".dtbo" appended to it. This still allows overlays to lack .dtbo extension if user prefers it and just adds a fallback cushion. Future work could move this from a hard-coded ".dtbo" to a loader.conf(5) configuration option. Reviewed by: gonzo MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D13968 Modified: head/stand/fdt/fdt_loader_cmd.c Modified: head/stand/fdt/fdt_loader_cmd.c ============================================================================== --- head/stand/fdt/fdt_loader_cmd.c Tue Jan 23 18:01:40 2018 (r328292) +++ head/stand/fdt/fdt_loader_cmd.c Tue Jan 23 18:03:13 2018 (r328293) @@ -73,6 +73,7 @@ static size_t fdtp_size = 0; static vm_offset_t fdtp_va = 0; static int fdt_load_dtb(vm_offset_t va); +static void fdt_print_overlay_load_error(int err, const char *filename); static int fdt_cmd_nyi(int argc, char *argv[]); @@ -286,36 +287,57 @@ fdt_load_dtb_overlay(const char * filename) debugf("fdt_load_dtb_overlay(%s)\n", filename); - /* Attempt to load and validate a new dtb from a file. */ - if ((bfp = file_loadraw(filename, "dtbo", 1)) == NULL) { - printf("failed to load file '%s'\n", filename); - return (1); - } + /* Attempt to load and validate a new dtb from a file. FDT_ERR_NOTFOUND + * is normally a libfdt error code, but libfdt would actually return + * -FDT_ERR_NOTFOUND. We re-purpose the error code here to convey a + * similar meaning: the file itself was not found, which can still be + * considered an error dealing with FDT pieces. + */ + if ((bfp = file_loadraw(filename, "dtbo", 1)) == NULL) + return (FDT_ERR_NOTFOUND); COPYOUT(bfp->f_addr, &header, sizeof(header)); err = fdt_check_header(&header); if (err < 0) { file_discard(bfp); - if (err == -FDT_ERR_BADVERSION) - printf("incompatible blob version: %d, should be: %d\n", - fdt_version(fdtp), FDT_LAST_SUPPORTED_VERSION); - - else - printf("error validating blob: %s\n", - fdt_strerror(err)); - return (1); + return (err); } return (0); } +static void +fdt_print_overlay_load_error(int err, const char *filename) +{ + + switch (err) { + case FDT_ERR_NOTFOUND: + printf("%s: failed to load file\n", filename); + break; + case -FDT_ERR_BADVERSION: + printf("%s: incompatible blob version: %d, should be: %d\n", + filename, fdt_version(fdtp), + FDT_LAST_SUPPORTED_VERSION); + break; + default: + /* libfdt errs are negative */ + if (err < 0) + printf("%s: error validating blob: %s\n", + filename, fdt_strerror(err)); + else + printf("%s: unknown load error\n", filename); + break; + } +} + int fdt_load_dtb_overlays(const char * filenames) { char *names; - char *name; + char *name, *name_ext; char *comaptr; + int err, namesz; debugf("fdt_load_dtb_overlay(%s)\n", filenames); @@ -327,7 +349,23 @@ fdt_load_dtb_overlays(const char * filenames) comaptr = strchr(name, ','); if (comaptr) *comaptr = '\0'; - fdt_load_dtb_overlay(name); + err = fdt_load_dtb_overlay(name); + if (err == FDT_ERR_NOTFOUND) { + /* Allocate enough to append ".dtbo" */ + namesz = strlen(name) + 6; + name_ext = malloc(namesz); + if (name_ext == NULL) { + fdt_print_overlay_load_error(err, name); + name = comaptr + 1; + continue; + } + snprintf(name_ext, namesz, "%s.dtbo", name); + err = fdt_load_dtb_overlay(name_ext); + free(name_ext); + } + /* Catch error with either initial load or fallback load */ + if (err != 0) + fdt_print_overlay_load_error(err, name); name = comaptr + 1; } while(comaptr); From owner-svn-src-all@freebsd.org Tue Jan 23 18:22:42 2018 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 9D704EBE88E; Tue, 23 Jan 2018 18:22:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 784AC681E1; Tue, 23 Jan 2018 18:22: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8CC7122A8; Tue, 23 Jan 2018 18:22:41 +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 w0NIMfot092995; Tue, 23 Jan 2018 18:22:41 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NIMfhc092993; Tue, 23 Jan 2018 18:22:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801231822.w0NIMfhc092993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 23 Jan 2018 18:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328294 - in stable: 10/sys/sys 11/sys/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/sys/sys 11/sys/sys X-SVN-Commit-Revision: 328294 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 18:22:42 -0000 Author: jhb Date: Tue Jan 23 18:22:41 2018 New Revision: 328294 URL: https://svnweb.freebsd.org/changeset/base/328294 Log: MFC 325835: Use #if instead of #ifdef for __BSD_VISIBLE tests. __BSD_VISIBLE is always defined and it's value instead needs to be tested via #if to determine if FreeBSD-specific APIs should be exposed. PR: 196226 Modified: stable/10/sys/sys/aio.h stable/10/sys/sys/shm.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/sys/aio.h stable/11/sys/sys/shm.h Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/sys/aio.h ============================================================================== --- stable/10/sys/sys/aio.h Tue Jan 23 18:03:13 2018 (r328293) +++ stable/10/sys/sys/aio.h Tue Jan 23 18:22:41 2018 (r328294) @@ -130,7 +130,7 @@ int aio_suspend(const struct aiocb * const[], int, con */ int aio_mlock(struct aiocb *); -#ifdef __BSD_VISIBLE +#if __BSD_VISIBLE int aio_waitcomplete(struct aiocb **, struct timespec *); #endif Modified: stable/10/sys/sys/shm.h ============================================================================== --- stable/10/sys/sys/shm.h Tue Jan 23 18:03:13 2018 (r328293) +++ stable/10/sys/sys/shm.h Tue Jan 23 18:22:41 2018 (r328294) @@ -154,7 +154,7 @@ typedef __size_t size_t; #endif __BEGIN_DECLS -#ifdef __BSD_VISIBLE +#if __BSD_VISIBLE int shmsys(int, ...); #endif void *shmat(int, const void *, int); From owner-svn-src-all@freebsd.org Tue Jan 23 18:22:42 2018 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 E4DDDEBE894; Tue, 23 Jan 2018 18:22:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C080A681E4; Tue, 23 Jan 2018 18:22: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1273D122A9; Tue, 23 Jan 2018 18:22: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 w0NIMfdd093003; Tue, 23 Jan 2018 18:22:41 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NIMfcN093001; Tue, 23 Jan 2018 18:22:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801231822.w0NIMfcN093001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 23 Jan 2018 18:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328294 - in stable: 10/sys/sys 11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/sys/sys 11/sys/sys X-SVN-Commit-Revision: 328294 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 18:22:43 -0000 Author: jhb Date: Tue Jan 23 18:22:41 2018 New Revision: 328294 URL: https://svnweb.freebsd.org/changeset/base/328294 Log: MFC 325835: Use #if instead of #ifdef for __BSD_VISIBLE tests. __BSD_VISIBLE is always defined and it's value instead needs to be tested via #if to determine if FreeBSD-specific APIs should be exposed. PR: 196226 Modified: stable/11/sys/sys/aio.h stable/11/sys/sys/shm.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/sys/aio.h stable/10/sys/sys/shm.h Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/sys/aio.h ============================================================================== --- stable/11/sys/sys/aio.h Tue Jan 23 18:03:13 2018 (r328293) +++ stable/11/sys/sys/aio.h Tue Jan 23 18:22:41 2018 (r328294) @@ -252,7 +252,7 @@ int aio_suspend(const struct aiocb * const[], int, con */ int aio_mlock(struct aiocb *); -#ifdef __BSD_VISIBLE +#if __BSD_VISIBLE ssize_t aio_waitcomplete(struct aiocb **, struct timespec *); #endif Modified: stable/11/sys/sys/shm.h ============================================================================== --- stable/11/sys/sys/shm.h Tue Jan 23 18:03:13 2018 (r328293) +++ stable/11/sys/sys/shm.h Tue Jan 23 18:22:41 2018 (r328294) @@ -157,7 +157,7 @@ typedef __size_t size_t; #endif __BEGIN_DECLS -#ifdef __BSD_VISIBLE +#if __BSD_VISIBLE int shmsys(int, ...); #endif void *shmat(int, const void *, int); From owner-svn-src-all@freebsd.org Tue Jan 23 18:56:16 2018 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 C79FFEC0327; Tue, 23 Jan 2018 18:56:16 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 849D069514; Tue, 23 Jan 2018 18:56:15 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id 9D5D12739D; Tue, 23 Jan 2018 18:56:05 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w0NItnUv093951 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 23 Jan 2018 18:55:49 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0NItm2n093950; Tue, 23 Jan 2018 18:55:48 GMT (envelope-from phk) To: Warner Losh cc: John Baldwin , Ravi Pokala , Emmanuel Vadot , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <93948.1516733748.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Tue, 23 Jan 2018 18:55:48 +0000 Message-ID: <93949.1516733748@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 23 Jan 2018 18:56:16 -0000 -------- In message , Warner Losh writes: >--089e08222b4ce7f8a4056372a0d5 >I'm actually thinking the right thing is to remove the checks everywhere. > >We then create a couple of new simplebus methods: +1 -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-svn-src-all@freebsd.org Tue Jan 23 19:00:14 2018 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 90548EC0651; Tue, 23 Jan 2018 19:00:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6986069742; Tue, 23 Jan 2018 19:00:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DE311277E; Tue, 23 Jan 2018 19:00:13 +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 w0NJ0DUM005986; Tue, 23 Jan 2018 19:00:13 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NJ0DgR005983; Tue, 23 Jan 2018 19:00:13 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801231900.w0NJ0DgR005983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 23 Jan 2018 19:00: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: r328295 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/fs/tmpfs X-SVN-Commit-Revision: 328295 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 19:00:14 -0000 Author: jhb Date: Tue Jan 23 19:00:13 2018 New Revision: 328295 URL: https://svnweb.freebsd.org/changeset/base/328295 Log: MFC 323993: Use tmpfs_print for tmpfs FIFOs. Modified: stable/11/sys/fs/tmpfs/tmpfs_fifoops.c stable/11/sys/fs/tmpfs/tmpfs_vnops.c stable/11/sys/fs/tmpfs/tmpfs_vnops.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs_fifoops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_fifoops.c Tue Jan 23 18:22:41 2018 (r328294) +++ stable/11/sys/fs/tmpfs/tmpfs_fifoops.c Tue Jan 23 19:00:13 2018 (r328295) @@ -69,5 +69,5 @@ struct vop_vector tmpfs_fifoop_entries = { .vop_access = tmpfs_access, .vop_getattr = tmpfs_getattr, .vop_setattr = tmpfs_setattr, + .vop_print = tmpfs_print, }; - Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.c Tue Jan 23 18:22:41 2018 (r328294) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.c Tue Jan 23 19:00:13 2018 (r328295) @@ -1310,7 +1310,7 @@ tmpfs_reclaim(struct vop_reclaim_args *v) return 0; } -static int +int tmpfs_print(struct vop_print_args *v) { struct vnode *vp = v->a_vp; Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.h Tue Jan 23 18:22:41 2018 (r328294) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.h Tue Jan 23 19:00:13 2018 (r328295) @@ -49,6 +49,7 @@ extern struct vop_vector tmpfs_vnodeop_nonc_entries; vop_access_t tmpfs_access; vop_getattr_t tmpfs_getattr; vop_setattr_t tmpfs_setattr; +vop_print_t tmpfs_print; vop_reclaim_t tmpfs_reclaim; #endif /* _FS_TMPFS_TMPFS_VNOPS_H_ */ From owner-svn-src-all@freebsd.org Tue Jan 23 19:13:52 2018 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 ADD9BEC1408; Tue, 23 Jan 2018 19:13:52 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f179.google.com (mail-io0-f179.google.com [209.85.223.179]) (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 7D68B6A3B1; Tue, 23 Jan 2018 19:13:52 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f179.google.com with SMTP id l17so2095550ioc.3; Tue, 23 Jan 2018 11:13:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=hkoez4e0bTy745O9yjMCNdByiMHgFTk8pV8M2LCE/Yk=; b=nKZdEa4hg9pl4f5Z1PAzhceGXohWErqNu/pr3FEOjvSR0u7L2A2AtevR2lcG7JHtlL I3ZG8EWsGqaM0TCKJJdusIDe/xmg5A7cr1f+06vrPd43q3Qk+cjGc7D2tCkyIto1Z6X3 1Eaia+ukbHm6l22y7OGc+aWCIidefuDNZpHrYSj4elT8BctaTLnzNYeWpk+4GrZX3ACx e3meUr5O2RKVqkzEblDEMnVvX+S4Hp6YZFgf2rTqIRCr7e9KXutG8ZaGid26fLWdNlji bCbMnbhabm+GU+Vk0jeRl9tIU6M/REnhzdXKeUe24l3PkG/P5Ewg/HQzr++Gi19AhYe4 1kIw== X-Gm-Message-State: AKwxytex6aF8+qy4xaqOwjAayOs5Xo++E+naMoplbSB3LS4khYb3Bbpe WqFGiPmn4YNXZY7vqT3QZlhAtLIM X-Google-Smtp-Source: AH8x227uaYedowGXQ311tAnLKJqqgyrgNDYauhfXL+vhgllzsva5vWxqowSTHUtMtBIJV1CB1ZVU7g== X-Received: by 10.107.154.129 with SMTP id c123mr5210526ioe.203.1516734516798; Tue, 23 Jan 2018 11:08:36 -0800 (PST) Received: from mail-io0-f182.google.com (mail-io0-f182.google.com. [209.85.223.182]) by smtp.gmail.com with ESMTPSA id 188sm9684341iou.80.2018.01.23.11.08.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jan 2018 11:08:36 -0800 (PST) Received: by mail-io0-f182.google.com with SMTP id b198so2073340iof.6; Tue, 23 Jan 2018 11:08:36 -0800 (PST) X-Received: by 10.107.174.196 with SMTP id n65mr5158112ioo.256.1516734516352; Tue, 23 Jan 2018 11:08:36 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Tue, 23 Jan 2018 11:08:35 -0800 (PST) In-Reply-To: <201801211542.w0LFgbsp005980@repo.freebsd.org> References: <201801211542.w0LFgbsp005980@repo.freebsd.org> From: Conrad Meyer Date: Tue, 23 Jan 2018 11:08:35 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: "Pedro F. Giffuni" 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.25 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, 23 Jan 2018 19:13:52 -0000 Hi Pedro, On Sun, Jan 21, 2018 at 7:42 AM, Pedro F. Giffuni wrote: > Author: pfg > Date: Sun Jan 21 15:42:36 2018 > New Revision: 328218 > URL: https://svnweb.freebsd.org/changeset/base/328218 > > Log: > Revert r327828, r327949, r327953, r328016-r328026, r328041: > Uses of mallocarray(9). > > The use of mallocarray(9) has rocketed the required swap to build FreeBSD. > This is likely caused by the allocation size attributes which put extra pressure > on the compiler. I'm confused about this change. Wouldn't it be better to remove the annotation/attributes from mallocarray() than to remove the protection against overflow? (If the compiler is fixed in the future to not use excessive memory with these attributes, they can be conditionalized on compiler version, of course.) Best, Conrad From owner-svn-src-all@freebsd.org Tue Jan 23 19:40:07 2018 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 1F276EC296F; Tue, 23 Jan 2018 19:40:07 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EEF926B2F9; Tue, 23 Jan 2018 19:40:06 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46C8012DD0; Tue, 23 Jan 2018 19:40:06 +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 w0NJe6Bm022515; Tue, 23 Jan 2018 19:40:06 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NJe657022513; Tue, 23 Jan 2018 19:40:06 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201801231940.w0NJe657022513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 23 Jan 2018 19:40:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328296 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 328296 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 19:40:07 -0000 Author: asomers Date: Tue Jan 23 19:40:05 2018 New Revision: 328296 URL: https://svnweb.freebsd.org/changeset/base/328296 Log: sys/netinet6: fix typos in comments. No functional change. MFC after: 3 weeks Sponsored by: Spectra Logic Corp Modified: head/sys/netinet6/in6.c head/sys/netinet6/scope6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Tue Jan 23 19:00:13 2018 (r328295) +++ head/sys/netinet6/in6.c Tue Jan 23 19:40:05 2018 (r328296) @@ -1454,7 +1454,7 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp, int ignorefl /* - * find the internet address corresponding to a given address. + * find the interface address corresponding to a given IPv6 address. * ifaddr is returned referenced. */ struct in6_ifaddr * Modified: head/sys/netinet6/scope6.c ============================================================================== --- head/sys/netinet6/scope6.c Tue Jan 23 19:00:13 2018 (r328295) +++ head/sys/netinet6/scope6.c Tue Jan 23 19:40:05 2018 (r328296) @@ -411,7 +411,7 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, if (scope == IPV6_ADDR_SCOPE_INTFACELOCAL || scope == IPV6_ADDR_SCOPE_LINKLOCAL) { /* - * Currently we use interface indeces as the + * Currently we use interface indices as the * zone IDs for interface-local and link-local * scopes. */ From owner-svn-src-all@freebsd.org Tue Jan 23 19:40:18 2018 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 AE0ADEC29EE for ; Tue, 23 Jan 2018 19:40:18 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic305-17.consmr.mail.bf2.yahoo.com (sonic305-17.consmr.mail.bf2.yahoo.com [74.6.133.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C190E6B3CB for ; Tue, 23 Jan 2018 19:40:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1516736410; bh=L2Y/OTSjRny7LAh63OBcwa7ZkgvnVVhs533gvjKqZjU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=sE3a1u3nGX7qgcrUPEzlNyLsx4HR3ArJhV5Scob7pB5efIpk5e/Uwp2ZaaW7mhk8vwEWKxDZ6agauVomj3chERk0g8okwnNwcrhPQKt/0n7xvYjgCIAoEjHKCB/SAHXdmZcgE0pZTqKCIpp0FKcikGWyWx4biLzWXqebgUu0cQ0J9TyiZ23a9nJDSreASuoGBXToBTK0t8aeJkMst3KF+XUaFchwoDluddU9DXcSHWG5zNSt1A7/mUnfCKg6aFBlMwHcDL6m1YV+phJz6Wzzp+uzZZoXcoZFzva3FeiklPvHUYUcVMffphHDmTHKqRNZ/hGtAsaXmGI+WaM5PXc9TQ== X-YMail-OSG: THUMT7oVM1luqzSYo9tznwZ5wBesyi1RAKpAoF1WW.g5J.Fhw6sIR.RHXv2a9Et LfJk1yySoD1VBiMbIcbS2.5f68LuNo9Joe1v7ZVLCHtfRzxcQIneIHwGm.9g4YwjSfuJ6buwtw65 99_BrITXtl73_5DENGmIK44LC6TlEOEsvKxNknryAJeh8AHxyuCX6EEXeowovTmYQAOa89_mEyWw 43_RercKy5rth6cRpho9O8xdzPSGTfNyPq5sv9Q4udxQLPrmVZWnfvIxRea2PXWq8c1ztRmD71dj NWfEN60rL07zSv5x2DU1aI_0AKU9jDdKze9BufL89dMoEXhgQntPkyr5huKG84qFPZhH5_MBGjWL M7xQhHZW4rEhv_ukjTwLsAWuvn_J.7PghwT33xGGuYitDPliGeh0kJLYY.fnhRXJAOAYXn_RC4Ke .OfmKkQdmrF4WxTKVp_REbdXf50FOdZnlkdIbOlMmBYMXOqmlxCjwwHwpMYERp6hkTReVJMd4Ub1 OXUaQyYLNiQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.bf2.yahoo.com with HTTP; Tue, 23 Jan 2018 19:40:10 +0000 Received: from smtp106.rhel.mail.bf1.yahoo.com (EHLO [192.168.0.8]) ([98.139.231.40]) by smtp401.mail.bf1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID e30219802c78c8c7b2dd33cc494aea19; Tue, 23 Jan 2018 19:40:07 +0000 (UTC) Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801211542.w0LFgbsp005980@repo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> Date: Tue, 23 Jan 2018 14:40:05 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 23 Jan 2018 19:40:19 -0000 Hi; On 23/01/2018 14:08, Conrad Meyer wrote: > Hi Pedro, > > On Sun, Jan 21, 2018 at 7:42 AM, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Sun Jan 21 15:42:36 2018 >> New Revision: 328218 >> URL: https://svnweb.freebsd.org/changeset/base/328218 >> >> Log: >> Revert r327828, r327949, r327953, r328016-r328026, r328041: >> Uses of mallocarray(9). >> >> The use of mallocarray(9) has rocketed the required swap to build FreeBSD. >> This is likely caused by the allocation size attributes which put extra pressure >> on the compiler. > I'm confused about this change. Wouldn't it be better to remove the > annotation/attributes from mallocarray() than to remove the protection > against overflow? Not in my opinion: it would be better to detect such overflows at compile time (or through a static analyzer) than to have late notification though panics. The blind use of mallocarray(9) is probably a mistake also: we shouldn't use it unless there is some real risk of overflow. > (If the compiler is fixed in the future to not use > excessive memory with these attributes, they can be conditionalized on > compiler version, of course.) All in all, the compiler is not provably wrong: it's just using more swap space, which is rather inconvenient for small platforms but not necessarily wrong. Pedro. From owner-svn-src-all@freebsd.org Tue Jan 23 20:07:53 2018 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 5BD39EC3F3A; Tue, 23 Jan 2018 20:07:53 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 37DE76C408; Tue, 23 Jan 2018 20:07: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45036132A3; Tue, 23 Jan 2018 20:07: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 w0NK7peM035126; Tue, 23 Jan 2018 20:07:51 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NK7pJj035125; Tue, 23 Jan 2018 20:07:51 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201801232007.w0NK7pJj035125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 23 Jan 2018 20:07:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328297 - head/usr.bin/procstat X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/usr.bin/procstat X-SVN-Commit-Revision: 328297 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 20:07:53 -0000 Author: brooks Date: Tue Jan 23 20:07:51 2018 New Revision: 328297 URL: https://svnweb.freebsd.org/changeset/base/328297 Log: Don't escape '?'s in protocol output. This isn't required by mandoc and is nonfunctional in groff. PR: 224632 Reported by: w.schwarzenfeld@utanet.at MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D13779 Modified: head/usr.bin/procstat/procstat.1 Modified: head/usr.bin/procstat/procstat.1 ============================================================================== --- head/usr.bin/procstat/procstat.1 Tue Jan 23 19:40:05 2018 (r328296) +++ head/usr.bin/procstat/procstat.1 Tue Jan 23 20:07:51 2018 (r328297) @@ -374,7 +374,7 @@ see .Dv IPPROTO_DIVERT ; see .Xr divert 4 . -.It IP\? +.It IP? unknown protocol. .It RAW .Dv IPPROTO_RAW ; @@ -405,12 +405,12 @@ see .Dv IPPROTO_TCP ; see .Xr tcp 4 . -.It UD\? +.It UD? unknown protocol. .El .Pp .Bl -tag -width indent -compact -.It \? +.It ? unknown address family. .El .Ss Signal Disposition Information From owner-svn-src-all@freebsd.org Tue Jan 23 20:08:29 2018 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 5DC7AEC4036; Tue, 23 Jan 2018 20:08:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 265D46C60A; Tue, 23 Jan 2018 20:08:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FAE7132B5; Tue, 23 Jan 2018 20:08: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 w0NK8RNX035225; Tue, 23 Jan 2018 20:08:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NK8PCY035206; Tue, 23 Jan 2018 20:08:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801232008.w0NK8PCY035206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 23 Jan 2018 20:08:25 +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: r328298 - in stable/11/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/cd9660 fs/devfs fs/ext2fs fs/fdescfs fs/fifofs fs/fuse fs/msdosfs fs/nandfs fs/nfsclient fs/smbfs fs/tmpfs fs/u... X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/11/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/cd9660 fs/devfs fs/ext2fs fs/fdescfs fs/fifofs fs/fuse fs/msdosfs fs/nandfs fs/nfsclient fs/smbfs fs/tmpfs fs/udf kern sys ufs/ufs X-SVN-Commit-Revision: 328298 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 20:08:29 -0000 Author: jhb Date: Tue Jan 23 20:08:25 2018 New Revision: 328298 URL: https://svnweb.freebsd.org/changeset/base/328298 Log: MFC 320900,323882,324224,324226,324228,326986,326988,326989,326990,326993, 326994,326995,327004: Various fixes for pathconf(2). The original change to use vop_stdpathconf() more widely was motivated by a panic due to recent AIO-related changes. However, bde@ reported that vop_stdpathconf() contained too many settings that were not filesystem-independent. The end result of this set of patches is to fix the AIO-related panic via use of a trimmed-down vop_stdpathconf() while also adding support for missing pathconf variables in various filesystems (and removing a few settings incorrectly reported as supported). 320900: Consistently use vop_stdpathconf() for default pathconf values. Update filesystems not currently using vop_stdpathconf() in pathconf VOPs to use vop_stdpathconf() for any configuration variables that do not have filesystem-specific values. vop_stdpathconf() is used for variables that have system-wide settings as well as providing default values for some values based on system limits. Filesystems can still explicitly override individual settings. 323882: Only handle _PC_MAX_CANON, _PC_MAX_INPUT, and _PC_VDISABLE for TTY devices. Move handling of these three pathconf() variables out of vop_stdpathconf() and into devfs_pathconf() as TTY devices can only be devfs files. In addition, only return settings for these three variables for devfs devices whose device switch has the D_TTY flag set. 324224: Handle _PC_FILESIZEBITS and _PC_SYMLINK_MAX pathconf() requests in cd9660. cd9660 only supports symlinks with Rock Ridge extensions, so _PC_SYMLINK_MAX is conditional on Rock Ridge. 324226: Return 64 for pathconf(_PC_FILESIZEBITS) on tmpfs. 324228: Flesh out pathconf() on UDF. - Return 64 bits for _PC_FILESIZEBITS. - Handle _PC_SYMLINK_MAX. - Defer _PC_PATH_MAX to vop_stdpathconf(). 326986: Add a custom VOP_PATHCONF method for fdescfs. The method handles NAME_MAX and LINK_MAX explicitly. For all other pathconf variables, the method passes the request down to the underlying file descriptor. This requires splitting a kern_fpathconf() syscallsubr routine out of sys_fpathconf(). Also, to avoid lock order reversals with vnode locks, the fdescfs vnode is unlocked around the call to kern_fpathconf(), but with the usecount of the vnode bumped. 326988: Add a custom VOP_PATHCONF method for fuse. This method handles _PC_FILESIZEBITS, _PC_SYMLINK_MAX, and _PC_NO_TRUNC. For other values it defers to vop_stdpathconf(). 326989: Support _PC_FILESIZEBITS in msdosfs' VOP_PATHCONF(). 326990: Handle _PC_FILESIZEBITS and _PC_NO_TRUNC for smbfs' VOP_PATHCONF(). 326993: Move NAME_MAX, LINK_MAX, and CHOWN_RESTRICTED out of vop_stdpathconf(). Having all filesystems fall through to default values isn't always correct and these values can vary for different filesystem implementations. Most of these changes just use the existing default values with a few exceptions: - Don't report CHOWN_RESTRICTED for ZFS since it doesn't do the exact permissions check this claims for chown(). - Use NANDFS_NAME_LEN for NAME_MAX for nandfs. - Don't report a LINK_MAX of 0 on smbfs. Now fail with EINVAL to indicate hard links aren't supported. 326994: Handle _PC_FILESIZEBITS and _PC_SYMLINK_MAX for devfs' VOP_PATHCONF(). 326995: Use FUSE_LINK_MAX for LINK_MAX in fuse' VOP_PATHCONF(). Should have included this in r326993. 327004: Rework pathconf handling for FIFOs. On the one hand, FIFOs should respect other variables not supported by the fifofs vnode operation (such as _PC_NAME_MAX, _PC_LINK_MAX, etc.). These values are fs-specific and must come from a fs-specific method. On the other hand, filesystems that support FIFOs are required to support _PC_PIPE_BUF on directory vnodes that can contain FIFOs. Given this latter requirement, once the fs-specific VOP_PATHCONF method supports _PC_PIPE_BUF for directories, it is also suitable for FIFOs permitting a single VOP_PATHCONF method to be used for both FIFOs and non-FIFOs. To that end, retire all of the FIFO-specific pathconf methods from filesystems and change FIFO-specific vnode operation switches to use the existing fs-specific VOP_PATHCONF method. For fifofs, set it's VOP_PATHCONF to VOP_PANIC since it should no longer be used. While here, move _PC_PIPE_BUF handling out of vop_stdpathconf() so that only filesystems supporting FIFOs will report a value. In addition, only report a valid _PC_PIPE_BUF for directories and FIFOs. PR: 219851 Sponsored by: Chelsio Communications Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/11/sys/fs/cd9660/cd9660_vnops.c stable/11/sys/fs/devfs/devfs_vnops.c stable/11/sys/fs/ext2fs/ext2_vnops.c stable/11/sys/fs/fdescfs/fdesc_vnops.c stable/11/sys/fs/fifofs/fifo_vnops.c stable/11/sys/fs/fuse/fuse_vnops.c stable/11/sys/fs/msdosfs/msdosfs_vnops.c stable/11/sys/fs/nandfs/nandfs_vnops.c stable/11/sys/fs/nfsclient/nfs_clvnops.c stable/11/sys/fs/smbfs/smbfs_vnops.c stable/11/sys/fs/tmpfs/tmpfs_fifoops.c stable/11/sys/fs/tmpfs/tmpfs_vnops.c stable/11/sys/fs/tmpfs/tmpfs_vnops.h stable/11/sys/fs/udf/udf_vnops.c stable/11/sys/kern/kern_descrip.c stable/11/sys/kern/vfs_default.c stable/11/sys/sys/syscallsubr.h stable/11/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -5404,30 +5404,25 @@ zfs_freebsd_pathconf(ap) int error; error = zfs_pathconf(ap->a_vp, ap->a_name, &val, curthread->td_ucred, NULL); - if (error == 0) + if (error == 0) { *ap->a_retval = val; - else if (error == EOPNOTSUPP) - error = vop_stdpathconf(ap); - return (error); -} + return (error); + } + if (error != EOPNOTSUPP) + return (error); -static int -zfs_freebsd_fifo_pathconf(ap) - struct vop_pathconf_args /* { - struct vnode *a_vp; - int a_name; - register_t *a_retval; - } */ *ap; -{ - switch (ap->a_name) { - case _PC_ACL_EXTENDED: - case _PC_ACL_NFS4: - case _PC_ACL_PATH_MAX: - case _PC_MAC_PRESENT: - return (zfs_freebsd_pathconf(ap)); + case _PC_NAME_MAX: + *ap->a_retval = NAME_MAX; + return (0); + case _PC_PIPE_BUF: + if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO) { + *ap->a_retval = PIPE_BUF; + return (0); + } + return (EINVAL); default: - return (fifo_specops.vop_pathconf(ap)); + return (vop_stdpathconf(ap)); } } @@ -6041,7 +6036,7 @@ struct vop_vector zfs_fifoops = { .vop_reclaim = zfs_freebsd_reclaim, .vop_setattr = zfs_freebsd_setattr, .vop_write = VOP_PANIC, - .vop_pathconf = zfs_freebsd_fifo_pathconf, + .vop_pathconf = zfs_freebsd_pathconf, .vop_fid = zfs_freebsd_fid, .vop_getacl = zfs_freebsd_getacl, .vop_setacl = zfs_freebsd_setacl, Modified: stable/11/sys/fs/cd9660/cd9660_vnops.c ============================================================================== --- stable/11/sys/fs/cd9660/cd9660_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/cd9660/cd9660_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -780,6 +780,9 @@ cd9660_pathconf(ap) { switch (ap->a_name) { + case _PC_FILESIZEBITS: + *ap->a_retval = 32; + return (0); case _PC_LINK_MAX: *ap->a_retval = 1; return (0); @@ -789,20 +792,17 @@ cd9660_pathconf(ap) else *ap->a_retval = 37; return (0); - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - return (0); - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - return (0); - case _PC_CHOWN_RESTRICTED: - *ap->a_retval = 1; - return (0); + case _PC_SYMLINK_MAX: + if (VTOI(ap->a_vp)->i_mnt->iso_ftype == ISO_FTYPE_RRIP) { + *ap->a_retval = MAXPATHLEN; + return (0); + } + return (EINVAL); case _PC_NO_TRUNC: *ap->a_retval = 1; return (0); default: - return (EINVAL); + return (vop_stdpathconf(ap)); } /* NOTREACHED */ } Modified: stable/11/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/11/sys/fs/devfs/devfs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/devfs/devfs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -1165,6 +1165,36 @@ devfs_pathconf(struct vop_pathconf_args *ap) { switch (ap->a_name) { + case _PC_FILESIZEBITS: + *ap->a_retval = 64; + return (0); + case _PC_NAME_MAX: + *ap->a_retval = NAME_MAX; + return (0); + case _PC_LINK_MAX: + *ap->a_retval = LINK_MAX; + return (0); + case _PC_SYMLINK_MAX: + *ap->a_retval = MAXPATHLEN; + return (0); + case _PC_MAX_CANON: + if (ap->a_vp->v_vflag & VV_ISTTY) { + *ap->a_retval = MAX_CANON; + return (0); + } + return (EINVAL); + case _PC_MAX_INPUT: + if (ap->a_vp->v_vflag & VV_ISTTY) { + *ap->a_retval = MAX_INPUT; + return (0); + } + return (EINVAL); + case _PC_VDISABLE: + if (ap->a_vp->v_vflag & VV_ISTTY) { + *ap->a_retval = _POSIX_VDISABLE; + return (0); + } + return (EINVAL); case _PC_MAC_PRESENT: #ifdef MAC /* @@ -1175,6 +1205,9 @@ devfs_pathconf(struct vop_pathconf_args *ap) #else *ap->a_retval = 0; #endif + return (0); + case _PC_CHOWN_RESTRICTED: + *ap->a_retval = 1; return (0); default: return (vop_stdpathconf(ap)); Modified: stable/11/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/11/sys/fs/ext2fs/ext2_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/ext2fs/ext2_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -179,6 +179,7 @@ struct vop_vector ext2_fifoops = { .vop_getattr = ext2_getattr, .vop_inactive = ext2_inactive, .vop_kqfilter = ext2fifo_kqfilter, + .vop_pathconf = ext2_pathconf, .vop_print = ext2_print, .vop_read = VOP_PANIC, .vop_reclaim = ext2_reclaim, @@ -1596,11 +1597,11 @@ ext2_pathconf(struct vop_pathconf_args *ap) case _PC_NAME_MAX: *ap->a_retval = NAME_MAX; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; + if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO) + *ap->a_retval = PIPE_BUF; + else + error = EINVAL; break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; @@ -1627,11 +1628,6 @@ ext2_pathconf(struct vop_pathconf_args *ap) case _PC_MIN_HOLE_SIZE: *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; break; - case _PC_ASYNC_IO: - /* _PC_ASYNC_IO should have been handled by upper layers. */ - KASSERT(0, ("_PC_ASYNC_IO should not get here")); - error = EINVAL; - break; case _PC_PRIO_IO: *ap->a_retval = 0; break; @@ -1661,7 +1657,7 @@ ext2_pathconf(struct vop_pathconf_args *ap) break; default: - error = EINVAL; + error = vop_stdpathconf(ap); break; } return (error); Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- stable/11/sys/fs/fdescfs/fdesc_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/fdescfs/fdesc_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -53,6 +53,8 @@ #include #include #include +#include +#include #include #include @@ -68,6 +70,7 @@ struct mtx fdesc_hashmtx; static vop_getattr_t fdesc_getattr; static vop_lookup_t fdesc_lookup; static vop_open_t fdesc_open; +static vop_pathconf_t fdesc_pathconf; static vop_readdir_t fdesc_readdir; static vop_readlink_t fdesc_readlink; static vop_reclaim_t fdesc_reclaim; @@ -80,7 +83,7 @@ static struct vop_vector fdesc_vnodeops = { .vop_getattr = fdesc_getattr, .vop_lookup = fdesc_lookup, .vop_open = fdesc_open, - .vop_pathconf = vop_stdpathconf, + .vop_pathconf = fdesc_pathconf, .vop_readdir = fdesc_readdir, .vop_readlink = fdesc_readlink, .vop_reclaim = fdesc_reclaim, @@ -391,6 +394,33 @@ fdesc_open(struct vop_open_args *ap) */ ap->a_td->td_dupfd = VTOFDESC(vp)->fd_fd; /* XXX */ return (ENODEV); +} + +static int +fdesc_pathconf(struct vop_pathconf_args *ap) +{ + struct vnode *vp = ap->a_vp; + int error; + + switch (ap->a_name) { + case _PC_NAME_MAX: + *ap->a_retval = NAME_MAX; + return (0); + case _PC_LINK_MAX: + if (VTOFDESC(vp)->fd_type == Froot) + *ap->a_retval = 2; + else + *ap->a_retval = 1; + return (0); + default: + vref(vp); + VOP_UNLOCK(vp, 0); + error = kern_fpathconf(curthread, VTOFDESC(vp)->fd_fd, + ap->a_name); + vn_lock(vp, LK_SHARED | LK_RETRY); + vunref(vp); + return (error); + } } static int Modified: stable/11/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- stable/11/sys/fs/fifofs/fifo_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/fifofs/fifo_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -71,7 +71,6 @@ struct fifoinfo { static vop_print_t fifo_print; static vop_open_t fifo_open; static vop_close_t fifo_close; -static vop_pathconf_t fifo_pathconf; static vop_advlock_t fifo_advlock; struct vop_vector fifo_specops = { @@ -87,7 +86,7 @@ struct vop_vector fifo_specops = { .vop_mkdir = VOP_PANIC, .vop_mknod = VOP_PANIC, .vop_open = fifo_open, - .vop_pathconf = fifo_pathconf, + .vop_pathconf = VOP_PANIC, .vop_print = fifo_print, .vop_read = VOP_PANIC, .vop_readdir = VOP_PANIC, @@ -337,34 +336,6 @@ fifo_print(ap) fifo_printinfo(ap->a_vp); printf("\n"); return (0); -} - -/* - * Return POSIX pathconf information applicable to fifo's. - */ -static int -fifo_pathconf(ap) - struct vop_pathconf_args /* { - struct vnode *a_vp; - int a_name; - int *a_retval; - } */ *ap; -{ - - switch (ap->a_name) { - case _PC_LINK_MAX: - *ap->a_retval = LINK_MAX; - return (0); - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - return (0); - case _PC_CHOWN_RESTRICTED: - *ap->a_retval = 1; - return (0); - default: - return (EINVAL); - } - /* NOTREACHED */ } /* Modified: stable/11/sys/fs/fuse/fuse_vnops.c ============================================================================== --- stable/11/sys/fs/fuse/fuse_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/fuse/fuse_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -123,6 +123,7 @@ static vop_lookup_t fuse_vnop_lookup; static vop_mkdir_t fuse_vnop_mkdir; static vop_mknod_t fuse_vnop_mknod; static vop_open_t fuse_vnop_open; +static vop_pathconf_t fuse_vnop_pathconf; static vop_read_t fuse_vnop_read; static vop_readdir_t fuse_vnop_readdir; static vop_readlink_t fuse_vnop_readlink; @@ -155,7 +156,7 @@ struct vop_vector fuse_vnops = { .vop_mkdir = fuse_vnop_mkdir, .vop_mknod = fuse_vnop_mknod, .vop_open = fuse_vnop_open, - .vop_pathconf = vop_stdpathconf, + .vop_pathconf = fuse_vnop_pathconf, .vop_read = fuse_vnop_read, .vop_readdir = fuse_vnop_readdir, .vop_readlink = fuse_vnop_readlink, @@ -1170,6 +1171,31 @@ fuse_vnop_open(struct vop_open_args *ap) error = fuse_filehandle_open(vp, fufh_type, NULL, td, cred); return error; +} + +static int +fuse_vnop_pathconf(struct vop_pathconf_args *ap) +{ + + switch (ap->a_name) { + case _PC_FILESIZEBITS: + *ap->a_retval = 64; + return (0); + case _PC_NAME_MAX: + *ap->a_retval = NAME_MAX; + return (0); + case _PC_LINK_MAX: + *ap->a_retval = FUSE_LINK_MAX; + return (0); + case _PC_SYMLINK_MAX: + *ap->a_retval = MAXPATHLEN; + return (0); + case _PC_NO_TRUNC: + *ap->a_retval = 1; + return (0); + default: + return (vop_stdpathconf(ap)); + } } /* Modified: stable/11/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/msdosfs/msdosfs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -1891,15 +1891,15 @@ msdosfs_pathconf(struct vop_pathconf_args *ap) struct msdosfsmount *pmp = VTODE(ap->a_vp)->de_pmp; switch (ap->a_name) { + case _PC_FILESIZEBITS: + *ap->a_retval = 32; + return (0); case _PC_LINK_MAX: *ap->a_retval = 1; return (0); case _PC_NAME_MAX: *ap->a_retval = pmp->pm_flags & MSDOSFSMNT_LONGNAME ? WIN_MAXLEN : 12; return (0); - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - return (0); case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; return (0); @@ -1907,7 +1907,7 @@ msdosfs_pathconf(struct vop_pathconf_args *ap) *ap->a_retval = 0; return (0); default: - return (EINVAL); + return (vop_stdpathconf(ap)); } /* NOTREACHED */ } Modified: stable/11/sys/fs/nandfs/nandfs_vnops.c ============================================================================== --- stable/11/sys/fs/nandfs/nandfs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/nandfs/nandfs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -2240,13 +2240,13 @@ nandfs_pathconf(struct vop_pathconf_args *ap) *ap->a_retval = LINK_MAX; break; case _PC_NAME_MAX: - *ap->a_retval = NAME_MAX; + *ap->a_retval = NANDFS_NAME_LEN; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; + if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO) + *ap->a_retval = PIPE_BUF; + else + error = EINVAL; break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; @@ -2273,7 +2273,7 @@ nandfs_pathconf(struct vop_pathconf_args *ap) *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; break; default: - error = EINVAL; + error = vop_stdpathconf(ap); break; } return (error); @@ -2418,6 +2418,7 @@ struct vop_vector nandfs_fifoops = { .vop_close = nandfsfifo_close, .vop_getattr = nandfs_getattr, .vop_inactive = nandfs_inactive, + .vop_pathconf = nandfs_pathconf, .vop_print = nandfs_print, .vop_read = VOP_PANIC, .vop_reclaim = nandfs_reclaim, Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/nfsclient/nfs_clvnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -187,6 +187,7 @@ struct vop_vector newnfs_fifoops = { .vop_fsync = nfs_fsync, .vop_getattr = nfs_getattr, .vop_inactive = ncl_inactive, + .vop_pathconf = nfs_pathconf, .vop_print = nfs_print, .vop_read = nfsfifo_read, .vop_reclaim = ncl_reclaim, @@ -3465,11 +3466,11 @@ nfs_pathconf(struct vop_pathconf_args *ap) case _PC_NAME_MAX: *ap->a_retval = pc.pc_namemax; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; + if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO) + *ap->a_retval = PIPE_BUF; + else + error = EINVAL; break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = pc.pc_chownrestricted; @@ -3496,11 +3497,6 @@ nfs_pathconf(struct vop_pathconf_args *ap) case _PC_MAC_PRESENT: *ap->a_retval = 0; break; - case _PC_ASYNC_IO: - /* _PC_ASYNC_IO should have been handled by upper layers. */ - KASSERT(0, ("_PC_ASYNC_IO should not get here")); - error = EINVAL; - break; case _PC_PRIO_IO: *ap->a_retval = 0; break; @@ -3533,7 +3529,7 @@ nfs_pathconf(struct vop_pathconf_args *ap) break; default: - error = EINVAL; + error = vop_stdpathconf(ap); break; } return (error); Modified: stable/11/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- stable/11/sys/fs/smbfs/smbfs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/smbfs/smbfs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -897,8 +897,12 @@ smbfs_pathconf (ap) int error = 0; switch (ap->a_name) { - case _PC_LINK_MAX: - *retval = 0; + case _PC_FILESIZEBITS: + if (vcp->vc_sopt.sv_caps & (SMB_CAP_LARGE_READX | + SMB_CAP_LARGE_WRITEX)) + *retval = 64; + else + *retval = 32; break; case _PC_NAME_MAX: *retval = (vcp->vc_hflags2 & SMB_FLAGS2_KNOWS_LONG_NAMES) ? 255 : 12; @@ -906,8 +910,11 @@ smbfs_pathconf (ap) case _PC_PATH_MAX: *retval = 800; /* XXX: a correct one ? */ break; + case _PC_NO_TRUNC: + *retval = 1; + break; default: - error = EINVAL; + error = vop_stdpathconf(ap); } return error; } Modified: stable/11/sys/fs/tmpfs/tmpfs_fifoops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_fifoops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/tmpfs/tmpfs_fifoops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -69,5 +69,6 @@ struct vop_vector tmpfs_fifoop_entries = { .vop_access = tmpfs_access, .vop_getattr = tmpfs_getattr, .vop_setattr = tmpfs_setattr, + .vop_pathconf = tmpfs_pathconf, .vop_print = tmpfs_print, }; Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -1333,9 +1333,10 @@ tmpfs_print(struct vop_print_args *v) return 0; } -static int +int tmpfs_pathconf(struct vop_pathconf_args *v) { + struct vnode *vp = v->a_vp; int name = v->a_name; register_t *retval = v->a_retval; @@ -1352,12 +1353,11 @@ tmpfs_pathconf(struct vop_pathconf_args *v) *retval = NAME_MAX; break; - case _PC_PATH_MAX: - *retval = PATH_MAX; - break; - case _PC_PIPE_BUF: - *retval = PIPE_BUF; + if (vp->v_type == VDIR || vp->v_type == VFIFO) + *retval = PIPE_BUF; + else + error = EINVAL; break; case _PC_CHOWN_RESTRICTED: @@ -1373,11 +1373,11 @@ tmpfs_pathconf(struct vop_pathconf_args *v) break; case _PC_FILESIZEBITS: - *retval = 0; /* XXX Don't know which value should I return. */ + *retval = 64; break; default: - error = EINVAL; + error = vop_stdpathconf(v); } return error; Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.h Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.h Tue Jan 23 20:08:25 2018 (r328298) @@ -49,6 +49,7 @@ extern struct vop_vector tmpfs_vnodeop_nonc_entries; vop_access_t tmpfs_access; vop_getattr_t tmpfs_getattr; vop_setattr_t tmpfs_setattr; +vop_pathconf_t tmpfs_pathconf; vop_print_t tmpfs_print; vop_reclaim_t tmpfs_reclaim; Modified: stable/11/sys/fs/udf/udf_vnops.c ============================================================================== --- stable/11/sys/fs/udf/udf_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/udf/udf_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -100,6 +100,7 @@ struct vop_vector udf_fifoops = { .vop_default = &fifo_specops, .vop_access = udf_access, .vop_getattr = udf_getattr, + .vop_pathconf = udf_pathconf, .vop_print = udf_print, .vop_reclaim = udf_reclaim, .vop_setattr = udf_setattr, @@ -383,20 +384,29 @@ udf_pathconf(struct vop_pathconf_args *a) { switch (a->a_name) { + case _PC_FILESIZEBITS: + *a->a_retval = 64; + return (0); case _PC_LINK_MAX: *a->a_retval = 65535; return (0); case _PC_NAME_MAX: *a->a_retval = NAME_MAX; return (0); - case _PC_PATH_MAX: - *a->a_retval = PATH_MAX; + case _PC_SYMLINK_MAX: + *a->a_retval = MAXPATHLEN; return (0); case _PC_NO_TRUNC: *a->a_retval = 1; return (0); - default: + case _PC_PIPE_BUF: + if (a->a_vp->v_type == VDIR || a->a_vp->v_type == VFIFO) { + *a->a_retval = PIPE_BUF; + return (0); + } return (EINVAL); + default: + return (vop_stdpathconf(a)); } } Modified: stable/11/sys/kern/kern_descrip.c ============================================================================== --- stable/11/sys/kern/kern_descrip.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/kern/kern_descrip.c Tue Jan 23 20:08:25 2018 (r328298) @@ -1386,26 +1386,33 @@ struct fpathconf_args { int sys_fpathconf(struct thread *td, struct fpathconf_args *uap) { + + return (kern_fpathconf(td, uap->fd, uap->name)); +} + +int +kern_fpathconf(struct thread *td, int fd, int name) +{ struct file *fp; struct vnode *vp; cap_rights_t rights; int error; - error = fget(td, uap->fd, cap_rights_init(&rights, CAP_FPATHCONF), &fp); + error = fget(td, fd, cap_rights_init(&rights, CAP_FPATHCONF), &fp); if (error != 0) return (error); - if (uap->name == _PC_ASYNC_IO) { + if (name == _PC_ASYNC_IO) { td->td_retval[0] = _POSIX_ASYNCHRONOUS_IO; goto out; } vp = fp->f_vnode; if (vp != NULL) { vn_lock(vp, LK_SHARED | LK_RETRY); - error = VOP_PATHCONF(vp, uap->name, td->td_retval); + error = VOP_PATHCONF(vp, name, td->td_retval); VOP_UNLOCK(vp, 0); } else if (fp->f_type == DTYPE_PIPE || fp->f_type == DTYPE_SOCKET) { - if (uap->name != _PC_PIPE_BUF) { + if (name != _PC_PIPE_BUF) { error = EINVAL; } else { td->td_retval[0] = PIPE_BUF; Modified: stable/11/sys/kern/vfs_default.c ============================================================================== --- stable/11/sys/kern/vfs_default.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/kern/vfs_default.c Tue Jan 23 20:08:25 2018 (r328298) @@ -477,29 +477,8 @@ vop_stdpathconf(ap) case _PC_ASYNC_IO: *ap->a_retval = _POSIX_ASYNCHRONOUS_IO; return (0); - case _PC_NAME_MAX: - *ap->a_retval = NAME_MAX; - return (0); case _PC_PATH_MAX: *ap->a_retval = PATH_MAX; - return (0); - case _PC_LINK_MAX: - *ap->a_retval = LINK_MAX; - return (0); - case _PC_MAX_CANON: - *ap->a_retval = MAX_CANON; - return (0); - case _PC_MAX_INPUT: - *ap->a_retval = MAX_INPUT; - return (0); - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - return (0); - case _PC_CHOWN_RESTRICTED: - *ap->a_retval = 1; - return (0); - case _PC_VDISABLE: - *ap->a_retval = _POSIX_VDISABLE; return (0); default: return (EINVAL); Modified: stable/11/sys/sys/syscallsubr.h ============================================================================== --- stable/11/sys/sys/syscallsubr.h Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/sys/syscallsubr.h Tue Jan 23 20:08:25 2018 (r328298) @@ -110,6 +110,7 @@ int kern_fcntl(struct thread *td, int fd, int cmd, int int kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long arg); int kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf); int kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf); +int kern_fpathconf(struct thread *td, int fd, int name); int kern_fstat(struct thread *td, int fd, struct stat *sbp); int kern_fstatfs(struct thread *td, int fd, struct statfs *buf); int kern_fsync(struct thread *td, int fd, bool fullsync); Modified: stable/11/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/11/sys/ufs/ufs/ufs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/ufs/ufs/ufs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -122,7 +122,6 @@ static vop_symlink_t ufs_symlink; static vop_whiteout_t ufs_whiteout; static vop_close_t ufsfifo_close; static vop_kqfilter_t ufsfifo_kqfilter; -static vop_pathconf_t ufsfifo_pathconf; SYSCTL_NODE(_vfs, OID_AUTO, ufs, CTLFLAG_RD, 0, "UFS filesystem"); @@ -2405,30 +2404,6 @@ ufsfifo_kqfilter(ap) } /* - * Return POSIX pathconf information applicable to fifos. - */ -static int -ufsfifo_pathconf(ap) - struct vop_pathconf_args /* { - struct vnode *a_vp; - int a_name; - int *a_retval; - } */ *ap; -{ - - switch (ap->a_name) { - case _PC_ACL_EXTENDED: - case _PC_ACL_NFS4: - case _PC_ACL_PATH_MAX: - case _PC_MAC_PRESENT: - return (ufs_pathconf(ap)); - default: - return (fifo_specops.vop_pathconf(ap)); - } - /* NOTREACHED */ -} - -/* * Return POSIX pathconf information applicable to ufs filesystems. */ static int @@ -2443,17 +2418,14 @@ ufs_pathconf(ap) error = 0; switch (ap->a_name) { - case _PC_LINK_MAX: - *ap->a_retval = LINK_MAX; - break; case _PC_NAME_MAX: *ap->a_retval = NAME_MAX; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; + if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO) + *ap->a_retval = PIPE_BUF; + else + error = EINVAL; break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; @@ -2506,11 +2478,6 @@ ufs_pathconf(ap) case _PC_MIN_HOLE_SIZE: *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; break; - case _PC_ASYNC_IO: - /* _PC_ASYNC_IO should have been handled by upper layers. */ - KASSERT(0, ("_PC_ASYNC_IO should not get here")); - error = EINVAL; - break; case _PC_PRIO_IO: *ap->a_retval = 0; break; @@ -2540,7 +2507,7 @@ ufs_pathconf(ap) break; default: - error = EINVAL; + error = vop_stdpathconf(ap); break; } return (error); @@ -2813,7 +2780,7 @@ struct vop_vector ufs_fifoops = { .vop_inactive = ufs_inactive, .vop_kqfilter = ufsfifo_kqfilter, .vop_markatime = ufs_markatime, - .vop_pathconf = ufsfifo_pathconf, + .vop_pathconf = ufs_pathconf, .vop_print = ufs_print, .vop_read = VOP_PANIC, .vop_reclaim = ufs_reclaim, From owner-svn-src-all@freebsd.org Tue Jan 23 20:35:45 2018 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 CD069EC5B4C; Tue, 23 Jan 2018 20:35:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A72176DBB7; Tue, 23 Jan 2018 20:35:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73200137A7; Tue, 23 Jan 2018 20:35:44 +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 w0NKZhfo047688; Tue, 23 Jan 2018 20:35:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NKZhOP047685; Tue, 23 Jan 2018 20:35:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801232035.w0NKZhOP047685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 23 Jan 2018 20:35:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328299 - in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Commit-Revision: 328299 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 20:35:45 -0000 Author: emaste Date: Tue Jan 23 20:35:43 2018 New Revision: 328299 URL: https://svnweb.freebsd.org/changeset/base/328299 Log: Use BSD-2-Clause-FreeBSD license on linux_support.s These files previously had a 3-clause license and 'THE REGENTS' text. Switch to standard 2-clause text with kib's approval, and add the SPDX tag. Approved by: kib Modified: head/sys/amd64/linux/linux_support.s head/sys/amd64/linux32/linux32_support.s head/sys/i386/linux/linux_support.s Modified: head/sys/amd64/linux/linux_support.s ============================================================================== --- head/sys/amd64/linux/linux_support.s Tue Jan 23 20:08:25 2018 (r328298) +++ head/sys/amd64/linux/linux_support.s Tue Jan 23 20:35:43 2018 (r328299) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007 Konstantin Belousov * All rights reserved. * @@ -10,14 +12,11 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Modified: head/sys/amd64/linux32/linux32_support.s ============================================================================== --- head/sys/amd64/linux32/linux32_support.s Tue Jan 23 20:08:25 2018 (r328298) +++ head/sys/amd64/linux32/linux32_support.s Tue Jan 23 20:35:43 2018 (r328299) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2007 Konstantin Belousov * All rights reserved. * @@ -10,14 +12,11 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Modified: head/sys/i386/linux/linux_support.s ============================================================================== --- head/sys/i386/linux/linux_support.s Tue Jan 23 20:08:25 2018 (r328298) +++ head/sys/i386/linux/linux_support.s Tue Jan 23 20:35:43 2018 (r328299) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2006,2007 Konstantin Belousov * All rights reserved. * @@ -10,14 +12,11 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) From owner-svn-src-all@freebsd.org Tue Jan 23 20:38:05 2018 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 BAC7AEC5D05; Tue, 23 Jan 2018 20:38:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 96B666DD82; Tue, 23 Jan 2018 20:38:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9EE1137A8; Tue, 23 Jan 2018 20:38:04 +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 w0NKc3iN047809; Tue, 23 Jan 2018 20:38:03 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NKc3pn047808; Tue, 23 Jan 2018 20:38:03 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801232038.w0NKc3pn047808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 23 Jan 2018 20:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328300 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 328300 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 20:38:05 -0000 Author: emaste Date: Tue Jan 23 20:38:03 2018 New Revision: 328300 URL: https://svnweb.freebsd.org/changeset/base/328300 Log: copyright.h: Update license text to 'THE AUTHOR' This matches the license text at https://www.freebsd.org/copyright/freebsd-license.html Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/copyright.h Modified: head/sys/sys/copyright.h ============================================================================== --- head/sys/sys/copyright.h Tue Jan 23 20:35:43 2018 (r328299) +++ head/sys/sys/copyright.h Tue Jan 23 20:38:03 2018 (r328300) @@ -12,10 +12,10 @@ * 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) From owner-svn-src-all@freebsd.org Tue Jan 23 21:18:16 2018 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 AFCD0EC7E5D; Tue, 23 Jan 2018 21:18:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 899B86F911; Tue, 23 Jan 2018 21:18:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2AB313E4E; Tue, 23 Jan 2018 21:18:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NLIFJU064545; Tue, 23 Jan 2018 21:18:15 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NLIF4F064544; Tue, 23 Jan 2018 21:18:15 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801232118.w0NLIF4F064544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 23 Jan 2018 21:18:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328301 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 328301 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 21:18:16 -0000 Author: ian Date: Tue Jan 23 21:18:15 2018 New Revision: 328301 URL: https://svnweb.freebsd.org/changeset/base/328301 Log: Switch to using the bcd_clocktime conversion functinos that validate the BCD data without panicking, and have common code for handling AM/PM mode. Modified: head/sys/dev/iicbus/ds13rtc.c Modified: head/sys/dev/iicbus/ds13rtc.c ============================================================================== --- head/sys/dev/iicbus/ds13rtc.c Tue Jan 23 20:38:03 2018 (r328300) +++ head/sys/dev/iicbus/ds13rtc.c Tue Jan 23 21:18:15 2018 (r328301) @@ -345,7 +345,7 @@ ds13rtc_start(void *arg) static int ds13rtc_gettime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; struct ds13rtc_softc *sc; int err; @@ -379,29 +379,23 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) else hourmask = DS13xx_M_24HOUR; - ct.sec = FROMBCD(tregs.sec & DS13xx_M_SECOND); - ct.min = FROMBCD(tregs.min & DS13xx_M_MINUTE); - ct.hour = FROMBCD(tregs.hour & hourmask); - ct.day = FROMBCD(tregs.day & DS13xx_M_DAY); - ct.mon = FROMBCD(tregs.month & DS13xx_M_MONTH); - ct.year = FROMBCD(tregs.year & DS13xx_M_YEAR); - ct.nsec = 0; + bct.nsec = 0; + bct.ispm = tregs.hour & DS13xx_B_HOUR_PM; + bct.sec = tregs.sec & DS13xx_M_SECOND; + bct.min = tregs.min & DS13xx_M_MINUTE; + bct.hour = tregs.hour & hourmask; + bct.day = tregs.day & DS13xx_M_DAY; + bct.mon = tregs.month & DS13xx_M_MONTH; + bct.year = tregs.year & DS13xx_M_YEAR; - if (sc->use_ampm) { - if (ct.hour == 12) - ct.hour = 0; - if (tregs.hour & DS13xx_B_HOUR_PM) - ct.hour += 12; - } - /* * If this chip has a century bit, honor it. Otherwise let * clock_ct_to_ts() infer the century from the 2-digit year. */ if (sc->use_century) - ct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 2000 : 1900; + bct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 0x100 : 0; - err = clock_ct_to_ts(&ct, ts); + err = clock_bcd_to_ts(&bct, ts, sc->use_ampm); return (err); } @@ -409,7 +403,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) static int ds13rtc_settime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; struct ds13rtc_softc *sc; int err; @@ -427,34 +421,30 @@ ds13rtc_settime(device_t dev, struct timespec *ts) if (sc->is_binary_counter) return (write_timeword(sc, ts->tv_sec)); - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, sc->use_ampm); /* If the chip is in AMPM mode deal with the PM flag. */ pmflags = 0; if (sc->use_ampm) { pmflags = DS13xx_B_HOUR_AMPM; - if (ct.hour >= 12) { - ct.hour -= 12; + if (bct.ispm) pmflags |= DS13xx_B_HOUR_PM; - } - if (ct.hour == 0) - ct.hour = 12; } /* If the chip has a century bit, set it as needed. */ cflag = 0; if (sc->use_century) { - if (ct.year >= 2000) + if (bct.year >= 2000) cflag |= DS13xx_B_MONTH_CENTURY; } - tregs.sec = TOBCD(ct.sec); - tregs.min = TOBCD(ct.min); - tregs.hour = TOBCD(ct.hour) | pmflags; - tregs.day = TOBCD(ct.day); - tregs.month = TOBCD(ct.mon) | cflag; - tregs.year = TOBCD(ct.year % 100); - tregs.wday = ct.dow; + tregs.sec = bct.sec; + tregs.min = bct.min; + tregs.hour = bct.hour | pmflags; + tregs.day = bct.day; + tregs.month = bct.mon | cflag; + tregs.year = bct.year & 0xff; + tregs.wday = bct.dow; /* * Set the time. Reset the OSF bit if it is on and it is not part of From owner-svn-src-all@freebsd.org Tue Jan 23 21:31:45 2018 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 91ECEEC8735; Tue, 23 Jan 2018 21:31:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 52D72700AA; Tue, 23 Jan 2018 21:31:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CF001404B; Tue, 23 Jan 2018 21:31:44 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NLVhGX070547; Tue, 23 Jan 2018 21:31:43 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NLVhkt070546; Tue, 23 Jan 2018 21:31:43 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801232131.w0NLVhkt070546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 23 Jan 2018 21:31:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328302 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 328302 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 21:31:45 -0000 Author: ian Date: Tue Jan 23 21:31:43 2018 New Revision: 328302 URL: https://svnweb.freebsd.org/changeset/base/328302 Log: Switch to using the bcd_clocktime conversion functions that validate the BCD data without panicking, and have common code for handling AM/PM mode. Modified: head/sys/dev/iicbus/ds1307.c Modified: head/sys/dev/iicbus/ds1307.c ============================================================================== --- head/sys/dev/iicbus/ds1307.c Tue Jan 23 21:18:15 2018 (r328301) +++ head/sys/dev/iicbus/ds1307.c Tue Jan 23 21:31:43 2018 (r328302) @@ -322,7 +322,7 @@ static int ds1307_gettime(device_t dev, struct timespec *ts) { int error; - struct clocktime ct; + struct bcd_clocktime bct; struct ds1307_softc *sc; uint8_t data[7], hourmask, st_mask; @@ -350,30 +350,24 @@ ds1307_gettime(device_t dev, struct timespec *ts) } else hourmask = DS1307_HOUR_MASK_24HR; - ct.nsec = 0; - ct.sec = FROMBCD(data[DS1307_SECS] & DS1307_SECS_MASK); - ct.min = FROMBCD(data[DS1307_MINS] & DS1307_MINS_MASK); - ct.hour = FROMBCD(data[DS1307_HOUR] & hourmask); - ct.day = FROMBCD(data[DS1307_DATE] & DS1307_DATE_MASK); - ct.mon = FROMBCD(data[DS1307_MONTH] & DS1307_MONTH_MASK); - ct.year = FROMBCD(data[DS1307_YEAR] & DS1307_YEAR_MASK); + bct.nsec = 0; + bct.ispm = (data[DS1307_HOUR] & DS1307_HOUR_IS_PM) != 0; + bct.sec = data[DS1307_SECS] & DS1307_SECS_MASK; + bct.min = data[DS1307_MINS] & DS1307_MINS_MASK; + bct.hour = data[DS1307_HOUR] & hourmask; + bct.day = data[DS1307_DATE] & DS1307_DATE_MASK; + bct.mon = data[DS1307_MONTH] & DS1307_MONTH_MASK; + bct.year = data[DS1307_YEAR] & DS1307_YEAR_MASK; - if (sc->sc_use_ampm) { - if (ct.hour == 12) - ct.hour = 0; - if (data[DS1307_HOUR] & DS1307_HOUR_IS_PM) - ct.hour += 12; - } - - return (clock_ct_to_ts(&ct, ts)); + return (clock_bcd_to_ts(&bct, ts, sc->sc_use_ampm)); } static int ds1307_settime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct ds1307_softc *sc; - int error; + int error, year; uint8_t data[7]; uint8_t pmflags; @@ -384,32 +378,28 @@ ds1307_settime(device_t dev, struct timespec *ts) * disables utc adjustment, so apply that ourselves. */ ts->tv_sec -= utc_offset(); - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, sc->sc_use_ampm); /* If the chip is in AM/PM mode, adjust hour and set flags as needed. */ if (sc->sc_use_ampm) { pmflags = DS1307_HOUR_USE_AMPM; - if (ct.hour >= 12) { - ct.hour -= 12; + if (bct.ispm) pmflags |= DS1307_HOUR_IS_PM; - } - if (ct.hour == 0) - ct.hour = 12; } else pmflags = 0; - data[DS1307_SECS] = TOBCD(ct.sec); - data[DS1307_MINS] = TOBCD(ct.min); - data[DS1307_HOUR] = TOBCD(ct.hour) | pmflags; - data[DS1307_DATE] = TOBCD(ct.day); - data[DS1307_WEEKDAY] = ct.dow; - data[DS1307_MONTH] = TOBCD(ct.mon); - data[DS1307_YEAR] = TOBCD(ct.year % 100); + data[DS1307_SECS] = bct.sec; + data[DS1307_MINS] = bct.min; + data[DS1307_HOUR] = bct.hour | pmflags; + data[DS1307_DATE] = bct.day; + data[DS1307_WEEKDAY] = bct.dow; + data[DS1307_MONTH] = bct.mon; + data[DS1307_YEAR] = bct.year & 0xff; if (sc->sc_mcp7941x) { data[DS1307_SECS] |= MCP7941X_SECS_ST; data[DS1307_WEEKDAY] |= MCP7941X_WEEKDAY_VBATEN; - if ((ct.year % 4 == 0 && ct.year % 100 != 0) || - ct.year % 400 == 0) + year = bcd2bin(bct.year >> 8) * 100 + bcd2bin(bct.year & 0xff); + if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) data[DS1307_MONTH] |= MCP7941X_MONTH_LPYR; } /* Write the time back to RTC. */ From owner-svn-src-all@freebsd.org Tue Jan 23 21:36:29 2018 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 2DE4AEC8A0E; Tue, 23 Jan 2018 21:36:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E42AC704AF; Tue, 23 Jan 2018 21:36:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB90814188; Tue, 23 Jan 2018 21:36:27 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NLaRdk072925; Tue, 23 Jan 2018 21:36:27 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NLaRTu072924; Tue, 23 Jan 2018 21:36:27 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801232136.w0NLaRTu072924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 23 Jan 2018 21:36:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328303 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 328303 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 21:36:29 -0000 Author: ian Date: Tue Jan 23 21:36:26 2018 New Revision: 328303 URL: https://svnweb.freebsd.org/changeset/base/328303 Log: Switch to using the bcd_clocktime conversion functions that validate the BCD data without panicking, and have common code for handling AM/PM mode. Modified: head/sys/dev/iicbus/nxprtc.c Modified: head/sys/dev/iicbus/nxprtc.c ============================================================================== --- head/sys/dev/iicbus/nxprtc.c Tue Jan 23 21:31:43 2018 (r328302) +++ head/sys/dev/iicbus/nxprtc.c Tue Jan 23 21:36:26 2018 (r328303) @@ -192,10 +192,10 @@ struct nxprtc_softc { uint8_t secaddr; /* Address of seconds register */ uint8_t tmcaddr; /* Address of timer count register */ bool use_timer; /* Use timer for fractional sec */ + bool use_ampm; /* Chip is set to use am/pm mode */ }; #define SC_F_CPOL (1 << 0) /* Century bit means 19xx */ -#define SC_F_AMPM (1 << 1) /* Use PM flag in hours reg */ /* * We use the compat_data table to look up hint strings in the non-FDT case, so @@ -382,10 +382,10 @@ pcf8523_start(struct nxprtc_softc *sc) /* Remember whether we're running in AM/PM mode. */ if (is2129) { if (cs1 & PCF2129_B_CS1_12HR) - sc->flags |= SC_F_AMPM; + sc->use_ampm = true; } else { if (cs1 & PCF8523_B_CS1_12HR) - sc->flags |= SC_F_AMPM; + sc->use_ampm = true; } return (0); @@ -543,7 +543,7 @@ nxprtc_start(void *dev) static int nxprtc_gettime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; struct nxprtc_softc *sc; int err; @@ -570,21 +570,19 @@ nxprtc_gettime(device_t dev, struct timespec *ts) return (EINVAL); /* hardware is good, time is not. */ } - if (sc->flags & SC_F_AMPM) + if (sc->use_ampm) hourmask = PCF85xx_M_12HOUR; else hourmask = PCF85xx_M_24HOUR; - ct.nsec = ((uint64_t)tmrcount * 1000000000) / TMR_TICKS_SEC; - ct.sec = FROMBCD(tregs.sec & PCF85xx_M_SECOND); - ct.min = FROMBCD(tregs.min & PCF85xx_M_MINUTE); - ct.hour = FROMBCD(tregs.hour & hourmask); - ct.day = FROMBCD(tregs.day & PCF85xx_M_DAY); - ct.mon = FROMBCD(tregs.month & PCF85xx_M_MONTH); - ct.year = FROMBCD(tregs.year & PCF85xx_M_YEAR); - ct.year += 1900; - if (ct.year < POSIX_BASE_YEAR) - ct.year += 100; /* assume [1970, 2069] */ + bct.nsec = ((uint64_t)tmrcount * 1000000000) / TMR_TICKS_SEC; + bct.ispm = (tregs.hour & PCF8523_B_HOUR_PM) != 0; + bct.sec = tregs.sec & PCF85xx_M_SECOND; + bct.min = tregs.min & PCF85xx_M_MINUTE; + bct.hour = tregs.hour & hourmask; + bct.day = tregs.day & PCF85xx_M_DAY; + bct.mon = tregs.month & PCF85xx_M_MONTH; + bct.year = tregs.year & PCF85xx_M_YEAR; /* * Old PCF8563 datasheets recommended that the C bit be 1 for 19xx and 0 @@ -594,21 +592,13 @@ nxprtc_gettime(device_t dev, struct timespec *ts) */ if (sc->chiptype == TYPE_PCF8563) { if (tregs.month & PCF8563_B_MONTH_C) { - if (ct.year >= 2000) + if (bct.year < 0x70) sc->flags |= SC_F_CPOL; - } else if (ct.year < 2000) + } else if (bct.year >= 0x70) sc->flags |= SC_F_CPOL; } - /* If this chip is running in 12-hour/AMPM mode, deal with it. */ - if (sc->flags & SC_F_AMPM) { - if (ct.hour == 12) - ct.hour = 0; - if (tregs.hour & PCF8523_B_HOUR_PM) - ct.hour += 12; - } - - err = clock_ct_to_ts(&ct, ts); + err = clock_bcd_to_ts(&bct, ts, sc->use_ampm); ts->tv_sec += utc_offset(); return (err); @@ -617,11 +607,11 @@ nxprtc_gettime(device_t dev, struct timespec *ts) static int nxprtc_settime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; struct nxprtc_softc *sc; int err; - uint8_t cflag, cs1, pmflag; + uint8_t cflag, cs1; sc = device_get_softc(dev); @@ -647,36 +637,25 @@ nxprtc_settime(device_t dev, struct timespec *ts) getnanotime(ts); ts->tv_sec -= utc_offset(); ts->tv_nsec = 0; - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, sc->use_ampm); - /* If the chip is in AMPM mode deal with the PM flag. */ - pmflag = 0; - if (sc->flags & SC_F_AMPM) { - if (ct.hour >= 12) { - ct.hour -= 12; - pmflag = PCF8523_B_HOUR_PM; - } - if (ct.hour == 0) - ct.hour = 12; - } - /* On 8563 set the century based on the polarity seen when reading. */ cflag = 0; if (sc->chiptype == TYPE_PCF8563) { if ((sc->flags & SC_F_CPOL) != 0) { - if (ct.year >= 2000) + if (bct.year >= 0x2000) cflag = PCF8563_B_MONTH_C; - } else if (ct.year < 2000) + } else if (bct.year < 0x2000) cflag = PCF8563_B_MONTH_C; } - tregs.sec = TOBCD(ct.sec); - tregs.min = TOBCD(ct.min); - tregs.hour = TOBCD(ct.hour) | pmflag; - tregs.day = TOBCD(ct.day); - tregs.month = TOBCD(ct.mon); - tregs.year = TOBCD(ct.year % 100) | cflag; - tregs.wday = ct.dow; + tregs.sec = bct.sec; + tregs.min = bct.min; + tregs.hour = bct.hour | (bct.ispm ? PCF8523_B_HOUR_PM : 0); + tregs.day = bct.day; + tregs.month = bct.mon; + tregs.year = (bct.year & 0xff) | cflag; + tregs.wday = bct.dow; /* * Set the time, reset the timer count register, then start the clocks. From owner-svn-src-all@freebsd.org Tue Jan 23 22:13:40 2018 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 98C1CECA9CE; Tue, 23 Jan 2018 22:13:40 +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 621B971C48; Tue, 23 Jan 2018 22:13:40 +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 7CC5612318; Tue, 23 Jan 2018 22:13:39 +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 54907A873; Tue, 23 Jan 2018 22:13:38 +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 Ph04X4kMLLCx; Tue, 23 Jan 2018 22:13:35 +0000 (UTC) Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 4E39FA86E To: Pedro Giffuni , cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <695a7cbd-f341-690c-5ad7-2551941bbf1e@FreeBSD.org> Date: Tue, 23 Jan 2018 14:13:28 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zCsDlM2lBvcxTewW18WyCGNfFjbD8MJ1p" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 23 Jan 2018 22:13:40 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --zCsDlM2lBvcxTewW18WyCGNfFjbD8MJ1p Content-Type: multipart/mixed; boundary="CfZEnEbbyRw4887uRhmAq9qhs11PgUpD2"; protected-headers="v1" From: Bryan Drewery To: Pedro Giffuni , cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <695a7cbd-f341-690c-5ad7-2551941bbf1e@FreeBSD.org> Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> In-Reply-To: <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> --CfZEnEbbyRw4887uRhmAq9qhs11PgUpD2 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 1/23/2018 11:40 AM, Pedro Giffuni wrote: > Hi; >=20 >=20 > On 23/01/2018 14:08, Conrad Meyer wrote: >> Hi Pedro, >> >> On Sun, Jan 21, 2018 at 7:42 AM, Pedro F. Giffuni >> wrote: >>> Author: pfg >>> Date: Sun Jan 21 15:42:36 2018 >>> New Revision: 328218 >>> URL: https://svnweb.freebsd.org/changeset/base/328218 >>> >>> Log: >>> =C2=A0=C2=A0 Revert r327828, r327949, r327953, r328016-r328026, r3280= 41: >>> =C2=A0=C2=A0 Uses of mallocarray(9). >>> >>> =C2=A0=C2=A0 The use of mallocarray(9) has rocketed the required swap= to build >>> FreeBSD. >>> =C2=A0=C2=A0 This is likely caused by the allocation size attributes = which put >>> extra pressure >>> =C2=A0=C2=A0 on the compiler. >> I'm confused about this change.=C2=A0 Wouldn't it be better to remove = the >> annotation/attributes from mallocarray() than to remove the protection= >> against overflow? >=20 > Not in my opinion: it would be better to detect such overflows at > compile time (or through a static analyzer) than to have late > notification though panics. The blind use of mallocarray(9) is probably= > a mistake also: we shouldn't use it unless there is some real risk of > overflow. >=20 >> =C2=A0=C2=A0 (If the compiler is fixed in the future to not use >> excessive memory with these attributes, they can be conditionalized on= >> compiler version, of course.) >=20 > All in all, the compiler is not provably wrong: it's just using more > swap space, which is rather inconvenient for small platforms but not > necessarily wrong. >=20 > Pedro. >=20 >=20 I haven't dug into this to understand it all, but if mallocarray() is causing this sort of compilation problem then isn't the problem the compiler? Why keep a "dangerous" function around and not actually fix it? Is there a bug somewhere to fix the compilation load? --=20 Regards, Bryan Drewery --CfZEnEbbyRw4887uRhmAq9qhs11PgUpD2-- --zCsDlM2lBvcxTewW18WyCGNfFjbD8MJ1p 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 iQEcBAEBAgAGBQJaZ7OOAAoJEDXXcbtuRpfPfqkH/ArQUS55QlJ/9qS+Y4rQLFEe IqqRlNGYBDJOZN60WIi8A7c/sMWKRvarbR3GXdEtv3YiiBKpuhy8VvO3VDrzevNP 0tLpkMRPAAFbl1z7OoED1uix1YtZawYubuSJspZxBNVr08E2B5uqxIVa+e0qnXS+ CVlQrmtXFBUZ9TG943Y1ATmBHG1sqjuMPW0i3PUywEqKSMod2PltsHuxN162DF9u 1UT6G1vjAvEGynIEYc7ySEd4l5jDmgv+Jfjxz0Iaog2/biDOCNF6C8CffpzFL8Fj N+BELJ33U9x/+RNXbTZvtu0hAfXbj/Su5bSHFE3pwERID4me6us4DiSp/1tFtHw= =RgiW -----END PGP SIGNATURE----- --zCsDlM2lBvcxTewW18WyCGNfFjbD8MJ1p-- From owner-svn-src-all@freebsd.org Tue Jan 23 22:18:47 2018 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 00C3CECB0AE; Tue, 23 Jan 2018 22:18:47 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CEC0C721C9; Tue, 23 Jan 2018 22:18:46 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A7311488F; Tue, 23 Jan 2018 22:18:46 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NMIkK2089845; Tue, 23 Jan 2018 22:18:46 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NMIjV3089843; Tue, 23 Jan 2018 22:18:45 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201801232218.w0NMIjV3089843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Tue, 23 Jan 2018 22:18:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328304 - in head/lib/libc: gen sys X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in head/lib/libc: gen sys X-SVN-Commit-Revision: 328304 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 22:18:47 -0000 Author: mckusick Date: Tue Jan 23 22:18:45 2018 New Revision: 328304 URL: https://svnweb.freebsd.org/changeset/base/328304 Log: In the C library, the setting up of the group array by various utilities is done by calling gr_addgid() for each group to be added (usually found by traversing /etc/group) then calling the setgroups() system call after the group set has been created. The gr_addgid() function (helpfully?) deduplicates the addition of group members. So, if you call it to add a group member that already exists, it is just dropped. Because group[0] is the effective group-ID and is over-written when a setgid program is run, The value in group[0] is usually duplicated so that group value is not lost when a setgid program is run. Historically this happened because the group value indicated in the password file also appears in /etc/group (e.g., if you are group staff in the password file, you will also appear in the staff line in /etc/group). But, with the addition of the deduplication, the attempt to add group staff was lost because it already appeared in group[0]. So, the fix is to deduplicate starting from group[1] which allows a duplicate of the entry in group[0], but not in later entries. There is some confusion about the setgroups system call because in BSD it has (always) set the entire group including the egid group (in group[0]). However, in Linux, it skips over group[0] and starts setting from group[1]. See this comment from linux_setgroups: /* * cr_groups[0] holds egid. Setting the whole set from * the supplied set will cause egid to be changed too. * Keep cr_groups[0] unchanged to prevent that. */ To make it clear what the BSD setgroups system call does, I added the following paragraph to the setgroups(2) manual page: The first entry of the group array (gidset[0]) is used as the effective group-ID for the process. This entry is over-written when a setgid program is run. To avoid losing access to the privileges of the gidset[0] entry, it should be duplicated later in the group array. By convention, this happens because the group value indicated in the password file also appears in /etc/group. The group value in the password file is placed in gidset[0] and that value then gets added a second time when the /etc/group file is scanned to create the group set. Reported by: Paul McMath paulm at tetrardus.net Reviewed by: kib MFC after: 2 weeks Modified: head/lib/libc/gen/getgrent.c head/lib/libc/sys/setgroups.2 Modified: head/lib/libc/gen/getgrent.c ============================================================================== --- head/lib/libc/gen/getgrent.c Tue Jan 23 21:36:26 2018 (r328303) +++ head/lib/libc/gen/getgrent.c Tue Jan 23 22:18:45 2018 (r328304) @@ -436,7 +436,7 @@ gr_addgid(gid_t gid, gid_t *groups, int maxgrp, int *g { int ret, dupc; - for (dupc = 0; dupc < MIN(maxgrp, *grpcnt); dupc++) { + for (dupc = 1; dupc < MIN(maxgrp, *grpcnt); dupc++) { if (groups[dupc] == gid) return 1; } Modified: head/lib/libc/sys/setgroups.2 ============================================================================== --- head/lib/libc/sys/setgroups.2 Tue Jan 23 21:36:26 2018 (r328303) +++ head/lib/libc/sys/setgroups.2 Tue Jan 23 22:18:45 2018 (r328304) @@ -56,6 +56,23 @@ more than .Dv {NGROUPS_MAX}+1 . .Pp Only the super-user may set a new group list. +.Pp +The first entry of the group array +.Pq Va gidset[0] +is used as the effective group-ID for the process. +This entry is over-written when a setgid program is run. +To avoid losing access to the privileges of the +.Va gidset[0] +entry, it should be duplicated later in the group array. +By convention, +this happens because the group value indicated +in the password file also appears in +.Pa /etc/group . +The group value in the password file is placed in +.Va gidset[0] +and that value then gets added a second time when the +.Pa /etc/group +file is scanned to create the group set. .Sh RETURN VALUES .Rv -std setgroups .Sh ERRORS From owner-svn-src-all@freebsd.org Tue Jan 23 22:20:33 2018 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 6049CECB3FB; Tue, 23 Jan 2018 22:20:33 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 226037256C; Tue, 23 Jan 2018 22:20:33 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 8037C25D3892; Tue, 23 Jan 2018 22:20:30 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id CBDEED1F956; Tue, 23 Jan 2018 22:20:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id QSW6bU-7yL8W; Tue, 23 Jan 2018 22:20:28 +0000 (UTC) Received: from [192.168.2.110] (unknown [IPv6:fde9:577b:c1a9:31:2ef0:eeff:fe03:ee34]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 97332D1F955; Tue, 23 Jan 2018 22:20:28 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Kirk McKusick" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328304 - in head/lib/libc: gen sys Date: Tue, 23 Jan 2018 22:20:27 +0000 X-Mailer: MailMate (2.0BETAr6103) Message-ID: <9F23929C-273F-494A-A10D-113F3E7FCBD3@lists.zabbadoz.net> In-Reply-To: <201801232218.w0NMIjV3089843@repo.freebsd.org> References: <201801232218.w0NMIjV3089843@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 23 Jan 2018 22:20:33 -0000 On 23 Jan 2018, at 22:18, Kirk McKusick wrote: > Author: mckusick > Date: Tue Jan 23 22:18:45 2018 > New Revision: 328304 > URL: https://svnweb.freebsd.org/changeset/base/328304 > > > Modified: > head/lib/libc/gen/getgrent.c > head/lib/libc/sys/setgroups.2 > Modified: head/lib/libc/sys/setgroups.2 > ============================================================================== > --- head/lib/libc/sys/setgroups.2 Tue Jan 23 21:36:26 2018 (r328303) > +++ head/lib/libc/sys/setgroups.2 Tue Jan 23 22:18:45 2018 (r328304) You want to bump .Dd ? From owner-svn-src-all@freebsd.org Tue Jan 23 22:41:15 2018 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 29863ECCFBB; Tue, 23 Jan 2018 22:41:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 03BA27398D; Tue, 23 Jan 2018 22:41:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A41B14CA2; Tue, 23 Jan 2018 22:41:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NMfDhD002172; Tue, 23 Jan 2018 22:41:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NMfDWW002171; Tue, 23 Jan 2018 22:41:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801232241.w0NMfDWW002171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 23 Jan 2018 22:41:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328305 - head/lib/libcxxrt X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/lib/libcxxrt X-SVN-Commit-Revision: 328305 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 22:41:15 -0000 Author: emaste Date: Tue Jan 23 22:41:13 2018 New Revision: 328305 URL: https://svnweb.freebsd.org/changeset/base/328305 Log: libcxxrt: Move mangled symbols out of extern "C++" in Version.map r260553 added a number of mangled C++ symbols to Version.map inside of an existing `extern "C++"` block. ld.bfd 2.17.50 treats `extern "C++"` permissively and will match both mangled and demangled symbols against the strings in the version map block. ld.lld interprets `extern "C++"` strictly, and matches only demangled symbols. I believe lld's behaviour is correct. Contemporary versions of ld.bfd also behave as lld does, so move the mangled symbols out of the `extern "C++"` block. PR: 225128, 185663 MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/lib/libcxxrt/Version.map Modified: head/lib/libcxxrt/Version.map ============================================================================== --- head/lib/libcxxrt/Version.map Tue Jan 23 22:18:45 2018 (r328304) +++ head/lib/libcxxrt/Version.map Tue Jan 23 22:41:13 2018 (r328305) @@ -112,19 +112,6 @@ CXXABI_1.3 { "typeinfo for void"; "typeinfo for wchar_t const*"; "typeinfo for wchar_t"; - # C++11 typeinfo not understood by our linker - # std::nullptr_t - _ZTIDn;_ZTIPDn;_ZTIPKDn; - # char16_t - _ZTIDi;_ZTIPDi;_ZTIPKDi; - # char32_t - _ZTIDs;_ZTIPDs;_ZTIPKDs; - # IEEE 754r decimal floating point - _ZTIDd;_ZTIPDd;_ZTIPKDd; - _ZTIDe;_ZTIPDe;_ZTIPKDe; - _ZTIDf;_ZTIPDf;_ZTIPKDf; - # IEEE 754r half-precision floating point - _ZTIDh;_ZTIPDh;_ZTIPKDh; "typeinfo for bool*"; "typeinfo for wchar_t*"; @@ -209,19 +196,6 @@ CXXABI_1.3 { "typeinfo name for void*"; "typeinfo name for unsigned int*"; "typeinfo name for float*"; - # C++11 typeinfo name not understood by our linker - # std::nullptr_t - _ZTSDn;_ZTSPDn;_ZTSPKDn; - # char16_t - _ZTSDi;_ZTSPDi;_ZTSPKDi; - # char32_t - _ZTSDs;_ZTSPDs;_ZTSPKDs; - # IEEE 754r decimal floating point - _ZTSDd;_ZTSPDd;_ZTSPKDd; - _ZTSDe;_ZTSPDe;_ZTSPKDe; - _ZTSDf;_ZTSPDf;_ZTSPKDf; - # IEEE 754r half-precision floating point - _ZTSDh;_ZTSPDh;_ZTSPKDh; "typeinfo name for __cxxabiv1::__array_type_info"; "typeinfo name for __cxxabiv1::__class_type_info"; @@ -242,9 +216,35 @@ CXXABI_1.3 { "pathscale::set_terminate(void (*)())"; "pathscale::set_unexpected(void (*)())"; "pathscale::set_use_thread_local_handlers(bool)"; + }; + # C++11 typeinfo not understood by ld.bfd 2.17.50 + # std::nullptr_t + _ZTIDn;_ZTIPDn;_ZTIPKDn; + # char16_t + _ZTIDi;_ZTIPDi;_ZTIPKDi; + # char32_t + _ZTIDs;_ZTIPDs;_ZTIPKDs; + # IEEE 754r decimal floating point + _ZTIDd;_ZTIPDd;_ZTIPKDd; + _ZTIDe;_ZTIPDe;_ZTIPKDe; + _ZTIDf;_ZTIPDf;_ZTIPKDf; + # IEEE 754r half-precision floating point + _ZTIDh;_ZTIPDh;_ZTIPKDh; - }; + # C++11 typeinfo name not understood by ld.bfd 2.17.50 + # std::nullptr_t + _ZTSDn;_ZTSPDn;_ZTSPKDn; + # char16_t + _ZTSDi;_ZTSPDi;_ZTSPKDi; + # char32_t + _ZTSDs;_ZTSPDs;_ZTSPKDs; + # IEEE 754r decimal floating point + _ZTSDd;_ZTSPDd;_ZTSPKDd; + _ZTSDe;_ZTSPDe;_ZTSPKDe; + _ZTSDf;_ZTSPDf;_ZTSPKDf; + # IEEE 754r half-precision floating point + _ZTSDh;_ZTSPDh;_ZTSPKDh; local: *; From owner-svn-src-all@freebsd.org Tue Jan 23 23:12:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67F39ECE60E for ; Tue, 23 Jan 2018 23:12:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic305-18.consmr.mail.bf2.yahoo.com (sonic305-18.consmr.mail.bf2.yahoo.com [74.6.133.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B589968354 for ; Tue, 23 Jan 2018 23:04:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1516748647; bh=LmFz27SAAKflJikPbdcP4BapGkVKhMIoEh+qaHJtXFc=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=QS7h4YcKndMlwScr19TJwop6WQ8vvNKatBqhiMgydWlLqpyUbjYIfh3KhVxB6hgbcT06FcSkiZMWIwup6Sl1906cBkZBlj71al4jmKar3p4vhITBfIoNyxSNvWHO7Sdsl5RyP2d6iaxDaiVhH94V+j7vSJNYNkhcfX1BkPIyn3pWi+XEFdijFhLAtIPCdpOQk6c7MHxvcAI2lpaw5ti6FMhbH/WLJ7fh3JhCprv67ahp09yxAmqHukygqj5n5niRa/F7n+/EUeSOGmxBFkacy8qPjV1CiA1/X5imvFaEV6DKnJ/5d+BCRilaYEF/Oj/D0HUhH2VvCdW1taYC/0aJZQ== X-YMail-OSG: DC.Jof4VM1lLrW4p6gZHn0WX20j4qVlkP8_XH5SVN69itNwpL99wjExpQXR.IUL PbIHizNLYrgqZIxtNwxlotc6tzRyBH1syq_xDM4kCgJ6Ry.xLgHjr.9MY4wbiwNglxlpwIE1spgO hDkYs9fDSAOfinBpxZtzJLQClvgxPAYsHnOwRoLmdq8.lUP4OIsNiDb20a44fEAMsYDs2l7IRAKP E8Z4gizUVH_YhFdU.7r8IzdxuOmPqtuLQaYsyCymrDWmQw5Y3GLUtHgiI0b.GZhCJpQknaU6hYr4 P_JKYYeTnMkKoVla9d1peVeU2_lDat9r1zi21CdtyLARJHsDxejWQXHpqz.f0iGalanzx5xzW2Mx K33mVJ10imx514rV8OBhN1ssuQmJpEbiUbA.Ye8bRP1.UFEra9SVrRoPpXB9Xs5DiC9CUCjzxmjk OJcokfSbpdEal8FKGaddZe9UuRumy5aX4hFX.qNn4OaC3UJ8gs5lGOSXb0u5WWE7z7ynujlfF.MT CAl5W2F2Chg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.bf2.yahoo.com with HTTP; Tue, 23 Jan 2018 23:04:07 +0000 Received: from smtp103.rhel.mail.bf1.yahoo.com (EHLO [192.168.0.8]) ([98.139.230.213]) by smtp413.mail.bf1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 3e101f6fcb5385e598f3190fe37a2d27; Tue, 23 Jan 2018 23:04:04 +0000 (UTC) Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Bryan Drewery , cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <695a7cbd-f341-690c-5ad7-2551941bbf1e@FreeBSD.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <7d6e9800-d0d1-0855-6251-0ca46338acef@FreeBSD.org> Date: Tue, 23 Jan 2018 18:04:02 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <695a7cbd-f341-690c-5ad7-2551941bbf1e@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 23 Jan 2018 23:12:01 -0000 Hi; On 23/01/2018 17:13, Bryan Drewery wrote: > On 1/23/2018 11:40 AM, Pedro Giffuni wrote: >> Hi; >> >> >> On 23/01/2018 14:08, Conrad Meyer wrote: >>> Hi Pedro, >>> >>> On Sun, Jan 21, 2018 at 7:42 AM, Pedro F. Giffuni >>> wrote: >>>> Author: pfg >>>> Date: Sun Jan 21 15:42:36 2018 >>>> New Revision: 328218 >>>> URL: https://svnweb.freebsd.org/changeset/base/328218 >>>> >>>> Log: >>>>    Revert r327828, r327949, r327953, r328016-r328026, r328041: >>>>    Uses of mallocarray(9). >>>> >>>>    The use of mallocarray(9) has rocketed the required swap to build >>>> FreeBSD. >>>>    This is likely caused by the allocation size attributes which put >>>> extra pressure >>>>    on the compiler. >>> I'm confused about this change.  Wouldn't it be better to remove the >>> annotation/attributes from mallocarray() than to remove the protection >>> against overflow? >> Not in my opinion: it would be better to detect such overflows at >> compile time (or through a static analyzer) than to have late >> notification though panics. The blind use of mallocarray(9) is probably >> a mistake also: we shouldn't use it unless there is some real risk of >> overflow. >> >>>    (If the compiler is fixed in the future to not use >>> excessive memory with these attributes, they can be conditionalized on >>> compiler version, of course.) >> All in all, the compiler is not provably wrong: it's just using more >> swap space, which is rather inconvenient for small platforms but not >> necessarily wrong. >> >> Pedro. >> >> > I haven't dug into this to understand it all, but if mallocarray() is > causing this sort of compilation problem then isn't the problem the > compiler? Why keep a "dangerous" function around and not actually fix > it? Is there a bug somewhere to fix the compilation load? > In all honesty .. I don't know what is going on. I theorize it may be related to attributes but who knows. I wouldn't say mallocarray(9) is dangerous, it's just not worth my time specially since most of those multiplications have no chance of overflowing. I will put up a patch with all the malloc --> mallocarray replacements in case someone wants to spend time on it. Pedro. From owner-svn-src-all@freebsd.org Tue Jan 23 23:26:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73CD9ED0567; Tue, 23 Jan 2018 23:26:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 23B926AE6B; Tue, 23 Jan 2018 23:26:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 792DD14E5E; Tue, 23 Jan 2018 22:48:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NMm6HZ002464; Tue, 23 Jan 2018 22:48:06 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NMm6nk002462; Tue, 23 Jan 2018 22:48:06 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801232248.w0NMm6nk002462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 23 Jan 2018 22:48:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328306 - head/bin/ps X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/bin/ps X-SVN-Commit-Revision: 328306 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 23:26:48 -0000 Author: jhb Date: Tue Jan 23 22:48:06 2018 New Revision: 328306 URL: https://svnweb.freebsd.org/changeset/base/328306 Log: Remove some KSE references from ps(1). - Simplify the description of -H to assume 1:1 threading. - Drop 'process' from description of 'lwp' field and the corresponding XO field name. - Do add an expansion of LWP in the description of 'lwp' and 'nlwps'. - Add 'tid' as an alias for the 'lwp' field. Reviewed by: imp, kib (older version) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14021 Modified: head/bin/ps/keyword.c head/bin/ps/ps.1 Modified: head/bin/ps/keyword.c ============================================================================== --- head/bin/ps/keyword.c Tue Jan 23 22:41:13 2018 (r328305) +++ head/bin/ps/keyword.c Tue Jan 23 22:48:06 2018 (r328306) @@ -122,7 +122,7 @@ static VAR var[] = { {"logname", "", "login", NULL, 0, NULL, 0, CHAR, NULL, 0}, {"lstart", "STARTED", NULL, "start-time", LJUST|USER, lstarted, 0, CHAR, NULL, 0}, - {"lwp", "LWP", NULL, "process-thread-id", 0, kvar, KOFF(ki_tid), UINT, + {"lwp", "LWP", NULL, "thread-id", 0, kvar, KOFF(ki_tid), UINT, LWPFMT, 0}, {"majflt", "MAJFLT", NULL, "major-faults", USER, rvar, ROFF(ru_majflt), LONG, "ld", 0}, @@ -204,6 +204,7 @@ static VAR var[] = { {"tdnam", "", "tdname", NULL, 0, NULL, 0, CHAR, NULL, 0}, {"tdname", "TDNAME", NULL, "thread-name", LJUST, tdnam, 0, CHAR, NULL, 0}, + {"tid", "", "lwp", NULL, 0, NULL, 0, CHAR, NULL, 0}, {"time", "TIME", NULL, "cpu-time", USER, cputime, 0, CHAR, NULL, 0}, {"tpgid", "TPGID", NULL, "terminal-process-gid", 0, kvar, KOFF(ki_tpgid), UINT, PIDFMT, 0}, Modified: head/bin/ps/ps.1 ============================================================================== --- head/bin/ps/ps.1 Tue Jan 23 22:41:13 2018 (r328305) +++ head/bin/ps/ps.1 Tue Jan 23 22:48:06 2018 (r328306) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd December 1, 2017 +.Dd January 23, 2018 .Dt PS 1 .Os .Sh NAME @@ -148,12 +148,7 @@ This option is honored only if the UID of the user is Display information about processes which are running with the specified real group IDs. .It Fl H -Show all of the -.Em kernel visible -threads associated with each process. -Depending on the threading package that -is in use, this may show only the process, only the kernel scheduled entities, -or all of the process threads. +Show all of the threads associated with each process. .It Fl h Repeat the information header as often as necessary to guarantee one header per page of information. @@ -588,7 +583,8 @@ login name of user who started the session .It Cm lstart time started .It Cm lwp -process thread-id +thread (light-weight process) ID (alias +.Cm tid ) .It Cm majflt total page faults .It Cm minflt @@ -605,7 +601,7 @@ nice value (alias .It Cm nivcsw total involuntary context switches .It Cm nlwp -number of threads tied to a process +number of threads (light-weight processes) tied to a process .It Cm nsigs total signals taken (alias .Cm nsignals ) From owner-svn-src-all@freebsd.org Tue Jan 23 23:30:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47A98ED0B94; Tue, 23 Jan 2018 23:30:20 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6B476B40C; Tue, 23 Jan 2018 23:30:19 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98F1015ACA; Tue, 23 Jan 2018 23:30:19 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NNUJ7B019645; Tue, 23 Jan 2018 23:30:19 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NNUJfn019643; Tue, 23 Jan 2018 23:30:19 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801232330.w0NNUJfn019643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 23 Jan 2018 23:30:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328307 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 328307 X-SVN-Commit-Repository: base 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.25 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, 23 Jan 2018 23:30:20 -0000 Author: ian Date: Tue Jan 23 23:30:19 2018 New Revision: 328307 URL: https://svnweb.freebsd.org/changeset/base/328307 Log: Fix a bug introduced with recursive bus ownership support in r321584. The recursive ownership support added in r321584 was unconditionally in effect all the time -- whenever a given i2c slave device instance tried to lock the i2c bus for exclusive use when it already owned the bus, the call returned immediately without waiting. However, many i2c slave drivers use bus ownership to enforce that only a single thread at a time can be using the slave device. The recursive locking changes broke this use case. Now there is a new flag, IIC_RECURSIVE, which can be mixed in with the other flags passed to iicbus_acquire_bus() to allow drivers to indicate when recursive locking is desired. Using the flag implies that the driver is managing concurrent access to the device by different threads in some way. This immediately fixes all existing i2c slave drivers except for the two i2c RTC drivers which use the recursive locking feature; those will be fixed in a followup commit. Modified: head/sys/dev/iicbus/iiconf.c head/sys/dev/iicbus/iiconf.h Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Tue Jan 23 22:48:06 2018 (r328306) +++ head/sys/dev/iicbus/iiconf.c Tue Jan 23 23:30:19 2018 (r328307) @@ -84,7 +84,7 @@ iicbus_poll(struct iicbus_softc *sc, int how) int error; IICBUS_ASSERT_LOCKED(sc); - switch (how) { + switch (how & IIC_INTRWAIT) { case IIC_WAIT | IIC_INTR: error = mtx_sleep(sc, &sc->lock, IICPRI|PCATCH, "iicreq", 0); break; @@ -115,8 +115,14 @@ iicbus_request_bus(device_t bus, device_t dev, int how IICBUS_LOCK(sc); - while (error == 0 && sc->owner != NULL && sc->owner != dev) - error = iicbus_poll(sc, how); + for (;;) { + if (sc->owner == NULL) + break; + if ((how & IIC_RECURSIVE) && sc->owner == dev) + break; + if ((error = iicbus_poll(sc, how)) != 0) + break; + } if (error == 0) { ++sc->owncount; Modified: head/sys/dev/iicbus/iiconf.h ============================================================================== --- head/sys/dev/iicbus/iiconf.h Tue Jan 23 22:48:06 2018 (r328306) +++ head/sys/dev/iicbus/iiconf.h Tue Jan 23 23:30:19 2018 (r328307) @@ -39,13 +39,14 @@ #define LSB 0x1 /* - * How tsleep() is called in iic_request_bus(). + * Options affecting iicbus_request_bus() */ #define IIC_DONTWAIT 0 #define IIC_NOINTR 0 #define IIC_WAIT 0x1 #define IIC_INTR 0x2 #define IIC_INTRWAIT (IIC_INTR | IIC_WAIT) +#define IIC_RECURSIVE 0x4 /* * i2c modes From owner-svn-src-all@freebsd.org Wed Jan 24 00:11:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB68FED3FA3; Wed, 24 Jan 2018 00:11:46 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7FEA26DC1A; Wed, 24 Jan 2018 00:11:46 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AD7216329; Wed, 24 Jan 2018 00:11:46 +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 w0O0BkcK036954; Wed, 24 Jan 2018 00:11:46 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O0Bk5S036953; Wed, 24 Jan 2018 00:11:46 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801240011.w0O0Bk5S036953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 24 Jan 2018 00:11: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: r328308 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 328308 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 00:11:47 -0000 Author: pfg Date: Wed Jan 24 00:11:46 2018 New Revision: 328308 URL: https://svnweb.freebsd.org/changeset/base/328308 Log: MFC r328221: Define a new __alloc_size2 attribute to complement the existing support. At least on GCC7, calling __alloc_size(x) twice is not equivalent to calling using the attribute once with two arguments. The later is the documented use in GCC documentation so add a new alloc_size(n, x) alternative to cover for the few places where it is used: basically: calloc(3), reallocarray(3) and mallocarray(9). Submitted by: Mark Millard Modified: stable/11/sys/sys/cdefs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/cdefs.h ============================================================================== --- stable/11/sys/sys/cdefs.h Tue Jan 23 23:30:19 2018 (r328307) +++ stable/11/sys/sys/cdefs.h Wed Jan 24 00:11:46 2018 (r328308) @@ -239,8 +239,10 @@ #endif #if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__) #define __alloc_size(x) __attribute__((__alloc_size__(x))) +#define __alloc_size2(n, x) __attribute__((__alloc_size__(n, x))) #else #define __alloc_size(x) +#define __alloc_size2(n, x) #endif #if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__) #define __alloc_align(x) __attribute__((__alloc_align__(x))) From owner-svn-src-all@freebsd.org Wed Jan 24 00:32:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB536ED59A8; Wed, 24 Jan 2018 00:32:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 989FA6EBB3; Wed, 24 Jan 2018 00:32:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93A47165DB; Wed, 24 Jan 2018 00:32:02 +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 w0O0W2Kd047620; Wed, 24 Jan 2018 00:32:02 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O0W2AU047619; Wed, 24 Jan 2018 00:32:02 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801240032.w0O0W2AU047619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 00:32:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328309 - in stable: 10/tests/sys/kern 11/tests/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/tests/sys/kern 11/tests/sys/kern X-SVN-Commit-Revision: 328309 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 00:32:03 -0000 Author: jhb Date: Wed Jan 24 00:32:02 2018 New Revision: 328309 URL: https://svnweb.freebsd.org/changeset/base/328309 Log: MFC 326953: Catch up to r325719 which makes the kern.proc.pid sysctl "work" for zombies. Some of the ptrace tests need to wait for a child process to become a zombie before preceding. The parent process polls the child process via the kern.proc.pid sysctl to wait for it to become a zombie. Previously the code polled until the sysctl failed with ESRCH. Now it will poll until either the sysctl fails with ESRCH (for compatiblity with older kernels) or returns a kinfo_proc structure with the ki_stat field set to SZOMB. Modified: stable/10/tests/sys/kern/ptrace_test.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/tests/sys/kern/ptrace_test.c Directory Properties: stable/11/ (props changed) Modified: stable/10/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/10/tests/sys/kern/ptrace_test.c Wed Jan 24 00:11:46 2018 (r328308) +++ stable/10/tests/sys/kern/ptrace_test.c Wed Jan 24 00:32:02 2018 (r328309) @@ -103,6 +103,10 @@ wait_for_zombie(pid_t pid) /* * Wait for a process to exit. This is kind of gross, but * there is not a better way. + * + * Prior to r325719, the kern.proc.pid. sysctl failed + * with ESRCH. After that change, a valid struct kinfo_proc + * is returned for zombies with ki_stat set to SZOMB. */ for (;;) { struct kinfo_proc kp; @@ -115,10 +119,11 @@ wait_for_zombie(pid_t pid) mib[3] = pid; len = sizeof(kp); if (sysctl(mib, nitems(mib), &kp, &len, NULL, 0) == -1) { - /* The KERN_PROC_PID sysctl fails for zombies. */ ATF_REQUIRE(errno == ESRCH); break; } + if (kp.ki_stat == SZOMB) + break; usleep(5000); } } From owner-svn-src-all@freebsd.org Wed Jan 24 00:32:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B4EEED59AA; Wed, 24 Jan 2018 00:32:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B37EE6EBB5; Wed, 24 Jan 2018 00:32:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE6EE165DD; Wed, 24 Jan 2018 00:32:02 +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 w0O0W2PE047626; Wed, 24 Jan 2018 00:32:02 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O0W2GD047625; Wed, 24 Jan 2018 00:32:02 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801240032.w0O0W2GD047625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 00:32: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: r328309 - in stable: 10/tests/sys/kern 11/tests/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/tests/sys/kern 11/tests/sys/kern X-SVN-Commit-Revision: 328309 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 00:32:03 -0000 Author: jhb Date: Wed Jan 24 00:32:02 2018 New Revision: 328309 URL: https://svnweb.freebsd.org/changeset/base/328309 Log: MFC 326953: Catch up to r325719 which makes the kern.proc.pid sysctl "work" for zombies. Some of the ptrace tests need to wait for a child process to become a zombie before preceding. The parent process polls the child process via the kern.proc.pid sysctl to wait for it to become a zombie. Previously the code polled until the sysctl failed with ESRCH. Now it will poll until either the sysctl fails with ESRCH (for compatiblity with older kernels) or returns a kinfo_proc structure with the ki_stat field set to SZOMB. Modified: stable/11/tests/sys/kern/ptrace_test.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/tests/sys/kern/ptrace_test.c Directory Properties: stable/10/ (props changed) Modified: stable/11/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/11/tests/sys/kern/ptrace_test.c Wed Jan 24 00:11:46 2018 (r328308) +++ stable/11/tests/sys/kern/ptrace_test.c Wed Jan 24 00:32:02 2018 (r328309) @@ -104,6 +104,10 @@ wait_for_zombie(pid_t pid) /* * Wait for a process to exit. This is kind of gross, but * there is not a better way. + * + * Prior to r325719, the kern.proc.pid. sysctl failed + * with ESRCH. After that change, a valid struct kinfo_proc + * is returned for zombies with ki_stat set to SZOMB. */ for (;;) { struct kinfo_proc kp; @@ -116,10 +120,11 @@ wait_for_zombie(pid_t pid) mib[3] = pid; len = sizeof(kp); if (sysctl(mib, nitems(mib), &kp, &len, NULL, 0) == -1) { - /* The KERN_PROC_PID sysctl fails for zombies. */ ATF_REQUIRE(errno == ESRCH); break; } + if (kp.ki_stat == SZOMB) + break; usleep(5000); } } From owner-svn-src-all@freebsd.org Wed Jan 24 00:52:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9658CED7414; Wed, 24 Jan 2018 00:52:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4AF886FDCC; Wed, 24 Jan 2018 00:52:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4479816A6F; Wed, 24 Jan 2018 00:52: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 w0O0qQ9U056682; Wed, 24 Jan 2018 00:52:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O0qQYk056680; Wed, 24 Jan 2018 00:52:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801240052.w0O0qQYk056680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 24 Jan 2018 00:52: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: r328310 - stable/11/usr.bin/clang/lld X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.bin/clang/lld X-SVN-Commit-Revision: 328310 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 00:52:26 -0000 Author: emaste Date: Wed Jan 24 00:52:25 2018 New Revision: 328310 URL: https://svnweb.freebsd.org/changeset/base/328310 Log: MFC r327770: lld: introduce basic man page Upstream lld has no man page. Introduce a basic one for FreeBSD based on ld.lld --help, with a brief introduction and additional detail for some options. We'll continue refining this in FreeBSD, and then submit it upstream once the first round of edits are complete. Submitted by: krion, Arshan Khanifar, emaste, bjk Sponsored by: The FreeBSD Foundation Added: stable/11/usr.bin/clang/lld/ld.lld.1 - copied unchanged from r327770, head/usr.bin/clang/lld/ld.lld.1 Modified: stable/11/usr.bin/clang/lld/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/clang/lld/Makefile ============================================================================== --- stable/11/usr.bin/clang/lld/Makefile Wed Jan 24 00:32:02 2018 (r328309) +++ stable/11/usr.bin/clang/lld/Makefile Wed Jan 24 00:52:25 2018 (r328310) @@ -7,9 +7,10 @@ LLD_SRCS= ${LLVM_SRCS}/tools/lld PACKAGE= lld PROG_CXX= ld.lld -MAN= + .if ${MK_LLD_IS_LD} != "no" SYMLINKS= ${PROG_CXX} ${BINDIR}/ld +MLINKS= ld.lld.1 ld.1 .endif CFLAGS+= -I${LLD_SRCS}/ELF Copied: stable/11/usr.bin/clang/lld/ld.lld.1 (from r327770, head/usr.bin/clang/lld/ld.lld.1) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/usr.bin/clang/lld/ld.lld.1 Wed Jan 24 00:52:25 2018 (r328310, copy of r327770, head/usr.bin/clang/lld/ld.lld.1) @@ -0,0 +1,364 @@ +.\"- +.\" Copyright (c) 2018 Kirill Ponomarev +.\" Copyright (c) 2018 The FreeBSD Foundation +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 10, 2018 +.Dt LD.LLD 1 +.Os +.Sh NAME +.Nm ld.lld +.Nd ELF linker from the LLVM project +.Sh SYNOPSIS +.Nm ld.lld +.Op Ar options +.Ar objfile ... +.Sh DESCRIPTION +A linker takes one or more object, archive and library files, and combines +them into an output file (an executable, a shared library, or another object +file). +It relocates code and data from the input files and resolves symbol +references between them. +.Pp +.Nm +is a drop-in replacement for the GNU BFD and gold linkers. +It accepts most of the same command line arguments and linker scripts +as GNU linkers. +.Pp +The following options are available: +.Bl -tag -width indent +.It Fl -allow-multiple-definition +Allow multiple definitions. +.It Fl -as-needed +Only set +.Dv DT_NEEDED +for shared libraries if used. +.It Fl -auxiliary Ar value +Set the +.Dv DT_AUXILIARY +field to the specified name. +.It Fl -Bdynamic +Link against shared libraries. +.It Fl -Bstatic +Do not link against shared libraries. +.It Fl -Bsymbolic-functions +Bind defined function symbols locally. +.It Fl -Bsymbolic +Bind defined symbols locally. +.It Fl -build-id= Ns Ar value +Generate a build ID note. +.It Fl -build-id +Generate a build ID note. +.It Fl -color-diagnostics= Ns Ar value +Use colors in diagnostics. +.It Fl -color-diagnostics +Use colors in diagnostics. +.It Fl -compress-debug-sections= Ns Ar value +Compress DWARF debug sections. +.It Fl -define-common +Assign space to common symbols. +.It Fl -defsym= Ns Ar value +Define a symbol alias. +.It Fl -demangle +Demangle symbol names. +.It Fl -disable-new-dtags +Disable new dynamic tags. +.It Fl -discard-all +Delete all local symbols. +.It Fl -discard-locals +Delete temporary local symbols. +.It Fl -discard-none +Keep all symbols in the symbol table. +.It Fl -dynamic-linker Ar value +Specify the dynamic linker to be used for a dynamically linked executable. +This is recorded in an ELF segment of type +.Dv PT_INTERP . +.It Fl -dynamic-list Ar value +Read a list of dynamic symbols. +.It Fl -eh-frame-hdr +Request creation of +.Li .eh_frame_hdr +section and +.Dv PT_GNU_EH_FRAME +segment header. +.It Fl -emit-relocs +Generate relocations in the output. +.It Fl -enable-new-dtags +Enable new dynamic tags. +.It Fl -end-lib +End a grouping of objects that should be treated as if they were together +in an archive. +.It Fl -entry Ar entry +Name of entry point symbol. +.It Fl -error-limit Ar value +Maximum number of errors to emit before stopping. +A value of zero indicates that there is no limit. +.It Fl -error-unresolved-symbols +Report unresolved symbols as errors. +.It Fl -exclude-libs Ar value +Exclude static libraries from automatic export. +.It Fl -export-dynamic-symbol Ar value +Put a symbol in the dynamic symbol table. +.It Fl -export-dynamic +Put symbols in the dynamic symbol table. +.It Fl -fatal-warnings +Treat warnings as errors. +.It Fl -filter= Ns Ar value +Set the +.Dv DT_FILTER +field to the specified value. +.It Fl -fini Ar symbol +Specify a finalizer function. +.It Fl -format= Ns Ar input-format +Change the input format of the inputs following this option. +.It Fl -full-shutdown +Perform a full shutdown instead of calling +.Fn _exit . +.It Fl -gc-sections +Enable garbage collection of unused sections. +.It Fl -gdb-index +Generate +.Li .gdb_index +section. +.It Fl -hash-style Ar value +Specify hash style (sysv, gnu or both). +.It Fl -help +Print a usage message. +.It Fl -icf=all +Enable identical code folding. +.It Fl -icf=none +Disable identical code folding. +.It Fl -image-base= Ns Ar value +Set the base address to +.Ar value . +.It Fl -init Ar symbol +Specify an initializer function. +.It Fl -lto-aa-pipeline= Ns Ar value +AA pipeline to run during LTO. +Used in conjunction with +.Fl -lto-newpm-passes . +.It Fl -lto-newpm-passes= Ns Ar value +Passes to run during LTO. +.It Fl -lto-O Ar opt-level +Optimization level for LTO. +.It Fl -lto-partitions= Ns Ar value +Number of LTO codegen partitions. +.It Fl L Ar dir +Add a directory to the library search path. +.It Fl l Ar libName +Root name of library to use. +.It Fl -Map Ar value +Print a link map to the specified file. +.It Fl m Ar value +Set target emulation. +.It Fl -no-as-needed +Always set +.Dv DT_NEEDED +for shared libraries. +.It Fl -no-color-diagnostics +Do not use colors in diagnostics. +.It Fl -no-define-common +Do not assign space to common symbols. +.It Fl -no-demangle +Do not demangle symbol names. +.It Fl -no-dynamic-linker +Inhibit output of an +.Li .interp +section. +.It Fl -no-gc-sections +Disable garbage collection of unused sections. +.It Fl -no-gnu-unique +Disable STB_GNU_UNIQUE symbol binding. +.It Fl -no-rosegment +Do not put read-only non-executable sections in their own segment. +.It Fl -no-threads +Do not run the linker multi-threaded. +.It Fl -no-undefined-version +Report version scripts that refer undefined symbols. +.It Fl -no-undefined +Report unresolved symbols even if the linker is creating a shared library. +.It Fl -no-whole-archive +Restores the default behavior of loading archive members. +.It Fl -noinhibit-exec +Retain the executable output file whenever it is still usable. +.It Fl -nopie +Do not create a position independent executable. +.It Fl -nostdlib +Only search directories specified on the command line. +.It Fl -oformat Ar format +Specify the binary format for the output object file. +.It Fl -omagic +Set the text and data sections to be readable and writable. +.It Fl -opt-remarks-filename Ar value +YAML output file for optimization remarks. +.It Fl -opt-remarks-with-hotness +Include hotness information in the optimization remarks file. +.It Fl O Ar value +Optimize output file size. +.It Fl o Ar path +Write the output executable, library or object to +.Ar path . +If not specified, +.Dv a.out +is used as a default. +.It Fl -pie +Create a position independent executable. +.It Fl -print-gc-sections +List removed unused sections. +.It Fl -print-map +Print a link map to the standard output. +.It Fl -relocatable +Create relocatable object file. +.It Fl -reproduce Ar value +Dump linker invocation and input files for debugging. +.It Fl -retain-symbols-file= Ns Ar file +Retain only the symbols listed in the file. +.It Fl -rpath Ar value +Add a +.Dv DT_RUNPATH +to the output. +.It Fl -rsp-quoting= Ns Ar value +Quoting style for response files. +The supported values are +.Ar windows +and +.Ar posix . +.It Fl -script Ar value +Read linker script from the path +.Ar value . +.It Fl -section-start Ar address +Set address of section. +.It Fl -shared +Build a shared object. +.It Fl -soname= Ns Ar value +Set +.Dv DT_SONAME +to +.Ar value . +.It Fl -sort-section Ar value +Specifies sections sorting rule when linkerscript is used. +.It Fl -start-lib +Start a grouping of objects that should be treated as if they were together +in an archive. +.It Fl -strip-all +Strip all symbols. +.It Fl -strip-debug +Strip debugging information. +.It Fl -symbol-ordering-file Ar value +Lay out sections in the order specified by the symbol file. +.It Fl -sysroot= Ns Ar value +Set the system root. +.It Fl -target1-abs +Interpret +.Dv R_ARM_TARGET1 +as +.Dv R_ARM_ABS32 . +.It Fl -target1-rel +Interpret +.Dv R_ARM_TARGET1 +as +.Dv R_ARM_REL32 . +.It Fl -target2=type +Interpret +.Dv R_ARM_TARGET2 +as +.Ar type , +where +.Ar type +is one of +.Li rel , +.Li abs , +or +.Li got-rel . +.It Fl -Tbss Ar value +Same as +.Fl -section-start +with +.Li .bss +as the sectionname. +.It Fl -Tdata Ar value +Same as +.Fl -section-start +with +.Li .data +as the sectionname. +.It Fl -thinlto-cache-dir= Ns Ar value +Path to ThinLTO cached object file directory. +.It Fl -thinlto-cache-policy Ar value +Pruning policy for the ThinLTO cache. +.It Fl -thinlto-jobs= Ns Ar value +Number of ThinLTO jobs. +.It Fl -threads +Run the linker multi-threaded. +.It Fl -trace-symbol Ar value +Trace references to symbols. +.It Fl -trace +Print the names of the input files. +.It Fl -Ttext Ar value +Same as +.Fl -section-start +with +.Li .text +as the sectionname. +.It Fl -undefined Ar value +Force undefined symbol during linking. +.It Fl -unresolved-symbols= Ns Ar value +Determine how to handle unresolved symbols. +.It Fl -verbose +Verbose mode. +.It Fl -version-script Ar value +Read a version script. +.It Fl V , Fl -version +Display the version number and exit. +.It Fl v +Display the version number, and proceed with linking if object files are +specified. +.It Fl -warn-common +Warn about duplicate common symbols. +.It Fl -warn-unresolved-symbols +Report unresolved symbols as warnings. +.It Fl -whole-archive +Force load of all members in a static library. +.It Fl -wrap Ar symbol +Use wrapper functions for symbol. +.It Fl z Ar option +Linker option extensions. +.Bl -tag -width indent +.It Cm notext +Allow relocations against read-only segments. +Sets the +.Dv DT_TEXTREL flag in the +.Dv DYNAMIC +section. +.It Cm text +Do not allow relocations against read-only segments. +This is the default. +.El +.El +.Sh IMPLEMENTATION NOTES +The targets supported by +.Nm +are: +elf32-i386 elf32-iamcu elf32-littlearm elf32-ntradbigmips elf32-ntradlittlemips elf32-powerpc elf32-tradbigmips elf32-tradlittlemips elf32-x86-64 elf64-amdgpu elf64-littleaarch64 elf64-powerpc elf64-tradbigmips elf64-tradlittlemips elf64-x86-64 From owner-svn-src-all@freebsd.org Wed Jan 24 03:09:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4CA9EB6C3B; Wed, 24 Jan 2018 03:09:41 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74F73744E9; Wed, 24 Jan 2018 03:09:41 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FD8D1800E; Wed, 24 Jan 2018 03:09:41 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0O39fWM020151; Wed, 24 Jan 2018 03:09:41 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O39f05020150; Wed, 24 Jan 2018 03:09:41 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801240309.w0O39f05020150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 24 Jan 2018 03:09:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328311 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 328311 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 03:09:42 -0000 Author: ian Date: Wed Jan 24 03:09:41 2018 New Revision: 328311 URL: https://svnweb.freebsd.org/changeset/base/328311 Log: Follow changes in r328307 by using new IIC_RECURSIVE flag. The driver now ensures only one thread at a time is running in the API functions (clock_gettime() and clock_settime()) by specifically requesting ownership of the i2c bus without using IIC_RECURSIVE, then it does all IO using IIC_RECURSIVE so that each individual IO operation doesn't try to re-acquire the bus. The other IO done by the driver happens at attach or intr_config_hooks time, when there can't be multiple threads running with the same device instance. So, the IIC_RECURSIVE flag can be safely ORed into the wait flags for all IO done by the driver, because it's all either done in a single-threaded environment, or protected within a block bounded by explict iicbus_acquire_bus() and iicbus_release_bus() calls. Modified: head/sys/dev/iicbus/isl12xx.c Modified: head/sys/dev/iicbus/isl12xx.c ============================================================================== --- head/sys/dev/iicbus/isl12xx.c Wed Jan 24 00:52:25 2018 (r328310) +++ head/sys/dev/iicbus/isl12xx.c Wed Jan 24 03:09:41 2018 (r328311) @@ -137,18 +137,27 @@ static struct ofw_compat_data compat_data[] = { }; #endif +/* + * When doing i2c IO, indicate that we need to wait for exclusive bus ownership, + * but that we should not wait if we already own the bus. This lets us put + * iicbus_acquire_bus() calls with a non-recursive wait at the entry of our API + * functions to ensure that only one client at a time accesses the hardware for + * the entire series of operations it takes to read or write the clock. + */ +#define WAITFLAGS (IIC_WAIT | IIC_RECURSIVE) + static inline int isl12xx_read1(struct isl12xx_softc *sc, uint8_t reg, uint8_t *data) { - return (iicdev_readfrom(sc->dev, reg, data, 1, IIC_WAIT)); + return (iicdev_readfrom(sc->dev, reg, data, 1, WAITFLAGS)); } static inline int isl12xx_write1(struct isl12xx_softc *sc, uint8_t reg, uint8_t val) { - return (iicdev_writeto(sc->dev, reg, &val, 1, IIC_WAIT)); + return (iicdev_writeto(sc->dev, reg, &val, 1, WAITFLAGS)); } static void @@ -229,17 +238,23 @@ isl12xx_gettime(device_t dev, struct timespec *ts) int err; uint8_t hourmask, sreg; - /* If power failed, we can't provide valid time. */ - if ((err = isl12xx_read1(sc, ISL12XX_SR_REG, &sreg)) != 0) + /* + * Read the status and time registers. + */ + if ((err = iicbus_request_bus(sc->busdev, sc->dev, IIC_WAIT)) == 0) { + if ((err = isl12xx_read1(sc, ISL12XX_SR_REG, &sreg)) == 0) { + err = iicdev_readfrom(sc->dev, ISL12XX_SC_REG, &tregs, + sizeof(tregs), WAITFLAGS); + } + iicbus_release_bus(sc->busdev, sc->dev); + } + if (err != 0) return (err); + + /* If power failed, we can't provide valid time. */ if (sreg & ISL12XX_SR_RTCF) return (EINVAL); - /* Read the bcd time registers. */ - if ((err = iicdev_readfrom(sc->dev, ISL12XX_SC_REG, &tregs, sizeof(tregs), - IIC_WAIT)) != 0) - return (EINVAL); - /* If chip is in AM/PM mode remember that for when we set time. */ if (tregs.hour & ISL12XX_24HR_FLAG) { hourmask = ISL12xx_24HR_MASK; @@ -319,7 +334,7 @@ isl12xx_settime(device_t dev, struct timespec *ts) sreg |= ISL12XX_SR_WRTC | ISL12XX_SR_W0C_BITS; if ((err = isl12xx_write1(sc, ISL12XX_SR_REG, sreg)) == 0) { err = iicdev_writeto(sc->dev, ISL12XX_SC_REG, &tregs, - sizeof(tregs), IIC_WAIT); + sizeof(tregs), WAITFLAGS); sreg &= ~ISL12XX_SR_WRTC; isl12xx_write1(sc, ISL12XX_SR_REG, sreg); } From owner-svn-src-all@freebsd.org Wed Jan 24 03:09:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FFCCEB6CA1; Wed, 24 Jan 2018 03:09:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 130D5745DC; Wed, 24 Jan 2018 03:09:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D6661800F; Wed, 24 Jan 2018 03:09:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0O39umM020201; Wed, 24 Jan 2018 03:09:56 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O39u2p020200; Wed, 24 Jan 2018 03:09:56 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801240309.w0O39u2p020200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 24 Jan 2018 03:09:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328312 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 328312 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 03:09:57 -0000 Author: ian Date: Wed Jan 24 03:09:56 2018 New Revision: 328312 URL: https://svnweb.freebsd.org/changeset/base/328312 Log: Follow changes in r328307 by using new IIC_RECURSIVE flag. The driver now ensures only one thread at a time is running in the API functions (clock_gettime() and clock_settime()) by specifically requesting ownership of the i2c bus without using IIC_RECURSIVE, then it does all IO using IIC_RECURSIVE so that each individual IO operation doesn't try to re-acquire the bus. The other IO done by the driver happens at attach or intr_config_hooks time, when there can't be multiple threads running with the same device instance. So, the IIC_RECURSIVE flag can be safely ORed into the wait flags for all IO done by the driver, because it's all either done in a single-threaded environment, or protected within a block bounded by explict iicbus_acquire_bus() and iicbus_release_bus() calls. Modified: head/sys/dev/iicbus/nxprtc.c Modified: head/sys/dev/iicbus/nxprtc.c ============================================================================== --- head/sys/dev/iicbus/nxprtc.c Wed Jan 24 03:09:41 2018 (r328311) +++ head/sys/dev/iicbus/nxprtc.c Wed Jan 24 03:09:56 2018 (r328312) @@ -198,6 +198,15 @@ struct nxprtc_softc { #define SC_F_CPOL (1 << 0) /* Century bit means 19xx */ /* + * When doing i2c IO, indicate that we need to wait for exclusive bus ownership, + * but that we should not wait if we already own the bus. This lets us put + * iicbus_acquire_bus() calls with a non-recursive wait at the entry of our API + * functions to ensure that only one client at a time accesses the hardware for + * the entire series of operations it takes to read or write the clock. + */ +#define WAITFLAGS (IIC_WAIT | IIC_RECURSIVE) + +/* * We use the compat_data table to look up hint strings in the non-FDT case, so * define the struct locally when we don't get it from ofw_bus_subr.h. */ @@ -230,14 +239,14 @@ static int read_reg(struct nxprtc_softc *sc, uint8_t reg, uint8_t *val) { - return (iicdev_readfrom(sc->dev, reg, val, sizeof(*val), IIC_WAIT)); + return (iicdev_readfrom(sc->dev, reg, val, sizeof(*val), WAITFLAGS)); } static int write_reg(struct nxprtc_softc *sc, uint8_t reg, uint8_t val) { - return (iicdev_writeto(sc->dev, reg, &val, sizeof(val), IIC_WAIT)); + return (iicdev_writeto(sc->dev, reg, &val, sizeof(val), WAITFLAGS)); } static int @@ -264,7 +273,7 @@ read_timeregs(struct nxprtc_softc *sc, struct time_reg continue; } if ((err = iicdev_readfrom(sc->dev, sc->secaddr, tregs, - sizeof(*tregs), IIC_WAIT)) != 0) + sizeof(*tregs), WAITFLAGS)) != 0) break; } while (sc->use_timer && tregs->sec != sec); @@ -294,7 +303,7 @@ write_timeregs(struct nxprtc_softc *sc, struct time_re { return (iicdev_writeto(sc->dev, sc->secaddr, tregs, - sizeof(*tregs), IIC_WAIT)); + sizeof(*tregs), WAITFLAGS)); } static int @@ -557,14 +566,15 @@ nxprtc_gettime(device_t dev, struct timespec *ts) * bit is not set in the control reg. The latter can happen if there * was an error when setting the time. */ - if ((err = read_timeregs(sc, &tregs, &tmrcount)) != 0) { - device_printf(dev, "cannot read RTC time\n"); - return (err); + if ((err = iicbus_request_bus(sc->busdev, sc->dev, IIC_WAIT)) == 0) { + if ((err = read_timeregs(sc, &tregs, &tmrcount)) == 0) { + err = read_reg(sc, PCF85xx_R_CS1, &cs1); + } + iicbus_release_bus(sc->busdev, sc->dev); } - if ((err = read_reg(sc, PCF85xx_R_CS1, &cs1)) != 0) { - device_printf(dev, "cannot read RTC time\n"); + if (err != 0) return (err); - } + if ((tregs.sec & PCF85xx_B_SECOND_OS) || (cs1 & PCF85xx_B_CS1_STOP)) { device_printf(dev, "RTC clock not running\n"); return (EINVAL); /* hardware is good, time is not. */ From owner-svn-src-all@freebsd.org Wed Jan 24 04:29:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6DBDEBB691; Wed, 24 Jan 2018 04:29:17 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6648776C4D; Wed, 24 Jan 2018 04:29:17 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 591CB18D02; Wed, 24 Jan 2018 04:29:17 +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 w0O4THGT059441; Wed, 24 Jan 2018 04:29:17 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O4THIl059440; Wed, 24 Jan 2018 04:29:17 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201801240429.w0O4THIl059440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 24 Jan 2018 04:29:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328313 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 328313 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 04:29:17 -0000 Author: kp Date: Wed Jan 24 04:29:16 2018 New Revision: 328313 URL: https://svnweb.freebsd.org/changeset/base/328313 Log: pf: States have at least two references pf_unlink_state() releases a reference to the state without checking if this is the last reference. It can't be, because pf_state_insert() initialises it to two. KASSERT() that this is always the case. CID: 1347140 Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Wed Jan 24 03:09:56 2018 (r328312) +++ head/sys/netpfil/pf/pf.c Wed Jan 24 04:29:16 2018 (r328313) @@ -1613,6 +1613,7 @@ int pf_unlink_state(struct pf_state *s, u_int flags) { struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; + int last; if ((flags & PF_ENTER_LOCKED) == 0) PF_HASHROW_LOCK(ih); @@ -1653,7 +1654,8 @@ pf_unlink_state(struct pf_state *s, u_int flags) PF_HASHROW_UNLOCK(ih); pf_detach_state(s); - refcount_release(&s->refs); + last = refcount_release(&s->refs); + KASSERT(last == 0, ("Incorrect state reference count")); return (pf_release_state(s)); } From owner-svn-src-all@freebsd.org Wed Jan 24 05:09:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C7EDEBE182; Wed, 24 Jan 2018 05:09:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DCE177D46; Wed, 24 Jan 2018 05:09:22 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4473C19348; Wed, 24 Jan 2018 05:09:22 +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 w0O59MvI079012; Wed, 24 Jan 2018 05:09:22 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O59MXg079010; Wed, 24 Jan 2018 05:09:22 GMT (envelope-from np@FreeBSD.org) Message-Id: <201801240509.w0O59MXg079010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 24 Jan 2018 05:09:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328314 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 328314 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 05:09:22 -0000 Author: np Date: Wed Jan 24 05:09:21 2018 New Revision: 328314 URL: https://svnweb.freebsd.org/changeset/base/328314 Log: Do not generate illegal mbuf chains during IP fragment reassembly. Only the first mbuf of the reassembled datagram should have a pkthdr. This was discovered with cxgbe(4) + IPSEC + ping with payload more than interface MTU. cxgbe can generate !M_WRITEABLE mbufs and this results in m_unshare being called on the reassembled datagram, and it complains: panic: m_unshare: m0 0xfffff80020f82600, m 0xfffff8005d054100 has M_PKTHDR PR: 224922 Reviewed by: ae@ MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D14009 Modified: head/sys/netinet/ip_reass.c head/sys/netinet6/frag6.c Modified: head/sys/netinet/ip_reass.c ============================================================================== --- head/sys/netinet/ip_reass.c Wed Jan 24 04:29:16 2018 (r328313) +++ head/sys/netinet/ip_reass.c Wed Jan 24 05:09:21 2018 (r328314) @@ -377,6 +377,7 @@ ip_reass(struct mbuf *m) q->m_nextpkt = NULL; m->m_pkthdr.csum_flags &= q->m_pkthdr.csum_flags; m->m_pkthdr.csum_data += q->m_pkthdr.csum_data; + m_demote_pkthdr(q); m_cat(m, q); } /* Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Wed Jan 24 04:29:16 2018 (r328313) +++ head/sys/netinet6/frag6.c Wed Jan 24 05:09:21 2018 (r328314) @@ -541,6 +541,7 @@ insert: while (t->m_next) t = t->m_next; m_adj(IP6_REASS_MBUF(af6), af6->ip6af_offset); + m_demote_pkthdr(IP6_REASS_MBUF(af6)); m_cat(t, IP6_REASS_MBUF(af6)); free(af6, M_FTABLE); af6 = af6dwn; From owner-svn-src-all@freebsd.org Wed Jan 24 05:16:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B825EBE88F; Wed, 24 Jan 2018 05:16:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B998678381; Wed, 24 Jan 2018 05:16:11 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0840194F4; Wed, 24 Jan 2018 05:16:11 +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 w0O5GBXa084068; Wed, 24 Jan 2018 05:16:11 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O5GBAa084067; Wed, 24 Jan 2018 05:16:11 GMT (envelope-from np@FreeBSD.org) Message-Id: <201801240516.w0O5GBAa084067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 24 Jan 2018 05:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328315 - head/sys/dev/cxgb X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgb X-SVN-Commit-Revision: 328315 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 05:16:12 -0000 Author: np Date: Wed Jan 24 05:16:11 2018 New Revision: 328315 URL: https://svnweb.freebsd.org/changeset/base/328315 Log: cxgb(4): Validate offset/len in the GET_EEPROM ioctl. Reported by: Ilja Van Sprundel Modified: head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Wed Jan 24 05:09:21 2018 (r328314) +++ head/sys/dev/cxgb/cxgb_main.c Wed Jan 24 05:16:11 2018 (r328315) @@ -2958,8 +2958,14 @@ cxgb_extension_ioctl(struct cdev *dev, unsigned long c case CHELSIO_GET_EEPROM: { int i; struct ch_eeprom *e = (struct ch_eeprom *)data; - uint8_t *buf = malloc(EEPROMSIZE, M_DEVBUF, M_NOWAIT); + uint8_t *buf; + if (e->offset & 3 || e->offset >= EEPROMSIZE || + e->len > EEPROMSIZE || e->offset + e->len > EEPROMSIZE) { + return (EINVAL); + } + + buf = malloc(EEPROMSIZE, M_DEVBUF, M_NOWAIT); if (buf == NULL) { return (ENOMEM); } From owner-svn-src-all@freebsd.org Wed Jan 24 06:45:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9878EC1F01; Wed, 24 Jan 2018 06:45:04 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 694627A5D5; Wed, 24 Jan 2018 06:45:04 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5EF231A361; Wed, 24 Jan 2018 06:45:04 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0O6j4CO027928; Wed, 24 Jan 2018 06:45:04 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O6j3Xm027917; Wed, 24 Jan 2018 06:45:03 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201801240645.w0O6j3Xm027917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Wed, 24 Jan 2018 06:45:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328316 - vendor/tzdata/dist X-SVN-Group: vendor X-SVN-Commit-Author: philip X-SVN-Commit-Paths: vendor/tzdata/dist X-SVN-Commit-Revision: 328316 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 06:45:05 -0000 Author: philip Date: Wed Jan 24 06:45:03 2018 New Revision: 328316 URL: https://svnweb.freebsd.org/changeset/base/328316 Log: Import tzdata 2018c Added: vendor/tzdata/dist/pacificnew Modified: vendor/tzdata/dist/Makefile vendor/tzdata/dist/NEWS vendor/tzdata/dist/README vendor/tzdata/dist/asia vendor/tzdata/dist/europe vendor/tzdata/dist/leap-seconds.list vendor/tzdata/dist/leapseconds vendor/tzdata/dist/theory.html vendor/tzdata/dist/version vendor/tzdata/dist/zishrink.awk Modified: vendor/tzdata/dist/Makefile ============================================================================== --- vendor/tzdata/dist/Makefile Wed Jan 24 05:16:11 2018 (r328315) +++ vendor/tzdata/dist/Makefile Wed Jan 24 06:45:03 2018 (r328316) @@ -455,14 +455,15 @@ WEB_PAGES= tz-art.html tz-how-to.html tz-link.html DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) PRIMARY_YDATA= africa antarctica asia australasia \ europe northamerica southamerica -YDATA= $(PRIMARY_YDATA) etcetera $(BACKWARD) +YDATA= $(PRIMARY_YDATA) etcetera NDATA= systemv factory -TDATA= $(YDATA) $(NDATA) +TDATA_TO_CHECK= $(YDATA) $(NDATA) backward pacificnew +TDATA= $(YDATA) $(NDATA) $(BACKWARD) ZONETABLES= zone1970.tab zone.tab TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) LEAP_DEPS= leapseconds.awk leap-seconds.list TZDATA_ZI_DEPS= zishrink.awk version $(TDATA) $(PACKRATDATA) -DATA= $(YDATA) $(NDATA) backzone iso3166.tab leap-seconds.list \ +DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ leapseconds yearistype.sh $(ZONETABLES) AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk zishrink.awk MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl @@ -670,7 +671,7 @@ check_character_set: $(ENCHILADA) $(MISC) $(SOURCES) $(WEB_PAGES) \ CONTRIBUTING LICENSE Makefile README \ version tzdata.zi && \ - ! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ leapseconds yearistype.sh zone.tab && \ ! grep -Env $(OK_LINE) $(ENCHILADA); \ } @@ -678,14 +679,16 @@ check_character_set: $(ENCHILADA) check_white_space: $(ENCHILADA) patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ ! grep -En "$$pat" $(ENCHILADA) - ! grep -n '[[:space:]]$$' $(ENCHILADA) + ! grep -n '[[:space:]]$$' \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+ FILE_NAME_COMPONENT_TOO_LONG = \ $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15} -check_name_lengths: $(TDATA) backzone - ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' $(TDATA) backzone +check_name_lengths: $(TDATA_TO_CHECK) backzone + ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ + $(TDATA_TO_CHECK) backzone CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } @@ -699,8 +702,8 @@ check_sorted: backward backzone iso3166.tab zone.tab z $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \ LC_ALL=C sort -cu -check_links: checklinks.awk $(TDATA) - $(AWK) -f checklinks.awk $(TDATA) +check_links: checklinks.awk $(TDATA_TO_CHECK) + $(AWK) -f checklinks.awk $(TDATA_TO_CHECK) $(AWK) -f checklinks.awk tzdata.zi check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES) @@ -803,10 +806,10 @@ check_public: $(MAKE) maintainer-clean $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL mkdir -p public.dir - for i in $(TDATA) tzdata.zi; do \ + for i in $(TDATA_TO_CHECK) tzdata.zi; do \ $(zic) -v -d public.dir $$i 2>&1 || exit; \ done - $(zic) -v -d public.dir $(TDATA) + $(zic) -v -d public.dir $(TDATA_TO_CHECK) rm -fr public.dir # Check that the code works under various alternative Modified: vendor/tzdata/dist/NEWS ============================================================================== --- vendor/tzdata/dist/NEWS Wed Jan 24 05:16:11 2018 (r328315) +++ vendor/tzdata/dist/NEWS Wed Jan 24 06:45:03 2018 (r328316) @@ -1,5 +1,51 @@ News for the tz database +Release 2018c - 2018-01-22 23:00:44 -0800 + + Briefly: + Revert Irish changes that relied on negative DST offsets. + + Changes to tm_isdst + + Revert the 2018a change to Europe/Dublin. As before, this change + does not affect UT offsets or abbreviations; it affects only + whether timestamps are considered to be standard time or + daylight-saving time, as expressed in the tm_isdst flag of C's + struct tm type. This reversion is intended to be a temporary + workaround for problems discovered with downstream uses of + releases 2018a and 2018b, which implemented Irish time by using + negative DST offsets in the Eire rules of the 'europe' file. + Although negative DST offsets have been part of tzcode for many + years and are supported by many platforms, they were not + documented before 2018a and ICU and OpenJDK do not currently + support them. A mechanism to export data to platforms lacking + support for negative DST is planned to be developed before the + change is reapplied. (Problems reported by Deborah Goldsmith and + Stephen Colebourne.) + + Changes to past time stamps + + Japanese DST transitions (1948-1951) were Sundays at 00:00, not + Saturdays or Sundays at 02:00. (Thanks to Takayuki Nikai.) + + Changes to build procedure + + The build procedure now works around mawk 1.3.3's lack of support + for character class expressions. (Problem reported by Ohyama.) + + +Release 2018b - 2018-01-17 23:24:48 -0800 + + Briefly: + Fix a packaging problem in tz2018a, which was missing 'pacificnew'. + + Changes to build procedure + + The distribution now contains the file 'pacificnew' again. + This file was inadvertantly omitted in the 2018a distribution. + (Problem reported by Matias Fonzo.) + + Release 2018a - 2018-01-12 22:29:21 -0800 Briefly: Modified: vendor/tzdata/dist/README ============================================================================== --- vendor/tzdata/dist/README Wed Jan 24 05:16:11 2018 (r328315) +++ vendor/tzdata/dist/README Wed Jan 24 06:45:03 2018 (r328316) @@ -18,7 +18,7 @@ platform other than GNU/Linux. Then run the following substituting your desired installation directory for "$HOME/tzdir": make TOPDIR=$HOME/tzdir install - $HOME/tzdir/etc/zdump -v America/Los_Angeles + $HOME/tzdir/usr/bin/zdump -v America/Los_Angeles Historical local time information has been included here to: Modified: vendor/tzdata/dist/asia ============================================================================== --- vendor/tzdata/dist/asia Wed Jan 24 05:16:11 2018 (r328315) +++ vendor/tzdata/dist/asia Wed Jan 24 06:45:03 2018 (r328316) @@ -1464,17 +1464,17 @@ Zone Asia/Jerusalem 2:20:54 - LMT 1880 # of the Japanese wanted to scrap daylight-saving time, as opposed to 30% who # wanted to keep it.) -# From Paul Eggert (2006-03-22): -# Shanks & Pottenger write that DST in Japan during those years was as follows: +# From Takayuki Nikai (2018-01-19): +# The source of information is Japanese law. +# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00219480428029.htm +# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00719500331039.htm +# ... In summary, it is written as follows. From 24:00 on the first Saturday +# in May, until 0:00 on the day after the second Saturday in September. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Japan 1948 only - May Sun>=1 2:00 1:00 D -Rule Japan 1948 1951 - Sep Sat>=8 2:00 0 S -Rule Japan 1949 only - Apr Sun>=1 2:00 1:00 D -Rule Japan 1950 1951 - May Sun>=1 2:00 1:00 D -# but the only locations using it (for birth certificates, presumably, since -# their audience is astrologers) were US military bases. For now, assume -# that for most purposes daylight-saving time was observed; otherwise, what -# would have been the point of the 1951 poll? +Rule Japan 1948 only - May Sat>=1 24:00 1:00 D +Rule Japan 1948 1951 - Sep Sun>=9 0:00 0 S +Rule Japan 1949 only - Apr Sat>=1 24:00 1:00 D +Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D # From Hideyuki Suzuki (1998-11-09): # 'Tokyo' usually stands for the former location of Tokyo Astronomical Modified: vendor/tzdata/dist/europe ============================================================================== --- vendor/tzdata/dist/europe Wed Jan 24 05:16:11 2018 (r328315) +++ vendor/tzdata/dist/europe Wed Jan 24 06:45:03 2018 (r328316) @@ -508,16 +508,19 @@ Link Europe/London Europe/Jersey Link Europe/London Europe/Guernsey Link Europe/London Europe/Isle_of_Man +# From Paul Eggert (2018-01-19): # The following is like GB-Eire and EU, except with standard time in # summer and negative daylight saving time in winter. +# Although currently commented out, this will need to become uncommented +# once the ICU/OpenJDK workaround is removed; see below. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Eire 1971 only - Oct 31 2:00u -1:00 GMT -Rule Eire 1972 1980 - Mar Sun>=16 2:00u 0 IST -Rule Eire 1972 1980 - Oct Sun>=23 2:00u -1:00 GMT -Rule Eire 1981 max - Mar lastSun 1:00u 0 IST -Rule Eire 1981 1989 - Oct Sun>=23 1:00u -1:00 GMT -Rule Eire 1990 1995 - Oct Sun>=22 1:00u -1:00 GMT -Rule Eire 1996 max - Oct lastSun 1:00u -1:00 GMT +#Rule Eire 1971 only - Oct 31 2:00u -1:00 GMT +#Rule Eire 1972 1980 - Mar Sun>=16 2:00u 0 IST +#Rule Eire 1972 1980 - Oct Sun>=23 2:00u -1:00 GMT +#Rule Eire 1981 max - Mar lastSun 1:00u 0 IST +#Rule Eire 1981 1989 - Oct Sun>=23 1:00u -1:00 GMT +#Rule Eire 1990 1995 - Oct Sun>=22 1:00u -1:00 GMT +#Rule Eire 1996 max - Oct lastSun 1:00u -1:00 GMT # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 @@ -530,7 +533,25 @@ Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 0:00 1:00 IST 1947 Nov 2 2:00s 0:00 - GMT 1948 Apr 18 2:00s 0:00 GB-Eire GMT/IST 1968 Oct 27 - 1:00 Eire IST/GMT +# From Paul Eggert (2018-01-18): +# The next line should look like this: +# 1:00 Eire IST/GMT +# However, in January 2018 we discovered that the Eire rules cause +# problems with tests for ICU: +# https://mm.icann.org/pipermail/tz/2018-January/025825.html +# and with tests for OpenJDK: +# https://mm.icann.org/pipermail/tz/2018-January/025822.html +# To work around this problem, use a traditional approximation for +# time stamps after 1971-10-31 02:00 UTC, to give ICU and OpenJDK +# developers breathing room to fix bugs. This approximation has +# correct UTC offsets, but results in tm_isdst flags are the reverse +# of what they should be. This workaround is temporary and should be +# removed reasonably soon. + 1:00 - IST 1971 Oct 31 2:00u + 0:00 GB-Eire GMT/IST 1996 + 0:00 EU GMT/IST +# End of workaround for ICU and OpenJDK bugs. + ############################################################################### Modified: vendor/tzdata/dist/leap-seconds.list ============================================================================== --- vendor/tzdata/dist/leap-seconds.list Wed Jan 24 05:16:11 2018 (r328315) +++ vendor/tzdata/dist/leap-seconds.list Wed Jan 24 06:45:03 2018 (r328316) @@ -61,7 +61,12 @@ # or # Terry Quinn, "The BIPM and the Accurate Measurement # of Time," Proc. of the IEEE, Vol. 79, pp. 894-905, -# July, 1991. +# July, 1991. +# reprinted in: +# Christine Hackman and Donald B Sullivan (eds.) +# Time and Frequency Measurement +# American Association of Physics Teachers (1996) +# , pp. 75-86 # # 4. The decision to insert a leap second into UTC is currently # the responsibility of the International Earth Rotation and @@ -199,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C54 -# File expires on: 28 June 2018 +# Updated through IERS Bulletin C55 +# File expires on: 28 December 2018 # -#@ 3739132800 +#@ 3754944000 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -247,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 5101445a 69948b51 9153e2b 2086e3d8 d54561a3 +#h 44dcf58c e28d25aa b36612c8 f3d3e8b5 a8fdf478 Modified: vendor/tzdata/dist/leapseconds ============================================================================== --- vendor/tzdata/dist/leapseconds Wed Jan 24 05:16:11 2018 (r328315) +++ vendor/tzdata/dist/leapseconds Wed Jan 24 06:45:03 2018 (r328316) @@ -57,5 +57,5 @@ Leap 2012 Jun 30 23:59:60 + S Leap 2015 Jun 30 23:59:60 + S Leap 2016 Dec 31 23:59:60 + S -# Updated through IERS Bulletin C54 -# File expires on: 28 June 2018 +# Updated through IERS Bulletin C55 +# File expires on: 28 December 2018 Added: vendor/tzdata/dist/pacificnew ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/tzdata/dist/pacificnew Wed Jan 24 06:45:03 2018 (r328316) @@ -0,0 +1,27 @@ +# This file is in the public domain, so clarified as of +# 2009-05-17 by Arthur David Olson. + +# From Arthur David Olson (1989-04-05): +# On 1989-04-05, the U. S. House of Representatives passed (238-154) a bill +# establishing "Pacific Presidential Election Time"; it was not acted on +# by the Senate or signed into law by the President. +# You might want to change the "PE" (Presidential Election) below to +# "Q" (Quadrennial) to maintain three-character zone abbreviations. +# If you're really conservative, you might want to change it to "D". +# Avoid "L" (Leap Year), which won't be true in 2100. + +# If Presidential Election Time is ever established, replace "XXXX" below +# with the year the law takes effect and uncomment the "##" lines. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +## Rule Twilite XXXX max - Apr Sun>=1 2:00 1:00 D +## Rule Twilite XXXX max uspres Oct lastSun 2:00 1:00 PE +## Rule Twilite XXXX max uspres Nov Sun>=7 2:00 0 S +## Rule Twilite XXXX max nonpres Oct lastSun 2:00 0 S + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +## Zone America/Los_Angeles-PET -8:00 US P%sT XXXX +## -8:00 Twilite P%sT + +# For now... +Link America/Los_Angeles US/Pacific-New ## Modified: vendor/tzdata/dist/theory.html ============================================================================== --- vendor/tzdata/dist/theory.html Wed Jan 24 05:16:11 2018 (r328315) +++ vendor/tzdata/dist/theory.html Wed Jan 24 06:45:03 2018 (r328316) @@ -1065,7 +1065,7 @@ Sources: Michael Allison and Robert Schmunk, "Technical Notes on Mars Solar Time as Adopted by the Mars24 Sunclock" -(2012-08-08). +(2015-06-30).
  • Jia-Rui Chong, Modified: vendor/tzdata/dist/version ============================================================================== --- vendor/tzdata/dist/version Wed Jan 24 05:16:11 2018 (r328315) +++ vendor/tzdata/dist/version Wed Jan 24 06:45:03 2018 (r328316) @@ -1 +1 @@ -2018a +2018c Modified: vendor/tzdata/dist/zishrink.awk ============================================================================== --- vendor/tzdata/dist/zishrink.awk Wed Jan 24 05:16:11 2018 (r328315) +++ vendor/tzdata/dist/zishrink.awk Wed Jan 24 06:45:03 2018 (r328316) @@ -37,7 +37,7 @@ function process_input_line(line, field, end, i, n, st # Remove comments, normalize spaces, and append a space to each line. sub(/#.*/, "", line) line = line " " - gsub(/[[:space:]]+/, " ", line) + gsub(/[\f\r\t\v ]+/, " ", line) # Abbreviate keywords. Do not abbreviate "Link" to just "L", # as pre-2017c zic erroneously diagnoses "Li" as ambiguous. @@ -94,7 +94,7 @@ function process_input_line(line, field, end, i, n, st sub(/ 0+$/, "", line) # Remove unnecessary trailing days-of-month "1". - if (match(line, /[[:alpha:]] 1$/)) + if (match(line, /[A-Za-z] 1$/)) line = substr(line, 1, RSTART) # Remove unnecessary trailing " Ja" (for January). @@ -148,7 +148,7 @@ BEGIN { print "# This zic input file is in the public domain." } -/^[[:space:]]*[^#[:space:]]/ { +/^[\f\r\t\v ]*[^#\f\r\t\v ]/ { process_input_line($0) } From owner-svn-src-all@freebsd.org Wed Jan 24 06:45:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2809CEC1F82; Wed, 24 Jan 2018 06:45:53 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CF43F7A6FA; Wed, 24 Jan 2018 06:45:52 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B114B1A362; Wed, 24 Jan 2018 06:45:52 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0O6jqfv027994; Wed, 24 Jan 2018 06:45:52 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O6jqC8027993; Wed, 24 Jan 2018 06:45:52 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201801240645.w0O6jqC8027993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Wed, 24 Jan 2018 06:45:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328317 - vendor/tzdata/tzdata2018c X-SVN-Group: vendor X-SVN-Commit-Author: philip X-SVN-Commit-Paths: vendor/tzdata/tzdata2018c X-SVN-Commit-Revision: 328317 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 06:45:53 -0000 Author: philip Date: Wed Jan 24 06:45:52 2018 New Revision: 328317 URL: https://svnweb.freebsd.org/changeset/base/328317 Log: Tag import of tzdata 2018c Added: vendor/tzdata/tzdata2018c/ - copied from r328316, vendor/tzdata/dist/ From owner-svn-src-all@freebsd.org Wed Jan 24 06:48:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18134EC2182; Wed, 24 Jan 2018 06:48:44 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B80FA7A881; Wed, 24 Jan 2018 06:48:43 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7E121A363; Wed, 24 Jan 2018 06:48:43 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0O6mh6P028139; Wed, 24 Jan 2018 06:48:43 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O6mgbc028128; Wed, 24 Jan 2018 06:48:42 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201801240648.w0O6mgbc028128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Wed, 24 Jan 2018 06:48:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328318 - head/contrib/tzdata X-SVN-Group: head X-SVN-Commit-Author: philip X-SVN-Commit-Paths: head/contrib/tzdata X-SVN-Commit-Revision: 328318 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 06:48:44 -0000 Author: philip Date: Wed Jan 24 06:48:42 2018 New Revision: 328318 URL: https://svnweb.freebsd.org/changeset/base/328318 Log: Import tzdata 2018c Changes: https://github.com/eggert/tz/blob/2018c/NEWS MFC after: 3 days Added: head/contrib/tzdata/pacificnew - copied unchanged from r328316, vendor/tzdata/dist/pacificnew Modified: head/contrib/tzdata/Makefile head/contrib/tzdata/NEWS head/contrib/tzdata/README head/contrib/tzdata/asia head/contrib/tzdata/europe head/contrib/tzdata/leap-seconds.list head/contrib/tzdata/leapseconds head/contrib/tzdata/theory.html head/contrib/tzdata/version head/contrib/tzdata/zishrink.awk Directory Properties: head/contrib/tzdata/ (props changed) Modified: head/contrib/tzdata/Makefile ============================================================================== --- head/contrib/tzdata/Makefile Wed Jan 24 06:45:52 2018 (r328317) +++ head/contrib/tzdata/Makefile Wed Jan 24 06:48:42 2018 (r328318) @@ -455,14 +455,15 @@ WEB_PAGES= tz-art.html tz-how-to.html tz-link.html DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) PRIMARY_YDATA= africa antarctica asia australasia \ europe northamerica southamerica -YDATA= $(PRIMARY_YDATA) etcetera $(BACKWARD) +YDATA= $(PRIMARY_YDATA) etcetera NDATA= systemv factory -TDATA= $(YDATA) $(NDATA) +TDATA_TO_CHECK= $(YDATA) $(NDATA) backward pacificnew +TDATA= $(YDATA) $(NDATA) $(BACKWARD) ZONETABLES= zone1970.tab zone.tab TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) LEAP_DEPS= leapseconds.awk leap-seconds.list TZDATA_ZI_DEPS= zishrink.awk version $(TDATA) $(PACKRATDATA) -DATA= $(YDATA) $(NDATA) backzone iso3166.tab leap-seconds.list \ +DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ leapseconds yearistype.sh $(ZONETABLES) AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk zishrink.awk MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl @@ -670,7 +671,7 @@ check_character_set: $(ENCHILADA) $(MISC) $(SOURCES) $(WEB_PAGES) \ CONTRIBUTING LICENSE Makefile README \ version tzdata.zi && \ - ! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ leapseconds yearistype.sh zone.tab && \ ! grep -Env $(OK_LINE) $(ENCHILADA); \ } @@ -678,14 +679,16 @@ check_character_set: $(ENCHILADA) check_white_space: $(ENCHILADA) patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ ! grep -En "$$pat" $(ENCHILADA) - ! grep -n '[[:space:]]$$' $(ENCHILADA) + ! grep -n '[[:space:]]$$' \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+ FILE_NAME_COMPONENT_TOO_LONG = \ $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15} -check_name_lengths: $(TDATA) backzone - ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' $(TDATA) backzone +check_name_lengths: $(TDATA_TO_CHECK) backzone + ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ + $(TDATA_TO_CHECK) backzone CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } @@ -699,8 +702,8 @@ check_sorted: backward backzone iso3166.tab zone.tab z $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \ LC_ALL=C sort -cu -check_links: checklinks.awk $(TDATA) - $(AWK) -f checklinks.awk $(TDATA) +check_links: checklinks.awk $(TDATA_TO_CHECK) + $(AWK) -f checklinks.awk $(TDATA_TO_CHECK) $(AWK) -f checklinks.awk tzdata.zi check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES) @@ -803,10 +806,10 @@ check_public: $(MAKE) maintainer-clean $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL mkdir -p public.dir - for i in $(TDATA) tzdata.zi; do \ + for i in $(TDATA_TO_CHECK) tzdata.zi; do \ $(zic) -v -d public.dir $$i 2>&1 || exit; \ done - $(zic) -v -d public.dir $(TDATA) + $(zic) -v -d public.dir $(TDATA_TO_CHECK) rm -fr public.dir # Check that the code works under various alternative Modified: head/contrib/tzdata/NEWS ============================================================================== --- head/contrib/tzdata/NEWS Wed Jan 24 06:45:52 2018 (r328317) +++ head/contrib/tzdata/NEWS Wed Jan 24 06:48:42 2018 (r328318) @@ -1,5 +1,51 @@ News for the tz database +Release 2018c - 2018-01-22 23:00:44 -0800 + + Briefly: + Revert Irish changes that relied on negative DST offsets. + + Changes to tm_isdst + + Revert the 2018a change to Europe/Dublin. As before, this change + does not affect UT offsets or abbreviations; it affects only + whether timestamps are considered to be standard time or + daylight-saving time, as expressed in the tm_isdst flag of C's + struct tm type. This reversion is intended to be a temporary + workaround for problems discovered with downstream uses of + releases 2018a and 2018b, which implemented Irish time by using + negative DST offsets in the Eire rules of the 'europe' file. + Although negative DST offsets have been part of tzcode for many + years and are supported by many platforms, they were not + documented before 2018a and ICU and OpenJDK do not currently + support them. A mechanism to export data to platforms lacking + support for negative DST is planned to be developed before the + change is reapplied. (Problems reported by Deborah Goldsmith and + Stephen Colebourne.) + + Changes to past time stamps + + Japanese DST transitions (1948-1951) were Sundays at 00:00, not + Saturdays or Sundays at 02:00. (Thanks to Takayuki Nikai.) + + Changes to build procedure + + The build procedure now works around mawk 1.3.3's lack of support + for character class expressions. (Problem reported by Ohyama.) + + +Release 2018b - 2018-01-17 23:24:48 -0800 + + Briefly: + Fix a packaging problem in tz2018a, which was missing 'pacificnew'. + + Changes to build procedure + + The distribution now contains the file 'pacificnew' again. + This file was inadvertantly omitted in the 2018a distribution. + (Problem reported by Matias Fonzo.) + + Release 2018a - 2018-01-12 22:29:21 -0800 Briefly: Modified: head/contrib/tzdata/README ============================================================================== --- head/contrib/tzdata/README Wed Jan 24 06:45:52 2018 (r328317) +++ head/contrib/tzdata/README Wed Jan 24 06:48:42 2018 (r328318) @@ -18,7 +18,7 @@ platform other than GNU/Linux. Then run the following substituting your desired installation directory for "$HOME/tzdir": make TOPDIR=$HOME/tzdir install - $HOME/tzdir/etc/zdump -v America/Los_Angeles + $HOME/tzdir/usr/bin/zdump -v America/Los_Angeles Historical local time information has been included here to: Modified: head/contrib/tzdata/asia ============================================================================== --- head/contrib/tzdata/asia Wed Jan 24 06:45:52 2018 (r328317) +++ head/contrib/tzdata/asia Wed Jan 24 06:48:42 2018 (r328318) @@ -1464,17 +1464,17 @@ Zone Asia/Jerusalem 2:20:54 - LMT 1880 # of the Japanese wanted to scrap daylight-saving time, as opposed to 30% who # wanted to keep it.) -# From Paul Eggert (2006-03-22): -# Shanks & Pottenger write that DST in Japan during those years was as follows: +# From Takayuki Nikai (2018-01-19): +# The source of information is Japanese law. +# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00219480428029.htm +# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00719500331039.htm +# ... In summary, it is written as follows. From 24:00 on the first Saturday +# in May, until 0:00 on the day after the second Saturday in September. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Japan 1948 only - May Sun>=1 2:00 1:00 D -Rule Japan 1948 1951 - Sep Sat>=8 2:00 0 S -Rule Japan 1949 only - Apr Sun>=1 2:00 1:00 D -Rule Japan 1950 1951 - May Sun>=1 2:00 1:00 D -# but the only locations using it (for birth certificates, presumably, since -# their audience is astrologers) were US military bases. For now, assume -# that for most purposes daylight-saving time was observed; otherwise, what -# would have been the point of the 1951 poll? +Rule Japan 1948 only - May Sat>=1 24:00 1:00 D +Rule Japan 1948 1951 - Sep Sun>=9 0:00 0 S +Rule Japan 1949 only - Apr Sat>=1 24:00 1:00 D +Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D # From Hideyuki Suzuki (1998-11-09): # 'Tokyo' usually stands for the former location of Tokyo Astronomical Modified: head/contrib/tzdata/europe ============================================================================== --- head/contrib/tzdata/europe Wed Jan 24 06:45:52 2018 (r328317) +++ head/contrib/tzdata/europe Wed Jan 24 06:48:42 2018 (r328318) @@ -508,16 +508,19 @@ Link Europe/London Europe/Jersey Link Europe/London Europe/Guernsey Link Europe/London Europe/Isle_of_Man +# From Paul Eggert (2018-01-19): # The following is like GB-Eire and EU, except with standard time in # summer and negative daylight saving time in winter. +# Although currently commented out, this will need to become uncommented +# once the ICU/OpenJDK workaround is removed; see below. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Eire 1971 only - Oct 31 2:00u -1:00 GMT -Rule Eire 1972 1980 - Mar Sun>=16 2:00u 0 IST -Rule Eire 1972 1980 - Oct Sun>=23 2:00u -1:00 GMT -Rule Eire 1981 max - Mar lastSun 1:00u 0 IST -Rule Eire 1981 1989 - Oct Sun>=23 1:00u -1:00 GMT -Rule Eire 1990 1995 - Oct Sun>=22 1:00u -1:00 GMT -Rule Eire 1996 max - Oct lastSun 1:00u -1:00 GMT +#Rule Eire 1971 only - Oct 31 2:00u -1:00 GMT +#Rule Eire 1972 1980 - Mar Sun>=16 2:00u 0 IST +#Rule Eire 1972 1980 - Oct Sun>=23 2:00u -1:00 GMT +#Rule Eire 1981 max - Mar lastSun 1:00u 0 IST +#Rule Eire 1981 1989 - Oct Sun>=23 1:00u -1:00 GMT +#Rule Eire 1990 1995 - Oct Sun>=22 1:00u -1:00 GMT +#Rule Eire 1996 max - Oct lastSun 1:00u -1:00 GMT # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 @@ -530,7 +533,25 @@ Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 0:00 1:00 IST 1947 Nov 2 2:00s 0:00 - GMT 1948 Apr 18 2:00s 0:00 GB-Eire GMT/IST 1968 Oct 27 - 1:00 Eire IST/GMT +# From Paul Eggert (2018-01-18): +# The next line should look like this: +# 1:00 Eire IST/GMT +# However, in January 2018 we discovered that the Eire rules cause +# problems with tests for ICU: +# https://mm.icann.org/pipermail/tz/2018-January/025825.html +# and with tests for OpenJDK: +# https://mm.icann.org/pipermail/tz/2018-January/025822.html +# To work around this problem, use a traditional approximation for +# time stamps after 1971-10-31 02:00 UTC, to give ICU and OpenJDK +# developers breathing room to fix bugs. This approximation has +# correct UTC offsets, but results in tm_isdst flags are the reverse +# of what they should be. This workaround is temporary and should be +# removed reasonably soon. + 1:00 - IST 1971 Oct 31 2:00u + 0:00 GB-Eire GMT/IST 1996 + 0:00 EU GMT/IST +# End of workaround for ICU and OpenJDK bugs. + ############################################################################### Modified: head/contrib/tzdata/leap-seconds.list ============================================================================== --- head/contrib/tzdata/leap-seconds.list Wed Jan 24 06:45:52 2018 (r328317) +++ head/contrib/tzdata/leap-seconds.list Wed Jan 24 06:48:42 2018 (r328318) @@ -61,7 +61,12 @@ # or # Terry Quinn, "The BIPM and the Accurate Measurement # of Time," Proc. of the IEEE, Vol. 79, pp. 894-905, -# July, 1991. +# July, 1991. +# reprinted in: +# Christine Hackman and Donald B Sullivan (eds.) +# Time and Frequency Measurement +# American Association of Physics Teachers (1996) +# , pp. 75-86 # # 4. The decision to insert a leap second into UTC is currently # the responsibility of the International Earth Rotation and @@ -199,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C54 -# File expires on: 28 June 2018 +# Updated through IERS Bulletin C55 +# File expires on: 28 December 2018 # -#@ 3739132800 +#@ 3754944000 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -247,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 5101445a 69948b51 9153e2b 2086e3d8 d54561a3 +#h 44dcf58c e28d25aa b36612c8 f3d3e8b5 a8fdf478 Modified: head/contrib/tzdata/leapseconds ============================================================================== --- head/contrib/tzdata/leapseconds Wed Jan 24 06:45:52 2018 (r328317) +++ head/contrib/tzdata/leapseconds Wed Jan 24 06:48:42 2018 (r328318) @@ -57,5 +57,5 @@ Leap 2012 Jun 30 23:59:60 + S Leap 2015 Jun 30 23:59:60 + S Leap 2016 Dec 31 23:59:60 + S -# Updated through IERS Bulletin C54 -# File expires on: 28 June 2018 +# Updated through IERS Bulletin C55 +# File expires on: 28 December 2018 Copied: head/contrib/tzdata/pacificnew (from r328316, vendor/tzdata/dist/pacificnew) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/tzdata/pacificnew Wed Jan 24 06:48:42 2018 (r328318, copy of r328316, vendor/tzdata/dist/pacificnew) @@ -0,0 +1,27 @@ +# This file is in the public domain, so clarified as of +# 2009-05-17 by Arthur David Olson. + +# From Arthur David Olson (1989-04-05): +# On 1989-04-05, the U. S. House of Representatives passed (238-154) a bill +# establishing "Pacific Presidential Election Time"; it was not acted on +# by the Senate or signed into law by the President. +# You might want to change the "PE" (Presidential Election) below to +# "Q" (Quadrennial) to maintain three-character zone abbreviations. +# If you're really conservative, you might want to change it to "D". +# Avoid "L" (Leap Year), which won't be true in 2100. + +# If Presidential Election Time is ever established, replace "XXXX" below +# with the year the law takes effect and uncomment the "##" lines. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +## Rule Twilite XXXX max - Apr Sun>=1 2:00 1:00 D +## Rule Twilite XXXX max uspres Oct lastSun 2:00 1:00 PE +## Rule Twilite XXXX max uspres Nov Sun>=7 2:00 0 S +## Rule Twilite XXXX max nonpres Oct lastSun 2:00 0 S + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +## Zone America/Los_Angeles-PET -8:00 US P%sT XXXX +## -8:00 Twilite P%sT + +# For now... +Link America/Los_Angeles US/Pacific-New ## Modified: head/contrib/tzdata/theory.html ============================================================================== --- head/contrib/tzdata/theory.html Wed Jan 24 06:45:52 2018 (r328317) +++ head/contrib/tzdata/theory.html Wed Jan 24 06:48:42 2018 (r328318) @@ -1065,7 +1065,7 @@ Sources: Michael Allison and Robert Schmunk, "Technical Notes on Mars Solar Time as Adopted by the Mars24 Sunclock" -(2012-08-08). +(2015-06-30).
  • Jia-Rui Chong, Modified: head/contrib/tzdata/version ============================================================================== --- head/contrib/tzdata/version Wed Jan 24 06:45:52 2018 (r328317) +++ head/contrib/tzdata/version Wed Jan 24 06:48:42 2018 (r328318) @@ -1 +1 @@ -2018a +2018c Modified: head/contrib/tzdata/zishrink.awk ============================================================================== --- head/contrib/tzdata/zishrink.awk Wed Jan 24 06:45:52 2018 (r328317) +++ head/contrib/tzdata/zishrink.awk Wed Jan 24 06:48:42 2018 (r328318) @@ -37,7 +37,7 @@ function process_input_line(line, field, end, i, n, st # Remove comments, normalize spaces, and append a space to each line. sub(/#.*/, "", line) line = line " " - gsub(/[[:space:]]+/, " ", line) + gsub(/[\f\r\t\v ]+/, " ", line) # Abbreviate keywords. Do not abbreviate "Link" to just "L", # as pre-2017c zic erroneously diagnoses "Li" as ambiguous. @@ -94,7 +94,7 @@ function process_input_line(line, field, end, i, n, st sub(/ 0+$/, "", line) # Remove unnecessary trailing days-of-month "1". - if (match(line, /[[:alpha:]] 1$/)) + if (match(line, /[A-Za-z] 1$/)) line = substr(line, 1, RSTART) # Remove unnecessary trailing " Ja" (for January). @@ -148,7 +148,7 @@ BEGIN { print "# This zic input file is in the public domain." } -/^[[:space:]]*[^#[:space:]]/ { +/^[\f\r\t\v ]*[^#\f\r\t\v ]/ { process_input_line($0) } From owner-svn-src-all@freebsd.org Wed Jan 24 07:01:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 314B2EC29B3; Wed, 24 Jan 2018 07:01:45 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB9BA7AFDB; Wed, 24 Jan 2018 07:01:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D69161A55B; Wed, 24 Jan 2018 07:01:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0O71iRe036855; Wed, 24 Jan 2018 07:01:44 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O71in5036854; Wed, 24 Jan 2018 07:01:44 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801240701.w0O71in5036854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Wed, 24 Jan 2018 07:01:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328319 - head/usr.bin/m4 X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/m4 X-SVN-Commit-Revision: 328319 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 07:01:45 -0000 Author: eadler Date: Wed Jan 24 07:01:44 2018 New Revision: 328319 URL: https://svnweb.freebsd.org/changeset/base/328319 Log: m4: add annotations to various functions Explain to the compiler that several functions are either noreturn or take printf like arguments Discussed with: swildner@DragonFlyBSD.org Modified: head/usr.bin/m4/extern.h Modified: head/usr.bin/m4/extern.h ============================================================================== --- head/usr.bin/m4/extern.h Wed Jan 24 06:48:42 2018 (r328318) +++ head/usr.bin/m4/extern.h Wed Jan 24 07:01:44 2018 (r328319) @@ -105,16 +105,16 @@ extern void pbnumbase(int, int, int); extern void pbunsigned(unsigned long); extern void pbstr(const char *); extern void pushback(int); -extern void *xalloc(size_t, const char *, ...); -extern void *xcalloc(size_t, size_t, const char *, ...); -extern void *xrealloc(void *, size_t, const char *, ...); -extern void *xreallocarray(void *, size_t, size_t, const char *, ...); +extern void *xalloc(size_t, const char *, ...) __printf0like(2, 3); +extern void *xcalloc(size_t, size_t, const char *, ...) __printf0like(3, 4); +extern void *xrealloc(void *, size_t, const char *, ...) __printf0like(3, 4); +extern void *xreallocarray(void *, size_t, size_t, const char *, ...) __printf0like(4, 5); extern char *xstrdup(const char *); extern void usage(void); extern void resizedivs(int); extern size_t buffer_mark(void); extern void dump_buffer(FILE *, size_t); -extern void m4errx(int, const char *, ...); +extern void m4errx(int, const char *, ...) __dead2 __printf0like(2, 3); extern int obtain_char(struct input_file *); extern void set_input(struct input_file *, FILE *, const char *); From owner-svn-src-all@freebsd.org Wed Jan 24 07:54:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66F60EC561F; Wed, 24 Jan 2018 07:54:06 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19D107D0BD; Wed, 24 Jan 2018 07:54:06 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14DAC1AE9E; Wed, 24 Jan 2018 07:54:06 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0O7s5oL063487; Wed, 24 Jan 2018 07:54:05 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O7s57E063486; Wed, 24 Jan 2018 07:54:05 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801240754.w0O7s57E063486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 24 Jan 2018 07:54:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328320 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 328320 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 07:54:06 -0000 Author: wma Date: Wed Jan 24 07:54:05 2018 New Revision: 328320 URL: https://svnweb.freebsd.org/changeset/base/328320 Log: ULE: provide defaults to ts_cpu Fix a bug when the system has no CPU 0. When created, threads were implicitly assigned to CPU 0. This had no practical effect since a real CPU was chosen immediately by the scheduler. However, on systems without a CPU 0, sched_ule attempted to access the scheduler queue of the "old" CPU when assigned the initial choice of the old one. This caused an attempt to use illegal memory and a crash (or, more usually, a deadlock). Fix this by assigned new threads to the BSP explicitly and add some asserts to see that this problem does not recur. Authored by: Nathan Whitehorn Submitted by: Wojciech Macek Obtained from: Semihalf Differential revision: https://reviews.freebsd.org/D13932 Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Wed Jan 24 07:01:44 2018 (r328319) +++ head/sys/kern/sched_ule.c Wed Jan 24 07:54:05 2018 (r328320) @@ -1405,6 +1405,7 @@ sched_setup(void *dummy) /* Add thread0's load since it's running. */ TDQ_LOCK(tdq); + td_get_sched(&thread0)->ts_cpu = curcpu; /* Something valid to start */ thread0.td_lock = TDQ_LOCKPTR(TDQ_SELF()); tdq_load_add(tdq, &thread0); tdq->tdq_lowpri = thread0.td_priority; @@ -2454,6 +2455,7 @@ sched_add(struct thread *td, int flags) * Pick the destination cpu and if it isn't ours transfer to the * target cpu. */ + td_get_sched(td)->ts_cpu = curcpu; /* Pick something valid to start */ cpu = sched_pickcpu(td, flags); tdq = sched_setcpu(td, cpu, flags); tdq_add(tdq, td, flags); From owner-svn-src-all@freebsd.org Wed Jan 24 08:50:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9447BEC7C63; Wed, 24 Jan 2018 08:50:44 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id D61677EA33; Wed, 24 Jan 2018 08:50:42 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 2A80A104ADB; Wed, 24 Jan 2018 19:50:34 +1100 (AEDT) Date: Wed, 24 Jan 2018 19:50:33 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pedro Giffuni cc: cem@freebsd.org, src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... In-Reply-To: <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> Message-ID: <20180124182548.X1063@besplex.bde.org> References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=YbvN30Zf c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=_0KUm0Rbt2uuAB5mhFEA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 08:50:44 -0000 On Tue, 23 Jan 2018, Pedro Giffuni wrote: > On 23/01/2018 14:08, Conrad Meyer wrote: >> Hi Pedro, >> >> On Sun, Jan 21, 2018 at 7:42 AM, Pedro F. Giffuni wrote: >>> Author: pfg >>> Date: Sun Jan 21 15:42:36 2018 >>> New Revision: 328218 >>> URL: https://svnweb.freebsd.org/changeset/base/328218 >>> >>> Log: >>> Revert r327828, r327949, r327953, r328016-r328026, r328041: >>> Uses of mallocarray(9). >>> >>> The use of mallocarray(9) has rocketed the required swap to build >>> FreeBSD. >>> This is likely caused by the allocation size attributes which put extra >>> pressure >>> on the compiler. >> I'm confused about this change. Wouldn't it be better to remove the >> annotation/attributes from mallocarray() than to remove the protection >> against overflow? It would be better to remove mallocarray(). > Not in my opinion: it would be better to detect such overflows at compile > time (or through a static analyzer) than to have late notification though > panics. The blind use of mallocarray(9) is probably a mistake also: we > shouldn't use it unless there is some real risk of overflow. Excellent! There is no real risk of overflow except in cases that are broken anyway. The overflow checks in mallocarray() are insufficient even for detecting overflow and don't detect most broken cases when they are sufficient. This leaves no cases where even non-blind use of it does any good. >> (If the compiler is fixed in the future to not use >> excessive memory with these attributes, they can be conditionalized on >> compiler version, of course.) > > All in all, the compiler is not provably wrong: it's just using more swap > space, which is rather inconvenient for small platforms but not necessarily > wrong. I don't know why the compiler uses more swap space, but the general brokenness of mallocarray() is obvious. Callers must somehow ensure that the allocation size is not too large. Too large is closer to 64K than SIZE_MAX for most allocations. Some bloatware allocates a few MB, but malloc() is rarely used for that. vmstat -m has been broken to not show a summary of sizes at the end, but on freefall now it seems to shows a maximum malloc() size of 64K, and vmstat -z confirms this by not showing any malloc() bucket sizes larger than 64K, and in fact kern_malloc.c only has statically allocatd bucket sizes up to 64K. (vmstat -z never had a summary at the end to break). Much larger allocations are mostly done using k*alloc(), and slightly larger allocations are usually done using UMA. zfs does zillions of allocations using UMA, and the largest one seems to be 16M. If the caller doesn't check, this gives a Denial of Service security hole if the size and count are controlled by userland. If the size and count are controlled by the kernel, then the overflow check is not very useful. It is less useful than most KASSERT()s which are left out of production kernels. The caller must keep its allocation sizes not much more than 64K, and once it does that it is unlikely to make them larger than SIZE_MAX sometimes. The overflow checks in mallocarray have many type errors so they don't always work: X Modified: head/share/man/man9/malloc.9 X ============================================================================== X --- head/share/man/man9/malloc.9 Sun Jan 7 10:29:15 2018 (r327673) X +++ head/share/man/man9/malloc.9 Sun Jan 7 13:21:01 2018 (r327674) X @@ -45,6 +45,8 @@ X .In sys/malloc.h X .Ft void * X .Fn malloc "unsigned long size" "struct malloc_type *type" "int flags" X +.Ft void * X +.Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags" One type error is already obvious. malloc(9)'s arg doesn't have type size_t like malloc(3)'s arg. The arg type is u_long in the kernel. mallocarray()'s types are inconsistent with this. size_t happens to have the same representation as u_long on all supported arches, so this doesn't cause many problems now. On 32-bit arches, size_t hs type u_int. u_int has smaller rank than u_long, so compilers could reasonably complain that converting a u_long to a size_t is a downcast. They shouldn't complain that converting a size_t to a u_long to pass it to malloc() is an upcast, so there is no problem in typical sloppy code that uses size_t for sizes and passes these to malloc(). More careful ciode would use u_long for size to pass to malloc() and compiler's might complain about downcasting to pass to mallocarray() instead. Otherwise (on exotic machines with size_t larger than u_long), passing size_t's to malloc() is a bug unless they values have been checked to be <= ULONG_MAX, and mallocarrary()'s inconsistent API expands this bug. X Modified: head/sys/kern/kern_malloc.c X ============================================================================== X --- head/sys/kern/kern_malloc.c Sun Jan 7 10:29:15 2018 (r327673) X +++ head/sys/kern/kern_malloc.c Sun Jan 7 13:21:01 2018 (r327674) X @@ -532,6 +533,22 @@ malloc(unsigned long size, struct malloc_type *mtp, in X va = redzone_setup(va, osize); X #endif X return ((void *) va); X +} X + X +/* X + * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX X + * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW X + */ X +#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 8 / 2)) SIZE_MAX and its square root are not the thing to check here. malloc()'s limit is ULONG_MAX. Using 1UL here assumes hat u_long is no smaller than size_t. Otherwise, there the shift overflows when size_t is more than twice as large as u_long so that even the square root doesn't fit. That would be very exotic. More likely, size_t is only slightly larger than u_long. Then the shift doesn't overflow, and MUL_NO_OVERFLOW has type u_long instead of the intended size_t. Since we don't square it, there are problems with the square overflowing. X +void * X +mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) No function API can work for bounds checking, since function args have some type and converting to that type may overflow before any overflow check can be done. Even uintmax_t doesn't quite work for the arg types, since perverse callers might start with floating point values. uintmax_t is enough in the kernel since the kernel doesn't support FP. X +{ X + X + if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && X + nmemb > 0 && SIZE_MAX / nmemb < size) X + return (NULL); X + X + return (malloc(size * nmemb, type, flags)); [This is the original version that returns instead of panicing.) Except for overflow in the shift in MUL_NO_OVERFLOW, this gives a non- overflowing (size * member) with value <= SIZE_MAX, but it needs to be <= ULONG_MAX. Overflow in the product gives undefined behaviour, but overflow in the arg passing (either to pass size and nmemb here or the product to malloc()) only gives implementation-defined behaviour (usually a truncated value). The bugs are only latent, but in some cases the buggy call to mallocarray replaces correct code that does something like: u_long nmemb, size; size = size(struct foo); /* small, so doesn't need check */ nmemb = whatever(); /* API must ensure it fits in u_long */ if (nmemb >= NMEMB_LIMIT) return (EINVAL); /* not ENOMEM */ p = malloc(nmemb * size, M_FOO, M_WAITOK); The non-hard-coded limit(s) make it non-obvious that the product is small, but this code has to trust that the limits are small enough. If this is converted to mallocarray(), it remains correct, but only because the buggy and incomplete range checking in mallocarray has no effect since this already did complete checking. (The checking here guarantees: - that size and nmemb are small, so they can be passed to mallocarray() despite it having inconsistent arg types. - that the product can't overflow, so we return EINVAL here instead of panicing later. (The original version returns an errror, which breaks the M_WAITOK case. The current version panics, which breaks the M_NOWAIT case.) - that the product is small. mallocarray() just doesn't check for this. Bruce From owner-svn-src-all@freebsd.org Wed Jan 24 10:13:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9623CECB45D; Wed, 24 Jan 2018 10:13:16 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1372D81723; Wed, 24 Jan 2018 10:13:15 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C83D31C513; Wed, 24 Jan 2018 10:13:14 +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 w0OADERd032600; Wed, 24 Jan 2018 10:13:14 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OADEh1032599; Wed, 24 Jan 2018 10:13:14 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201801241013.w0OADEh1032599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Wed, 24 Jan 2018 10:13:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328321 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: smh X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 328321 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 10:13:16 -0000 Author: smh Date: Wed Jan 24 10:13:14 2018 New Revision: 328321 URL: https://svnweb.freebsd.org/changeset/base/328321 Log: Added missing CTLFLAG_VNET to lacp default_strict_mode Added CTLFLAG_VNET to net.link.lagg.lacp.default_strict_mode which was missed in r290450. Reported by: julian@ MFC after: 1 week Sponsored by: Multiplay Modified: head/sys/net/ieee8023ad_lacp.c Modified: head/sys/net/ieee8023ad_lacp.c ============================================================================== --- head/sys/net/ieee8023ad_lacp.c Wed Jan 24 07:54:05 2018 (r328320) +++ head/sys/net/ieee8023ad_lacp.c Wed Jan 24 10:13:14 2018 (r328321) @@ -201,8 +201,8 @@ SYSCTL_INT(_net_link_lagg_lacp, OID_AUTO, debug, CTLFL &VNET_NAME(lacp_debug), 0, "Enable LACP debug logging (1=debug, 2=trace)"); static VNET_DEFINE(int, lacp_default_strict_mode) = 1; -SYSCTL_INT(_net_link_lagg_lacp, OID_AUTO, default_strict_mode, CTLFLAG_RWTUN, - &VNET_NAME(lacp_default_strict_mode), 0, +SYSCTL_INT(_net_link_lagg_lacp, OID_AUTO, default_strict_mode, + CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(lacp_default_strict_mode), 0, "LACP strict protocol compliance default"); #define LACP_DPRINTF(a) if (V_lacp_debug & 0x01) { lacp_dprintf a ; } From owner-svn-src-all@freebsd.org Wed Jan 24 10:50:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0272ECCA25; Wed, 24 Jan 2018 10:50:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 97AA482E40; Wed, 24 Jan 2018 10:50:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83C751C9E5; Wed, 24 Jan 2018 10:50:22 +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 w0OAoMIK048835; Wed, 24 Jan 2018 10:50:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OAoMvw048833; Wed, 24 Jan 2018 10:50:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801241050.w0OAoMvw048833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 24 Jan 2018 10:50: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: r328322 - in stable/11/sys/amd64: amd64 include X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys/amd64: amd64 include X-SVN-Commit-Revision: 328322 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 10:50:23 -0000 Author: kib Date: Wed Jan 24 10:50:21 2018 New Revision: 328322 URL: https://svnweb.freebsd.org/changeset/base/328322 Log: MFC r328082: Amd64 user_ldt_deref() is not used outside sys_machdep.c. Mark it as static. Modified: stable/11/sys/amd64/amd64/sys_machdep.c stable/11/sys/amd64/include/proc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/sys_machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/sys_machdep.c Wed Jan 24 10:13:14 2018 (r328321) +++ stable/11/sys/amd64/amd64/sys_machdep.c Wed Jan 24 10:50:21 2018 (r328322) @@ -63,6 +63,9 @@ __FBSDID("$FreeBSD$"); #include +static void user_ldt_deref(struct proc_ldt *pldt); +static void user_ldt_derefl(struct proc_ldt *pldt); + #define MAX_LD 8192 int max_ldt_segment = 512; @@ -81,8 +84,6 @@ max_ldt_segment_init(void *arg __unused) } SYSINIT(maxldt, SI_SUB_VM_CONF, SI_ORDER_ANY, max_ldt_segment_init, NULL); -static void user_ldt_derefl(struct proc_ldt *pldt); - #ifndef _SYS_SYSPROTO_H_ struct sysarch_args { int op; @@ -529,7 +530,7 @@ user_ldt_derefl(struct proc_ldt *pldt) } } -void +static void user_ldt_deref(struct proc_ldt *pldt) { Modified: stable/11/sys/amd64/include/proc.h ============================================================================== --- stable/11/sys/amd64/include/proc.h Wed Jan 24 10:13:14 2018 (r328321) +++ stable/11/sys/amd64/include/proc.h Wed Jan 24 10:50:21 2018 (r328322) @@ -90,7 +90,6 @@ struct syscall_args { struct proc_ldt *user_ldt_alloc(struct proc *, int); void user_ldt_free(struct thread *); -void user_ldt_deref(struct proc_ldt *); struct sysarch_args; int sysarch_ldt(struct thread *td, struct sysarch_args *uap, int uap_space); int amd64_set_ldt_data(struct thread *td, int start, int num, From owner-svn-src-all@freebsd.org Wed Jan 24 11:01:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67833ECD07A; Wed, 24 Jan 2018 11:01:16 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1040483475; Wed, 24 Jan 2018 11:01:16 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B0B51CCBA; Wed, 24 Jan 2018 11:01:16 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OB1Geo053666; Wed, 24 Jan 2018 11:01:16 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OB1Cf0053628; Wed, 24 Jan 2018 11:01:12 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201801241101.w0OB1Cf0053628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Wed, 24 Jan 2018 11:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328323 - in vendor/libarchive/dist: . cat cat/test libarchive libarchive/test tar/test X-SVN-Group: vendor X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in vendor/libarchive/dist: . cat cat/test libarchive libarchive/test tar/test X-SVN-Commit-Revision: 328323 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 11:01:16 -0000 Author: mm Date: Wed Jan 24 11:01:12 2018 New Revision: 328323 URL: https://svnweb.freebsd.org/changeset/base/328323 Log: Update libarchive to git 2d9156bb3ad92c43c1e81546f4a2c21549ba248f Relevant vendor changes: PR #893: delete dead ppmd7 alloc callbacks PR #904: Fix archive freeing bug in bsdcat PR #961: Fix ZIP format names PR #962: Don't modify attributes for existing directories when ARCHIVE_EXTRACT_NO_OVERWRITE is set PR #964: Fix -Werror=implicit-fallthrough= for GCC 7 PR #970: zip: Allow backslash as path separator Modified: vendor/libarchive/dist/CMakeLists.txt vendor/libarchive/dist/Makefile.am vendor/libarchive/dist/cat/bsdcat.c vendor/libarchive/dist/cat/test/CMakeLists.txt vendor/libarchive/dist/libarchive/archive_acl.c vendor/libarchive/dist/libarchive/archive_disk_acl_freebsd.c vendor/libarchive/dist/libarchive/archive_match.c vendor/libarchive/dist/libarchive/archive_platform.h vendor/libarchive/dist/libarchive/archive_ppmd7.c vendor/libarchive/dist/libarchive/archive_ppmd7_private.h vendor/libarchive/dist/libarchive/archive_ppmd_private.h vendor/libarchive/dist/libarchive/archive_read.c vendor/libarchive/dist/libarchive/archive_read_disk_posix.c vendor/libarchive/dist/libarchive/archive_read_disk_windows.c vendor/libarchive/dist/libarchive/archive_read_support_format_7zip.c vendor/libarchive/dist/libarchive/archive_read_support_format_mtree.c vendor/libarchive/dist/libarchive/archive_read_support_format_rar.c vendor/libarchive/dist/libarchive/archive_read_support_format_tar.c vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c vendor/libarchive/dist/libarchive/archive_util.c vendor/libarchive/dist/libarchive/archive_virtual.c vendor/libarchive/dist/libarchive/archive_write.c vendor/libarchive/dist/libarchive/archive_write_disk_posix.c vendor/libarchive/dist/libarchive/archive_write_disk_windows.c vendor/libarchive/dist/libarchive/archive_write_set_format_7zip.c vendor/libarchive/dist/libarchive/test/read_open_memory.c vendor/libarchive/dist/libarchive/test/test.h vendor/libarchive/dist/libarchive/test/test_acl_platform_nfs4.c vendor/libarchive/dist/libarchive/test/test_compat_zip.c vendor/libarchive/dist/libarchive/test/test_read_format_zip.c vendor/libarchive/dist/libarchive/test/test_write_disk_perms.c vendor/libarchive/dist/tar/test/test_option_acls.c Modified: vendor/libarchive/dist/CMakeLists.txt ============================================================================== --- vendor/libarchive/dist/CMakeLists.txt Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/CMakeLists.txt Wed Jan 24 11:01:12 2018 (r328323) @@ -179,6 +179,7 @@ include(CTest) OPTION(ENABLE_NETTLE "Enable use of Nettle" ON) OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON) +OPTION(ENABLE_LZ4 "Enable the use of the system LZ4 library if found" ON) OPTION(ENABLE_LZO "Enable the use of the system LZO library if found" OFF) OPTION(ENABLE_LZMA "Enable the use of the system LZMA library if found" ON) @@ -509,15 +510,19 @@ MARK_AS_ADVANCED(CLEAR LZO2_LIBRARY) # # Find LZ4 # -IF (LZ4_INCLUDE_DIR) - # Already in cache, be silent - SET(LZ4_FIND_QUIETLY TRUE) -ENDIF (LZ4_INCLUDE_DIR) +IF(ENABLE_LZ4) + IF (LZ4_INCLUDE_DIR) + # Already in cache, be silent + SET(LZ4_FIND_QUIETLY TRUE) + ENDIF (LZ4_INCLUDE_DIR) -FIND_PATH(LZ4_INCLUDE_DIR lz4.h) -FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4) -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR) + FIND_PATH(LZ4_INCLUDE_DIR lz4.h) + FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4) + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR) +ELSE(ENABLE_LZ4) + SET(LZ4_FOUND FALSE) # Override cached value +ENDIF(ENABLE_LZ4) IF(LZ4_FOUND) SET(HAVE_LIBLZ4 1) SET(HAVE_LZ4_H 1) Modified: vendor/libarchive/dist/Makefile.am ============================================================================== --- vendor/libarchive/dist/Makefile.am Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/Makefile.am Wed Jan 24 11:01:12 2018 (r328323) @@ -681,6 +681,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_compat_zip_5.zip.uu \ libarchive/test/test_compat_zip_6.zip.uu \ libarchive/test/test_compat_zip_7.xps.uu \ + libarchive/test/test_compat_zip_8.zip.uu \ libarchive/test/test_compat_zstd_1.tar.zst.uu \ libarchive/test/test_fuzz.cab.uu \ libarchive/test/test_fuzz.lzh.uu \ @@ -1282,6 +1283,7 @@ bsdcat_test_SOURCES= \ cat/test/test_expand_xz.c \ cat/test/test_expand_zstd.c \ cat/test/test_help.c \ + cat/test/test_stdin.c \ cat/test/test_version.c bsdcat_test_CPPFLAGS= \ Modified: vendor/libarchive/dist/cat/bsdcat.c ============================================================================== --- vendor/libarchive/dist/cat/bsdcat.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/cat/bsdcat.c Wed Jan 24 11:01:12 2018 (r328323) @@ -70,6 +70,12 @@ version(void) void bsdcat_next(void) { + if (a != NULL) { + if (archive_read_close(a) != ARCHIVE_OK) + bsdcat_print_error(); + archive_read_free(a); + } + a = archive_read_new(); archive_read_support_filter_all(a); archive_read_support_format_empty(a); @@ -100,8 +106,10 @@ bsdcat_read_to_stdout(const char* filename) ; else if (archive_read_data_into_fd(a, 1) != ARCHIVE_OK) bsdcat_print_error(); - if (archive_read_free(a) != ARCHIVE_OK) + if (archive_read_close(a) != ARCHIVE_OK) bsdcat_print_error(); + archive_read_free(a); + a = NULL; } int @@ -135,15 +143,14 @@ main(int argc, char **argv) if (*bsdcat->argv == NULL) { bsdcat_current_path = ""; bsdcat_read_to_stdout(NULL); - } else + } else { while (*bsdcat->argv) { bsdcat_current_path = *bsdcat->argv++; bsdcat_read_to_stdout(bsdcat_current_path); bsdcat_next(); } - - if (a != NULL) - archive_read_free(a); + archive_read_free(a); /* Help valgrind & friends */ + } exit(exit_status); } Modified: vendor/libarchive/dist/cat/test/CMakeLists.txt ============================================================================== --- vendor/libarchive/dist/cat/test/CMakeLists.txt Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/cat/test/CMakeLists.txt Wed Jan 24 11:01:12 2018 (r328323) @@ -24,6 +24,7 @@ IF(ENABLE_CAT AND ENABLE_TEST) test_expand_xz.c test_expand_zstd.c test_help.c + test_stdin.c test_version.c ) Modified: vendor/libarchive/dist/libarchive/archive_acl.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_acl.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_acl.c Wed Jan 24 11:01:12 2018 (r328323) @@ -1159,6 +1159,7 @@ archive_acl_from_text_w(struct archive_acl *acl, const switch (want_type) { case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E: want_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS; + __LA_FALLTHROUGH; case ARCHIVE_ENTRY_ACL_TYPE_ACCESS: case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT: numfields = 5; @@ -1626,6 +1627,7 @@ archive_acl_from_text_l(struct archive_acl *acl, const switch (want_type) { case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E: want_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS; + __LA_FALLTHROUGH; case ARCHIVE_ENTRY_ACL_TYPE_ACCESS: case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT: numfields = 5; Modified: vendor/libarchive/dist/libarchive/archive_disk_acl_freebsd.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_disk_acl_freebsd.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_disk_acl_freebsd.c Wed Jan 24 11:01:12 2018 (r328323) @@ -93,7 +93,9 @@ static const acl_perm_map_t acl_nfs4_flag_map[] = { {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY}, {ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACL_ENTRY_SUCCESSFUL_ACCESS}, {ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACL_ENTRY_FAILED_ACCESS}, +#ifdef ACL_ENTRY_INHERITED {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED} +#endif }; static const int acl_nfs4_flag_map_size = Modified: vendor/libarchive/dist/libarchive/archive_match.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_match.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_match.c Wed Jan 24 11:01:12 2018 (r328323) @@ -1582,7 +1582,7 @@ time_excluded(struct archive_match *a, struct archive_ */ int -archive_match_include_uid(struct archive *_a, int64_t uid) +archive_match_include_uid(struct archive *_a, la_int64_t uid) { struct archive_match *a; @@ -1593,7 +1593,7 @@ archive_match_include_uid(struct archive *_a, int64_t } int -archive_match_include_gid(struct archive *_a, int64_t gid) +archive_match_include_gid(struct archive *_a, la_int64_t gid) { struct archive_match *a; Modified: vendor/libarchive/dist/libarchive/archive_platform.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive_platform.h Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_platform.h Wed Jan 24 11:01:12 2018 (r328323) @@ -191,4 +191,10 @@ #define ARCHIVE_ERRNO_MISC (-1) #endif +#if defined(__GNUC__) && (__GNUC__ >= 7) +#define __LA_FALLTHROUGH __attribute__((fallthrough)) +#else +#define __LA_FALLTHROUGH +#endif + #endif /* !ARCHIVE_PLATFORM_H_INCLUDED */ Modified: vendor/libarchive/dist/libarchive/archive_ppmd7.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_ppmd7.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_ppmd7.c Wed Jan 24 11:01:12 2018 (r328323) @@ -115,14 +115,14 @@ static void Ppmd7_Construct(CPpmd7 *p) memset(p->HB2Flag + 0x40, 8, 0x100 - 0x40); } -static void Ppmd7_Free(CPpmd7 *p, ISzAlloc *alloc) +static void Ppmd7_Free(CPpmd7 *p) { - alloc->Free(alloc, p->Base); + free(p->Base); p->Size = 0; p->Base = 0; } -static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAlloc *alloc) +static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size) { if (p->Base == 0 || p->Size != size) { @@ -131,14 +131,14 @@ static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAll if (size < UNIT_SIZE) { return False; } - Ppmd7_Free(p, alloc); + Ppmd7_Free(p); p->AlignOffset = #ifdef PPMD_32BIT (4 - size) & 3; #else 4 - (size & 3); #endif - if ((p->Base = (Byte *)alloc->Alloc(alloc, p->AlignOffset + size + if ((p->Base = (Byte *)malloc(p->AlignOffset + size #ifndef PPMD_32BIT + UNIT_SIZE #endif Modified: vendor/libarchive/dist/libarchive/archive_ppmd7_private.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive_ppmd7_private.h Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_ppmd7_private.h Wed Jan 24 11:01:12 2018 (r328323) @@ -95,8 +95,8 @@ typedef struct { /* Base Functions */ void (*Ppmd7_Construct)(CPpmd7 *p); - Bool (*Ppmd7_Alloc)(CPpmd7 *p, UInt32 size, ISzAlloc *alloc); - void (*Ppmd7_Free)(CPpmd7 *p, ISzAlloc *alloc); + Bool (*Ppmd7_Alloc)(CPpmd7 *p, UInt32 size); + void (*Ppmd7_Free)(CPpmd7 *p); void (*Ppmd7_Init)(CPpmd7 *p, unsigned maxOrder); #define Ppmd7_WasAllocated(p) ((p)->Base != NULL) Modified: vendor/libarchive/dist/libarchive/archive_ppmd_private.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive_ppmd_private.h Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_ppmd_private.h Wed Jan 24 11:01:12 2018 (r328323) @@ -69,13 +69,6 @@ typedef struct void (*Write)(void *p, Byte b); } IByteOut; - -typedef struct -{ - void *(*Alloc)(void *p, size_t size); - void (*Free)(void *p, void *address); /* address can be 0 */ -} ISzAlloc; - /*** End defined in Types.h ***/ /*** Begin defined in CpuArch.h ***/ Modified: vendor/libarchive/dist/libarchive/archive_read.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_read.c Wed Jan 24 11:01:12 2018 (r328323) @@ -120,7 +120,8 @@ archive_read_new(void) * Record the do-not-extract-to file. This belongs in archive_read_extract.c. */ void -archive_read_extract_set_skip_file(struct archive *_a, int64_t d, int64_t i) +archive_read_extract_set_skip_file(struct archive *_a, la_int64_t d, + la_int64_t i) { struct archive_read *a = (struct archive_read *)_a; @@ -747,7 +748,7 @@ choose_format(struct archive_read *a) * Return the file offset (within the uncompressed data stream) where * the last header started. */ -int64_t +la_int64_t archive_read_header_position(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; @@ -943,7 +944,7 @@ archive_read_data_skip(struct archive *_a) return (r); } -int64_t +la_int64_t archive_seek_data(struct archive *_a, int64_t offset, int whence) { struct archive_read *a = (struct archive_read *)_a; @@ -1626,7 +1627,8 @@ __archive_read_filter_seek(struct archive_read_filter switch (whence) { case SEEK_CUR: /* Adjust the offset and use SEEK_SET instead */ - offset += filter->position; + offset += filter->position; + __LA_FALLTHROUGH; case SEEK_SET: cursor = 0; while (1) Modified: vendor/libarchive/dist/libarchive/archive_read_disk_posix.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_disk_posix.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_read_disk_posix.c Wed Jan 24 11:01:12 2018 (r328323) @@ -387,7 +387,7 @@ archive_read_disk_vtable(void) } const char * -archive_read_disk_gname(struct archive *_a, int64_t gid) +archive_read_disk_gname(struct archive *_a, la_int64_t gid) { struct archive_read_disk *a = (struct archive_read_disk *)_a; if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, @@ -399,7 +399,7 @@ archive_read_disk_gname(struct archive *_a, int64_t gi } const char * -archive_read_disk_uname(struct archive *_a, int64_t uid) +archive_read_disk_uname(struct archive *_a, la_int64_t uid) { struct archive_read_disk *a = (struct archive_read_disk *)_a; if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, @@ -413,7 +413,7 @@ archive_read_disk_uname(struct archive *_a, int64_t ui int archive_read_disk_set_gname_lookup(struct archive *_a, void *private_data, - const char * (*lookup_gname)(void *private, int64_t gid), + const char * (*lookup_gname)(void *private, la_int64_t gid), void (*cleanup_gname)(void *private)) { struct archive_read_disk *a = (struct archive_read_disk *)_a; @@ -432,7 +432,7 @@ archive_read_disk_set_gname_lookup(struct archive *_a, int archive_read_disk_set_uname_lookup(struct archive *_a, void *private_data, - const char * (*lookup_uname)(void *private, int64_t uid), + const char * (*lookup_uname)(void *private, la_int64_t uid), void (*cleanup_uname)(void *private)) { struct archive_read_disk *a = (struct archive_read_disk *)_a; Modified: vendor/libarchive/dist/libarchive/archive_read_disk_windows.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_disk_windows.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_read_disk_windows.c Wed Jan 24 11:01:12 2018 (r328323) @@ -320,7 +320,7 @@ archive_read_disk_vtable(void) } const char * -archive_read_disk_gname(struct archive *_a, int64_t gid) +archive_read_disk_gname(struct archive *_a, la_int64_t gid) { struct archive_read_disk *a = (struct archive_read_disk *)_a; if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, @@ -332,7 +332,7 @@ archive_read_disk_gname(struct archive *_a, int64_t gi } const char * -archive_read_disk_uname(struct archive *_a, int64_t uid) +archive_read_disk_uname(struct archive *_a, la_int64_t uid) { struct archive_read_disk *a = (struct archive_read_disk *)_a; if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, @@ -346,7 +346,7 @@ archive_read_disk_uname(struct archive *_a, int64_t ui int archive_read_disk_set_gname_lookup(struct archive *_a, void *private_data, - const char * (*lookup_gname)(void *private, int64_t gid), + const char * (*lookup_gname)(void *private, la_int64_t gid), void (*cleanup_gname)(void *private)) { struct archive_read_disk *a = (struct archive_read_disk *)_a; @@ -923,6 +923,7 @@ next_entry(struct archive_read_disk *a, struct tree *t t->entry_fh = CreateFileW(tree_current_access_path(t), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, flags, NULL); if (t->entry_fh == INVALID_HANDLE_VALUE) { + la_dosmaperr(GetLastError()); archive_set_error(&a->archive, errno, "Couldn't open %ls", tree_current_path(a->tree)); return (ARCHIVE_FAILED); Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_7zip.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_7zip.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_7zip.c Wed Jan 24 11:01:12 2018 (r328323) @@ -975,18 +975,6 @@ decode_codec_id(const unsigned char *codecId, size_t i return (id); } -static void * -ppmd_alloc(void *p, size_t size) -{ - (void)p; - return malloc(size); -} -static void -ppmd_free(void *p, void *address) -{ - (void)p; - free(address); -} static Byte ppmd_read(void *p) { @@ -1006,8 +994,6 @@ ppmd_read(void *p) return (b); } -static ISzAlloc g_szalloc = { ppmd_alloc, ppmd_free }; - static int init_decompression(struct archive_read *a, struct _7zip *zip, const struct _7z_coder *coder1, const struct _7z_coder *coder2) @@ -1237,7 +1223,7 @@ init_decompression(struct archive_read *a, struct _7zi if (zip->ppmd7_valid) { __archive_ppmd7_functions.Ppmd7_Free( - &zip->ppmd7_context, &g_szalloc); + &zip->ppmd7_context); zip->ppmd7_valid = 0; } @@ -1256,7 +1242,7 @@ init_decompression(struct archive_read *a, struct _7zi } __archive_ppmd7_functions.Ppmd7_Construct(&zip->ppmd7_context); r = __archive_ppmd7_functions.Ppmd7_Alloc( - &zip->ppmd7_context, msize, &g_szalloc); + &zip->ppmd7_context, msize); if (r == 0) { archive_set_error(&a->archive, ENOMEM, "Coludn't allocate memory for PPMd"); @@ -1636,7 +1622,7 @@ free_decompression(struct archive_read *a, struct _7zi #endif if (zip->ppmd7_valid) { __archive_ppmd7_functions.Ppmd7_Free( - &zip->ppmd7_context, &g_szalloc); + &zip->ppmd7_context); zip->ppmd7_valid = 0; } return (r); @@ -2569,6 +2555,7 @@ read_Header(struct archive_read *a, struct _7z_header_ case kDummy: if (ll == 0) break; + __LA_FALLTHROUGH; default: if (header_bytes(a, ll) == NULL) return (-1); Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_mtree.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_mtree.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_mtree.c Wed Jan 24 11:01:12 2018 (r328323) @@ -1499,6 +1499,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt } if (strcmp(key, "cksum") == 0) break; + __LA_FALLTHROUGH; case 'd': if (strcmp(key, "device") == 0) { /* stat(2) st_rdev field, e.g. the major/minor IDs @@ -1512,12 +1513,14 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_set_rdev(entry, dev); return r; } + __LA_FALLTHROUGH; case 'f': if (strcmp(key, "flags") == 0) { *parsed_kws |= MTREE_HAS_FFLAGS; archive_entry_copy_fflags_text(entry, val); break; } + __LA_FALLTHROUGH; case 'g': if (strcmp(key, "gid") == 0) { *parsed_kws |= MTREE_HAS_GID; @@ -1529,16 +1532,19 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_copy_gname(entry, val); break; } + __LA_FALLTHROUGH; case 'i': if (strcmp(key, "inode") == 0) { archive_entry_set_ino(entry, mtree_atol(&val, 10)); break; } + __LA_FALLTHROUGH; case 'l': if (strcmp(key, "link") == 0) { archive_entry_copy_symlink(entry, val); break; } + __LA_FALLTHROUGH; case 'm': if (strcmp(key, "md5") == 0 || strcmp(key, "md5digest") == 0) break; @@ -1555,6 +1561,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt } break; } + __LA_FALLTHROUGH; case 'n': if (strcmp(key, "nlink") == 0) { *parsed_kws |= MTREE_HAS_NLINK; @@ -1562,6 +1569,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt (unsigned int)mtree_atol(&val, 10)); break; } + __LA_FALLTHROUGH; case 'r': if (strcmp(key, "resdevice") == 0) { /* stat(2) st_dev field, e.g. the device ID where the @@ -1577,6 +1585,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt if (strcmp(key, "rmd160") == 0 || strcmp(key, "rmd160digest") == 0) break; + __LA_FALLTHROUGH; case 's': if (strcmp(key, "sha1") == 0 || strcmp(key, "sha1digest") == 0) break; @@ -1593,6 +1602,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_set_size(entry, mtree_atol(&val, 10)); break; } + __LA_FALLTHROUGH; case 't': if (strcmp(key, "tags") == 0) { /* @@ -1635,18 +1645,21 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_set_filetype(entry, AE_IFBLK); break; } + __LA_FALLTHROUGH; case 'c': if (strcmp(val, "char") == 0) { archive_entry_set_filetype(entry, AE_IFCHR); break; } + __LA_FALLTHROUGH; case 'd': if (strcmp(val, "dir") == 0) { archive_entry_set_filetype(entry, AE_IFDIR); break; } + __LA_FALLTHROUGH; case 'f': if (strcmp(val, "fifo") == 0) { archive_entry_set_filetype(entry, @@ -1658,12 +1671,14 @@ parse_keyword(struct archive_read *a, struct mtree *mt AE_IFREG); break; } + __LA_FALLTHROUGH; case 'l': if (strcmp(val, "link") == 0) { archive_entry_set_filetype(entry, AE_IFLNK); break; } + __LA_FALLTHROUGH; default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, @@ -1675,6 +1690,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt *parsed_kws |= MTREE_HAS_TYPE; break; } + __LA_FALLTHROUGH; case 'u': if (strcmp(key, "uid") == 0) { *parsed_kws |= MTREE_HAS_UID; @@ -1686,6 +1702,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_copy_uname(entry, val); break; } + __LA_FALLTHROUGH; default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Unrecognized key %s=%s", key, val); Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_rar.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_rar.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_rar.c Wed Jan 24 11:01:12 2018 (r328323) @@ -604,20 +604,6 @@ lzss_emit_match(struct rar *rar, int offset, int lengt rar->lzss.position += length; } -static void * -ppmd_alloc(void *p, size_t size) -{ - (void)p; - return malloc(size); -} -static void -ppmd_free(void *p, void *address) -{ - (void)p; - free(address); -} -static ISzAlloc g_szalloc = { ppmd_alloc, ppmd_free }; - static Byte ppmd_read(void *p) { @@ -1038,7 +1024,7 @@ archive_read_format_rar_read_data(struct archive_read case COMPRESS_METHOD_BEST: ret = read_data_compressed(a, buff, size, offset); if (ret != ARCHIVE_OK && ret != ARCHIVE_WARN) - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); break; default: @@ -1253,7 +1239,7 @@ archive_read_format_rar_cleanup(struct archive_read *a free(rar->dbo); free(rar->unp_buffer); free(rar->lzss.window); - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); free(rar); (a->format->data) = NULL; return (ARCHIVE_OK); @@ -1658,7 +1644,7 @@ read_header(struct archive_read *a, struct archive_ent rar->unp_offset = 0; rar->unp_buffer_size = UNP_BUFFER_SIZE; memset(rar->lengthtable, 0, sizeof(rar->lengthtable)); - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); rar->ppmd_valid = rar->ppmd_eod = 0; /* Don't set any archive entries for non-file header types */ @@ -2122,7 +2108,7 @@ parse_codes(struct archive_read *a) /* Make sure ppmd7_contest is freed before Ppmd7_Construct * because reading a broken file cause this abnormal sequence. */ - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); rar->bytein.a = a; rar->bytein.Read = &ppmd_read; @@ -2137,7 +2123,7 @@ parse_codes(struct archive_read *a) } if (!__archive_ppmd7_functions.Ppmd7_Alloc(&rar->ppmd7_context, - rar->dictionary_size, &g_szalloc)) + rar->dictionary_size)) { archive_set_error(&a->archive, ENOMEM, "Out of memory"); Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_tar.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_tar.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_tar.c Wed Jan 24 11:01:12 2018 (r328323) @@ -251,15 +251,15 @@ archive_read_support_format_tar(struct archive *_a) ARCHIVE_STATE_NEW, "archive_read_support_format_tar"); tar = (struct tar *)calloc(1, sizeof(*tar)); -#ifdef HAVE_COPYFILE_H - /* Set this by default on Mac OS. */ - tar->process_mac_extensions = 1; -#endif if (tar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate tar data"); return (ARCHIVE_FATAL); } +#ifdef HAVE_COPYFILE_H + /* Set this by default on Mac OS. */ + tar->process_mac_extensions = 1; +#endif r = __archive_read_register_format(a, tar, "tar", archive_read_format_tar_bid, Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c Wed Jan 24 11:01:12 2018 (r328323) @@ -886,6 +886,24 @@ zip_read_local_file_header(struct archive_read *a, str zip_entry->mode |= 0664; } + /* Windows archivers sometimes use backslash as the directory separator. + Normalize to slash. */ + if (zip_entry->system == 0 && + (wp = archive_entry_pathname_w(entry)) != NULL) { + if (wcschr(wp, L'/') == NULL && wcschr(wp, L'\\') != NULL) { + size_t i; + struct archive_wstring s; + archive_string_init(&s); + archive_wstrcpy(&s, wp); + for (i = 0; i < archive_strlen(&s); i++) { + if (s.s[i] == '\\') + s.s[i] = '/'; + } + archive_entry_copy_pathname_w(entry, s.s); + archive_wstring_free(&s); + } + } + /* Make sure that entries with a trailing '/' are marked as directories * even if the External File Attributes contains bogus values. If this * is not a directory and there is no type, assume regularfile. */ @@ -1061,6 +1079,7 @@ zip_read_local_file_header(struct archive_read *a, str zip->end_of_entry = 1; /* Set up a more descriptive format name. */ + archive_string_empty(&zip->format_name); archive_string_sprintf(&zip->format_name, "ZIP %d.%d (%s)", version / 10, version % 10, compression_name(zip->entry->compression)); Modified: vendor/libarchive/dist/libarchive/archive_util.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_util.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_util.c Wed Jan 24 11:01:12 2018 (r328323) @@ -140,7 +140,7 @@ archive_compression_name(struct archive *a) /* * Return a count of the number of compressed bytes processed. */ -int64_t +la_int64_t archive_position_compressed(struct archive *a) { return archive_filter_bytes(a, -1); @@ -149,7 +149,7 @@ archive_position_compressed(struct archive *a) /* * Return a count of the number of uncompressed bytes processed. */ -int64_t +la_int64_t archive_position_uncompressed(struct archive *a) { return archive_filter_bytes(a, 0); Modified: vendor/libarchive/dist/libarchive/archive_virtual.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_virtual.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_virtual.c Wed Jan 24 11:01:12 2018 (r328323) @@ -48,7 +48,7 @@ archive_filter_name(struct archive *a, int n) return ((a->vtable->archive_filter_name)(a, n)); } -int64_t +la_int64_t archive_filter_bytes(struct archive *a, int n) { return ((a->vtable->archive_filter_bytes)(a, n)); @@ -131,7 +131,8 @@ archive_write_data(struct archive *a, const void *buff } ssize_t -archive_write_data_block(struct archive *a, const void *buff, size_t s, int64_t o) +archive_write_data_block(struct archive *a, const void *buff, size_t s, + la_int64_t o) { if (a->vtable->archive_write_data_block == NULL) { archive_set_error(a, ARCHIVE_ERRNO_MISC, @@ -156,7 +157,7 @@ archive_read_next_header2(struct archive *a, struct ar int archive_read_data_block(struct archive *a, - const void **buff, size_t *s, int64_t *o) + const void **buff, size_t *s, la_int64_t *o) { return ((a->vtable->archive_read_data_block)(a, buff, s, o)); } Modified: vendor/libarchive/dist/libarchive/archive_write.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_write.c Wed Jan 24 11:01:12 2018 (r328323) @@ -190,7 +190,7 @@ archive_write_get_bytes_in_last_block(struct archive * * an archive to itself recursively. */ int -archive_write_set_skip_file(struct archive *_a, int64_t d, int64_t i) +archive_write_set_skip_file(struct archive *_a, la_int64_t d, la_int64_t i) { struct archive_write *a = (struct archive_write *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, Modified: vendor/libarchive/dist/libarchive/archive_write_disk_posix.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write_disk_posix.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_write_disk_posix.c Wed Jan 24 11:01:12 2018 (r328323) @@ -835,7 +835,7 @@ _archive_write_disk_header(struct archive *_a, struct } int -archive_write_disk_set_skip_file(struct archive *_a, int64_t d, int64_t i) +archive_write_disk_set_skip_file(struct archive *_a, la_int64_t d, la_int64_t i) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1786,7 +1786,7 @@ finish_metadata: int archive_write_disk_set_group_lookup(struct archive *_a, void *private_data, - int64_t (*lookup_gid)(void *private, const char *gname, int64_t gid), + la_int64_t (*lookup_gid)(void *private, const char *gname, la_int64_t gid), void (*cleanup_gid)(void *private)) { struct archive_write_disk *a = (struct archive_write_disk *)_a; @@ -1822,7 +1822,7 @@ archive_write_disk_set_user_lookup(struct archive *_a, } int64_t -archive_write_disk_gid(struct archive *_a, const char *name, int64_t id) +archive_write_disk_gid(struct archive *_a, const char *name, la_int64_t id) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1833,7 +1833,7 @@ archive_write_disk_gid(struct archive *_a, const char } int64_t -archive_write_disk_uid(struct archive *_a, const char *name, int64_t id) +archive_write_disk_uid(struct archive *_a, const char *name, la_int64_t id) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1981,6 +1981,10 @@ restore_entry(struct archive_write_disk *a) if ((en == EISDIR || en == EEXIST) && (a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) { /* If we're not overwriting, we're done. */ + if (S_ISDIR(a->mode)) { + /* Don't overwrite any settings on existing directories. */ + a->todo = 0; + } archive_entry_unset_size(a->entry); return (ARCHIVE_OK); } Modified: vendor/libarchive/dist/libarchive/archive_write_disk_windows.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write_disk_windows.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_write_disk_windows.c Wed Jan 24 11:01:12 2018 (r328323) @@ -906,7 +906,7 @@ _archive_write_disk_header(struct archive *_a, struct } int -archive_write_disk_set_skip_file(struct archive *_a, int64_t d, int64_t i) +archive_write_disk_set_skip_file(struct archive *_a, la_int64_t d, la_int64_t i) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1156,7 +1156,7 @@ _archive_write_disk_finish_entry(struct archive *_a) int archive_write_disk_set_group_lookup(struct archive *_a, void *private_data, - int64_t (*lookup_gid)(void *private, const char *gname, int64_t gid), + la_int64_t (*lookup_gid)(void *private, const char *gname, la_int64_t gid), void (*cleanup_gid)(void *private)) { struct archive_write_disk *a = (struct archive_write_disk *)_a; @@ -1192,7 +1192,7 @@ archive_write_disk_set_user_lookup(struct archive *_a, } int64_t -archive_write_disk_gid(struct archive *_a, const char *name, int64_t id) +archive_write_disk_gid(struct archive *_a, const char *name, la_int64_t id) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1203,7 +1203,7 @@ archive_write_disk_gid(struct archive *_a, const char } int64_t -archive_write_disk_uid(struct archive *_a, const char *name, int64_t id) +archive_write_disk_uid(struct archive *_a, const char *name, la_int64_t id) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1325,6 +1325,10 @@ restore_entry(struct archive_write_disk *a) if ((en == EISDIR || en == EEXIST) && (a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) { /* If we're not overwriting, we're done. */ + if (S_ISDIR(a->mode)) { + /* Don't overwrite any settings on existing directories. */ + a->todo = 0; + } archive_entry_unset_size(a->entry); return (ARCHIVE_OK); } Modified: vendor/libarchive/dist/libarchive/archive_write_set_format_7zip.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write_set_format_7zip.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/archive_write_set_format_7zip.c Wed Jan 24 11:01:12 2018 (r328323) @@ -2095,20 +2095,7 @@ compression_init_encoder_lzma2(struct archive *a, /* * _7_PPMD compressor. */ -static void * -ppmd_alloc(void *p, size_t size) -{ - (void)p; - return malloc(size); -} static void -ppmd_free(void *p, void *address) -{ - (void)p; - free(address); -} -static ISzAlloc g_szalloc = { ppmd_alloc, ppmd_free }; -static void ppmd_write(void *p, Byte b) { struct archive_write *a = ((IByteOut *)p)->a; @@ -2167,7 +2154,7 @@ compression_init_encoder_ppmd(struct archive *a, archive_le32enc(props+1, msize); __archive_ppmd7_functions.Ppmd7_Construct(&strm->ppmd7_context); r = __archive_ppmd7_functions.Ppmd7_Alloc( - &strm->ppmd7_context, msize, &g_szalloc); + &strm->ppmd7_context, msize); if (r == 0) { free(strm->buff); free(strm); @@ -2243,7 +2230,7 @@ compression_end_ppmd(struct archive *a, struct la_zstr (void)a; /* UNUSED */ strm = (struct ppmd_stream *)lastrm->real_stream; - __archive_ppmd7_functions.Ppmd7_Free(&strm->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&strm->ppmd7_context); free(strm->buff); free(strm); lastrm->real_stream = NULL; Modified: vendor/libarchive/dist/libarchive/test/read_open_memory.c ============================================================================== --- vendor/libarchive/dist/libarchive/test/read_open_memory.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/test/read_open_memory.c Wed Jan 24 11:01:12 2018 (r328323) @@ -91,9 +91,11 @@ read_open_memory_internal(struct archive *a, const voi switch (level) { case 3: archive_read_set_seek_callback(a, memory_read_seek); + __LA_FALLTHROUGH; case 2: archive_read_set_open_callback(a, memory_read_open); archive_read_set_skip_callback(a, memory_read_skip); + __LA_FALLTHROUGH; case 1: mine = malloc(sizeof(*mine)); if (mine == NULL) { Modified: vendor/libarchive/dist/libarchive/test/test.h ============================================================================== --- vendor/libarchive/dist/libarchive/test/test.h Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/test/test.h Wed Jan 24 11:01:12 2018 (r328323) @@ -33,4 +33,10 @@ #define EXTRA_ERRNO(x) archive_errno((struct archive *)(x)) #define EXTRA_VERSION archive_version_details() +#if defined(__GNUC__) && (__GNUC__ >= 7) +#define __LA_FALLTHROUGH __attribute__((fallthrough)) +#else +#define __LA_FALLTHROUGH +#endif + #include "test_common.h" Modified: vendor/libarchive/dist/libarchive/test/test_acl_platform_nfs4.c ============================================================================== --- vendor/libarchive/dist/libarchive/test/test_acl_platform_nfs4.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/test/test_acl_platform_nfs4.c Wed Jan 24 11:01:12 2018 (r328323) @@ -408,7 +408,9 @@ acl_flagset_to_bitmap(acl_flagset_t opaque_fs) {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, RICHACE_INHERIT_ONLY_ACE}, {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, RICHACE_INHERITED_ACE} #else /* FreeBSD NFSv4 ACL inheritance flags */ +#ifdef ACL_ENTRY_INHERITED {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED}, +#endif {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT}, {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT}, {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT}, Modified: vendor/libarchive/dist/libarchive/test/test_compat_zip.c ============================================================================== --- vendor/libarchive/dist/libarchive/test/test_compat_zip.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/test/test_compat_zip.c Wed Jan 24 11:01:12 2018 (r328323) @@ -422,3 +422,29 @@ DEFINE_TEST(test_compat_zip_7) } free(p); } + +/** + * A file with backslash path separators instead of slashes. + * PowerShell's Compress-Archive cmdlet produces such archives. + */ +DEFINE_TEST(test_compat_zip_8) +{ + const char *refname = "test_compat_zip_8.zip"; + struct archive *a; + struct archive_entry *ae; + void *p; + size_t s; + + extract_reference_file(refname); + p = slurpfile(&s, refname); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_minimal(a, p, s, 7)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + /* This file is in the archive as arc\test */ + assertEqualString("arc/test", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); + free(p); +} Modified: vendor/libarchive/dist/libarchive/test/test_read_format_zip.c ============================================================================== --- vendor/libarchive/dist/libarchive/test/test_read_format_zip.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/test/test_read_format_zip.c Wed Jan 24 11:01:12 2018 (r328323) @@ -41,6 +41,7 @@ verify_basic(struct archive *a, int seek_checks) int64_t o; assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 1.0 (uncompressed)", archive_format_name(a)); assertEqualString("dir/", archive_entry_pathname(ae)); assertEqualInt(1179604249, archive_entry_mtime(ae)); assertEqualInt(0, archive_entry_size(ae)); @@ -53,6 +54,7 @@ verify_basic(struct archive *a, int seek_checks) assertEqualInt((int)s, 0); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 2.0 (deflation)", archive_format_name(a)); assertEqualString("file1", archive_entry_pathname(ae)); assertEqualInt(1179604289, archive_entry_mtime(ae)); if (seek_checks) @@ -72,6 +74,7 @@ verify_basic(struct archive *a, int seek_checks) } assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 2.0 (deflation)", archive_format_name(a)); assertEqualString("file2", archive_entry_pathname(ae)); assertEqualInt(1179605932, archive_entry_mtime(ae)); assertEqualInt(archive_entry_is_encrypted(ae), 0); @@ -93,6 +96,7 @@ verify_basic(struct archive *a, int seek_checks) assert(archive_errno(a) != 0); } assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 2.0 (deflation)", archive_format_name(a)); /* Verify the number of files read. */ failure("the archive file has three files"); assertEqualInt(3, archive_file_count(a)); Modified: vendor/libarchive/dist/libarchive/test/test_write_disk_perms.c ============================================================================== --- vendor/libarchive/dist/libarchive/test/test_write_disk_perms.c Wed Jan 24 10:50:21 2018 (r328322) +++ vendor/libarchive/dist/libarchive/test/test_write_disk_perms.c Wed Jan 24 11:01:12 2018 (r328323) @@ -131,6 +131,8 @@ DEFINE_TEST(test_write_disk_perms) struct archive *a; struct archive_entry *ae; struct stat st; + uid_t original_uid; + uid_t try_to_change_uid; assertUmask(UMASK); @@ -200,6 +202,37 @@ DEFINE_TEST(test_write_disk_perms) assertEqualInt(0, stat("dir_overwrite_0744", &st)); failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode); assertEqualInt(st.st_mode & 0777, 0744); + + /* For dir, the owner should get left when not overwritting. */ + assertMakeDir("dir_owner", 0744); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Jan 24 11:03:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A221ECD2A8; Wed, 24 Jan 2018 11:03:19 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4047F837BA; Wed, 24 Jan 2018 11:03:19 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FDF31CD19; Wed, 24 Jan 2018 11:03:19 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OB3JOd058114; Wed, 24 Jan 2018 11:03:19 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OB3IHC058111; Wed, 24 Jan 2018 11:03:18 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201801241103.w0OB3IHC058111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Wed, 24 Jan 2018 11:03:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328324 - in vendor/libarchive/dist: cat/test libarchive/test X-SVN-Group: vendor X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in vendor/libarchive/dist: cat/test libarchive/test X-SVN-Commit-Revision: 328324 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 11:03:19 -0000 Author: mm Date: Wed Jan 24 11:03:18 2018 New Revision: 328324 URL: https://svnweb.freebsd.org/changeset/base/328324 Log: vendor/libarchive/dist: Add new files missing in r328323 Added: vendor/libarchive/dist/cat/test/test_stdin.c (contents, props changed) vendor/libarchive/dist/libarchive/test/test_compat_zip_8.zip.uu Added: vendor/libarchive/dist/cat/test/test_stdin.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/dist/cat/test/test_stdin.c Wed Jan 24 11:03:18 2018 (r328324) @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Sean Purcell + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" + +#if !defined(_WIN32) || defined(__CYGWIN__) +#define DEV_NULL "/dev/null" +#else +#define DEV_NULL "NUL" +#endif + +DEFINE_TEST(test_stdin) +{ + int f; + + f = systemf("%s <%s >test.out 2>test.err", testprog, DEV_NULL); + assertEqualInt(0, f); + assertEmptyFile("test.out"); + assertEmptyFile("test.err"); +} + Added: vendor/libarchive/dist/libarchive/test/test_compat_zip_8.zip.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/dist/libarchive/test/test_compat_zip_8.zip.uu Wed Jan 24 11:03:18 2018 (r328324) @@ -0,0 +1,6 @@ +begin 666 test_compat_zip_8.zip +M4$L#!!0````(`%A\;TOY6""D$`````X````(````87)C7'1E!BP$`4$L!`A0`%`````@`6'QO2_E8(*00````#@````@````````` +H`````````````&%R8UQT97-T4$L%!@`````!``$`-@```#8````````` +` +end From owner-svn-src-all@freebsd.org Wed Jan 24 11:51:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15422ECF2FA; Wed, 24 Jan 2018 11:51:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A2C2085370; Wed, 24 Jan 2018 11:51:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from coleburn.avinity.tv (unknown [77.95.97.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 441C86C09; Wed, 24 Jan 2018 12:51:16 +0100 (CET) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_C5C03FDE-AF29-4317-B0C8-11B1F174B9BC"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r328305 - head/lib/libcxxrt Date: Wed, 24 Jan 2018 12:51:16 +0100 In-Reply-To: <201801232241.w0NMfDWW002171@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Ed Maste References: <201801232241.w0NMfDWW002171@repo.freebsd.org> X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 11:51:18 -0000 --Apple-Mail=_C5C03FDE-AF29-4317-B0C8-11B1F174B9BC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 23 Jan 2018, at 23:41, Ed Maste wrote: >=20 > Author: emaste > Date: Tue Jan 23 22:41:13 2018 > New Revision: 328305 > URL: https://svnweb.freebsd.org/changeset/base/328305 >=20 > Log: > libcxxrt: Move mangled symbols out of extern "C++" in Version.map >=20 > r260553 added a number of mangled C++ symbols to Version.map inside = of > an existing `extern "C++"` block. >=20 > ld.bfd 2.17.50 treats `extern "C++"` permissively and will match both > mangled and demangled symbols against the strings in the version map > block. ld.lld interprets `extern "C++"` strictly, and matches only > demangled symbols. >=20 > I believe lld's behaviour is correct. Contemporary versions of = ld.bfd > also behave as lld does, so move the mangled symbols out of the > `extern "C++"` block. >=20 > PR: 225128, 185663 > MFC after: 1 week > Sponsored by: The FreeBSD Foundation >=20 > Modified: > head/lib/libcxxrt/Version.map >=20 > Modified: head/lib/libcxxrt/Version.map > = =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/lib/libcxxrt/Version.map Tue Jan 23 22:18:45 2018 = (r328304) > +++ head/lib/libcxxrt/Version.map Tue Jan 23 22:41:13 2018 = (r328305) > @@ -112,19 +112,6 @@ CXXABI_1.3 { > "typeinfo for void"; > "typeinfo for wchar_t const*"; > "typeinfo for wchar_t"; > - # C++11 typeinfo not understood by our linker > - # std::nullptr_t > - _ZTIDn;_ZTIPDn;_ZTIPKDn; Maybe, for readability, we should change these to unmangled form = instead? I didn't really understand why the file had mixed mangled and unmangled = forms. -Dimitry --Apple-Mail=_C5C03FDE-AF29-4317-B0C8-11B1F174B9BC Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWmhzNAAKCRCwXqMKLiCW ow+gAKDpL+4heH7EcRafMPwPMyTXLFpEkgCfcZlezMU4zLRIcJXq9Y8+qhK90Xs= =UP1H -----END PGP SIGNATURE----- --Apple-Mail=_C5C03FDE-AF29-4317-B0C8-11B1F174B9BC-- From owner-svn-src-all@freebsd.org Wed Jan 24 12:01:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABFB3ECFECF; Wed, 24 Jan 2018 12:01:33 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F8B985DDF; Wed, 24 Jan 2018 12:01:33 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A9041D562; Wed, 24 Jan 2018 12:01:33 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OC1XZK087639; Wed, 24 Jan 2018 12:01:33 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OC1X9R087638; Wed, 24 Jan 2018 12:01:33 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801241201.w0OC1X9R087638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 24 Jan 2018 12:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328325 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 328325 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 12:01:33 -0000 Author: wma Date: Wed Jan 24 12:01:32 2018 New Revision: 328325 URL: https://svnweb.freebsd.org/changeset/base/328325 Log: PPC: Add KASSERT in intrcnt_add which checks for buffer overflow Authored by: Patryk Duda Submitted by: Wojciech Macek Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Modified: head/sys/powerpc/powerpc/intr_machdep.c Modified: head/sys/powerpc/powerpc/intr_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/intr_machdep.c Wed Jan 24 11:03:18 2018 (r328324) +++ head/sys/powerpc/powerpc/intr_machdep.c Wed Jan 24 12:01:32 2018 (r328325) @@ -178,6 +178,8 @@ intrcnt_add(const char *name, u_long **countp) int idx; idx = atomic_fetchadd_int(&intrcnt_index, 1); + KASSERT(idx < INTR_VECTORS, ("intrcnt_add: Interrupt counter index " + "reached INTR_VECTORS")); *countp = &intrcnt[idx]; intrcnt_setname(name, idx); } From owner-svn-src-all@freebsd.org Wed Jan 24 12:40:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 680BBED2059; Wed, 24 Jan 2018 12:40:29 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 14F4B8760E; Wed, 24 Jan 2018 12:40:29 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 078BB1DB6E; Wed, 24 Jan 2018 12:40:29 +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 w0OCeSla003958; Wed, 24 Jan 2018 12:40:28 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OCeSWq003957; Wed, 24 Jan 2018 12:40:28 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201801241240.w0OCeSWq003957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 24 Jan 2018 12:40:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328326 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 328326 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 12:40:29 -0000 Author: ae Date: Wed Jan 24 12:40:28 2018 New Revision: 328326 URL: https://svnweb.freebsd.org/changeset/base/328326 Log: When IPv6 packet is handled by O_REJECT opcode, convert ICMP code specified in the arg1 into ICMPv6 destination unreachable code according to RFC7915. Obtained from: Yandex LLC MFC after: 2 weeks Sponsored by: Yandex LLC Modified: head/sys/netpfil/ipfw/ip_fw2.c Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Wed Jan 24 12:01:32 2018 (r328325) +++ head/sys/netpfil/ipfw/ip_fw2.c Wed Jan 24 12:40:28 2018 (r328326) @@ -821,6 +821,32 @@ is_icmp6_query(int icmp6_type) return (0); } +static int +map_icmp_unreach(int code) +{ + + /* RFC 7915 p4.2 */ + switch (code) { + case ICMP_UNREACH_NET: + case ICMP_UNREACH_HOST: + case ICMP_UNREACH_SRCFAIL: + case ICMP_UNREACH_NET_UNKNOWN: + case ICMP_UNREACH_HOST_UNKNOWN: + case ICMP_UNREACH_TOSNET: + case ICMP_UNREACH_TOSHOST: + return (ICMP6_DST_UNREACH_NOROUTE); + case ICMP_UNREACH_PORT: + return (ICMP6_DST_UNREACH_NOPORT); + default: + /* + * Map the rest of codes into admit prohibited. + * XXX: unreach proto should be mapped into ICMPv6 + * parameter problem, but we use only unreach type. + */ + return (ICMP6_DST_UNREACH_ADMIN); + } +} + static void send_reject6(struct ip_fw_args *args, int code, u_int hlen, struct ip6_hdr *ip6) { @@ -2831,9 +2857,12 @@ do { \ (proto != IPPROTO_ICMPV6 || (is_icmp6_query(icmp6_type) == 1)) && !(m->m_flags & (M_BCAST|M_MCAST)) && - !IN6_IS_ADDR_MULTICAST(&args->f_id.dst_ip6)) { - send_reject6( - args, cmd->arg1, hlen, + !IN6_IS_ADDR_MULTICAST( + &args->f_id.dst_ip6)) { + send_reject6(args, + cmd->opcode == O_REJECT ? + map_icmp_unreach(cmd->arg1): + cmd->arg1, hlen, (struct ip6_hdr *)ip); m = args->m; } From owner-svn-src-all@freebsd.org Wed Jan 24 12:40:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2A10ED2087; Wed, 24 Jan 2018 12:40:42 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::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 8A9CD8771B; Wed, 24 Jan 2018 12:40:42 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x22e.google.com with SMTP id m11so4704063iob.2; Wed, 24 Jan 2018 04:40:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=/PogDyxGwoqhqUEDSBdNaRelvSAdSNPuCiJkdSIgn+4=; b=Q99pfphHfPYfZIGnJOH5JqbLXwt0OP3qsir7OfMLRy90HuPsVbQoJnW9urxK3vNcx/ 81TxSRWIk1RTvQNq5eoFOgtcxNhVoRhg969ozcKURT9SSWCxyAAhnTzKfonpLs3JslM1 UMSJlTuhIfjAt11cPPROhSjyj3ElMQy0cvhuq5qRxsgD0/R/ZIAb953j7M3bcsBDqeKU PFP84uUYznd5wEC+BK2fDZo6NhKhmkqtndddGEH6fTVJzf/8saowcb0Bd7hJGv7icA2E +glul4OhRTBfz7dl+9ZrbwZ3n8I6nRKytZuG4fipDY7+XBITSsVfxX8B6xPMtUUzw7Wo xIzg== 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=/PogDyxGwoqhqUEDSBdNaRelvSAdSNPuCiJkdSIgn+4=; b=pphcGWkAMQs5ofHgGICR3hBwRc6pBpuvUyaUx/FvadGJtprlV4sbN+sA2im+oF2CCO JEvf63cGIKrb+QuER2J3YHaG25Ib+l7D/wjTDrtB2naBVYu2dUOnf5aFrB5PfPf4UPcV pKCNQpzv5IzA9XTnpiOo+UUPLkieAlXu6HDd5hG23D+x+br5BNUCXiGujA+8YxOGuW6h rvNPznrcp9EEJjIc+/nF441FxWfLSOH/DUsNSmUKnmu/8aj1azfaX9L5KQoBouJWFpkG GXSAZ0Mh26RSyjdNTDBcKJanY5Iq5L8ZN0secro6ZeNvO4OKX1BMP9EjP2OITefjM9D3 90Fg== X-Gm-Message-State: AKwxytclAgmiP6sJ1EilLLAXBh174eMqBbJbSoAUTzL3Z4PuHUH0PqeE /SiJpw5HcTXvbt0440Xf5BM+t5B2CWUzx97bmrg4Ig== X-Google-Smtp-Source: AH8x225FLFt+ywWe7gX9wZysdO2Xh3TEi+lxSuWuIQTkMqyDR2W6nsxnJMknlkvqgsUfxb0j599F1vl/lpxobR2WyZ0= X-Received: by 10.107.169.94 with SMTP id s91mr8193223ioe.83.1516797641966; Wed, 24 Jan 2018 04:40:41 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.152.9 with HTTP; Wed, 24 Jan 2018 04:40:21 -0800 (PST) In-Reply-To: References: <201801232241.w0NMfDWW002171@repo.freebsd.org> From: Ed Maste Date: Wed, 24 Jan 2018 07:40:21 -0500 X-Google-Sender-Auth: fNenXhJSiETPcHzQEVRnkiliDyo Message-ID: Subject: Re: svn commit: r328305 - head/lib/libcxxrt To: Dimitry Andric 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.25 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, 24 Jan 2018 12:40:43 -0000 On 24 January 2018 at 06:51, Dimitry Andric wrote: >> - # C++11 typeinfo not understood by our linker >> - # std::nullptr_t >> - _ZTIDn;_ZTIPDn;_ZTIPKDn; > > Maybe, for readability, we should change these to unmangled form instead? I believe they're mangled because ld.bfd 2.17.50 cannot demangle them. I think we have to keep them like this until we're fully committed to using only in-tree lld or external toolchain linkers across platforms. From owner-svn-src-all@freebsd.org Wed Jan 24 12:51:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EF27ED26A1; Wed, 24 Jan 2018 12:51:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40E7587E44; Wed, 24 Jan 2018 12:51:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BD051DE39; Wed, 24 Jan 2018 12:51:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OCpEow011826; Wed, 24 Jan 2018 12:51:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OCpEW4011824; Wed, 24 Jan 2018 12:51:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201801241251.w0OCpEW4011824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 24 Jan 2018 12:51: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: r328327 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 328327 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 12:51:14 -0000 Author: hselasky Date: Wed Jan 24 12:51:13 2018 New Revision: 328327 URL: https://svnweb.freebsd.org/changeset/base/328327 Log: MFC r322596: Add SI_SUB_TASKQ after SI_SUB_INTR and move taskqueue initialization there for EARLY_AP_STARTUP This fixes a regression accidentally introduced in r322588, due to an interaction with EARLY_AP_STARTUP. Discussed with: cem@ Reviewed by: bdrewery@, jhb@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12053 Modified: stable/11/sys/sys/kernel.h stable/11/sys/sys/taskqueue.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/kernel.h ============================================================================== --- stable/11/sys/sys/kernel.h Wed Jan 24 12:40:28 2018 (r328326) +++ stable/11/sys/sys/kernel.h Wed Jan 24 12:51:13 2018 (r328327) @@ -118,6 +118,7 @@ enum sysinit_sub_id { SI_SUB_SCHED_IDLE = 0x2600000, /* required idle procs */ SI_SUB_MBUF = 0x2700000, /* mbuf subsystem */ SI_SUB_INTR = 0x2800000, /* interrupt threads */ + SI_SUB_TASKQ = 0x2880000, /* task queues */ #ifdef EARLY_AP_STARTUP SI_SUB_SMP = 0x2900000, /* start the APs*/ #endif Modified: stable/11/sys/sys/taskqueue.h ============================================================================== --- stable/11/sys/sys/taskqueue.h Wed Jan 24 12:40:28 2018 (r328326) +++ stable/11/sys/sys/taskqueue.h Wed Jan 24 12:51:13 2018 (r328327) @@ -149,7 +149,7 @@ taskqueue_define_##name(void *arg) \ init; \ } \ \ -SYSINIT(taskqueue_##name, SI_SUB_INIT_IF, SI_ORDER_SECOND, \ +SYSINIT(taskqueue_##name, SI_SUB_TASKQ, SI_ORDER_SECOND, \ taskqueue_define_##name, NULL); \ \ struct __hack @@ -174,7 +174,7 @@ taskqueue_define_##name(void *arg) \ init; \ } \ \ -SYSINIT(taskqueue_##name, SI_SUB_INIT_IF, SI_ORDER_SECOND, \ +SYSINIT(taskqueue_##name, SI_SUB_TASKQ, SI_ORDER_SECOND, \ taskqueue_define_##name, NULL); \ \ struct __hack From owner-svn-src-all@freebsd.org Wed Jan 24 13:12:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD3C5ED35D9; Wed, 24 Jan 2018 13:12:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5BB5488AA1; Wed, 24 Jan 2018 13:12:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56BAA1E1B9; Wed, 24 Jan 2018 13:12:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0ODCM55023587; Wed, 24 Jan 2018 13:12:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0ODCMro023584; Wed, 24 Jan 2018 13:12:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201801241312.w0ODCMro023584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 24 Jan 2018 13:12: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: r328328 - in stable/11/sys: kern net sys X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: kern net sys X-SVN-Commit-Revision: 328328 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 13:12:22 -0000 Author: hselasky Date: Wed Jan 24 13:12:21 2018 New Revision: 328328 URL: https://svnweb.freebsd.org/changeset/base/328328 Log: MFC r314502: Make gtaskqueue compatible with drm-next such that they can be used with the linuxkpi tasklets. Submitted by: mmacy@nextbsd.org Reported by: hselasky (hps) Modified: stable/11/sys/kern/subr_gtaskqueue.c stable/11/sys/net/iflib.c stable/11/sys/sys/gtaskqueue.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/11/sys/kern/subr_gtaskqueue.c Wed Jan 24 12:51:13 2018 (r328327) +++ stable/11/sys/kern/subr_gtaskqueue.c Wed Jan 24 13:12:21 2018 (r328328) @@ -52,6 +52,7 @@ static MALLOC_DEFINE(M_GTASKQUEUE, "taskqueue", "Task static void gtaskqueue_thread_enqueue(void *); static void gtaskqueue_thread_loop(void *arg); +TASKQGROUP_DEFINE(softirq, mp_ncpus, 1); struct gtaskqueue_busy { struct gtask *tb_running; Modified: stable/11/sys/net/iflib.c ============================================================================== --- stable/11/sys/net/iflib.c Wed Jan 24 12:51:13 2018 (r328327) +++ stable/11/sys/net/iflib.c Wed Jan 24 13:12:21 2018 (r328328) @@ -480,7 +480,6 @@ MODULE_VERSION(iflib, 1); MODULE_DEPEND(iflib, pci, 1, 1, 1); MODULE_DEPEND(iflib, ether, 1, 1, 1); -TASKQGROUP_DEFINE(if_io_tqg, mp_ncpus, 1); TASKQGROUP_DEFINE(if_config_tqg, 1, 1); #ifndef IFLIB_DEBUG_COUNTERS @@ -3706,7 +3705,7 @@ iflib_device_deregister(if_ctx_t ctx) if (ctx->ifc_led_dev != NULL) led_destroy(ctx->ifc_led_dev); /* XXX drain any dependent tasks */ - tqg = qgroup_if_io_tqg; + tqg = qgroup_softirq; for (txq = ctx->ifc_txqs, i = 0; i < NTXQSETS(ctx); i++, txq++) { callout_drain(&txq->ift_timer); callout_drain(&txq->ift_db_check); @@ -4328,7 +4327,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, in q = &ctx->ifc_txqs[qid]; info = &ctx->ifc_txqs[qid].ift_filter_info; gtask = &ctx->ifc_txqs[qid].ift_task; - tqg = qgroup_if_io_tqg; + tqg = qgroup_softirq; tqrid = irq->ii_rid; fn = _task_fn_tx; break; @@ -4336,7 +4335,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, in q = &ctx->ifc_rxqs[qid]; info = &ctx->ifc_rxqs[qid].ifr_filter_info; gtask = &ctx->ifc_rxqs[qid].ifr_task; - tqg = qgroup_if_io_tqg; + tqg = qgroup_softirq; tqrid = irq->ii_rid; fn = _task_fn_rx; break; @@ -4384,13 +4383,13 @@ iflib_softirq_alloc_generic(if_ctx_t ctx, int rid, ifl case IFLIB_INTR_TX: q = &ctx->ifc_txqs[qid]; gtask = &ctx->ifc_txqs[qid].ift_task; - tqg = qgroup_if_io_tqg; + tqg = qgroup_softirq; fn = _task_fn_tx; break; case IFLIB_INTR_RX: q = &ctx->ifc_rxqs[qid]; gtask = &ctx->ifc_rxqs[qid].ifr_task; - tqg = qgroup_if_io_tqg; + tqg = qgroup_softirq; fn = _task_fn_rx; break; case IFLIB_INTR_ADMIN: @@ -4441,7 +4440,7 @@ iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filte q = &ctx->ifc_rxqs[0]; info = &rxq[0].ifr_filter_info; gtask = &rxq[0].ifr_task; - tqg = qgroup_if_io_tqg; + tqg = qgroup_softirq; tqrid = irq->ii_rid = *rid; fn = _task_fn_rx; @@ -4457,7 +4456,7 @@ iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filte taskqgroup_attach(tqg, gtask, q, tqrid, name); GROUPTASK_INIT(&txq->ift_task, 0, _task_fn_tx, txq); - taskqgroup_attach(qgroup_if_io_tqg, &txq->ift_task, txq, tqrid, "tx"); + taskqgroup_attach(qgroup_softirq, &txq->ift_task, txq, tqrid, "tx"); GROUPTASK_INIT(&ctx->ifc_admin_task, 0, _task_fn_admin, ctx); taskqgroup_attach(qgroup_if_config_tqg, &ctx->ifc_admin_task, ctx, -1, "admin/link"); @@ -4504,7 +4503,7 @@ void iflib_io_tqg_attach(struct grouptask *gt, void *uniq, int cpu, char *name) { - taskqgroup_attach_cpu(qgroup_if_io_tqg, gt, uniq, cpu, -1, name); + taskqgroup_attach_cpu(qgroup_softirq, gt, uniq, cpu, -1, name); } void Modified: stable/11/sys/sys/gtaskqueue.h ============================================================================== --- stable/11/sys/sys/gtaskqueue.h Wed Jan 24 12:51:13 2018 (r328327) +++ stable/11/sys/sys/gtaskqueue.h Wed Jan 24 13:12:21 2018 (r328328) @@ -121,5 +121,6 @@ SYSINIT(taskqgroup_adj_##name, SI_SUB_SMP, SI_ORDER_AN struct __hack #endif TASKQGROUP_DECLARE(net); +TASKQGROUP_DECLARE(softirq); #endif /* !_SYS_GTASKQUEUE_H_ */ From owner-svn-src-all@freebsd.org Wed Jan 24 13:37:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC438ED4736; Wed, 24 Jan 2018 13:37:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6AA818985C; Wed, 24 Jan 2018 13:37:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F3531E4E5; Wed, 24 Jan 2018 13:37:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0ODb7jt033196; Wed, 24 Jan 2018 13:37:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0ODb7Z3033195; Wed, 24 Jan 2018 13:37:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201801241337.w0ODb7Z3033195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 24 Jan 2018 13:37:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328329 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 328329 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 13:37:07 -0000 Author: hselasky Date: Wed Jan 24 13:37:07 2018 New Revision: 328329 URL: https://svnweb.freebsd.org/changeset/base/328329 Log: Properly implement the "id" callback argument in the "idr_for_each" function in the LinuxKPI. The old implementation assumed only one IDR layer was present. Take additional IDR layers into account when computing the "id" value. MFC after: 1 week Found by: Karthik Palanichamy Tested by: Karthik Palanichamy Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_idr.c Modified: head/sys/compat/linuxkpi/common/src/linux_idr.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_idr.c Wed Jan 24 13:12:21 2018 (r328328) +++ head/sys/compat/linuxkpi/common/src/linux_idr.c Wed Jan 24 13:37:07 2018 (r328329) @@ -680,7 +680,7 @@ idr_alloc_cyclic(struct idr *idr, void *ptr, int start } static int -idr_for_each_layer(struct idr_layer *il, int layer, +idr_for_each_layer(struct idr_layer *il, int offset, int layer, int (*f)(int id, void *p, void *data), void *data) { int i, err; @@ -691,7 +691,7 @@ idr_for_each_layer(struct idr_layer *il, int layer, for (i = 0; i < IDR_SIZE; i++) { if (il->ary[i] == NULL) continue; - err = f(i, il->ary[i], data); + err = f(i + offset, il->ary[i], data); if (err) return (err); } @@ -700,7 +700,8 @@ idr_for_each_layer(struct idr_layer *il, int layer, for (i = 0; i < IDR_SIZE; i++) { if (il->ary[i] == NULL) continue; - err = idr_for_each_layer(il->ary[i], layer - 1, f, data); + err = idr_for_each_layer(il->ary[i], + (i + offset) * IDR_SIZE, layer - 1, f, data); if (err) return (err); } @@ -711,7 +712,7 @@ idr_for_each_layer(struct idr_layer *il, int layer, int idr_for_each(struct idr *idp, int (*f)(int id, void *p, void *data), void *data) { - return (idr_for_each_layer(idp->top, idp->layers - 1, f, data)); + return (idr_for_each_layer(idp->top, 0, idp->layers - 1, f, data)); } int From owner-svn-src-all@freebsd.org Wed Jan 24 13:45:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A22D9ED4CD2; Wed, 24 Jan 2018 13:45:49 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (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 34A1489E1D; Wed, 24 Jan 2018 13:45:48 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 459C22604F8; Wed, 24 Jan 2018 14:45:40 +0100 (CET) Subject: Re: svn commit: r328320 - head/sys/kern To: Wojciech Macek , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801240754.w0O7s57E063486@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Wed, 24 Jan 2018 14:42:47 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801240754.w0O7s57E063486@repo.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.25 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, 24 Jan 2018 13:45:50 -0000 On 01/24/18 08:54, Wojciech Macek wrote: > Author: wma > Date: Wed Jan 24 07:54:05 2018 > New Revision: 328320 > URL: https://svnweb.freebsd.org/changeset/base/328320 > > Log: > ULE: provide defaults to ts_cpu > > Fix a bug when the system has no CPU 0. When created, threads were implicitly assigned to CPU 0. > This had no practical effect since a real CPU was chosen immediately by the scheduler. However, > on systems without a CPU 0, sched_ule attempted to access the scheduler queue of the "old" CPU > when assigned the initial choice of the old one. This caused an attempt to use illegal memory > and a crash (or, more usually, a deadlock). Fix this by assigned new threads to the BSP > explicitly and add some asserts to see that this problem does not recur. > > Authored by: Nathan Whitehorn > Submitted by: Wojciech Macek > Obtained from: Semihalf > Differential revision: https://reviews.freebsd.org/D13932 > > Modified: > head/sys/kern/sched_ule.c > > Modified: head/sys/kern/sched_ule.c > ============================================================================== > --- head/sys/kern/sched_ule.c Wed Jan 24 07:01:44 2018 (r328319) > +++ head/sys/kern/sched_ule.c Wed Jan 24 07:54:05 2018 (r328320) > @@ -1405,6 +1405,7 @@ sched_setup(void *dummy) > > /* Add thread0's load since it's running. */ > TDQ_LOCK(tdq); > + td_get_sched(&thread0)->ts_cpu = curcpu; /* Something valid to start */ > thread0.td_lock = TDQ_LOCKPTR(TDQ_SELF()); > tdq_load_add(tdq, &thread0); > tdq->tdq_lowpri = thread0.td_priority; > @@ -2454,6 +2455,7 @@ sched_add(struct thread *td, int flags) > * Pick the destination cpu and if it isn't ours transfer to the > * target cpu. > */ > + td_get_sched(td)->ts_cpu = curcpu; /* Pick something valid to start */ > cpu = sched_pickcpu(td, flags); > tdq = sched_setcpu(td, cpu, flags); > tdq_add(tdq, td, flags); > > Hi Wojciech, I believe this chunk is wrong and the same like in r326218. See the explanation for r326376 as pasted below. Can you please revert? Further refer to existing discussions about "r326218" on the SVN commit list. Maybe you missed the point of r326376 when integrating? --HPS > Revision 326376 - (view) (download) (annotate) - [select for diffs] > Modified Wed Nov 29 23:28:40 2017 UTC (7 weeks, 6 days ago) by hselasky > File length: 80183 byte(s) > Diff to previous 326271 > > The sched_add() function is not only used when the thread is initially > started, but also by the turnstiles to mark a thread as runnable for > all locks, for instance sleepqueues do: > setrunnable()->sched_wakeup()->sched_add() > > In r326218 code was added to allow booting from non-zero CPU numbers > by setting the ts_cpu field inside the ULE scheduler's sched_add() > function. This had an undesired side-effect that prior sched_pin() and > sched_bind() calls got disregarded. This patch fixes the > initialization of the ts_cpu field for the ULE scheduler to only > happen once when the initial thread is constructed during system > init. Forking will then later on ensure that a valid ts_cpu value gets > copied to all children. > > Reviewed by: jhb, kib > Discussed with: nwhitehorn > MFC after: 1 month > Differential revision: https://reviews.freebsd.org/D13298 > Sponsored by: Mellanox Technologies > From owner-svn-src-all@freebsd.org Wed Jan 24 13:57:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80435ED522D; Wed, 24 Jan 2018 13:57:02 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 31C718A3CB; Wed, 24 Jan 2018 13:57:02 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 277A81E81B; Wed, 24 Jan 2018 13:57:02 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0ODv1Qc043581; Wed, 24 Jan 2018 13:57:01 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0ODv1tm043580; Wed, 24 Jan 2018 13:57:01 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801241357.w0ODv1tm043580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 24 Jan 2018 13:57:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328330 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 328330 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 13:57:02 -0000 Author: wma Date: Wed Jan 24 13:57:01 2018 New Revision: 328330 URL: https://svnweb.freebsd.org/changeset/base/328330 Log: Reverting r328320 Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Wed Jan 24 13:37:07 2018 (r328329) +++ head/sys/kern/sched_ule.c Wed Jan 24 13:57:01 2018 (r328330) @@ -1405,7 +1405,6 @@ sched_setup(void *dummy) /* Add thread0's load since it's running. */ TDQ_LOCK(tdq); - td_get_sched(&thread0)->ts_cpu = curcpu; /* Something valid to start */ thread0.td_lock = TDQ_LOCKPTR(TDQ_SELF()); tdq_load_add(tdq, &thread0); tdq->tdq_lowpri = thread0.td_priority; @@ -2455,7 +2454,6 @@ sched_add(struct thread *td, int flags) * Pick the destination cpu and if it isn't ours transfer to the * target cpu. */ - td_get_sched(td)->ts_cpu = curcpu; /* Pick something valid to start */ cpu = sched_pickcpu(td, flags); tdq = sched_setcpu(td, cpu, flags); tdq_add(tdq, td, flags); From owner-svn-src-all@freebsd.org Wed Jan 24 14:01:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5DC8ED54CC; Wed, 24 Jan 2018 14:01:08 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0A0CF8A721; Wed, 24 Jan 2018 14:01:07 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id eLbmeM3jD7GjaeLbneB83h; Wed, 24 Jan 2018 07:01:00 -0700 X-Authority-Analysis: v=2.3 cv=I59Luuog c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=RgaUWeydRksA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=9aLvj5GGk3lsft4EJrgA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id B94692C5; Wed, 24 Jan 2018 06:00:57 -0800 (PST) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w0OE0vq6013973; Wed, 24 Jan 2018 06:00:57 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w0OE0vBR013970; Wed, 24 Jan 2018 06:00:57 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201801241400.w0OE0vBR013970@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Wojciech Macek cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328330 - head/sys/kern In-Reply-To: Message from Wojciech Macek of "Wed, 24 Jan 2018 13:57:01 +0000." <201801241357.w0ODv1tm043580@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 24 Jan 2018 06:00:57 -0800 X-CMAE-Envelope: MS4wfBcQ1YdW+nnRuQTyZMUsCDo3U9Oug+pcPB+6tTrKZv3WU30hiv2PoyLVUSTOXfB+K1fn3q1h3pPjBDlhE9orysG8umhw9e4TbG8KgSkG1iUUnsUwuPqg LvtlXdE+z+tPuDg2+z0YIPsK565q3bElgSKnxScPC/62Q2RbOZxG80K48KoFbfhLjZbBZVSY+hOXWXBLWphQJV246Et8ySnl031a/eTcwFIpG4Uk8ICaTs2g dKW4WsaklEbXckvvHKxwTw== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 14:01:08 -0000 In message <201801241357.w0ODv1tm043580@repo.freebsd.org>, Wojciech Macek write s: > Author: wma > Date: Wed Jan 24 13:57:01 2018 > New Revision: 328330 > URL: https://svnweb.freebsd.org/changeset/base/328330 > > Log: > Reverting r328320 > > Modified: > head/sys/kern/sched_ule.c > > Modified: head/sys/kern/sched_ule.c Why? What happened? -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Wed Jan 24 14:09:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFCDEED5EB8; Wed, 24 Jan 2018 14:09:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (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 908CF8AB8D; Wed, 24 Jan 2018 14:09:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 0069B2604F8; Wed, 24 Jan 2018 15:09:16 +0100 (CET) Subject: Re: svn commit: r328330 - head/sys/kern To: Cy Schubert , Wojciech Macek Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801241400.w0OE0vBR013970@slippy.cwsent.com> From: Hans Petter Selasky Message-ID: <82d52ee3-1c2a-2399-0142-0027b4370b6f@selasky.org> Date: Wed, 24 Jan 2018 15:06:24 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801241400.w0OE0vBR013970@slippy.cwsent.com> 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.25 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, 24 Jan 2018 14:09:19 -0000 On 01/24/18 15:00, Cy Schubert wrote: > Why? What happened? > Hi, See r326376 . This patch is out of date :-) --HPS From owner-svn-src-all@freebsd.org Wed Jan 24 14:15:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C361ED6453; Wed, 24 Jan 2018 14:15:07 +0000 (UTC) (envelope-from amdmi3@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19CF78B099; Wed, 24 Jan 2018 14:15:07 +0000 (UTC) (envelope-from amdmi3@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13A5A1EB42; Wed, 24 Jan 2018 14:15:07 +0000 (UTC) (envelope-from amdmi3@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OEF6GF052977; Wed, 24 Jan 2018 14:15:06 GMT (envelope-from amdmi3@FreeBSD.org) Received: (from amdmi3@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OEF6vr052976; Wed, 24 Jan 2018 14:15:06 GMT (envelope-from amdmi3@FreeBSD.org) Message-Id: <201801241415.w0OEF6vr052976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: amdmi3 set sender to amdmi3@FreeBSD.org using -f From: Dmitry Marakasov Date: Wed, 24 Jan 2018 14:15:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328331 - head/etc X-SVN-Group: head X-SVN-Commit-Author: amdmi3 X-SVN-Commit-Paths: head/etc X-SVN-Commit-Revision: 328331 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 14:15:07 -0000 Author: amdmi3 (ports committer) Date: Wed Jan 24 14:15:06 2018 New Revision: 328331 URL: https://svnweb.freebsd.org/changeset/base/328331 Log: Support configuring arbitrary limits(1) for any daemon in rc.conf Usage is ${name}_limits, and the argument is any flags accepted by limits(1), such as `-n 100' (e.g. only allow 100 open files). Approved by: cy Differential Revision: https://reviews.freebsd.org/D14015 Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Wed Jan 24 13:57:01 2018 (r328330) +++ head/etc/rc.subr Wed Jan 24 14:15:06 2018 (r328331) @@ -775,6 +775,8 @@ check_startmsgs() # # ${name}_login_class n Login class to use, else "daemon". # +# ${name}_limits n limits(1) to apply to ${command}. +# # ${rc_arg}_cmd n If set, use this as the method when invoked; # Otherwise, use default command (see below) # @@ -952,7 +954,7 @@ run_rc_command() _group=\$${name}_group _groups=\$${name}_groups \ _fib=\$${name}_fib _env=\$${name}_env \ _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon} \ - _oomprotect=\$${name}_oomprotect + _limits=\$${name}_limits _oomprotect=\$${name}_oomprotect if [ -n "$_user" ]; then # unset $_user if running as that user if [ "$_user" = "$(eval $IDCMD)" ]; then @@ -1073,7 +1075,7 @@ $command $rc_flags $command_args" fi # Prepend default limits - _doit="$_cd limits -C $_login_class $_doit" + _doit="$_cd limits -C $_login_class $_limits $_doit" # run the full command # From owner-svn-src-all@freebsd.org Wed Jan 24 14:24:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC6B9ED6ACB; Wed, 24 Jan 2018 14:24:21 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 69DCB8B697; Wed, 24 Jan 2018 14:24:21 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 608DB1ED26; Wed, 24 Jan 2018 14:24:21 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OEOLde058892; Wed, 24 Jan 2018 14:24:21 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OEOIaI058858; Wed, 24 Jan 2018 14:24:18 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201801241424.w0OEOIaI058858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Wed, 24 Jan 2018 14:24:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328332 - in head: contrib/libarchive/cat contrib/libarchive/cat/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/test lib/libarchive/tests u... X-SVN-Group: head X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in head: contrib/libarchive/cat contrib/libarchive/cat/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/test lib/libarchive/tests usr.bin/bsdcat/tests X-SVN-Commit-Revision: 328332 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 14:24:22 -0000 Author: mm Date: Wed Jan 24 14:24:17 2018 New Revision: 328332 URL: https://svnweb.freebsd.org/changeset/base/328332 Log: MFV r328323,328324: Sync libarchive with vendor. Relevant vendor changes: PR #893: delete dead ppmd7 alloc callbacks PR #904: Fix archive freeing bug in bsdcat PR #961: Fix ZIP format names PR #962: Don't modify attributes for existing directories when ARCHIVE_EXTRACT_NO_OVERWRITE is set PR #964: Fix -Werror=implicit-fallthrough= for GCC 7 PR #970: zip: Allow backslash as path separator MFC after: 1 week Added: head/contrib/libarchive/cat/test/test_stdin.c - copied unchanged from r328324, vendor/libarchive/dist/cat/test/test_stdin.c head/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu - copied unchanged from r328324, vendor/libarchive/dist/libarchive/test/test_compat_zip_8.zip.uu Modified: head/contrib/libarchive/cat/bsdcat.c head/contrib/libarchive/libarchive/archive_acl.c head/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c head/contrib/libarchive/libarchive/archive_match.c head/contrib/libarchive/libarchive/archive_platform.h head/contrib/libarchive/libarchive/archive_ppmd7.c head/contrib/libarchive/libarchive/archive_ppmd7_private.h head/contrib/libarchive/libarchive/archive_ppmd_private.h head/contrib/libarchive/libarchive/archive_read.c head/contrib/libarchive/libarchive/archive_read_disk_posix.c head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c head/contrib/libarchive/libarchive/archive_read_support_format_rar.c head/contrib/libarchive/libarchive/archive_read_support_format_tar.c head/contrib/libarchive/libarchive/archive_read_support_format_zip.c head/contrib/libarchive/libarchive/archive_util.c head/contrib/libarchive/libarchive/archive_virtual.c head/contrib/libarchive/libarchive/archive_write.c head/contrib/libarchive/libarchive/archive_write_disk_posix.c head/contrib/libarchive/libarchive/archive_write_set_format_7zip.c head/contrib/libarchive/libarchive/test/read_open_memory.c head/contrib/libarchive/libarchive/test/test.h head/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c head/contrib/libarchive/libarchive/test/test_compat_zip.c head/contrib/libarchive/libarchive/test/test_read_format_zip.c head/contrib/libarchive/libarchive/test/test_write_disk_perms.c head/contrib/libarchive/tar/test/test_option_acls.c head/lib/libarchive/tests/Makefile head/usr.bin/bsdcat/tests/Makefile Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/cat/bsdcat.c ============================================================================== --- head/contrib/libarchive/cat/bsdcat.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/cat/bsdcat.c Wed Jan 24 14:24:17 2018 (r328332) @@ -70,6 +70,12 @@ version(void) void bsdcat_next(void) { + if (a != NULL) { + if (archive_read_close(a) != ARCHIVE_OK) + bsdcat_print_error(); + archive_read_free(a); + } + a = archive_read_new(); archive_read_support_filter_all(a); archive_read_support_format_empty(a); @@ -100,8 +106,10 @@ bsdcat_read_to_stdout(const char* filename) ; else if (archive_read_data_into_fd(a, 1) != ARCHIVE_OK) bsdcat_print_error(); - if (archive_read_free(a) != ARCHIVE_OK) + if (archive_read_close(a) != ARCHIVE_OK) bsdcat_print_error(); + archive_read_free(a); + a = NULL; } int @@ -135,15 +143,14 @@ main(int argc, char **argv) if (*bsdcat->argv == NULL) { bsdcat_current_path = ""; bsdcat_read_to_stdout(NULL); - } else + } else { while (*bsdcat->argv) { bsdcat_current_path = *bsdcat->argv++; bsdcat_read_to_stdout(bsdcat_current_path); bsdcat_next(); } - - if (a != NULL) - archive_read_free(a); + archive_read_free(a); /* Help valgrind & friends */ + } exit(exit_status); } Copied: head/contrib/libarchive/cat/test/test_stdin.c (from r328324, vendor/libarchive/dist/cat/test/test_stdin.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/cat/test/test_stdin.c Wed Jan 24 14:24:17 2018 (r328332, copy of r328324, vendor/libarchive/dist/cat/test/test_stdin.c) @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2017 Sean Purcell + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" + +#if !defined(_WIN32) || defined(__CYGWIN__) +#define DEV_NULL "/dev/null" +#else +#define DEV_NULL "NUL" +#endif + +DEFINE_TEST(test_stdin) +{ + int f; + + f = systemf("%s <%s >test.out 2>test.err", testprog, DEV_NULL); + assertEqualInt(0, f); + assertEmptyFile("test.out"); + assertEmptyFile("test.err"); +} + Modified: head/contrib/libarchive/libarchive/archive_acl.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_acl.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_acl.c Wed Jan 24 14:24:17 2018 (r328332) @@ -1159,6 +1159,7 @@ archive_acl_from_text_w(struct archive_acl *acl, const switch (want_type) { case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E: want_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS; + __LA_FALLTHROUGH; case ARCHIVE_ENTRY_ACL_TYPE_ACCESS: case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT: numfields = 5; @@ -1626,6 +1627,7 @@ archive_acl_from_text_l(struct archive_acl *acl, const switch (want_type) { case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E: want_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS; + __LA_FALLTHROUGH; case ARCHIVE_ENTRY_ACL_TYPE_ACCESS: case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT: numfields = 5; Modified: head/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c Wed Jan 24 14:24:17 2018 (r328332) @@ -93,7 +93,9 @@ static const acl_perm_map_t acl_nfs4_flag_map[] = { {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY}, {ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACL_ENTRY_SUCCESSFUL_ACCESS}, {ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACL_ENTRY_FAILED_ACCESS}, +#ifdef ACL_ENTRY_INHERITED {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED} +#endif }; static const int acl_nfs4_flag_map_size = Modified: head/contrib/libarchive/libarchive/archive_match.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_match.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_match.c Wed Jan 24 14:24:17 2018 (r328332) @@ -1582,7 +1582,7 @@ time_excluded(struct archive_match *a, struct archive_ */ int -archive_match_include_uid(struct archive *_a, int64_t uid) +archive_match_include_uid(struct archive *_a, la_int64_t uid) { struct archive_match *a; @@ -1593,7 +1593,7 @@ archive_match_include_uid(struct archive *_a, int64_t } int -archive_match_include_gid(struct archive *_a, int64_t gid) +archive_match_include_gid(struct archive *_a, la_int64_t gid) { struct archive_match *a; Modified: head/contrib/libarchive/libarchive/archive_platform.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_platform.h Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_platform.h Wed Jan 24 14:24:17 2018 (r328332) @@ -191,4 +191,10 @@ #define ARCHIVE_ERRNO_MISC (-1) #endif +#if defined(__GNUC__) && (__GNUC__ >= 7) +#define __LA_FALLTHROUGH __attribute__((fallthrough)) +#else +#define __LA_FALLTHROUGH +#endif + #endif /* !ARCHIVE_PLATFORM_H_INCLUDED */ Modified: head/contrib/libarchive/libarchive/archive_ppmd7.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_ppmd7.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_ppmd7.c Wed Jan 24 14:24:17 2018 (r328332) @@ -115,14 +115,14 @@ static void Ppmd7_Construct(CPpmd7 *p) memset(p->HB2Flag + 0x40, 8, 0x100 - 0x40); } -static void Ppmd7_Free(CPpmd7 *p, ISzAlloc *alloc) +static void Ppmd7_Free(CPpmd7 *p) { - alloc->Free(alloc, p->Base); + free(p->Base); p->Size = 0; p->Base = 0; } -static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAlloc *alloc) +static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size) { if (p->Base == 0 || p->Size != size) { @@ -131,14 +131,14 @@ static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAll if (size < UNIT_SIZE) { return False; } - Ppmd7_Free(p, alloc); + Ppmd7_Free(p); p->AlignOffset = #ifdef PPMD_32BIT (4 - size) & 3; #else 4 - (size & 3); #endif - if ((p->Base = (Byte *)alloc->Alloc(alloc, p->AlignOffset + size + if ((p->Base = (Byte *)malloc(p->AlignOffset + size #ifndef PPMD_32BIT + UNIT_SIZE #endif Modified: head/contrib/libarchive/libarchive/archive_ppmd7_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_ppmd7_private.h Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_ppmd7_private.h Wed Jan 24 14:24:17 2018 (r328332) @@ -95,8 +95,8 @@ typedef struct { /* Base Functions */ void (*Ppmd7_Construct)(CPpmd7 *p); - Bool (*Ppmd7_Alloc)(CPpmd7 *p, UInt32 size, ISzAlloc *alloc); - void (*Ppmd7_Free)(CPpmd7 *p, ISzAlloc *alloc); + Bool (*Ppmd7_Alloc)(CPpmd7 *p, UInt32 size); + void (*Ppmd7_Free)(CPpmd7 *p); void (*Ppmd7_Init)(CPpmd7 *p, unsigned maxOrder); #define Ppmd7_WasAllocated(p) ((p)->Base != NULL) Modified: head/contrib/libarchive/libarchive/archive_ppmd_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_ppmd_private.h Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_ppmd_private.h Wed Jan 24 14:24:17 2018 (r328332) @@ -69,13 +69,6 @@ typedef struct void (*Write)(void *p, Byte b); } IByteOut; - -typedef struct -{ - void *(*Alloc)(void *p, size_t size); - void (*Free)(void *p, void *address); /* address can be 0 */ -} ISzAlloc; - /*** End defined in Types.h ***/ /*** Begin defined in CpuArch.h ***/ Modified: head/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_read.c Wed Jan 24 14:24:17 2018 (r328332) @@ -120,7 +120,8 @@ archive_read_new(void) * Record the do-not-extract-to file. This belongs in archive_read_extract.c. */ void -archive_read_extract_set_skip_file(struct archive *_a, int64_t d, int64_t i) +archive_read_extract_set_skip_file(struct archive *_a, la_int64_t d, + la_int64_t i) { struct archive_read *a = (struct archive_read *)_a; @@ -747,7 +748,7 @@ choose_format(struct archive_read *a) * Return the file offset (within the uncompressed data stream) where * the last header started. */ -int64_t +la_int64_t archive_read_header_position(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; @@ -943,7 +944,7 @@ archive_read_data_skip(struct archive *_a) return (r); } -int64_t +la_int64_t archive_seek_data(struct archive *_a, int64_t offset, int whence) { struct archive_read *a = (struct archive_read *)_a; @@ -1626,7 +1627,8 @@ __archive_read_filter_seek(struct archive_read_filter switch (whence) { case SEEK_CUR: /* Adjust the offset and use SEEK_SET instead */ - offset += filter->position; + offset += filter->position; + __LA_FALLTHROUGH; case SEEK_SET: cursor = 0; while (1) Modified: head/contrib/libarchive/libarchive/archive_read_disk_posix.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_posix.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_read_disk_posix.c Wed Jan 24 14:24:17 2018 (r328332) @@ -387,7 +387,7 @@ archive_read_disk_vtable(void) } const char * -archive_read_disk_gname(struct archive *_a, int64_t gid) +archive_read_disk_gname(struct archive *_a, la_int64_t gid) { struct archive_read_disk *a = (struct archive_read_disk *)_a; if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, @@ -399,7 +399,7 @@ archive_read_disk_gname(struct archive *_a, int64_t gi } const char * -archive_read_disk_uname(struct archive *_a, int64_t uid) +archive_read_disk_uname(struct archive *_a, la_int64_t uid) { struct archive_read_disk *a = (struct archive_read_disk *)_a; if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, @@ -413,7 +413,7 @@ archive_read_disk_uname(struct archive *_a, int64_t ui int archive_read_disk_set_gname_lookup(struct archive *_a, void *private_data, - const char * (*lookup_gname)(void *private, int64_t gid), + const char * (*lookup_gname)(void *private, la_int64_t gid), void (*cleanup_gname)(void *private)) { struct archive_read_disk *a = (struct archive_read_disk *)_a; @@ -432,7 +432,7 @@ archive_read_disk_set_gname_lookup(struct archive *_a, int archive_read_disk_set_uname_lookup(struct archive *_a, void *private_data, - const char * (*lookup_uname)(void *private, int64_t uid), + const char * (*lookup_uname)(void *private, la_int64_t uid), void (*cleanup_uname)(void *private)) { struct archive_read_disk *a = (struct archive_read_disk *)_a; Modified: head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Wed Jan 24 14:24:17 2018 (r328332) @@ -975,18 +975,6 @@ decode_codec_id(const unsigned char *codecId, size_t i return (id); } -static void * -ppmd_alloc(void *p, size_t size) -{ - (void)p; - return malloc(size); -} -static void -ppmd_free(void *p, void *address) -{ - (void)p; - free(address); -} static Byte ppmd_read(void *p) { @@ -1006,8 +994,6 @@ ppmd_read(void *p) return (b); } -static ISzAlloc g_szalloc = { ppmd_alloc, ppmd_free }; - static int init_decompression(struct archive_read *a, struct _7zip *zip, const struct _7z_coder *coder1, const struct _7z_coder *coder2) @@ -1237,7 +1223,7 @@ init_decompression(struct archive_read *a, struct _7zi if (zip->ppmd7_valid) { __archive_ppmd7_functions.Ppmd7_Free( - &zip->ppmd7_context, &g_szalloc); + &zip->ppmd7_context); zip->ppmd7_valid = 0; } @@ -1256,7 +1242,7 @@ init_decompression(struct archive_read *a, struct _7zi } __archive_ppmd7_functions.Ppmd7_Construct(&zip->ppmd7_context); r = __archive_ppmd7_functions.Ppmd7_Alloc( - &zip->ppmd7_context, msize, &g_szalloc); + &zip->ppmd7_context, msize); if (r == 0) { archive_set_error(&a->archive, ENOMEM, "Coludn't allocate memory for PPMd"); @@ -1636,7 +1622,7 @@ free_decompression(struct archive_read *a, struct _7zi #endif if (zip->ppmd7_valid) { __archive_ppmd7_functions.Ppmd7_Free( - &zip->ppmd7_context, &g_szalloc); + &zip->ppmd7_context); zip->ppmd7_valid = 0; } return (r); @@ -2569,6 +2555,7 @@ read_Header(struct archive_read *a, struct _7z_header_ case kDummy: if (ll == 0) break; + __LA_FALLTHROUGH; default: if (header_bytes(a, ll) == NULL) return (-1); Modified: head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Wed Jan 24 14:24:17 2018 (r328332) @@ -1499,6 +1499,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt } if (strcmp(key, "cksum") == 0) break; + __LA_FALLTHROUGH; case 'd': if (strcmp(key, "device") == 0) { /* stat(2) st_rdev field, e.g. the major/minor IDs @@ -1512,12 +1513,14 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_set_rdev(entry, dev); return r; } + __LA_FALLTHROUGH; case 'f': if (strcmp(key, "flags") == 0) { *parsed_kws |= MTREE_HAS_FFLAGS; archive_entry_copy_fflags_text(entry, val); break; } + __LA_FALLTHROUGH; case 'g': if (strcmp(key, "gid") == 0) { *parsed_kws |= MTREE_HAS_GID; @@ -1529,16 +1532,19 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_copy_gname(entry, val); break; } + __LA_FALLTHROUGH; case 'i': if (strcmp(key, "inode") == 0) { archive_entry_set_ino(entry, mtree_atol(&val, 10)); break; } + __LA_FALLTHROUGH; case 'l': if (strcmp(key, "link") == 0) { archive_entry_copy_symlink(entry, val); break; } + __LA_FALLTHROUGH; case 'm': if (strcmp(key, "md5") == 0 || strcmp(key, "md5digest") == 0) break; @@ -1555,6 +1561,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt } break; } + __LA_FALLTHROUGH; case 'n': if (strcmp(key, "nlink") == 0) { *parsed_kws |= MTREE_HAS_NLINK; @@ -1562,6 +1569,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt (unsigned int)mtree_atol(&val, 10)); break; } + __LA_FALLTHROUGH; case 'r': if (strcmp(key, "resdevice") == 0) { /* stat(2) st_dev field, e.g. the device ID where the @@ -1577,6 +1585,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt if (strcmp(key, "rmd160") == 0 || strcmp(key, "rmd160digest") == 0) break; + __LA_FALLTHROUGH; case 's': if (strcmp(key, "sha1") == 0 || strcmp(key, "sha1digest") == 0) break; @@ -1593,6 +1602,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_set_size(entry, mtree_atol(&val, 10)); break; } + __LA_FALLTHROUGH; case 't': if (strcmp(key, "tags") == 0) { /* @@ -1635,18 +1645,21 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_set_filetype(entry, AE_IFBLK); break; } + __LA_FALLTHROUGH; case 'c': if (strcmp(val, "char") == 0) { archive_entry_set_filetype(entry, AE_IFCHR); break; } + __LA_FALLTHROUGH; case 'd': if (strcmp(val, "dir") == 0) { archive_entry_set_filetype(entry, AE_IFDIR); break; } + __LA_FALLTHROUGH; case 'f': if (strcmp(val, "fifo") == 0) { archive_entry_set_filetype(entry, @@ -1658,12 +1671,14 @@ parse_keyword(struct archive_read *a, struct mtree *mt AE_IFREG); break; } + __LA_FALLTHROUGH; case 'l': if (strcmp(val, "link") == 0) { archive_entry_set_filetype(entry, AE_IFLNK); break; } + __LA_FALLTHROUGH; default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, @@ -1675,6 +1690,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt *parsed_kws |= MTREE_HAS_TYPE; break; } + __LA_FALLTHROUGH; case 'u': if (strcmp(key, "uid") == 0) { *parsed_kws |= MTREE_HAS_UID; @@ -1686,6 +1702,7 @@ parse_keyword(struct archive_read *a, struct mtree *mt archive_entry_copy_uname(entry, val); break; } + __LA_FALLTHROUGH; default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Unrecognized key %s=%s", key, val); Modified: head/contrib/libarchive/libarchive/archive_read_support_format_rar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_rar.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_read_support_format_rar.c Wed Jan 24 14:24:17 2018 (r328332) @@ -604,20 +604,6 @@ lzss_emit_match(struct rar *rar, int offset, int lengt rar->lzss.position += length; } -static void * -ppmd_alloc(void *p, size_t size) -{ - (void)p; - return malloc(size); -} -static void -ppmd_free(void *p, void *address) -{ - (void)p; - free(address); -} -static ISzAlloc g_szalloc = { ppmd_alloc, ppmd_free }; - static Byte ppmd_read(void *p) { @@ -1038,7 +1024,7 @@ archive_read_format_rar_read_data(struct archive_read case COMPRESS_METHOD_BEST: ret = read_data_compressed(a, buff, size, offset); if (ret != ARCHIVE_OK && ret != ARCHIVE_WARN) - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); break; default: @@ -1253,7 +1239,7 @@ archive_read_format_rar_cleanup(struct archive_read *a free(rar->dbo); free(rar->unp_buffer); free(rar->lzss.window); - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); free(rar); (a->format->data) = NULL; return (ARCHIVE_OK); @@ -1658,7 +1644,7 @@ read_header(struct archive_read *a, struct archive_ent rar->unp_offset = 0; rar->unp_buffer_size = UNP_BUFFER_SIZE; memset(rar->lengthtable, 0, sizeof(rar->lengthtable)); - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); rar->ppmd_valid = rar->ppmd_eod = 0; /* Don't set any archive entries for non-file header types */ @@ -2122,7 +2108,7 @@ parse_codes(struct archive_read *a) /* Make sure ppmd7_contest is freed before Ppmd7_Construct * because reading a broken file cause this abnormal sequence. */ - __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); rar->bytein.a = a; rar->bytein.Read = &ppmd_read; @@ -2137,7 +2123,7 @@ parse_codes(struct archive_read *a) } if (!__archive_ppmd7_functions.Ppmd7_Alloc(&rar->ppmd7_context, - rar->dictionary_size, &g_szalloc)) + rar->dictionary_size)) { archive_set_error(&a->archive, ENOMEM, "Out of memory"); Modified: head/contrib/libarchive/libarchive/archive_read_support_format_tar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_tar.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_read_support_format_tar.c Wed Jan 24 14:24:17 2018 (r328332) @@ -251,15 +251,15 @@ archive_read_support_format_tar(struct archive *_a) ARCHIVE_STATE_NEW, "archive_read_support_format_tar"); tar = (struct tar *)calloc(1, sizeof(*tar)); -#ifdef HAVE_COPYFILE_H - /* Set this by default on Mac OS. */ - tar->process_mac_extensions = 1; -#endif if (tar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate tar data"); return (ARCHIVE_FATAL); } +#ifdef HAVE_COPYFILE_H + /* Set this by default on Mac OS. */ + tar->process_mac_extensions = 1; +#endif r = __archive_read_register_format(a, tar, "tar", archive_read_format_tar_bid, Modified: head/contrib/libarchive/libarchive/archive_read_support_format_zip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_zip.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_read_support_format_zip.c Wed Jan 24 14:24:17 2018 (r328332) @@ -886,6 +886,24 @@ zip_read_local_file_header(struct archive_read *a, str zip_entry->mode |= 0664; } + /* Windows archivers sometimes use backslash as the directory separator. + Normalize to slash. */ + if (zip_entry->system == 0 && + (wp = archive_entry_pathname_w(entry)) != NULL) { + if (wcschr(wp, L'/') == NULL && wcschr(wp, L'\\') != NULL) { + size_t i; + struct archive_wstring s; + archive_string_init(&s); + archive_wstrcpy(&s, wp); + for (i = 0; i < archive_strlen(&s); i++) { + if (s.s[i] == '\\') + s.s[i] = '/'; + } + archive_entry_copy_pathname_w(entry, s.s); + archive_wstring_free(&s); + } + } + /* Make sure that entries with a trailing '/' are marked as directories * even if the External File Attributes contains bogus values. If this * is not a directory and there is no type, assume regularfile. */ @@ -1061,6 +1079,7 @@ zip_read_local_file_header(struct archive_read *a, str zip->end_of_entry = 1; /* Set up a more descriptive format name. */ + archive_string_empty(&zip->format_name); archive_string_sprintf(&zip->format_name, "ZIP %d.%d (%s)", version / 10, version % 10, compression_name(zip->entry->compression)); Modified: head/contrib/libarchive/libarchive/archive_util.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_util.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_util.c Wed Jan 24 14:24:17 2018 (r328332) @@ -140,7 +140,7 @@ archive_compression_name(struct archive *a) /* * Return a count of the number of compressed bytes processed. */ -int64_t +la_int64_t archive_position_compressed(struct archive *a) { return archive_filter_bytes(a, -1); @@ -149,7 +149,7 @@ archive_position_compressed(struct archive *a) /* * Return a count of the number of uncompressed bytes processed. */ -int64_t +la_int64_t archive_position_uncompressed(struct archive *a) { return archive_filter_bytes(a, 0); Modified: head/contrib/libarchive/libarchive/archive_virtual.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_virtual.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_virtual.c Wed Jan 24 14:24:17 2018 (r328332) @@ -48,7 +48,7 @@ archive_filter_name(struct archive *a, int n) return ((a->vtable->archive_filter_name)(a, n)); } -int64_t +la_int64_t archive_filter_bytes(struct archive *a, int n) { return ((a->vtable->archive_filter_bytes)(a, n)); @@ -131,7 +131,8 @@ archive_write_data(struct archive *a, const void *buff } ssize_t -archive_write_data_block(struct archive *a, const void *buff, size_t s, int64_t o) +archive_write_data_block(struct archive *a, const void *buff, size_t s, + la_int64_t o) { if (a->vtable->archive_write_data_block == NULL) { archive_set_error(a, ARCHIVE_ERRNO_MISC, @@ -156,7 +157,7 @@ archive_read_next_header2(struct archive *a, struct ar int archive_read_data_block(struct archive *a, - const void **buff, size_t *s, int64_t *o) + const void **buff, size_t *s, la_int64_t *o) { return ((a->vtable->archive_read_data_block)(a, buff, s, o)); } Modified: head/contrib/libarchive/libarchive/archive_write.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_write.c Wed Jan 24 14:24:17 2018 (r328332) @@ -190,7 +190,7 @@ archive_write_get_bytes_in_last_block(struct archive * * an archive to itself recursively. */ int -archive_write_set_skip_file(struct archive *_a, int64_t d, int64_t i) +archive_write_set_skip_file(struct archive *_a, la_int64_t d, la_int64_t i) { struct archive_write *a = (struct archive_write *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, Modified: head/contrib/libarchive/libarchive/archive_write_disk_posix.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_disk_posix.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_write_disk_posix.c Wed Jan 24 14:24:17 2018 (r328332) @@ -835,7 +835,7 @@ _archive_write_disk_header(struct archive *_a, struct } int -archive_write_disk_set_skip_file(struct archive *_a, int64_t d, int64_t i) +archive_write_disk_set_skip_file(struct archive *_a, la_int64_t d, la_int64_t i) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1786,7 +1786,7 @@ finish_metadata: int archive_write_disk_set_group_lookup(struct archive *_a, void *private_data, - int64_t (*lookup_gid)(void *private, const char *gname, int64_t gid), + la_int64_t (*lookup_gid)(void *private, const char *gname, la_int64_t gid), void (*cleanup_gid)(void *private)) { struct archive_write_disk *a = (struct archive_write_disk *)_a; @@ -1822,7 +1822,7 @@ archive_write_disk_set_user_lookup(struct archive *_a, } int64_t -archive_write_disk_gid(struct archive *_a, const char *name, int64_t id) +archive_write_disk_gid(struct archive *_a, const char *name, la_int64_t id) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1833,7 +1833,7 @@ archive_write_disk_gid(struct archive *_a, const char } int64_t -archive_write_disk_uid(struct archive *_a, const char *name, int64_t id) +archive_write_disk_uid(struct archive *_a, const char *name, la_int64_t id) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -1981,6 +1981,10 @@ restore_entry(struct archive_write_disk *a) if ((en == EISDIR || en == EEXIST) && (a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) { /* If we're not overwriting, we're done. */ + if (S_ISDIR(a->mode)) { + /* Don't overwrite any settings on existing directories. */ + a->todo = 0; + } archive_entry_unset_size(a->entry); return (ARCHIVE_OK); } Modified: head/contrib/libarchive/libarchive/archive_write_set_format_7zip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_7zip.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/archive_write_set_format_7zip.c Wed Jan 24 14:24:17 2018 (r328332) @@ -2095,20 +2095,7 @@ compression_init_encoder_lzma2(struct archive *a, /* * _7_PPMD compressor. */ -static void * -ppmd_alloc(void *p, size_t size) -{ - (void)p; - return malloc(size); -} static void -ppmd_free(void *p, void *address) -{ - (void)p; - free(address); -} -static ISzAlloc g_szalloc = { ppmd_alloc, ppmd_free }; -static void ppmd_write(void *p, Byte b) { struct archive_write *a = ((IByteOut *)p)->a; @@ -2167,7 +2154,7 @@ compression_init_encoder_ppmd(struct archive *a, archive_le32enc(props+1, msize); __archive_ppmd7_functions.Ppmd7_Construct(&strm->ppmd7_context); r = __archive_ppmd7_functions.Ppmd7_Alloc( - &strm->ppmd7_context, msize, &g_szalloc); + &strm->ppmd7_context, msize); if (r == 0) { free(strm->buff); free(strm); @@ -2243,7 +2230,7 @@ compression_end_ppmd(struct archive *a, struct la_zstr (void)a; /* UNUSED */ strm = (struct ppmd_stream *)lastrm->real_stream; - __archive_ppmd7_functions.Ppmd7_Free(&strm->ppmd7_context, &g_szalloc); + __archive_ppmd7_functions.Ppmd7_Free(&strm->ppmd7_context); free(strm->buff); free(strm); lastrm->real_stream = NULL; Modified: head/contrib/libarchive/libarchive/test/read_open_memory.c ============================================================================== --- head/contrib/libarchive/libarchive/test/read_open_memory.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/test/read_open_memory.c Wed Jan 24 14:24:17 2018 (r328332) @@ -91,9 +91,11 @@ read_open_memory_internal(struct archive *a, const voi switch (level) { case 3: archive_read_set_seek_callback(a, memory_read_seek); + __LA_FALLTHROUGH; case 2: archive_read_set_open_callback(a, memory_read_open); archive_read_set_skip_callback(a, memory_read_skip); + __LA_FALLTHROUGH; case 1: mine = malloc(sizeof(*mine)); if (mine == NULL) { Modified: head/contrib/libarchive/libarchive/test/test.h ============================================================================== --- head/contrib/libarchive/libarchive/test/test.h Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/test/test.h Wed Jan 24 14:24:17 2018 (r328332) @@ -33,4 +33,10 @@ #define EXTRA_ERRNO(x) archive_errno((struct archive *)(x)) #define EXTRA_VERSION archive_version_details() +#if defined(__GNUC__) && (__GNUC__ >= 7) +#define __LA_FALLTHROUGH __attribute__((fallthrough)) +#else +#define __LA_FALLTHROUGH +#endif + #include "test_common.h" Modified: head/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c Wed Jan 24 14:24:17 2018 (r328332) @@ -408,7 +408,9 @@ acl_flagset_to_bitmap(acl_flagset_t opaque_fs) {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, RICHACE_INHERIT_ONLY_ACE}, {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, RICHACE_INHERITED_ACE} #else /* FreeBSD NFSv4 ACL inheritance flags */ +#ifdef ACL_ENTRY_INHERITED {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED}, +#endif {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT}, {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT}, {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT}, Modified: head/contrib/libarchive/libarchive/test/test_compat_zip.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_compat_zip.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/test/test_compat_zip.c Wed Jan 24 14:24:17 2018 (r328332) @@ -422,3 +422,29 @@ DEFINE_TEST(test_compat_zip_7) } free(p); } + +/** + * A file with backslash path separators instead of slashes. + * PowerShell's Compress-Archive cmdlet produces such archives. + */ +DEFINE_TEST(test_compat_zip_8) +{ + const char *refname = "test_compat_zip_8.zip"; + struct archive *a; + struct archive_entry *ae; + void *p; + size_t s; + + extract_reference_file(refname); + p = slurpfile(&s, refname); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_minimal(a, p, s, 7)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + /* This file is in the archive as arc\test */ + assertEqualString("arc/test", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); + free(p); +} Copied: head/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu (from r328324, vendor/libarchive/dist/libarchive/test/test_compat_zip_8.zip.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/libarchive/test/test_compat_zip_8.zip.uu Wed Jan 24 14:24:17 2018 (r328332, copy of r328324, vendor/libarchive/dist/libarchive/test/test_compat_zip_8.zip.uu) @@ -0,0 +1,6 @@ +begin 666 test_compat_zip_8.zip +M4$L#!!0````(`%A\;TOY6""D$`````X````(````87)C7'1E!BP$`4$L!`A0`%`````@`6'QO2_E8(*00````#@````@````````` +H`````````````&%R8UQT97-T4$L%!@`````!``$`-@```#8````````` +` +end Modified: head/contrib/libarchive/libarchive/test/test_read_format_zip.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_read_format_zip.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/test/test_read_format_zip.c Wed Jan 24 14:24:17 2018 (r328332) @@ -41,6 +41,7 @@ verify_basic(struct archive *a, int seek_checks) int64_t o; assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 1.0 (uncompressed)", archive_format_name(a)); assertEqualString("dir/", archive_entry_pathname(ae)); assertEqualInt(1179604249, archive_entry_mtime(ae)); assertEqualInt(0, archive_entry_size(ae)); @@ -53,6 +54,7 @@ verify_basic(struct archive *a, int seek_checks) assertEqualInt((int)s, 0); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 2.0 (deflation)", archive_format_name(a)); assertEqualString("file1", archive_entry_pathname(ae)); assertEqualInt(1179604289, archive_entry_mtime(ae)); if (seek_checks) @@ -72,6 +74,7 @@ verify_basic(struct archive *a, int seek_checks) } assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 2.0 (deflation)", archive_format_name(a)); assertEqualString("file2", archive_entry_pathname(ae)); assertEqualInt(1179605932, archive_entry_mtime(ae)); assertEqualInt(archive_entry_is_encrypted(ae), 0); @@ -93,6 +96,7 @@ verify_basic(struct archive *a, int seek_checks) assert(archive_errno(a) != 0); } assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualString("ZIP 2.0 (deflation)", archive_format_name(a)); /* Verify the number of files read. */ failure("the archive file has three files"); assertEqualInt(3, archive_file_count(a)); Modified: head/contrib/libarchive/libarchive/test/test_write_disk_perms.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_write_disk_perms.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/libarchive/test/test_write_disk_perms.c Wed Jan 24 14:24:17 2018 (r328332) @@ -131,6 +131,8 @@ DEFINE_TEST(test_write_disk_perms) struct archive *a; struct archive_entry *ae; struct stat st; + uid_t original_uid; + uid_t try_to_change_uid; assertUmask(UMASK); @@ -200,6 +202,37 @@ DEFINE_TEST(test_write_disk_perms) assertEqualInt(0, stat("dir_overwrite_0744", &st)); failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode); assertEqualInt(st.st_mode & 0777, 0744); + + /* For dir, the owner should get left when not overwritting. */ + assertMakeDir("dir_owner", 0744); + + if (getuid() == 0) { + original_uid = getuid() + 1; + try_to_change_uid = getuid(); + assertEqualInt(0, chown("dir_owner", original_uid, getgid())); + } else { + original_uid = getuid(); + try_to_change_uid = getuid() + 1; + } + + /* Check original owner. */ + assertEqualInt(0, stat("dir_owner", &st)); + failure("dir_owner: st.st_uid=%d", st.st_uid); + assertEqualInt(st.st_uid, original_uid); + /* Shouldn't try to edit the owner when no overwrite option is set. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir_owner"); + archive_entry_set_mode(ae, S_IFDIR | 0744); + archive_entry_set_uid(ae, try_to_change_uid); + archive_write_disk_set_options(a, + ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_NO_OVERWRITE); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); + /* Make sure they're unchanged. */ + assertEqualInt(0, stat("dir_owner", &st)); + failure("dir_owner: st.st_uid=%d", st.st_uid); + assertEqualInt(st.st_uid, original_uid); /* Write a regular file with SUID bit, but don't use _EXTRACT_PERM. */ assert((ae = archive_entry_new()) != NULL); Modified: head/contrib/libarchive/tar/test/test_option_acls.c ============================================================================== --- head/contrib/libarchive/tar/test/test_option_acls.c Wed Jan 24 14:15:06 2018 (r328331) +++ head/contrib/libarchive/tar/test/test_option_acls.c Wed Jan 24 14:24:17 2018 (r328332) @@ -85,7 +85,9 @@ static const acl_flag_t acl_flags[] = { ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_SUCCESSFUL_ACCESS, ACL_ENTRY_FAILED_ACCESS, +#ifdef ACL_ENTRY_INHERITED ACL_ENTRY_INHERITED +#endif #endif /* ARCHIVE_ACL_FREEBSD_NFS4 */ }; #endif /* ARCHIVE_ACL_DARWIN || ARCHIVE_ACL_FREEBSD_NFS4 */ Modified: head/lib/libarchive/tests/Makefile ============================================================================== --- head/lib/libarchive/tests/Makefile Wed Jan 24 14:15:06 2018 (r328331) +++ head/lib/libarchive/tests/Makefile Wed Jan 24 14:24:17 2018 (r328332) @@ -375,6 +375,7 @@ ${PACKAGE}FILES+= test_compat_zip_4.zip.uu ${PACKAGE}FILES+= test_compat_zip_5.zip.uu ${PACKAGE}FILES+= test_compat_zip_6.zip.uu ${PACKAGE}FILES+= test_compat_zip_7.xps.uu +${PACKAGE}FILES+= test_compat_zip_8.zip.uu ${PACKAGE}FILES+= test_compat_zstd_1.tar.zst.uu ${PACKAGE}FILES+= test_fuzz.cab.uu ${PACKAGE}FILES+= test_fuzz.lzh.uu Modified: head/usr.bin/bsdcat/tests/Makefile ============================================================================== --- head/usr.bin/bsdcat/tests/Makefile Wed Jan 24 14:15:06 2018 (r328331) +++ head/usr.bin/bsdcat/tests/Makefile Wed Jan 24 14:24:17 2018 (r328332) @@ -40,6 +40,7 @@ TESTS_SRCS= \ test_expand_xz.c \ test_expand_zstd.c \ test_help.c \ + test_stdin.c \ test_version.c SRCS.bsdcat_test= list.h \ From owner-svn-src-all@freebsd.org Wed Jan 24 15:02:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 642C7ED81FA; Wed, 24 Jan 2018 15:02:20 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B8DC98CB06; Wed, 24 Jan 2018 15:02:19 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id eMZ4etjNqZ8gBeMZ6eFKBS; Wed, 24 Jan 2018 08:02:18 -0700 X-Authority-Analysis: v=2.2 cv=M/g9E24s c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=RgaUWeydRksA:10 a=ndaoGXS1AAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=4yh_f3hxauaRR_NyrdUA:9 a=CjuIK1q_8ugA:10 a=mFeOnlTyF09QQMGr2mMI:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 7DF6FD3; Wed, 24 Jan 2018 07:02:14 -0800 (PST) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w0OF2EGD003339; Wed, 24 Jan 2018 07:02:14 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w0OF2CsP003336; Wed, 24 Jan 2018 07:02:13 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201801241502.w0OF2CsP003336@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Hans Petter Selasky cc: Cy Schubert , Wojciech Macek , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328330 - head/sys/kern In-Reply-To: Message from Hans Petter Selasky of "Wed, 24 Jan 2018 15:06:24 +0100." <82d52ee3-1c2a-2399-0142-0027b4370b6f@selasky.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 24 Jan 2018 07:02:12 -0800 X-CMAE-Envelope: MS4wfE0HIhO4qJuCZeHXj4lY98QdltTeBOQaq3yyoKrOfI5yOXixXcCArd7zcXKlGRyGftKH/WfAnsXIDLY8qL02pjaWq47Zv1S8Q6atgN7v4oquHHkx42iQ SUotzAJTCF7JEj81l7p+P65Acr446EpMHvuR0631rRgPFI/gCJzcXEdEChYwk8HGFO0Xqq20pk10jPmJsbbxFTIeU/JTVawjMO8RdLHhQViJ4srD61IiZgAl tjgOP9MuKW38c2DTMIbebUi7aFGzwrGd9RdOZE0JbgQ= X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 15:02:20 -0000 In message <82d52ee3-1c2a-2399-0142-0027b4370b6f@selasky.org>, Hans Petter Sela sky writes: > On 01/24/18 15:00, Cy Schubert wrote: > > Why? What happened? > > > > Hi, > > See r326376 . This patch is out of date :-) This makes my point. Someone browsing through the log will not be able to determine without dissecting the code why. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Wed Jan 24 15:15:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39E3EED8B1C; Wed, 24 Jan 2018 15:15:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E04638D52B; Wed, 24 Jan 2018 15:15:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C25621F511; Wed, 24 Jan 2018 15:15:18 +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 w0OFFIbC083796; Wed, 24 Jan 2018 15:15:18 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OFFI74083795; Wed, 24 Jan 2018 15:15:18 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801241515.w0OFFI74083795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 24 Jan 2018 15:15: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: r328333 - stable/11/sys/geom/mirror X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/geom/mirror X-SVN-Commit-Revision: 328333 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 15:15:19 -0000 Author: markj Date: Wed Jan 24 15:15:18 2018 New Revision: 328333 URL: https://svnweb.freebsd.org/changeset/base/328333 Log: MFC r327496, r327760: Fix some I/O ordering issues in gmirror. Modified: stable/11/sys/geom/mirror/g_mirror.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/11/sys/geom/mirror/g_mirror.c Wed Jan 24 14:24:17 2018 (r328332) +++ stable/11/sys/geom/mirror/g_mirror.c Wed Jan 24 15:15:18 2018 (r328333) @@ -109,7 +109,8 @@ static void g_mirror_update_device(struct g_mirror_sof static void g_mirror_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp); static void g_mirror_sync_stop(struct g_mirror_disk *disk, int type); -static void g_mirror_register_request(struct bio *bp); +static void g_mirror_register_request(struct g_mirror_softc *sc, + struct bio *bp); static void g_mirror_sync_release(struct g_mirror_softc *sc); @@ -890,27 +891,6 @@ g_mirror_unidle(struct g_mirror_softc *sc) } static void -g_mirror_flush_done(struct bio *bp) -{ - struct g_mirror_softc *sc; - struct bio *pbp; - - pbp = bp->bio_parent; - sc = pbp->bio_to->private; - mtx_lock(&sc->sc_done_mtx); - if (pbp->bio_error == 0) - pbp->bio_error = bp->bio_error; - pbp->bio_completed += bp->bio_completed; - pbp->bio_inbed++; - if (pbp->bio_children == pbp->bio_inbed) { - mtx_unlock(&sc->sc_done_mtx); - g_io_deliver(pbp, pbp->bio_error); - } else - mtx_unlock(&sc->sc_done_mtx); - g_destroy_bio(bp); -} - -static void g_mirror_done(struct bio *bp) { struct g_mirror_softc *sc; @@ -924,16 +904,46 @@ g_mirror_done(struct bio *bp) } static void -g_mirror_regular_request(struct bio *bp) +g_mirror_regular_request_error(struct g_mirror_softc *sc, + struct g_mirror_disk *disk, struct bio *bp) { - struct g_mirror_softc *sc; + + if (bp->bio_cmd == BIO_FLUSH && bp->bio_error == EOPNOTSUPP) + return; + + if ((disk->d_flags & G_MIRROR_DISK_FLAG_BROKEN) == 0) { + disk->d_flags |= G_MIRROR_DISK_FLAG_BROKEN; + G_MIRROR_LOGREQ(0, bp, "Request failed (error=%d).", + bp->bio_error); + } else { + G_MIRROR_LOGREQ(1, bp, "Request failed (error=%d).", + bp->bio_error); + } + if (g_mirror_disconnect_on_failure && + g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE) > 1) { + if (bp->bio_error == ENXIO && + bp->bio_cmd == BIO_READ) + sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; + else if (bp->bio_error == ENXIO) + sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID_NOW; + else + sc->sc_bump_id |= G_MIRROR_BUMP_GENID; + g_mirror_event_send(disk, G_MIRROR_DISK_STATE_DISCONNECTED, + G_MIRROR_EVENT_DONTWAIT); + } +} + +static void +g_mirror_regular_request(struct g_mirror_softc *sc, struct bio *bp) +{ struct g_mirror_disk *disk; struct bio *pbp; g_topology_assert_not(); + KASSERT(sc->sc_provider == bp->bio_parent->bio_to, + ("regular request %p with unexpected origin", bp)); pbp = bp->bio_parent; - sc = pbp->bio_to->private; bp->bio_from->index--; if (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_DELETE) sc->sc_writes--; @@ -944,12 +954,24 @@ g_mirror_regular_request(struct bio *bp) g_topology_unlock(); } - if (bp->bio_cmd == BIO_READ) + switch (bp->bio_cmd) { + case BIO_READ: KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_read, bp->bio_error); - else if (bp->bio_cmd == BIO_WRITE) + break; + case BIO_WRITE: KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_write, bp->bio_error); + break; + case BIO_DELETE: + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_delete, + bp->bio_error); + break; + case BIO_FLUSH: + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_flush, + bp->bio_error); + break; + } pbp->bio_inbed++; KASSERT(pbp->bio_inbed <= pbp->bio_children, @@ -973,35 +995,12 @@ g_mirror_regular_request(struct bio *bp) } else if (bp->bio_error != 0) { if (pbp->bio_error == 0) pbp->bio_error = bp->bio_error; - if (disk != NULL) { - if ((disk->d_flags & G_MIRROR_DISK_FLAG_BROKEN) == 0) { - disk->d_flags |= G_MIRROR_DISK_FLAG_BROKEN; - G_MIRROR_LOGREQ(0, bp, - "Request failed (error=%d).", - bp->bio_error); - } else { - G_MIRROR_LOGREQ(1, bp, - "Request failed (error=%d).", - bp->bio_error); - } - if (g_mirror_disconnect_on_failure && - g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE) > 1) - { - if (bp->bio_error == ENXIO && - bp->bio_cmd == BIO_READ) - sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; - else if (bp->bio_error == ENXIO) - sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID_NOW; - else - sc->sc_bump_id |= G_MIRROR_BUMP_GENID; - g_mirror_event_send(disk, - G_MIRROR_DISK_STATE_DISCONNECTED, - G_MIRROR_EVENT_DONTWAIT); - } - } + if (disk != NULL) + g_mirror_regular_request_error(sc, disk, bp); switch (pbp->bio_cmd) { case BIO_DELETE: case BIO_WRITE: + case BIO_FLUSH: pbp->bio_inbed--; pbp->bio_children--; break; @@ -1026,6 +1025,7 @@ g_mirror_regular_request(struct bio *bp) break; case BIO_DELETE: case BIO_WRITE: + case BIO_FLUSH: if (pbp->bio_children == 0) { /* * All requests failed. @@ -1038,9 +1038,11 @@ g_mirror_regular_request(struct bio *bp) pbp->bio_error = 0; pbp->bio_completed = pbp->bio_length; } - TAILQ_REMOVE(&sc->sc_inflight, pbp, bio_queue); - /* Release delayed sync requests if possible. */ - g_mirror_sync_release(sc); + if (pbp->bio_cmd == BIO_WRITE || pbp->bio_cmd == BIO_DELETE) { + TAILQ_REMOVE(&sc->sc_inflight, pbp, bio_queue); + /* Release delayed sync requests if possible. */ + g_mirror_sync_release(sc); + } g_io_deliver(pbp, pbp->bio_error); break; default: @@ -1113,47 +1115,6 @@ g_mirror_kernel_dump(struct bio *bp) } static void -g_mirror_flush(struct g_mirror_softc *sc, struct bio *bp) -{ - struct bio_queue queue; - struct g_mirror_disk *disk; - struct g_consumer *cp; - struct bio *cbp; - - TAILQ_INIT(&queue); - LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_state != G_MIRROR_DISK_STATE_ACTIVE) - continue; - cbp = g_clone_bio(bp); - if (cbp == NULL) { - while ((cbp = TAILQ_FIRST(&queue)) != NULL) { - TAILQ_REMOVE(&queue, cbp, bio_queue); - g_destroy_bio(cbp); - } - if (bp->bio_error == 0) - bp->bio_error = ENOMEM; - g_io_deliver(bp, bp->bio_error); - return; - } - TAILQ_INSERT_TAIL(&queue, cbp, bio_queue); - cbp->bio_done = g_mirror_flush_done; - cbp->bio_caller1 = disk; - cbp->bio_to = disk->d_consumer->provider; - } - while ((cbp = TAILQ_FIRST(&queue)) != NULL) { - TAILQ_REMOVE(&queue, cbp, bio_queue); - G_MIRROR_LOGREQ(3, cbp, "Sending request."); - disk = cbp->bio_caller1; - cbp->bio_caller1 = NULL; - cp = disk->d_consumer; - KASSERT(cp->acr >= 1 && cp->acw >= 1 && cp->ace >= 1, - ("Consumer %s not opened (r%dw%de%d).", cp->provider->name, - cp->acr, cp->acw, cp->ace)); - g_io_request(cbp, disk->d_consumer); - } -} - -static void g_mirror_start(struct bio *bp) { struct g_mirror_softc *sc; @@ -1172,10 +1133,8 @@ g_mirror_start(struct bio *bp) case BIO_READ: case BIO_WRITE: case BIO_DELETE: - break; case BIO_FLUSH: - g_mirror_flush(sc, bp); - return; + break; case BIO_GETATTR: if (!strcmp(bp->bio_attribute, "GEOM::candelete")) { g_mirror_candelete(bp); @@ -1257,14 +1216,14 @@ g_mirror_regular_collision(struct g_mirror_softc *sc, } /* - * Puts request onto delayed queue. + * Puts regular request onto delayed queue. */ static void g_mirror_regular_delay(struct g_mirror_softc *sc, struct bio *bp) { G_MIRROR_LOGREQ(2, bp, "Delaying request."); - TAILQ_INSERT_HEAD(&sc->sc_regular_delayed, bp, bio_queue); + TAILQ_INSERT_TAIL(&sc->sc_regular_delayed, bp, bio_queue); } /* @@ -1279,23 +1238,23 @@ g_mirror_sync_delay(struct g_mirror_softc *sc, struct } /* - * Releases delayed regular requests which don't collide anymore with sync - * requests. + * Requeue delayed regular requests. */ static void g_mirror_regular_release(struct g_mirror_softc *sc) { - struct bio *bp, *bp2; + struct bio *bp; - TAILQ_FOREACH_SAFE(bp, &sc->sc_regular_delayed, bio_queue, bp2) { - if (g_mirror_sync_collision(sc, bp)) - continue; - TAILQ_REMOVE(&sc->sc_regular_delayed, bp, bio_queue); - G_MIRROR_LOGREQ(2, bp, "Releasing delayed request (%p).", bp); - mtx_lock(&sc->sc_queue_mtx); - TAILQ_INSERT_HEAD(&sc->sc_queue, bp, bio_queue); - mtx_unlock(&sc->sc_queue_mtx); - } + if ((bp = TAILQ_FIRST(&sc->sc_regular_delayed)) == NULL) + return; + if (g_mirror_sync_collision(sc, bp)) + return; + + G_MIRROR_DEBUG(2, "Requeuing regular requests after collision."); + mtx_lock(&sc->sc_queue_mtx); + TAILQ_CONCAT(&sc->sc_regular_delayed, &sc->sc_queue, bio_queue); + TAILQ_SWAP(&sc->sc_regular_delayed, &sc->sc_queue, bio, bio_queue); + mtx_unlock(&sc->sc_queue_mtx); } /* @@ -1343,14 +1302,17 @@ g_mirror_sync_request_free(struct g_mirror_disk *disk, * send. */ static void -g_mirror_sync_request(struct bio *bp) +g_mirror_sync_request(struct g_mirror_softc *sc, struct bio *bp) { - struct g_mirror_softc *sc; struct g_mirror_disk *disk; struct g_mirror_disk_sync *sync; + KASSERT((bp->bio_cmd == BIO_READ && + bp->bio_from->geom == sc->sc_sync.ds_geom) || + (bp->bio_cmd == BIO_WRITE && bp->bio_from->geom == sc->sc_geom), + ("Sync BIO %p with unexpected origin", bp)); + bp->bio_from->index--; - sc = bp->bio_from->geom->softc; disk = bp->bio_from->private; if (disk == NULL) { sx_xunlock(&sc->sc_lock); /* Avoid recursion on sc_lock. */ @@ -1455,7 +1417,7 @@ g_mirror_sync_request(struct bio *bp) else g_io_request(bp, sync->ds_consumer); - /* Release delayed requests if possible. */ + /* Requeue delayed requests if possible. */ g_mirror_regular_release(sc); /* Find the smallest offset */ @@ -1683,11 +1645,26 @@ g_mirror_request_split(struct g_mirror_softc *sc, stru } static void -g_mirror_register_request(struct bio *bp) +g_mirror_register_request(struct g_mirror_softc *sc, struct bio *bp) { - struct g_mirror_softc *sc; + struct bio_queue queue; + struct bio *cbp; + struct g_consumer *cp; + struct g_mirror_disk *disk; - sc = bp->bio_to->private; + sx_assert(&sc->sc_lock, SA_XLOCKED); + + /* + * To avoid ordering issues, if a write is deferred because of a + * collision with a sync request, all I/O is deferred until that + * write is initiated. + */ + if (bp->bio_from->geom != sc->sc_sync.ds_geom && + !TAILQ_EMPTY(&sc->sc_regular_delayed)) { + g_mirror_regular_delay(sc, bp); + return; + } + switch (bp->bio_cmd) { case BIO_READ: switch (sc->sc_balance) { @@ -1707,13 +1684,6 @@ g_mirror_register_request(struct bio *bp) return; case BIO_WRITE: case BIO_DELETE: - { - struct bio_queue queue; - struct g_mirror_disk *disk; - struct g_mirror_disk_sync *sync; - struct g_consumer *cp; - struct bio *cbp; - /* * Delay the request if it is colliding with a synchronization * request. @@ -1742,12 +1712,11 @@ g_mirror_register_request(struct bio *bp) */ TAILQ_INIT(&queue); LIST_FOREACH(disk, &sc->sc_disks, d_next) { - sync = &disk->d_sync; switch (disk->d_state) { case G_MIRROR_DISK_STATE_ACTIVE: break; case G_MIRROR_DISK_STATE_SYNCHRONIZING: - if (bp->bio_offset >= sync->ds_offset) + if (bp->bio_offset >= disk->d_sync.ds_offset) continue; break; default: @@ -1777,6 +1746,8 @@ g_mirror_register_request(struct bio *bp) cp->provider->name, cp->acr, cp->acw, cp->ace)); } if (TAILQ_EMPTY(&queue)) { + KASSERT(bp->bio_cmd == BIO_DELETE, + ("No consumers for regular request %p", bp)); g_io_deliver(bp, EOPNOTSUPP); return; } @@ -1795,7 +1766,42 @@ g_mirror_register_request(struct bio *bp) */ TAILQ_INSERT_TAIL(&sc->sc_inflight, bp, bio_queue); return; - } + case BIO_FLUSH: + TAILQ_INIT(&queue); + LIST_FOREACH(disk, &sc->sc_disks, d_next) { + if (disk->d_state != G_MIRROR_DISK_STATE_ACTIVE) + continue; + cbp = g_clone_bio(bp); + if (cbp == NULL) { + while ((cbp = TAILQ_FIRST(&queue)) != NULL) { + TAILQ_REMOVE(&queue, cbp, bio_queue); + g_destroy_bio(cbp); + } + if (bp->bio_error == 0) + bp->bio_error = ENOMEM; + g_io_deliver(bp, bp->bio_error); + return; + } + TAILQ_INSERT_TAIL(&queue, cbp, bio_queue); + cbp->bio_done = g_mirror_done; + cbp->bio_caller1 = disk; + cbp->bio_to = disk->d_consumer->provider; + } + KASSERT(!TAILQ_EMPTY(&queue), + ("No consumers for regular request %p", bp)); + while ((cbp = TAILQ_FIRST(&queue)) != NULL) { + G_MIRROR_LOGREQ(3, cbp, "Sending request."); + TAILQ_REMOVE(&queue, cbp, bio_queue); + disk = cbp->bio_caller1; + cbp->bio_caller1 = NULL; + cp = disk->d_consumer; + KASSERT(cp->acr >= 1 && cp->acw >= 1 && cp->ace >= 1, + ("Consumer %s not opened (r%dw%de%d).", cp->provider->name, + cp->acr, cp->acw, cp->ace)); + cp->index++; + g_io_request(cbp, cp); + } + break; default: KASSERT(1 == 0, ("Invalid command here: %u (device=%s)", bp->bio_cmd, sc->sc_name)); @@ -1926,15 +1932,16 @@ g_mirror_worker(void *arg) G_MIRROR_DEBUG(5, "%s: I'm here 1.", __func__); continue; } + /* * Check if we can mark array as CLEAN and if we can't take * how much seconds should we wait. */ timeout = g_mirror_idle(sc, -1); + /* - * Now I/O requests. + * Handle I/O requests. */ - /* Get first request from the queue. */ mtx_lock(&sc->sc_queue_mtx); bp = TAILQ_FIRST(&sc->sc_queue); if (bp != NULL) @@ -1969,19 +1976,33 @@ g_mirror_worker(void *arg) if (bp->bio_from->geom == sc->sc_sync.ds_geom && (bp->bio_cflags & G_MIRROR_BIO_FLAG_SYNC) != 0) { - g_mirror_sync_request(bp); /* READ */ + /* + * Handle completion of the first half (the read) of a + * block synchronization operation. + */ + g_mirror_sync_request(sc, bp); } else if (bp->bio_to != sc->sc_provider) { if ((bp->bio_cflags & G_MIRROR_BIO_FLAG_REGULAR) != 0) - g_mirror_regular_request(bp); + /* + * Handle completion of a regular I/O request. + */ + g_mirror_regular_request(sc, bp); else if ((bp->bio_cflags & G_MIRROR_BIO_FLAG_SYNC) != 0) - g_mirror_sync_request(bp); /* WRITE */ + /* + * Handle completion of the second half (the + * write) of a block synchronization operation. + */ + g_mirror_sync_request(sc, bp); else { KASSERT(0, ("Invalid request cflags=0x%hx to=%s.", bp->bio_cflags, bp->bio_to->name)); } } else { - g_mirror_register_request(bp); + /* + * Initiate an I/O request. + */ + g_mirror_register_request(sc, bp); } G_MIRROR_DEBUG(5, "%s: I'm here 9.", __func__); } From owner-svn-src-all@freebsd.org Wed Jan 24 15:16:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1693DED8C13; Wed, 24 Jan 2018 15:16:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B7CC48D68D; Wed, 24 Jan 2018 15:16:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B27B11F512; Wed, 24 Jan 2018 15:16:17 +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 w0OFGHwf083908; Wed, 24 Jan 2018 15:16:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OFGHRB083905; Wed, 24 Jan 2018 15:16:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801241516.w0OFGHRB083905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 24 Jan 2018 15:16:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328334 - in stable/11: sys/geom/mirror tests/sys/geom/class/mirror X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11: sys/geom/mirror tests/sys/geom/class/mirror X-SVN-Commit-Revision: 328334 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 15:16:18 -0000 Author: markj Date: Wed Jan 24 15:16:17 2018 New Revision: 328334 URL: https://svnweb.freebsd.org/changeset/base/328334 Log: MFC r327779, r327780: Fix handling of read errors during synchronization. Added: stable/11/tests/sys/geom/class/mirror/sync_error.sh - copied unchanged from r327780, head/tests/sys/geom/class/mirror/sync_error.sh Modified: stable/11/sys/geom/mirror/g_mirror.c stable/11/tests/sys/geom/class/mirror/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/11/sys/geom/mirror/g_mirror.c Wed Jan 24 15:15:18 2018 (r328333) +++ stable/11/sys/geom/mirror/g_mirror.c Wed Jan 24 15:16:17 2018 (r328334) @@ -108,6 +108,8 @@ static int g_mirror_update_disk(struct g_mirror_disk * static void g_mirror_update_device(struct g_mirror_softc *sc, bool force); static void g_mirror_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp); +static void g_mirror_sync_reinit(const struct g_mirror_disk *disk, + struct bio *bp, off_t offset); static void g_mirror_sync_stop(struct g_mirror_disk *disk, int type); static void g_mirror_register_request(struct g_mirror_softc *sc, struct bio *bp); @@ -1296,10 +1298,11 @@ g_mirror_sync_request_free(struct g_mirror_disk *disk, /* * Handle synchronization requests. - * Every synchronization request is two-steps process: first, READ request is - * send to active provider and then WRITE request (with read data) to the provider - * being synchronized. When WRITE is finished, new synchronization request is - * send. + * Every synchronization request is a two-step process: first, a read request is + * sent to the mirror provider via the sync consumer. If that request completes + * successfully, it is converted to a write and sent to the disk being + * synchronized. If the write also completes successfully, the synchronization + * offset is advanced and a new read request is submitted. */ static void g_mirror_sync_request(struct g_mirror_softc *sc, struct bio *bp) @@ -1324,13 +1327,16 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc return; } + sync = &disk->d_sync; + /* * Synchronization request. */ switch (bp->bio_cmd) { - case BIO_READ: - { + case BIO_READ: { + struct g_mirror_disk *d; struct g_consumer *cp; + int readable; KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_read, bp->bio_error); @@ -1339,7 +1345,33 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc G_MIRROR_LOGREQ(0, bp, "Synchronization request failed (error=%d).", bp->bio_error); - g_mirror_sync_request_free(disk, bp); + + /* + * If there's at least one other disk from which we can + * read the block, retry the request. + */ + readable = 0; + LIST_FOREACH(d, &sc->sc_disks, d_next) + if (d->d_state == G_MIRROR_DISK_STATE_ACTIVE && + !(d->d_flags & G_MIRROR_DISK_FLAG_BROKEN)) + readable++; + + /* + * The read error will trigger a syncid bump, so there's + * no need to do that here. + * + * If we can retry the read from another disk, do so. + * Otherwise, all we can do is kick out the new disk. + */ + if (readable == 0) { + g_mirror_sync_request_free(disk, bp); + g_mirror_event_send(disk, + G_MIRROR_DISK_STATE_DISCONNECTED, + G_MIRROR_EVENT_DONTWAIT); + } else { + g_mirror_sync_reinit(disk, bp, bp->bio_offset); + goto retry_read; + } return; } G_MIRROR_LOGREQ(3, bp, @@ -1353,12 +1385,10 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc cp->index++; g_io_request(bp, cp); return; - } - case BIO_WRITE: - { + } + case BIO_WRITE: { off_t offset; - void *data; - int i, idx; + int i; KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_write, bp->bio_error); @@ -1375,7 +1405,6 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc return; } G_MIRROR_LOGREQ(3, bp, "Synchronization request finished."); - sync = &disk->d_sync; if (sync->ds_offset >= sc->sc_mediasize || sync->ds_consumer == NULL || (sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0) { @@ -1395,20 +1424,13 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc } /* Send next synchronization request. */ - data = bp->bio_data; - idx = (int)(uintptr_t)bp->bio_caller1; - g_reset_bio(bp); - bp->bio_cmd = BIO_READ; - bp->bio_offset = sync->ds_offset; - bp->bio_length = MIN(MAXPHYS, sc->sc_mediasize - bp->bio_offset); + g_mirror_sync_reinit(disk, bp, sync->ds_offset); sync->ds_offset += bp->bio_length; - bp->bio_done = g_mirror_sync_done; - bp->bio_data = data; - bp->bio_from = sync->ds_consumer; - bp->bio_to = sc->sc_provider; - bp->bio_caller1 = (void *)(uintptr_t)idx; + +retry_read: G_MIRROR_LOGREQ(3, bp, "Sending synchronization request."); sync->ds_consumer->index++; + /* * Delay the request if it is colliding with a regular request. */ @@ -1434,11 +1456,9 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc sync->ds_update_ts = time_uptime; } return; - } + } default: - KASSERT(1 == 0, ("Invalid command here: %u (device=%s)", - bp->bio_cmd, sc->sc_name)); - break; + panic("Invalid I/O request %p", bp); } } @@ -2029,15 +2049,39 @@ g_mirror_update_idle(struct g_mirror_softc *sc, struct } static void +g_mirror_sync_reinit(const struct g_mirror_disk *disk, struct bio *bp, + off_t offset) +{ + void *data; + int idx; + + data = bp->bio_data; + idx = (int)(uintptr_t)bp->bio_caller1; + g_reset_bio(bp); + + bp->bio_cmd = BIO_READ; + bp->bio_data = data; + bp->bio_done = g_mirror_sync_done; + bp->bio_from = disk->d_sync.ds_consumer; + bp->bio_to = disk->d_softc->sc_provider; + bp->bio_caller1 = (void *)(uintptr_t)idx; + bp->bio_offset = offset; + bp->bio_length = MIN(MAXPHYS, + disk->d_softc->sc_mediasize - bp->bio_offset); +} + +static void g_mirror_sync_start(struct g_mirror_disk *disk) { struct g_mirror_softc *sc; + struct g_mirror_disk_sync *sync; struct g_consumer *cp; struct bio *bp; int error, i; g_topology_assert_not(); sc = disk->d_softc; + sync = &disk->d_sync; sx_assert(&sc->sc_lock, SX_LOCKED); KASSERT(disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING, @@ -2063,54 +2107,48 @@ g_mirror_sync_start(struct g_mirror_disk *disk) g_mirror_get_diskname(disk)); if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_NOFAILSYNC) == 0) disk->d_flags |= G_MIRROR_DISK_FLAG_DIRTY; - KASSERT(disk->d_sync.ds_consumer == NULL, + KASSERT(sync->ds_consumer == NULL, ("Sync consumer already exists (device=%s, disk=%s).", sc->sc_name, g_mirror_get_diskname(disk))); - disk->d_sync.ds_consumer = cp; - disk->d_sync.ds_consumer->private = disk; - disk->d_sync.ds_consumer->index = 0; + sync->ds_consumer = cp; + sync->ds_consumer->private = disk; + sync->ds_consumer->index = 0; /* * Allocate memory for synchronization bios and initialize them. */ - disk->d_sync.ds_bios = malloc(sizeof(struct bio *) * g_mirror_syncreqs, + sync->ds_bios = malloc(sizeof(struct bio *) * g_mirror_syncreqs, M_MIRROR, M_WAITOK); for (i = 0; i < g_mirror_syncreqs; i++) { bp = g_alloc_bio(); - disk->d_sync.ds_bios[i] = bp; - bp->bio_parent = NULL; - bp->bio_cmd = BIO_READ; + sync->ds_bios[i] = bp; + bp->bio_data = malloc(MAXPHYS, M_MIRROR, M_WAITOK); - bp->bio_cflags = 0; - bp->bio_offset = disk->d_sync.ds_offset; - bp->bio_length = MIN(MAXPHYS, sc->sc_mediasize - bp->bio_offset); - disk->d_sync.ds_offset += bp->bio_length; - bp->bio_done = g_mirror_sync_done; - bp->bio_from = disk->d_sync.ds_consumer; - bp->bio_to = sc->sc_provider; bp->bio_caller1 = (void *)(uintptr_t)i; + g_mirror_sync_reinit(disk, bp, sync->ds_offset); + sync->ds_offset += bp->bio_length; } /* Increase the number of disks in SYNCHRONIZING state. */ sc->sc_sync.ds_ndisks++; /* Set the number of in-flight synchronization requests. */ - disk->d_sync.ds_inflight = g_mirror_syncreqs; + sync->ds_inflight = g_mirror_syncreqs; /* * Fire off first synchronization requests. */ for (i = 0; i < g_mirror_syncreqs; i++) { - bp = disk->d_sync.ds_bios[i]; + bp = sync->ds_bios[i]; G_MIRROR_LOGREQ(3, bp, "Sending synchronization request."); - disk->d_sync.ds_consumer->index++; + sync->ds_consumer->index++; /* * Delay the request if it is colliding with a regular request. */ if (g_mirror_regular_collision(sc, bp)) g_mirror_sync_delay(sc, bp); else - g_io_request(bp, disk->d_sync.ds_consumer); + g_io_request(bp, sync->ds_consumer); } } Modified: stable/11/tests/sys/geom/class/mirror/Makefile ============================================================================== --- stable/11/tests/sys/geom/class/mirror/Makefile Wed Jan 24 15:15:18 2018 (r328333) +++ stable/11/tests/sys/geom/class/mirror/Makefile Wed Jan 24 15:16:17 2018 (r328334) @@ -18,6 +18,8 @@ TAP_TESTS_SH+= 11_test TAP_TESTS_SH+= 12_test TAP_TESTS_SH+= 13_test +ATF_TESTS_SH+= sync_error + ${PACKAGE}FILES+= conf.sh .for t in ${TAP_TESTS_SH} Copied: stable/11/tests/sys/geom/class/mirror/sync_error.sh (from r327780, head/tests/sys/geom/class/mirror/sync_error.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tests/sys/geom/class/mirror/sync_error.sh Wed Jan 24 15:16:17 2018 (r328334, copy of r327780, head/tests/sys/geom/class/mirror/sync_error.sh) @@ -0,0 +1,110 @@ +# $FreeBSD$ + +REG_READ_FP=debug.fail_point.g_mirror_regular_request_read + +atf_test_case sync_read_error_2_disks cleanup +sync_read_error_2_disks_head() +{ + atf_set "descr" \ + "Ensure that we properly handle read errors during synchronization." + atf_set "require.user" "root" +} +sync_read_error_2_disks_body() +{ + . $(atf_get_srcdir)/conf.sh + + f1=$(mktemp ${base}.XXXXXX) + f2=$(mktemp ${base}.XXXXXX) + + atf_check dd if=/dev/zero bs=1M count=32 of=$f1 status=none + atf_check truncate -s 32M $f2 + + md1=$(attach_md -t vnode -f ${f1}) + md2=$(attach_md -t vnode -f ${f2}) + + atf_check gmirror label $name $md1 + devwait + + atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='1*return(5)' + + # If a read error occurs while synchronizing and the mirror contains + # a single active disk, gmirror has no choice but to fail the + # synchronization and kick the new disk out of the mirror. + atf_check gmirror insert $name $md2 + sleep 0.1 + syncwait + atf_check [ $(gmirror status -s $name | wc -l) -eq 1 ] + atf_check -s exit:0 -o match:"DEGRADED $md1 \(ACTIVE\)" \ + gmirror status -s $name +} +sync_read_error_2_disks_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + + atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='off' + gmirror_test_cleanup +} + +atf_test_case sync_read_error_3_disks cleanup +sync_read_error_3_disks_head() +{ + atf_set "descr" \ + "Ensure that we properly handle read errors during synchronization." + atf_set "require.user" "root" +} +sync_read_error_3_disks_body() +{ + . $(atf_get_srcdir)/conf.sh + + f1=$(mktemp ${base}.XXXXXX) + f2=$(mktemp ${base}.XXXXXX) + f3=$(mktemp ${base}.XXXXXX) + + atf_check dd if=/dev/random bs=1M count=32 of=$f1 status=none + atf_check truncate -s 32M $f2 + atf_check truncate -s 32M $f3 + + md1=$(attach_md -t vnode -f ${f1}) + md2=$(attach_md -t vnode -f ${f2}) + md3=$(attach_md -t vnode -f ${f3}) + + atf_check gmirror label $name $md1 + devwait + + atf_check gmirror insert $name $md2 + syncwait + + atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='1*return(5)' + + # If a read error occurs while synchronizing a new disk, and we have + # multiple active disks, we retry the read after an error. The disk + # which returned the read error is kicked out of the mirror. + atf_check gmirror insert $name $md3 + syncwait + atf_check [ $(gmirror status -s $name | wc -l) -eq 2 ] + atf_check -s exit:0 -o match:"DEGRADED $md3 \(ACTIVE\)" \ + gmirror status -s $name + + # Make sure that the two active disks are identical. Destroy the + # mirror first so that the metadata sectors are wiped. + if $(gmirror status -s $name | grep -q $md1); then + active=$md1 + else + active=$md2 + fi + atf_check gmirror destroy $name + atf_check cmp /dev/$active /dev/$md3 +} +sync_read_error_3_disks_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + + atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='off' + gmirror_test_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case sync_read_error_2_disks + atf_add_test_case sync_read_error_3_disks +} From owner-svn-src-all@freebsd.org Wed Jan 24 15:44:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C1B7ED9DF3 for ; Wed, 24 Jan 2018 15:44:19 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (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 CCD028E7D9 for ; Wed, 24 Jan 2018 15:44:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22f.google.com with SMTP id b5so5662624itc.3 for ; Wed, 24 Jan 2018 07:44:18 -0800 (PST) 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=ky9iXbe31AwKkkQ7NuyZsOSQOdk7mD/uA0k9iUMnPmo=; b=eOm+jZPBhWyb2ukVsUcGGtOnMDBgv4uhVIqiTtzklAZGs+QBip/4zPq2ajyrVc6Z4A Hs72bwtnd6NyLzZ06GCqIo3cRlQNg88+kK4SeuRo6+y4WEIklUdsigbfQmfkeU/mCbxg ZZ7IJ7tQsyKFFpMnhfhQG16ClbdKeJ/wkT09BTwYm4NyhinS/0V6kDG3/J4Tes4vpQrc DZ3Pn12Z1WBEVGA1DlEpXyDU5EVxz+i227t8pFdOaB14Ri6bhYGbbIE3FDeR5MeRY2bV hhyFDVG2YXgO1Xm55PG9D/nF6aCeqcUjYJN0aEHTqurD96g9+2aJKn06F4IxhYDqVF17 Ok8Q== 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=ky9iXbe31AwKkkQ7NuyZsOSQOdk7mD/uA0k9iUMnPmo=; b=FLo54naYqlrWLwH+LznYhajPdAZpHDgNRVIdNYGW28e9m73DfrpaDClOpwqyG8ilX/ NLCMARANAz4Vwb0aR/DakVsSJs4VJnBE2NKSrljXZt9Ll1p5y88wRMJIyOR9IyLeXHtK RMfBPlrBrdynZeWlL/oXMi/yM5/jMriTIhFQoIIOZ02iWQ6tS1bpiJtVn5w32gM3Fi41 XepU1Lux3Q5BsWuj5iAOEREDa08DAccWhdnAUQxHGR1aBuV05a9LM776IEX6NtaXViZ4 zfmQlGWkHO1gWJGDmgGJfGCGm99kZZgjPl6KuvaOPIRK2XTmejdezd7BE/WdychwrjgW qPHQ== X-Gm-Message-State: AKwxyteFHFHV/HjwcLOmBYfEsrLqrjq9p5vGJDNiWwW7DUGxEVSEFE++ jsxnR4Js1SuskVjCtHWJmjzt51fgvFv4SVk++huBTQ== X-Google-Smtp-Source: AH8x224btxDOdQ8/yoAILMUr/oyQbTBCBx5iiCk6T5K58FP01tO29mrw64PMC1e8OuqJr/SnklYOFZJ5p+L4T/SZbKo= X-Received: by 10.36.91.210 with SMTP id g201mr9124186itb.50.1516808658037; Wed, 24 Jan 2018 07:44:18 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.153.28 with HTTP; Wed, 24 Jan 2018 07:44:16 -0800 (PST) X-Originating-IP: [50.227.106.226] In-Reply-To: <20180124182548.X1063@besplex.bde.org> References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> From: Warner Losh Date: Wed, 24 Jan 2018 08:44:16 -0700 X-Google-Sender-Auth: UEs8OP-s76c_BpVLs6eFFalfnb0 Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Bruce Evans Cc: Pedro Giffuni , "Conrad E. Meyer" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 15:44:19 -0000 On Wed, Jan 24, 2018 at 1:50 AM, Bruce Evans wrote: > On Tue, 23 Jan 2018, Pedro Giffuni wrote: > > On 23/01/2018 14:08, Conrad Meyer wrote: >> >>> Hi Pedro, >>> >>> On Sun, Jan 21, 2018 at 7:42 AM, Pedro F. Giffuni >>> wrote: >>> >>>> Author: pfg >>>> Date: Sun Jan 21 15:42:36 2018 >>>> New Revision: 328218 >>>> URL: https://svnweb.freebsd.org/changeset/base/328218 >>>> >>>> Log: >>>> Revert r327828, r327949, r327953, r328016-r328026, r328041: >>>> Uses of mallocarray(9). >>>> >>>> The use of mallocarray(9) has rocketed the required swap to build >>>> FreeBSD. >>>> This is likely caused by the allocation size attributes which put >>>> extra pressure >>>> on the compiler. >>>> >>> I'm confused about this change. Wouldn't it be better to remove the >>> annotation/attributes from mallocarray() than to remove the protection >>> against overflow? >>> >> > It would be better to remove mallocarray(). I agree completely. It doesn't do what you think it is doing, for all the reasons that Bruce outlines. We thought it was a bad idea when it came up 2 years ago and nothing has really changed. Warner From owner-svn-src-all@freebsd.org Wed Jan 24 16:33:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26922EDBD17; Wed, 24 Jan 2018 16:33:34 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CB49C682DB; Wed, 24 Jan 2018 16:33:33 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C63DC20222; Wed, 24 Jan 2018 16:33:33 +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 w0OGXXOR022998; Wed, 24 Jan 2018 16:33:33 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OGXXYF022993; Wed, 24 Jan 2018 16:33:33 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201801241633.w0OGXXYF022993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 24 Jan 2018 16:33:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328335 - head/usr.sbin/uefisign X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/usr.sbin/uefisign X-SVN-Commit-Revision: 328335 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 16:33:34 -0000 Author: trasz Date: Wed Jan 24 16:33:33 2018 New Revision: 328335 URL: https://svnweb.freebsd.org/changeset/base/328335 Log: Add SPDX identifiers for uefisign(8) sources. MFC after: 2 weeks Modified: head/usr.sbin/uefisign/child.c head/usr.sbin/uefisign/magic.h head/usr.sbin/uefisign/pe.c head/usr.sbin/uefisign/uefisign.c head/usr.sbin/uefisign/uefisign.h Modified: head/usr.sbin/uefisign/child.c ============================================================================== --- head/usr.sbin/uefisign/child.c Wed Jan 24 15:16:17 2018 (r328334) +++ head/usr.sbin/uefisign/child.c Wed Jan 24 16:33:33 2018 (r328335) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * Modified: head/usr.sbin/uefisign/magic.h ============================================================================== --- head/usr.sbin/uefisign/magic.h Wed Jan 24 15:16:17 2018 (r328334) +++ head/usr.sbin/uefisign/magic.h Wed Jan 24 16:33:33 2018 (r328335) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * Modified: head/usr.sbin/uefisign/pe.c ============================================================================== --- head/usr.sbin/uefisign/pe.c Wed Jan 24 15:16:17 2018 (r328334) +++ head/usr.sbin/uefisign/pe.c Wed Jan 24 16:33:33 2018 (r328335) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * Modified: head/usr.sbin/uefisign/uefisign.c ============================================================================== --- head/usr.sbin/uefisign/uefisign.c Wed Jan 24 15:16:17 2018 (r328334) +++ head/usr.sbin/uefisign/uefisign.c Wed Jan 24 16:33:33 2018 (r328335) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * Modified: head/usr.sbin/uefisign/uefisign.h ============================================================================== --- head/usr.sbin/uefisign/uefisign.h Wed Jan 24 15:16:17 2018 (r328334) +++ head/usr.sbin/uefisign/uefisign.h Wed Jan 24 16:33:33 2018 (r328335) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * From owner-svn-src-all@freebsd.org Wed Jan 24 16:34:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD3ADEDBE0A; Wed, 24 Jan 2018 16:34:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6F8DD6847E; Wed, 24 Jan 2018 16:34:37 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A81D20223; Wed, 24 Jan 2018 16:34:37 +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 w0OGYbZT023081; Wed, 24 Jan 2018 16:34:37 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OGYbTS023080; Wed, 24 Jan 2018 16:34:37 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201801241634.w0OGYbTS023080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 24 Jan 2018 16:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328336 - head/usr.sbin/iscsid X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/usr.sbin/iscsid X-SVN-Commit-Revision: 328336 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 16:34:37 -0000 Author: trasz Date: Wed Jan 24 16:34:37 2018 New Revision: 328336 URL: https://svnweb.freebsd.org/changeset/base/328336 Log: Add missing SPDX identifier in iscsid(8). MFC after: 2 weeks Modified: head/usr.sbin/iscsid/chap.c Modified: head/usr.sbin/iscsid/chap.c ============================================================================== --- head/usr.sbin/iscsid/chap.c Wed Jan 24 16:33:33 2018 (r328335) +++ head/usr.sbin/iscsid/chap.c Wed Jan 24 16:34:37 2018 (r328336) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * From owner-svn-src-all@freebsd.org Wed Jan 24 16:37:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB2F6EB4138; Wed, 24 Jan 2018 16:37:30 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A862687D1; Wed, 24 Jan 2018 16:37: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 610BC20224; Wed, 24 Jan 2018 16:37: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 w0OGbUTD023234; Wed, 24 Jan 2018 16:37:30 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OGbU3o023231; Wed, 24 Jan 2018 16:37:30 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201801241637.w0OGbU3o023231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 24 Jan 2018 16:37:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328337 - head/usr.sbin/ctld X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/usr.sbin/ctld X-SVN-Commit-Revision: 328337 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 16:37:30 -0000 Author: trasz Date: Wed Jan 24 16:37:29 2018 New Revision: 328337 URL: https://svnweb.freebsd.org/changeset/base/328337 Log: Add missing SPDX tags for ctld(8). MFC after: 2 weeks Modified: head/usr.sbin/ctld/chap.c head/usr.sbin/ctld/isns.c head/usr.sbin/ctld/uclparse.c Modified: head/usr.sbin/ctld/chap.c ============================================================================== --- head/usr.sbin/ctld/chap.c Wed Jan 24 16:34:37 2018 (r328336) +++ head/usr.sbin/ctld/chap.c Wed Jan 24 16:37:29 2018 (r328337) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * Modified: head/usr.sbin/ctld/isns.c ============================================================================== --- head/usr.sbin/ctld/isns.c Wed Jan 24 16:34:37 2018 (r328336) +++ head/usr.sbin/ctld/isns.c Wed Jan 24 16:37:29 2018 (r328337) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 Alexander Motin * All rights reserved. * Modified: head/usr.sbin/ctld/uclparse.c ============================================================================== --- head/usr.sbin/ctld/uclparse.c Wed Jan 24 16:34:37 2018 (r328336) +++ head/usr.sbin/ctld/uclparse.c Wed Jan 24 16:37:29 2018 (r328337) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2015 iXsystems Inc. * All rights reserved. * From owner-svn-src-all@freebsd.org Wed Jan 24 16:39:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 193C8EB42C3; Wed, 24 Jan 2018 16:39:04 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BFDD06898D; Wed, 24 Jan 2018 16:39:03 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BAE7720227; Wed, 24 Jan 2018 16:39:03 +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 w0OGd3hr023347; Wed, 24 Jan 2018 16:39:03 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OGd2Le023338; Wed, 24 Jan 2018 16:39:02 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201801241639.w0OGd2Le023338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 24 Jan 2018 16:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328338 - head/usr.sbin/autofs X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/usr.sbin/autofs X-SVN-Commit-Revision: 328338 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 16:39:04 -0000 Author: trasz Date: Wed Jan 24 16:39:02 2018 New Revision: 328338 URL: https://svnweb.freebsd.org/changeset/base/328338 Log: Add SPDX tags for automount(8) et al. MFC after: 2 weeks Modified: head/usr.sbin/autofs/automount.c head/usr.sbin/autofs/automountd.c head/usr.sbin/autofs/autounmountd.c head/usr.sbin/autofs/common.c head/usr.sbin/autofs/common.h head/usr.sbin/autofs/defined.c head/usr.sbin/autofs/log.c head/usr.sbin/autofs/popen.c head/usr.sbin/autofs/token.l Modified: head/usr.sbin/autofs/automount.c ============================================================================== --- head/usr.sbin/autofs/automount.c Wed Jan 24 16:37:29 2018 (r328337) +++ head/usr.sbin/autofs/automount.c Wed Jan 24 16:39:02 2018 (r328338) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * Modified: head/usr.sbin/autofs/automountd.c ============================================================================== --- head/usr.sbin/autofs/automountd.c Wed Jan 24 16:37:29 2018 (r328337) +++ head/usr.sbin/autofs/automountd.c Wed Jan 24 16:39:02 2018 (r328338) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * Modified: head/usr.sbin/autofs/autounmountd.c ============================================================================== --- head/usr.sbin/autofs/autounmountd.c Wed Jan 24 16:37:29 2018 (r328337) +++ head/usr.sbin/autofs/autounmountd.c Wed Jan 24 16:39:02 2018 (r328338) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * Modified: head/usr.sbin/autofs/common.c ============================================================================== --- head/usr.sbin/autofs/common.c Wed Jan 24 16:37:29 2018 (r328337) +++ head/usr.sbin/autofs/common.c Wed Jan 24 16:39:02 2018 (r328338) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * Modified: head/usr.sbin/autofs/common.h ============================================================================== --- head/usr.sbin/autofs/common.h Wed Jan 24 16:37:29 2018 (r328337) +++ head/usr.sbin/autofs/common.h Wed Jan 24 16:39:02 2018 (r328338) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * Modified: head/usr.sbin/autofs/defined.c ============================================================================== --- head/usr.sbin/autofs/defined.c Wed Jan 24 16:37:29 2018 (r328337) +++ head/usr.sbin/autofs/defined.c Wed Jan 24 16:39:02 2018 (r328338) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * Modified: head/usr.sbin/autofs/log.c ============================================================================== --- head/usr.sbin/autofs/log.c Wed Jan 24 16:37:29 2018 (r328337) +++ head/usr.sbin/autofs/log.c Wed Jan 24 16:39:02 2018 (r328338) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 The FreeBSD Foundation * All rights reserved. * Modified: head/usr.sbin/autofs/popen.c ============================================================================== --- head/usr.sbin/autofs/popen.c Wed Jan 24 16:37:29 2018 (r328337) +++ head/usr.sbin/autofs/popen.c Wed Jan 24 16:39:02 2018 (r328338) @@ -1,4 +1,6 @@ /* + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * Copyright (c) 2014 The FreeBSD Foundation Modified: head/usr.sbin/autofs/token.l ============================================================================== --- head/usr.sbin/autofs/token.l Wed Jan 24 16:37:29 2018 (r328337) +++ head/usr.sbin/autofs/token.l Wed Jan 24 16:39:02 2018 (r328338) @@ -1,5 +1,7 @@ %{ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * From owner-svn-src-all@freebsd.org Wed Jan 24 16:40:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E80DCEB4425; Wed, 24 Jan 2018 16:40:26 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E51668B61; Wed, 24 Jan 2018 16:40: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9953E2022E; Wed, 24 Jan 2018 16:40: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 w0OGeQDW023471; Wed, 24 Jan 2018 16:40:26 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OGeQKR023467; Wed, 24 Jan 2018 16:40:26 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201801241640.w0OGeQKR023467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 24 Jan 2018 16:40:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328339 - head/sys/fs/autofs X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/fs/autofs X-SVN-Commit-Revision: 328339 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 16:40:27 -0000 Author: trasz Date: Wed Jan 24 16:40:26 2018 New Revision: 328339 URL: https://svnweb.freebsd.org/changeset/base/328339 Log: Add SPDX tags to autofs(5). MFC after: 2 weeks Modified: head/sys/fs/autofs/autofs.h head/sys/fs/autofs/autofs_ioctl.h head/sys/fs/autofs/autofs_vfsops.c head/sys/fs/autofs/autofs_vnops.c Modified: head/sys/fs/autofs/autofs.h ============================================================================== --- head/sys/fs/autofs/autofs.h Wed Jan 24 16:39:02 2018 (r328338) +++ head/sys/fs/autofs/autofs.h Wed Jan 24 16:40:26 2018 (r328339) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * Modified: head/sys/fs/autofs/autofs_ioctl.h ============================================================================== --- head/sys/fs/autofs/autofs_ioctl.h Wed Jan 24 16:39:02 2018 (r328338) +++ head/sys/fs/autofs/autofs_ioctl.h Wed Jan 24 16:40:26 2018 (r328339) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * Modified: head/sys/fs/autofs/autofs_vfsops.c ============================================================================== --- head/sys/fs/autofs/autofs_vfsops.c Wed Jan 24 16:39:02 2018 (r328338) +++ head/sys/fs/autofs/autofs_vfsops.c Wed Jan 24 16:40:26 2018 (r328339) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * Modified: head/sys/fs/autofs/autofs_vnops.c ============================================================================== --- head/sys/fs/autofs/autofs_vnops.c Wed Jan 24 16:39:02 2018 (r328338) +++ head/sys/fs/autofs/autofs_vnops.c Wed Jan 24 16:40:26 2018 (r328339) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * From owner-svn-src-all@freebsd.org Wed Jan 24 16:44:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 841DBEB4AB3; Wed, 24 Jan 2018 16:44:58 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 39E7669239; Wed, 24 Jan 2018 16:44:58 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34BDF203CD; Wed, 24 Jan 2018 16:44:58 +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 w0OGivGF028340; Wed, 24 Jan 2018 16:44:57 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OGivto028334; Wed, 24 Jan 2018 16:44:57 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801241644.w0OGivto028334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 24 Jan 2018 16:44:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328340 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in head/sys: fs/ext2fs ufs/ffs ufs/ufs X-SVN-Commit-Revision: 328340 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 16:44:58 -0000 Author: pfg Date: Wed Jan 24 16:44:57 2018 New Revision: 328340 URL: https://svnweb.freebsd.org/changeset/base/328340 Log: Revert r327781, r328093, r328056: ufs|ext2fs: Revert uses of mallocarray(9). These aren't really useful: drop them. Variable unsigning will be brought again later. Modified: head/sys/fs/ext2fs/ext2_lookup.c head/sys/fs/ext2fs/ext2_vfsops.c head/sys/ufs/ffs/ffs_snapshot.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ufs/ufs_dirhash.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- head/sys/fs/ext2fs/ext2_lookup.c Wed Jan 24 16:40:26 2018 (r328339) +++ head/sys/fs/ext2fs/ext2_lookup.c Wed Jan 24 16:44:57 2018 (r328340) @@ -145,9 +145,9 @@ ext2_readdir(struct vop_readdir_args *ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; + int ncookies; int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; - u_int ncookies; if (uio->uio_offset < 0) return (EINVAL); @@ -160,8 +160,7 @@ ext2_readdir(struct vop_readdir_args *ap) ncookies = ip->i_size - uio->uio_offset; ncookies = ncookies / (offsetof(struct ext2fs_direct_2, e2d_namlen) + 4) + 1; - cookies = mallocarray(ncookies, sizeof(*cookies), M_TEMP, - M_WAITOK); + cookies = malloc(ncookies * sizeof(*cookies), M_TEMP, M_WAITOK); *ap->a_ncookies = ncookies; *ap->a_cookies = cookies; } else { Modified: head/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vfsops.c Wed Jan 24 16:40:26 2018 (r328339) +++ head/sys/fs/ext2fs/ext2_vfsops.c Wed Jan 24 16:44:57 2018 (r328340) @@ -400,9 +400,9 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es fs->e2fs_bsize / sizeof(struct ext2_gd)); } fs->e2fs_gdbcount = howmany(fs->e2fs_gcount, e2fs_descpb); - fs->e2fs_gd = mallocarray(e2fs_gdbcount_alloc, fs->e2fs_bsize, + fs->e2fs_gd = malloc(e2fs_gdbcount_alloc * fs->e2fs_bsize, M_EXT2MNT, M_WAITOK | M_ZERO); - fs->e2fs_contigdirs = mallocarray(fs->e2fs_gcount, + fs->e2fs_contigdirs = malloc(fs->e2fs_gcount * sizeof(*fs->e2fs_contigdirs), M_EXT2MNT, M_WAITOK | M_ZERO); /* @@ -683,8 +683,7 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp) for (i = 0; i < ump->um_e2fs->e2fs_gcount; i++, sump++) { *lp++ = ump->um_e2fs->e2fs_contigsumsize; sump->cs_init = 0; - sump->cs_sum = mallocarray( - ump->um_e2fs->e2fs_contigsumsize + 1, + sump->cs_sum = malloc((ump->um_e2fs->e2fs_contigsumsize + 1) * sizeof(int32_t), M_EXT2MNT, M_WAITOK | M_ZERO); } } Modified: head/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- head/sys/ufs/ffs/ffs_snapshot.c Wed Jan 24 16:40:26 2018 (r328339) +++ head/sys/ufs/ffs/ffs_snapshot.c Wed Jan 24 16:44:57 2018 (r328340) @@ -648,7 +648,7 @@ loop: * keep us out of deadlock until the full one is ready. */ if (xp == NULL) { - snapblklist = mallocarray(snaplistsize, sizeof(daddr_t), + snapblklist = malloc(snaplistsize * sizeof(daddr_t), M_UFSMNT, M_WAITOK); blkp = &snapblklist[1]; *blkp++ = lblkno(fs, fs->fs_sblockloc); @@ -729,7 +729,7 @@ out1: /* * Allocate space for the full list of preallocated snapshot blocks. */ - snapblklist = mallocarray(snaplistsize, sizeof(daddr_t), + snapblklist = malloc(snaplistsize * sizeof(daddr_t), M_UFSMNT, M_WAITOK); ip->i_snapblklist = &snapblklist[1]; /* Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Wed Jan 24 16:40:26 2018 (r328339) +++ head/sys/ufs/ffs/ffs_softdep.c Wed Jan 24 16:44:57 2018 (r328340) @@ -2466,8 +2466,7 @@ softdep_mount(devvp, mp, fs, cred) struct ufsmount *ump; struct cg *cgp; struct buf *bp; - u_int cyl, i; - int error; + int i, error, cyl; sdp = malloc(sizeof(struct mount_softdeps), M_MOUNTDATA, M_WAITOK | M_ZERO); @@ -2501,7 +2500,7 @@ softdep_mount(devvp, mp, fs, cred) ump->bmsafemap_hashtbl = hashinit(1024, M_BMSAFEMAP, &ump->bmsafemap_hash_size); i = 1 << (ffs(desiredvnodes / 10) - 1); - ump->indir_hashtbl = mallocarray(i, sizeof(struct indir_hashhead), + ump->indir_hashtbl = malloc(i * sizeof(struct indir_hashhead), M_FREEWORK, M_WAITOK); ump->indir_hash_size = i - 1; for (i = 0; i <= ump->indir_hash_size; i++) @@ -2628,8 +2627,8 @@ jblocks_create(void) jblocks = malloc(sizeof(*jblocks), M_JBLOCKS, M_WAITOK | M_ZERO); TAILQ_INIT(&jblocks->jb_segs); jblocks->jb_avail = 10; - jblocks->jb_extent = mallocarray(jblocks->jb_avail, - sizeof(struct jextent), M_JBLOCKS, M_WAITOK | M_ZERO); + jblocks->jb_extent = malloc(sizeof(struct jextent) * jblocks->jb_avail, + M_JBLOCKS, M_WAITOK | M_ZERO); return (jblocks); } @@ -2714,7 +2713,7 @@ jblocks_add(jblocks, daddr, blocks) /* Adding a new extent. */ if (++jblocks->jb_used == jblocks->jb_avail) { jblocks->jb_avail *= 2; - jext = mallocarray(jblocks->jb_avail, sizeof(struct jextent), + jext = malloc(sizeof(struct jextent) * jblocks->jb_avail, M_JBLOCKS, M_WAITOK | M_ZERO); memcpy(jext, jblocks->jb_extent, sizeof(struct jextent) * jblocks->jb_used); Modified: head/sys/ufs/ufs/ufs_dirhash.c ============================================================================== --- head/sys/ufs/ufs/ufs_dirhash.c Wed Jan 24 16:40:26 2018 (r328339) +++ head/sys/ufs/ufs/ufs_dirhash.c Wed Jan 24 16:44:57 2018 (r328340) @@ -349,8 +349,7 @@ ufsdirhash_build(struct inode *ip) struct direct *ep; struct vnode *vp; doff_t bmask, pos; - int j, memreqd, slot; - u_int dirblocks, i, nblocks, narrays, nslots; + int dirblocks, i, j, memreqd, nblocks, narrays, nslots, slot; /* Take care of a decreased sysctl value. */ while (ufs_dirhashmem > ufs_dirhashmaxmem) { @@ -416,11 +415,11 @@ ufsdirhash_build(struct inode *ip) * Use non-blocking mallocs so that we will revert to a linear * lookup on failure rather than potentially blocking forever. */ - dh->dh_hash = mallocarray(narrays, sizeof(dh->dh_hash[0]), + dh->dh_hash = malloc(narrays * sizeof(dh->dh_hash[0]), M_DIRHASH, M_NOWAIT | M_ZERO); if (dh->dh_hash == NULL) goto fail; - dh->dh_blkfree = mallocarray(nblocks, sizeof(dh->dh_blkfree[0]), + dh->dh_blkfree = malloc(nblocks * sizeof(dh->dh_blkfree[0]), M_DIRHASH, M_NOWAIT); if (dh->dh_blkfree == NULL) goto fail; Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Wed Jan 24 16:40:26 2018 (r328339) +++ head/sys/ufs/ufs/ufs_vnops.c Wed Jan 24 16:44:57 2018 (r328340) @@ -2170,7 +2170,7 @@ ufs_readdir(ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - u_int ncookies; + int ncookies; int error; if (uio->uio_offset < 0) @@ -2185,8 +2185,7 @@ ufs_readdir(ap) else if (ip->i_size - uio->uio_offset < ncookies) ncookies = ip->i_size - uio->uio_offset; ncookies = ncookies / (offsetof(struct direct, d_name) + 4) + 1; - cookies = mallocarray(ncookies, sizeof(*cookies), M_TEMP, - M_WAITOK); + cookies = malloc(ncookies * sizeof(*cookies), M_TEMP, M_WAITOK); *ap->a_ncookies = ncookies; *ap->a_cookies = cookies; } else { From owner-svn-src-all@freebsd.org Wed Jan 24 16:58:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5050CEB55FA; Wed, 24 Jan 2018 16:58:27 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F376A698D3; Wed, 24 Jan 2018 16:58: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7C002056B; Wed, 24 Jan 2018 16:58: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 w0OGwQvx033582; Wed, 24 Jan 2018 16:58:26 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OGwQn9033578; Wed, 24 Jan 2018 16:58:26 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201801241658.w0OGwQn9033578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 24 Jan 2018 16:58:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328341 - head/sys/dev/iscsi X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/dev/iscsi X-SVN-Commit-Revision: 328341 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 16:58:27 -0000 Author: trasz Date: Wed Jan 24 16:58:26 2018 New Revision: 328341 URL: https://svnweb.freebsd.org/changeset/base/328341 Log: Add SPDX tags to iscsi(4). MFC after: 2 weeks Modified: head/sys/dev/iscsi/icl_conn_if.m head/sys/dev/iscsi/icl_soft.c head/sys/dev/iscsi/icl_wrappers.h Modified: head/sys/dev/iscsi/icl_conn_if.m ============================================================================== --- head/sys/dev/iscsi/icl_conn_if.m Wed Jan 24 16:44:57 2018 (r328340) +++ head/sys/dev/iscsi/icl_conn_if.m Wed Jan 24 16:58:26 2018 (r328341) @@ -1,4 +1,6 @@ #- +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# # Copyright (c) 2014 The FreeBSD Foundation # All rights reserved. # Modified: head/sys/dev/iscsi/icl_soft.c ============================================================================== --- head/sys/dev/iscsi/icl_soft.c Wed Jan 24 16:44:57 2018 (r328340) +++ head/sys/dev/iscsi/icl_soft.c Wed Jan 24 16:58:26 2018 (r328341) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 The FreeBSD Foundation * All rights reserved. * Modified: head/sys/dev/iscsi/icl_wrappers.h ============================================================================== --- head/sys/dev/iscsi/icl_wrappers.h Wed Jan 24 16:44:57 2018 (r328340) +++ head/sys/dev/iscsi/icl_wrappers.h Wed Jan 24 16:58:26 2018 (r328341) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. * From owner-svn-src-all@freebsd.org Wed Jan 24 17:04:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7EDAEB5CD0; Wed, 24 Jan 2018 17:04:01 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 89CDF69E16; Wed, 24 Jan 2018 17:04:01 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84AB1206F7; Wed, 24 Jan 2018 17:04:01 +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 w0OH417n038206; Wed, 24 Jan 2018 17:04:01 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OH41Pq038204; Wed, 24 Jan 2018 17:04:01 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201801241704.w0OH41Pq038204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 24 Jan 2018 17:04:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328342 - in head/sys: amd64/linux dev/usb/storage X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys: amd64/linux dev/usb/storage X-SVN-Commit-Revision: 328342 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 17:04:02 -0000 Author: trasz Date: Wed Jan 24 17:04:01 2018 New Revision: 328342 URL: https://svnweb.freebsd.org/changeset/base/328342 Log: Add SPDX identifiers to linux_ptrace.c and cfumass.c. MFC after: 2 weeks Modified: head/sys/amd64/linux/linux_ptrace.c head/sys/dev/usb/storage/cfumass.c Modified: head/sys/amd64/linux/linux_ptrace.c ============================================================================== --- head/sys/amd64/linux/linux_ptrace.c Wed Jan 24 16:58:26 2018 (r328341) +++ head/sys/amd64/linux/linux_ptrace.c Wed Jan 24 17:04:01 2018 (r328342) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2017 Edward Tomasz Napierala * All rights reserved. * Modified: head/sys/dev/usb/storage/cfumass.c ============================================================================== --- head/sys/dev/usb/storage/cfumass.c Wed Jan 24 16:58:26 2018 (r328341) +++ head/sys/dev/usb/storage/cfumass.c Wed Jan 24 17:04:01 2018 (r328342) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 The FreeBSD Foundation * All rights reserved. * From owner-svn-src-all@freebsd.org Wed Jan 24 17:12:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBB91EB63A2; Wed, 24 Jan 2018 17:12:34 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A2EA6A375; Wed, 24 Jan 2018 17:12:34 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74F0820887; Wed, 24 Jan 2018 17:12:34 +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 w0OHCY58043200; Wed, 24 Jan 2018 17:12:34 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OHCY6f043199; Wed, 24 Jan 2018 17:12:34 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201801241712.w0OHCY6f043199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 24 Jan 2018 17:12:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328343 - head/usr.bin/time X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/usr.bin/time X-SVN-Commit-Revision: 328343 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 17:12:35 -0000 Author: asomers Date: Wed Jan 24 17:12:34 2018 New Revision: 328343 URL: https://svnweb.freebsd.org/changeset/base/328343 Log: time(1): use clock_gettime(2) instead of gettimeofday(2) This is a prerequisite to adding support for the monotonic clock Reviewed by: ken, imp MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D14030 Modified: head/usr.bin/time/time.c Modified: head/usr.bin/time/time.c ============================================================================== --- head/usr.bin/time/time.c Wed Jan 24 17:04:01 2018 (r328342) +++ head/usr.bin/time/time.c Wed Jan 24 17:12:34 2018 (r328343) @@ -58,18 +58,19 @@ static const char rcsid[] = #include #include #include +#include #include static int getstathz(void); static void humantime(FILE *, long, long); -static void showtime(FILE *, struct timeval *, struct timeval *, +static void showtime(FILE *, struct timespec *, struct timespec *, struct rusage *); static void siginfo(int); static void usage(void); static sig_atomic_t siginfo_recvd; static char decimal_point; -static struct timeval before_tv; +static struct timespec before_ts; static int hflag, pflag; int @@ -80,7 +81,7 @@ main(int argc, char **argv) pid_t pid; struct rlimit rl; struct rusage ru; - struct timeval after; + struct timespec after; char *ofn = NULL; FILE *out = stderr; @@ -120,7 +121,8 @@ main(int argc, char **argv) setvbuf(out, (char *)NULL, _IONBF, (size_t)0); } - (void)gettimeofday(&before_tv, NULL); + if (clock_gettime(CLOCK_REALTIME, &before_ts)) + err(1, "clock_gettime"); switch(pid = fork()) { case -1: /* error */ err(1, "time"); @@ -139,16 +141,18 @@ main(int argc, char **argv) while (wait4(pid, &status, 0, &ru) != pid) { if (siginfo_recvd) { siginfo_recvd = 0; - (void)gettimeofday(&after, NULL); + if (clock_gettime(CLOCK_REALTIME, &after)) + err(1, "clock_gettime"); getrusage(RUSAGE_CHILDREN, &ru); - showtime(stdout, &before_tv, &after, &ru); + showtime(stdout, &before_ts, &after, &ru); } } - (void)gettimeofday(&after, NULL); + if (clock_gettime(CLOCK_REALTIME, &after)) + err(1, "clock_gettime"); if ( ! WIFEXITED(status)) warnx("command terminated abnormally"); exitonsig = WIFSIGNALED(status) ? WTERMSIG(status) : 0; - showtime(out, &before_tv, &after, &ru); + showtime(out, &before_ts, &after, &ru); if (lflag) { int hz = getstathz(); u_long ticks; @@ -237,7 +241,7 @@ getstathz(void) } static void -humantime(FILE *out, long sec, long usec) +humantime(FILE *out, long sec, long centisec) { long days, hrs, mins; @@ -255,18 +259,18 @@ humantime(FILE *out, long sec, long usec) fprintf(out, "%ldh", hrs); if (mins) fprintf(out, "%ldm", mins); - fprintf(out, "%ld%c%02lds", sec, decimal_point, usec); + fprintf(out, "%ld%c%02lds", sec, decimal_point, centisec); } static void -showtime(FILE *out, struct timeval *before, struct timeval *after, +showtime(FILE *out, struct timespec *before, struct timespec *after, struct rusage *ru) { after->tv_sec -= before->tv_sec; - after->tv_usec -= before->tv_usec; - if (after->tv_usec < 0) - after->tv_sec--, after->tv_usec += 1000000; + after->tv_nsec -= before->tv_nsec; + if (after->tv_nsec < 0) + after->tv_sec--, after->tv_nsec += 1000000000; if (pflag) { /* POSIX wants output that must look like @@ -274,7 +278,7 @@ showtime(FILE *out, struct timeval *before, struct tim at least two digits after the radix. */ fprintf(out, "real %jd%c%02ld\n", (intmax_t)after->tv_sec, decimal_point, - after->tv_usec/10000); + after->tv_nsec/10000000); fprintf(out, "user %jd%c%02ld\n", (intmax_t)ru->ru_utime.tv_sec, decimal_point, ru->ru_utime.tv_usec/10000); @@ -282,7 +286,7 @@ showtime(FILE *out, struct timeval *before, struct tim (intmax_t)ru->ru_stime.tv_sec, decimal_point, ru->ru_stime.tv_usec/10000); } else if (hflag) { - humantime(out, after->tv_sec, after->tv_usec/10000); + humantime(out, after->tv_sec, after->tv_nsec/10000000); fprintf(out, " real\t"); humantime(out, ru->ru_utime.tv_sec, ru->ru_utime.tv_usec/10000); fprintf(out, " user\t"); @@ -291,7 +295,7 @@ showtime(FILE *out, struct timeval *before, struct tim } else { fprintf(out, "%9jd%c%02ld real ", (intmax_t)after->tv_sec, decimal_point, - after->tv_usec/10000); + after->tv_nsec/10000000); fprintf(out, "%9jd%c%02ld user ", (intmax_t)ru->ru_utime.tv_sec, decimal_point, ru->ru_utime.tv_usec/10000); From owner-svn-src-all@freebsd.org Wed Jan 24 17:16:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54A66EB668D for ; Wed, 24 Jan 2018 17:16:51 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic312-36.consmr.mail.ne1.yahoo.com (sonic312-36.consmr.mail.ne1.yahoo.com [66.163.191.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E45976A62E for ; Wed, 24 Jan 2018 17:16:50 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1516814210; bh=jRMo9OQZ2ByaU4aVE5+3yLbIRr2meXhBeu+6sohutDo=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=B4w0gwa3g2XQHs73DC3yd7F41h780MtWNB/baabvS8/qDEIUlPKI7MjHNt+Cd8PmsM4cF8pvpt3cGVtmrv5py3i5nbSkTOFJIw7mgZuecLFBPmSS7Zng7BxhkjmHcc5jKoTjnSbmQGoqthy/UGXSQ6cR90udBAMK2rRSkaxLK8yagOWb8OR0Mm1Fxkds7MDOmzRZaZGDE2SZCNRsIHqtmY75ce03Zdqhy+cdNxsMmAzEuPrCCelMERa0NH0NDVm6weTL+0xBNpanE52bs6kF6nCYzElJylAOB+6S4cir9KTEsUi7tp0DB9mb0yZn21UFKe2t29XVbZe1QkDFFGxnOw== X-YMail-OSG: iJSoNtsVM1mq424v2KfNvDKMal2nfd5DavYX2XZmJDc8Bv1NeNbx2Nx2Xc_tFUs GDBdjFmUGHD2inMXdECeyYZfl5Snzm4bMlhtShZL_8RCdr6re8r0yxjSkYCkEnoBFpGxBQHxxNYn hHvSLiSSb4lXAe8Xxx9IKMZkBqWYgKzaZgaTk1pOp48qNg.yJGnJbGEFIcgCREhJi4OLn7OOzp1s DluPUfx8nSL_lbusTSXgaNyYJQk8SqJtc8HlmCgK1qosqT5noYSgaeTN9TtkAtR18Dr4tu2sW5m_ cRKp6WB2O330Muwjj5cQAecUqF5Es50vCd.yI7Kgj4Vx5jVhIzxTiZ1wtBEhOdFVRWD3U.UJpgnN ArVuCBfwl7ADJx7B2sFFmBm8h.h4rLe8YY51aOBvH67MaabCjWjBv9VbxKkjLteNhxmznNsBd64n zr2gvwBMTMOPWW0sjBlk2tUtpzeCICaza5dfq46PoOlNNwSn2d9MnfeAavICuKA.I_DlOO4pZaV9 _NeQIH_S_sQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ne1.yahoo.com with HTTP; Wed, 24 Jan 2018 17:16:50 +0000 Received: from smtp226.mail.ne1.yahoo.com (EHLO [192.168.0.8]) ([10.218.253.215]) by smtp414.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID c08e249350d66cd6390903803e180e59; Wed, 24 Jan 2018 17:16:47 +0000 (UTC) Subject: Re: svn commit: r328342 - in head/sys: amd64/linux dev/usb/storage To: Edward Tomasz Napierala , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801241704.w0OH41Pq038204@repo.freebsd.org> From: Pedro Giffuni Message-ID: Date: Wed, 24 Jan 2018 12:16:46 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801241704.w0OH41Pq038204@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 17:16:51 -0000 On 01/24/18 12:04, Edward Tomasz Napierala wrote: > Author: trasz > Date: Wed Jan 24 17:04:01 2018 > New Revision: 328342 > URL: https://svnweb.freebsd.org/changeset/base/328342 > > Log: > Add SPDX identifiers to linux_ptrace.c and cfumass.c. > > MFC after: 2 weeks Thanks for all these! For the record ... I am not considering MFCing SPDX tags. There is just too much to be done for current to worry about stable at all ... but I won't stop anyone from doing so ;). Pedro. > Modified: > head/sys/amd64/linux/linux_ptrace.c > head/sys/dev/usb/storage/cfumass.c > > Modified: head/sys/amd64/linux/linux_ptrace.c > ============================================================================== > --- head/sys/amd64/linux/linux_ptrace.c Wed Jan 24 16:58:26 2018 (r328341) > +++ head/sys/amd64/linux/linux_ptrace.c Wed Jan 24 17:04:01 2018 (r328342) > @@ -1,4 +1,6 @@ > /*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > * Copyright (c) 2017 Edward Tomasz Napierala > * All rights reserved. > * > > Modified: head/sys/dev/usb/storage/cfumass.c > ============================================================================== > --- head/sys/dev/usb/storage/cfumass.c Wed Jan 24 16:58:26 2018 (r328341) > +++ head/sys/dev/usb/storage/cfumass.c Wed Jan 24 17:04:01 2018 (r328342) > @@ -1,4 +1,6 @@ > /*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > * Copyright (c) 2016 The FreeBSD Foundation > * All rights reserved. > * > From owner-svn-src-all@freebsd.org Wed Jan 24 17:30:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CBE5EB70C3; Wed, 24 Jan 2018 17:30:48 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (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 B23D66AF3F; Wed, 24 Jan 2018 17:30:47 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wm0-x244.google.com with SMTP id f3so10141806wmc.1; Wed, 24 Jan 2018 09:30:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=vvoWiEN7AbD9cPyrPgf7n+HfpUnGf4AB8UIyN6MQL6o=; b=j+REFMkZMCyXV+GvtrQwa+Y2oa1UoyT4P3y9p9GG7Yq5PCFoNRTF0mlLK/VbY7gj4k WvNFZVHAiFCwLntvolU4tPrT2n9E5WkuvouToso0a18FLS7fzdBlMmsxGHQ+/9Ee1Oxa taTAOx9snfqZM1kn56aD00C3PpWJVLxGGr5csek3jeOK2xlvvhF1M7hUnUQ3jT30CBnE kuI1+vA/fq6ADc/5GnrWZ2s5poQMSyCImfMPJosUcsJxCcCxbw9jBgU/1IbF9RavpviM OsYI9FNFgtZKiJ/2qTcDnQzGOddGFMhHHywozg40tauw+cacQz4sDRbltkNTrkInm2fa Pgng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=vvoWiEN7AbD9cPyrPgf7n+HfpUnGf4AB8UIyN6MQL6o=; b=sAgPpuXw2QucwxzSGgH3VPobKyZbHdKepYF2mWF3GJSO29p1pXfMDAFO/57ghlhcja oS70H7JTvNbA4UTFKsRzIbzDtdFY40UwINNN+5Gfdgl1zv7LjG2Fplzjv0Hb9prby1GJ NeL/sLXk0i1lq/hzIgnF6mrSuQmdedpYSMHXZbEg8N+wCli75DrAwfWMCytjI64i86Vk /H7HQbqTmf4GhGJl9Ol15TpnJ477EHSIvacfHtJlbertpfjtkmHI1IQIhIXoujV5ELhz 5N4NoJ+eLusBYQDtxq4Ij/Ja2fg1x8sGgfwmaWNkWSEiXJUWZIBCjpSy783s1XR1UdnP 2lQw== X-Gm-Message-State: AKwxyteJMnt9A2HC/EbAr0CtRdeDu9pFKEzwH/6mnuOHltjNcEfJyE8t xIFYEHGMPYaQRTlWhyx4YW0sEA== X-Google-Smtp-Source: AH8x226w+hDfHsWDbiuCnqtCw0jQDESXUWHCK4oV8UZ4e0ClLHfQt6Epi+A3sd43beZ1grnryD7g5w== X-Received: by 10.28.215.76 with SMTP id o73mr5671454wmg.51.1516815046480; Wed, 24 Jan 2018 09:30:46 -0800 (PST) Received: from brick (cpc92302-cmbg19-2-0-cust461.5-4.cable.virginm.net. [82.1.209.206]) by smtp.gmail.com with ESMTPSA id x203sm1135564wmd.11.2018.01.24.09.30.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 09:30:45 -0800 (PST) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Wed, 24 Jan 2018 17:30:44 +0000 From: Edward Tomasz Napierala To: Pedro Giffuni Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328342 - in head/sys: amd64/linux dev/usb/storage Message-ID: <20180124173044.GA13044@brick> Mail-Followup-To: Pedro Giffuni , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801241704.w0OH41Pq038204@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 17:30:48 -0000 On 0124T1216, Pedro Giffuni wrote: > > On 01/24/18 12:04, Edward Tomasz Napierala wrote: > > Author: trasz > > Date: Wed Jan 24 17:04:01 2018 > > New Revision: 328342 > > URL: https://svnweb.freebsd.org/changeset/base/328342 > > > > Log: > > Add SPDX identifiers to linux_ptrace.c and cfumass.c. > > > > MFC after: 2 weeks > > > Thanks for all these! Thanks for all the rest :-) > For the record ... I am not considering MFCing SPDX tags. > There is just too much to be done for current to worry about stable at > all ... but I won't stop anyone from doing so ;). I'm not sure if I will MFC them either, to be honest. For me this field is added automatically, via ~/.subversion/config setting - it's better to get a reminder that I can ignore than to forget. From owner-svn-src-all@freebsd.org Wed Jan 24 17:40:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8907EB78FC; Wed, 24 Jan 2018 17:40:02 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f51.google.com (mail-it0-f51.google.com [209.85.214.51]) (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 40A9E6B789; Wed, 24 Jan 2018 17:40:02 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f51.google.com with SMTP id u62so6089469ita.2; Wed, 24 Jan 2018 09:40:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=acRulSFKh8NOcPHFrPFrDrO3aSx8UMnavzLCSEBpK2A=; b=V5UZlaNJNS0Lzg8PBlGRVCgCggOmnmgJ63onjO9KndxPOZUm42icdWxQCHwS1Gzh49 eneHZoCBY06qMwWKOSQPEIH+hTmF+aXJIZe4UJ6PMB1eU/zWRdirEArBQ9+yk5ZkX369 J9Zqnoeevw6lYltwG9VoObR82pB4t89AwzGCR2I2e7EfafFuoTQqs4C4PRT/nArqPQm8 zIokRSHabo1BIgBbBamqpHbpjgNuianhigyzGgF9XWWfYaUA4bztQu+z1cbcFSqd0PS3 qxBfUOQ8+8lbkNXFnUJUQsnXxTVTbVXqjAg0G1QkMMi0qYNo3k6PTp71oG5l62rdWy5k EABQ== X-Gm-Message-State: AKwxytf84Qubvh1JfhoYDriNa+73VeBgQH3SAFQPN/xc6pg1PgzRLIEO WXunLe1v+8JfeQ473tuhWqLGc1CU X-Google-Smtp-Source: AH8x225mxmJXoNQnpLSFiMFpBNQWWkc8LHrwJ1XxWhQ6u74tetzrlUbd1lPYFZsZlhj8Yaw5F9NHGg== X-Received: by 10.36.87.83 with SMTP id u80mr9919546ita.140.1516815269972; Wed, 24 Jan 2018 09:34:29 -0800 (PST) Received: from mail-it0-f47.google.com (mail-it0-f47.google.com. [209.85.214.47]) by smtp.gmail.com with ESMTPSA id 64sm438506iox.0.2018.01.24.09.34.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 09:34:29 -0800 (PST) Received: by mail-it0-f47.google.com with SMTP id b77so6068861itd.0; Wed, 24 Jan 2018 09:34:29 -0800 (PST) X-Received: by 10.36.84.205 with SMTP id t196mr9853050ita.128.1516815269236; Wed, 24 Jan 2018 09:34:29 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Wed, 24 Jan 2018 09:34:28 -0800 (PST) In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> From: Conrad Meyer Date: Wed, 24 Jan 2018 09:34:28 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Warner Losh Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 17:40:02 -0000 On Wed, Jan 24, 2018 at 7:44 AM, Warner Losh wrote: > I agree completely. It doesn't do what you think it is doing, for all the > reasons that Bruce outlines. We thought it was a bad idea when it came up= 2 > years ago and nothing has really changed. I disagree. I'm not sure what you mean by "it doesn't do what you think it is doing." Do you think the manual page is unclear or needs more detail? It seems clear to me, but it also does what I think it does. Your description of two years ago is inaccurate =E2=80=94 you thought it wa= s a bad idea, and were the most vocal on the mailing list about it, but that viewpoint was not universally shared. In a pure headcount vote I think you were even outvoted, but as the initiative was headed by a non-committer, it sputtered out. If Bruce has made some important point or illumination, please highlight it. It's buried in the mostly nonsense wall of text boilerplate he usually includes. mallocarray serves an important function =E2=80=94 a last ditch seatbelt against overflowing allocations that can trivially replace existing naive malloc calls containing multiplication. Trivial heap corruption is replaced with DoS =E2=80=94 a strict improvement. That is all it does. Best, Conrad From owner-svn-src-all@freebsd.org Wed Jan 24 17:43:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10A14EB7CFA; Wed, 24 Jan 2018 17:43:32 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f41.google.com (mail-it0-f41.google.com [209.85.214.41]) (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 A0B8D6BC0C; Wed, 24 Jan 2018 17:43:31 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f41.google.com with SMTP id 68so6102186ite.4; Wed, 24 Jan 2018 09:43:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=Rtt9WA5DH5nD0WXtpDBSvrKYz08XA1LXvSkpKjkJG3Q=; b=NhedIop18WyDgHqlyktBNETgj2hQXW+ozhNczrnvs6l9gxRh+05SQQaB8I0e9RdV3X 8Gthd7iDAz1FqDVBzFw07TxQd44FtiYgzJ9CG69h0nAw3qE4C8NLz3eeM0vK0Uqxmj2e Da5uQW5awoxjBEOjq8+cQ4ZrtMYlpQq6D6Yzfhz6uC/AnIllmniWfc/kbq0QwepAsOgq 2Ssmypb3KXzQS0NqxO6BacpMgZObEfE+uiIfKFwYIOQPzlaRa6gOShZnHeDPYRrJyRfI XU9oWIlUJaWZHqy6or5GSKHLIhHQLV6ZgkqWPP3qIAC4Hnb2U8FHxuRmCmsmbZjQhpoG swMQ== X-Gm-Message-State: AKwxytcgGTXDjX9xSW2lKk2IdSAQ0KR8zn5sT6ES+H0RLghDl2Uz1YBh 4P1H9CTIxECkBfOK59T6aDiiPYLT X-Google-Smtp-Source: AH8x227ll/a7EZ2SAqlOlpXY2SJarqhex+/ofwSBRc069bbcggz+2F+QscIMgEaJcomO3cToMYdWzA== X-Received: by 10.36.90.137 with SMTP id v131mr9982250ita.41.1516815480462; Wed, 24 Jan 2018 09:38:00 -0800 (PST) Received: from mail-io0-f174.google.com (mail-io0-f174.google.com. [209.85.223.174]) by smtp.gmail.com with ESMTPSA id z197sm474109ioz.16.2018.01.24.09.38.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 09:38:00 -0800 (PST) Received: by mail-io0-f174.google.com with SMTP id z6so5647426iob.11; Wed, 24 Jan 2018 09:38:00 -0800 (PST) X-Received: by 10.107.15.89 with SMTP id x86mr9677978ioi.38.1516815479919; Wed, 24 Jan 2018 09:37:59 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Wed, 24 Jan 2018 09:37:59 -0800 (PST) In-Reply-To: <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> From: Conrad Meyer Date: Wed, 24 Jan 2018 09:37:59 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Pedro Giffuni 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.25 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, 24 Jan 2018 17:43:32 -0000 On Tue, Jan 23, 2018 at 11:40 AM, Pedro Giffuni wrote: > On 23/01/2018 14:08, Conrad Meyer wrote: >> On Sun, Jan 21, 2018 at 7:42 AM, Pedro F. Giffuni wrote: >>> >>> Author: pfg >>> Date: Sun Jan 21 15:42:36 2018 >>> New Revision: 328218 >> >> I'm confused about this change. Wouldn't it be better to remove the >> annotation/attributes from mallocarray() than to remove the protection >> against overflow? > > > Not in my opinion: it would be better to detect such overflows at compile > time (or through a static analyzer) than to have late notification though > panics. Sure, it would be better, but some situations are only detected at runtime -- hence mallocarray. And occasional use of the annotations on systems with plenty of RAM would keep the source tree free of compiler-detectable overflows, which I suspect are incredibly uncommon. > The blind use of mallocarray(9) is probably a mistake also: we > shouldn't use it unless there is some real risk of overflow. I'm not sure I follow that. >> (If the compiler is fixed in the future to not use >> excessive memory with these attributes, they can be conditionalized on >> compiler version, of course.) > > All in all, the compiler is not provably wrong: it's just using more swap > space, which is rather inconvenient for small platforms but not necessarily > wrong. Seems wrong if it's a noticeable amount. Maybe we could flip the annotations on or off with a low-ram build knob or something like that. Best, Conrad From owner-svn-src-all@freebsd.org Wed Jan 24 17:44:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 355D4EB7DA7 for ; Wed, 24 Jan 2018 17:44:10 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic312-36.consmr.mail.ne1.yahoo.com (sonic312-36.consmr.mail.ne1.yahoo.com [66.163.191.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C32F36BD53 for ; Wed, 24 Jan 2018 17:44:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1516815849; bh=0tnM+4WK3RTsvPgUpZE3DFXXd+UGALjCIZIbiffWBI8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=Zmpf76w1Iwz+0mkA99eEPiahHd13Ld+1vfFh1n2ya7+QTT/TM/WkH6noRFkTcMo7/vccyeM6ZLXDPi6fjjgIW+zUqnMjeS4LGkPk333JtjGrxmhFVAoripJNB3fhiTBffVtz9mhsUx9BuMJJLjvfRkL8js4aOnSmKInxkRWHywDG9NLXj5HRcwY8cTtozWiQ3bvgKbICbDGRVfslMSmn5qU41Mjwpp6zUGivZkamzw6p5zP/N/U7Nbv1RryJSaPKlOhjJ5DWylg2B5jcwKa8oDWqzKJEPP+FBAq14PIUcfO05blSIyKqL0GtQp1yhnfV+WOFE3pJrOg68inbvcy01A== X-YMail-OSG: rwcX2osVM1ljHhovnUsIIGV6dfasEjuF8Rby2vQtOQOdytyhKFaA3FfEKDm4IsU 8gTSqS2RN5u9Rw3vDgqoyp2ft2wWoboXE7QFM420rxuFtrL9LZic6ZgB_trdrPl5mcGthUNYajQs EYwlqG.ZFXEgfKcHPqT3ft56DddVk5zUBg.NwnNRd8jvQ6Ju3dd9_fe15Oubt2aFeXCBgWuFwci2 arojLNZTFbBOJJi_PqHQ2GTCDbcfWD9CHVhvObUqRVSSSXDec4WR_QHTstfoRFM40.6b7f6Pq5.N 9uhX1VCOepGJ7Yivb2Q6dFiU6NUoTdya_tihvnU75Bd91z9w5nh8mztKR8niNw1pSPa06ukm0Kzz 80SKBuVO7kkS0bYzjGPw.FErWde4JZ_gnFIGGaOAu1oUg.FyMnv_Douy8z_hCiM4_LFq82OBwLjX cGmjAF8_Fp4ixZOh0oK_qcylZnjsWYdun5y5JDhAhn49QUGAiptZ0TrfslXLR5gS1TXLj5ESfpLu KQrq4mtayTQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ne1.yahoo.com with HTTP; Wed, 24 Jan 2018 17:44:09 +0000 Received: from smtp235.mail.ne1.yahoo.com (EHLO [192.168.0.8]) ([10.218.253.206]) by smtp409.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 59128b338738b6cab9c8ce7b42745176; Wed, 24 Jan 2018 17:23:49 +0000 (UTC) Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Bruce Evans Cc: cem@freebsd.org, src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> From: Pedro Giffuni Message-ID: Date: Wed, 24 Jan 2018 12:23:48 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180124182548.X1063@besplex.bde.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 17:44:10 -0000 On 01/24/18 03:50, Bruce Evans wrote: > On Tue, 23 Jan 2018, Pedro Giffuni wrote: > >> On 23/01/2018 14:08, Conrad Meyer wrote: >>> Hi Pedro, >>> >>> On Sun, Jan 21, 2018 at 7:42 AM, Pedro F. Giffuni >>> wrote: >>>> Author: pfg >>>> Date: Sun Jan 21 15:42:36 2018 >>>> New Revision: 328218 >>>> URL: https://svnweb.freebsd.org/changeset/base/328218 >>>> >>>> Log: >>>>    Revert r327828, r327949, r327953, r328016-r328026, r328041: >>>>    Uses of mallocarray(9). >>>> >>>>    The use of mallocarray(9) has rocketed the required swap to >>>> build FreeBSD. >>>>    This is likely caused by the allocation size attributes which >>>> put extra pressure >>>>    on the compiler. >>> I'm confused about this change.  Wouldn't it be better to remove the >>> annotation/attributes from mallocarray() than to remove the protection >>> against overflow? > > It would be better to remove mallocarray(). > I am fine with that: Its probably better to stop the bug now before it propagates. This said, several drivers, including drm2, have #defines to do the same. >> Not in my opinion: it would be better to detect such overflows at >> compile time (or through a static analyzer) than to have late >> notification though panics. The blind use of mallocarray(9) is >> probably a mistake also: we shouldn't use it unless there is some >> real risk of overflow. > > Excellent!  There is no real risk of overflow except in cases that are > broken anyway.  The overflow checks in mallocarray() are insufficient > even > for detecting overflow and don't detect most broken cases when they are > sufficient.  This leaves no cases where even non-blind use of it does any > good. > >>>    (If the compiler is fixed in the future to not use >>> excessive memory with these attributes, they can be conditionalized on >>> compiler version, of course.) >> >> All in all, the compiler is not provably wrong: it's just using more >> swap space, which is rather inconvenient for small platforms but not >> necessarily wrong. > > I don't know why the compiler uses more swap space, but the general > brokenness > of mallocarray() is obvious. > > Callers must somehow ensure that the allocation size is not too large. > Too large is closer to 64K than SIZE_MAX for most allocations. Some > bloatware allocates a few MB, but malloc() is rarely used for that. > vmstat -m has been broken to not show a summary of sizes at the end, > but on freefall now it seems to shows a maximum malloc() size of 64K, > and vmstat -z confirms this by not showing any malloc() bucket sizes > larger than 64K, and in fact kern_malloc.c only has statically allocatd > bucket sizes up to 64K.  (vmstat -z never had a summary at the end to > break).  Much larger allocations are mostly done using k*alloc(), and > slightly larger allocations are usually done using UMA.  zfs does > zillions of allocations using UMA, and the largest one seems to be 16M. > > If the caller doesn't check, this gives a Denial of Service security hole > if the size and count are controlled by userland.  If the size and count > are controlled by the kernel, then the overflow check is not very useful. > It is less useful than most KASSERT()s which are left out of production > kernels.  The caller must keep its allocation sizes not much more than > 64K, and once it does that it is unlikely to make them larger than > SIZE_MAX > sometimes. > > The overflow checks in mallocarray have many type errors so they don't > always work: > > X Modified: head/share/man/man9/malloc.9 > X > ============================================================================== > X --- head/share/man/man9/malloc.9    Sun Jan  7 10:29:15 2018 (r327673) > X +++ head/share/man/man9/malloc.9    Sun Jan  7 13:21:01 2018 (r327674) > X @@ -45,6 +45,8 @@ > X  .In sys/malloc.h > X  .Ft void * > X  .Fn malloc "unsigned long size" "struct malloc_type *type" "int flags" > X +.Ft void * > X +.Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type > *type" "int flags" > > One type error is already obvious.  malloc(9)'s arg doesn't have type > size_t > like malloc(3)'s arg.  The arg type is u_long in the kernel. > mallocarray()'s > types are inconsistent with this. > This would be relatively easy to "fix", at least so that the types match malloc(9). The rest is likely more painful, if it has solution at all. > size_t happens to have the same representation as u_long on all supported > arches, so this doesn't cause many problems now.  On 32-bit arches, > size_t > hs type u_int.  u_int has smaller rank than u_long, so compilers could > reasonably complain that converting a u_long to a size_t is a downcast. > They shouldn't complain that converting a size_t to a u_long to pass it > to malloc() is an upcast, so there is no problem in typical sloppy code > that uses size_t for sizes and passes these to malloc().  More careful > ciode would use u_long for size to pass to malloc() and compiler's might > complain about downcasting to pass to mallocarray() instead. > > Otherwise (on exotic machines with size_t larger than u_long), passing > size_t's to malloc() is a bug unless they values have been checked to > be <= ULONG_MAX, and mallocarrary()'s inconsistent API expands this bug. > > X Modified: head/sys/kern/kern_malloc.c > X > ============================================================================== > X --- head/sys/kern/kern_malloc.c    Sun Jan  7 10:29:15 2018 (r327673) > X +++ head/sys/kern/kern_malloc.c    Sun Jan  7 13:21:01 2018 (r327674) > X @@ -532,6 +533,22 @@ malloc(unsigned long size, struct malloc_type > *mtp, in > X          va = redzone_setup(va, osize); > X  #endif > X      return ((void *) va); > X +} > X + > X +/* > X + * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX > X + * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW > X + */ > X +#define MUL_NO_OVERFLOW        (1UL << (sizeof(size_t) * 8 / 2)) > > SIZE_MAX and its square root are not the thing to check here. malloc()'s > limit is ULONG_MAX. > > Using 1UL here assumes hat u_long is no smaller than size_t. Otherwise, > there the shift overflows when size_t is more than twice as large as > u_long so that even the square root doesn't fit. That would be very > exotic.  More likely, size_t is only slightly larger than u_long. Then > the shift doesn't overflow, and MUL_NO_OVERFLOW has type u_long instead > of the intended size_t.  Since we don't square it, there are problems > with the square overflowing. > > X +void * > X +mallocarray(size_t nmemb, size_t size, struct malloc_type *type, > int flags) > > No function API can work for bounds checking, since function args have > some > type and converting to that type may overflow before any overflow check > can be done.  Even uintmax_t doesn't quite work for the arg types, since > perverse callers might start with floating point values. uintmax_t is > enough in the kernel since the kernel doesn't support FP. > > X +{ > X + > X +    if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && > X +        nmemb > 0 && SIZE_MAX / nmemb < size) > X +        return (NULL); > X + > X +    return (malloc(size * nmemb, type, flags)); > > [This is the original version that returns instead of panicing.) > > Except for overflow in the shift in MUL_NO_OVERFLOW, this gives a non- > overflowing (size * member) with value <= SIZE_MAX, but it needs to be > <= ULONG_MAX.  Overflow in the product gives undefined behaviour, but > overflow in the arg passing (either to pass size and nmemb here or the > product to malloc()) only gives implementation-defined behaviour (usually > a truncated value). > > The bugs are only latent, but in some cases the buggy call to mallocarray > replaces correct code that does something like: > >     u_long nmemb, size; > >     size = size(struct foo);    /* small, so doesn't need check */ >     nmemb = whatever();        /* API must ensure it fits in u_long */ >     if (nmemb >= NMEMB_LIMIT) >         return (EINVAL);    /* not ENOMEM */ >     p = malloc(nmemb * size, M_FOO, M_WAITOK); > > The non-hard-coded limit(s) make it non-obvious that the product is > small, > but this code has to trust that the limits are small enough. > > If this is converted to mallocarray(), it remains correct, but only > because > the buggy and incomplete range checking in mallocarray has no effect > since > this already did complete checking.  (The checking here guarantees: > - that size and nmemb are small, so they can be passed to mallocarray() >   despite it having inconsistent arg types. - that the product can't > overflow, so we return EINVAL here instead of >   panicing later.  (The original version returns an errror, which breaks >   the M_WAITOK case.  The current version panics, which breaks the > M_NOWAIT >   case.) > - that the product is small.  mallocarray() just doesn't check for this. > > Bruce > From owner-svn-src-all@freebsd.org Wed Jan 24 17:46:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03DF7EB800B; Wed, 24 Jan 2018 17:46:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AAB156BEDB; Wed, 24 Jan 2018 17:46:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0A8820D61; Wed, 24 Jan 2018 17:46:20 +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 w0OHkK6B058095; Wed, 24 Jan 2018 17:46:20 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OHkKdI058094; Wed, 24 Jan 2018 17:46:20 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801241746.w0OHkKdI058094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 17:46:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328344 - head/tests/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/tests/sys/kern X-SVN-Commit-Revision: 328344 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 17:46:21 -0000 Author: jhb Date: Wed Jan 24 17:46:20 2018 New Revision: 328344 URL: https://svnweb.freebsd.org/changeset/base/328344 Log: Mark the unused argument to continue_thread() as such. clang in HEAD and 11 does not warn about this, but clang in 10 does. Modified: head/tests/sys/kern/ptrace_test.c Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Wed Jan 24 17:12:34 2018 (r328343) +++ head/tests/sys/kern/ptrace_test.c Wed Jan 24 17:46:20 2018 (r328344) @@ -3474,7 +3474,7 @@ ATF_TC_BODY(ptrace__PT_STEP_with_signal, tc) * that restarting doesn't retrigger the breakpoint. */ static void * -continue_thread(void *arg) +continue_thread(void *arg __unused) { breakpoint(); return (NULL); From owner-svn-src-all@freebsd.org Wed Jan 24 17:52:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88BACEB877C; Wed, 24 Jan 2018 17:52:07 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B4906C54A; Wed, 24 Jan 2018 17:52:07 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C4F420ED1; Wed, 24 Jan 2018 17:52:07 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OHq6nf062999; Wed, 24 Jan 2018 17:52:06 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OHq6ng062998; Wed, 24 Jan 2018 17:52:06 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801241752.w0OHq6ng062998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 24 Jan 2018 17:52:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328345 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 328345 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 17:52:07 -0000 Author: ian Date: Wed Jan 24 17:52:06 2018 New Revision: 328345 URL: https://svnweb.freebsd.org/changeset/base/328345 Log: Reformat indentation to match other imx5/6 register definition headers, and tweak some comments. No functional changes. Modified: head/sys/arm/freescale/imx/imx_wdogreg.h Modified: head/sys/arm/freescale/imx/imx_wdogreg.h ============================================================================== --- head/sys/arm/freescale/imx/imx_wdogreg.h Wed Jan 24 17:46:20 2018 (r328344) +++ head/sys/arm/freescale/imx/imx_wdogreg.h Wed Jan 24 17:52:06 2018 (r328345) @@ -34,31 +34,31 @@ #define WDOG_CLK_FREQ 32768 #define WDOG_CR_REG 0x00 /* Control Register */ -#define WDOG_CR_WT_MASK 0xff00 /* Count of 0.5 sec */ -#define WDOG_CR_WT_SHIFT 8 -#define WDOG_CR_WDW (1 << 7) /* Suspend WDog */ -#define WDOG_CR_WDA (1 << 5) /* Don't touch ipp_wdog */ -#define WDOG_CR_SRS (1 << 4) /* Don't touch sys_reset */ -#define WDOG_CR_WDT (1 << 3) /* Assert ipp_wdog on tout */ -#define WDOG_CR_WDE (1 << 2) /* WDog Enable */ -#define WDOG_CR_WDBG (1 << 1) /* Suspend when DBG mode */ -#define WDOG_CR_WDZST (1 << 0) /* Suspend when LP mode */ +#define WDOG_CR_WT_MASK 0xff00 /* Count; 0.5 sec units */ +#define WDOG_CR_WT_SHIFT 8 +#define WDOG_CR_WDW (1u << 7) /* Suspend when in WAIT mode */ +#define WDOG_CR_WDA (1u << 5) /* Don't assert ext reset */ +#define WDOG_CR_SRS (1u << 4) /* Don't assert soft reset */ +#define WDOG_CR_WDT (1u << 3) /* Assert ext reset on timeout */ +#define WDOG_CR_WDE (1u << 2) /* Watchdog Enable */ +#define WDOG_CR_WDBG (1u << 1) /* Suspend when DBG mode */ +#define WDOG_CR_WDZST (1u << 0) /* Suspend when LP mode */ #define WDOG_SR_REG 0x02 /* Service Register */ -#define WDOG_SR_STEP1 0x5555 -#define WDOG_SR_STEP2 0xaaaa +#define WDOG_SR_STEP1 0x5555 +#define WDOG_SR_STEP2 0xaaaa #define WDOG_RSR_REG 0x04 /* Reset Status Register */ -#define WDOG_RSR_POR (1 << 4) /* Due to Power-On Reset */ -#define WDOG_RSR_TOUT (1 << 1) /* Due WDog timeout reset */ -#define WDOG_RSR_SFTW (1 << 0) /* Due Soft reset */ +#define WDOG_RSR_POR (1u << 4) /* Due to Power-On Reset */ +#define WDOG_RSR_TOUT (1u << 1) /* Due WDog timeout reset */ +#define WDOG_RSR_SFTW (1u << 0) /* Due Soft reset */ #define WDOG_ICR_REG 0x06 /* Interrupt Control Register */ -#define WDOG_ICR_WIE (1 << 15) /* Enable Interrupt */ -#define WDOG_ICR_WTIS (1 << 14) /* Interrupt has occurred */ -#define WDOG_ICR_WTCT_MASK 0x00ff -#define WDOG_ICR_WTCT_SHIFT 0 /* Interrupt hold time */ +#define WDOG_ICR_WIE (1u << 15) /* Enable Interrupt */ +#define WDOG_ICR_WTIS (1u << 14) /* Interrupt has occurred */ +#define WDOG_ICR_WTCT_MASK 0x00ff /* Interrupt lead time in 0.5s */ +#define WDOG_ICR_WTCT_SHIFT 0 /* units before reset occurs */ #define WDOG_MCR_REG 0x08 /* Miscellaneous Control Register */ -#define WDOG_MCR_PDE (1 << 0) +#define WDOG_MCR_PDE (1u << 0) /* Power-down enable */ From owner-svn-src-all@freebsd.org Wed Jan 24 17:58:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9568CEB8CB8; Wed, 24 Jan 2018 17:58:49 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477806C96A; Wed, 24 Jan 2018 17:58:49 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 299C820F0C; Wed, 24 Jan 2018 17:58:49 +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 w0OHwnPZ063528; Wed, 24 Jan 2018 17:58:49 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OHwm26063524; Wed, 24 Jan 2018 17:58:48 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801241758.w0OHwm26063524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 24 Jan 2018 17:58:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in head/sys: fs/ext2fs ufs/ffs ufs/ufs X-SVN-Commit-Revision: 328346 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 17:58:49 -0000 Author: pfg Date: Wed Jan 24 17:58:48 2018 New Revision: 328346 URL: https://svnweb.freebsd.org/changeset/base/328346 Log: ext2fs|ufs:Unsign some values related to allocation. When allocating memory through malloc(9), we always expect the amount of memory requested to be unsigned as a negative value would either stand for an error or an overflow. Unsign some values, found when considering the use of mallocarray(9), to avoid unnecessary casting. Also consider that indexes should be of at least the same size/type as the upper limit they pretend to index. MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_lookup.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ufs/ufs_dirhash.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- head/sys/fs/ext2fs/ext2_lookup.c Wed Jan 24 17:52:06 2018 (r328345) +++ head/sys/fs/ext2fs/ext2_lookup.c Wed Jan 24 17:58:48 2018 (r328346) @@ -145,9 +145,9 @@ ext2_readdir(struct vop_readdir_args *ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - int ncookies; int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; + u_int ncookies; if (uio->uio_offset < 0) return (EINVAL); Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Wed Jan 24 17:52:06 2018 (r328345) +++ head/sys/ufs/ffs/ffs_softdep.c Wed Jan 24 17:58:48 2018 (r328346) @@ -2466,7 +2466,8 @@ softdep_mount(devvp, mp, fs, cred) struct ufsmount *ump; struct cg *cgp; struct buf *bp; - int i, error, cyl; + u_int cyl, i; + int error; sdp = malloc(sizeof(struct mount_softdeps), M_MOUNTDATA, M_WAITOK | M_ZERO); Modified: head/sys/ufs/ufs/ufs_dirhash.c ============================================================================== --- head/sys/ufs/ufs/ufs_dirhash.c Wed Jan 24 17:52:06 2018 (r328345) +++ head/sys/ufs/ufs/ufs_dirhash.c Wed Jan 24 17:58:48 2018 (r328346) @@ -349,7 +349,8 @@ ufsdirhash_build(struct inode *ip) struct direct *ep; struct vnode *vp; doff_t bmask, pos; - int dirblocks, i, j, memreqd, nblocks, narrays, nslots, slot; + u_int dirblocks, i, narrays, nblocks, nslots; + int j, memreqd, slot; /* Take care of a decreased sysctl value. */ while (ufs_dirhashmem > ufs_dirhashmaxmem) { Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Wed Jan 24 17:52:06 2018 (r328345) +++ head/sys/ufs/ufs/ufs_vnops.c Wed Jan 24 17:58:48 2018 (r328346) @@ -2170,7 +2170,7 @@ ufs_readdir(ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - int ncookies; + u_int ncookies; int error; if (uio->uio_offset < 0) From owner-svn-src-all@freebsd.org Wed Jan 24 18:04:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C20D6EB9131 for ; Wed, 24 Jan 2018 18:04:17 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (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 3A0326CE4B for ; Wed, 24 Jan 2018 18:04:16 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: f8a816a0-0130-11e8-bb8e-b35b57339d60 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id f8a816a0-0130-11e8-bb8e-b35b57339d60; Wed, 24 Jan 2018 18:04:08 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w0OI48CR009089; Wed, 24 Jan 2018 11:04:08 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1516817048.42536.182.camel@freebsd.org> Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... From: Ian Lepore To: cem@freebsd.org, Warner Losh Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Wed, 24 Jan 2018 11:04:08 -0700 In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> Content-Type: text/plain; charset="windows-1251" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 18:04:18 -0000 On Wed, 2018-01-24 at 09:34 -0800, Conrad Meyer wrote: > On Wed, Jan 24, 2018 at 7:44 AM, Warner Losh wrote: > > > > I agree completely. It doesn't do what you think it is doing, for all the > > reasons that Bruce outlines. We thought it was a bad idea when it came up 2 > > years ago and nothing has really changed. > I disagree.I'm not sure what you mean by "it doesn't do what you > think it is doing."Do you think the manual page is unclear or needs > more detail?It seems clear to me, but it also does what I think it > does. > > Your description of two years ago is inaccurate you thought it was a > bad idea, and were the most vocal on the mailing list about it, but > that viewpoint was not universally shared.In a pure headcount vote I > think you were even outvoted, but as the initiative was headed by a > non-committer, it sputtered out. > > If Bruce has made some important point or illumination, please > highlight it.It's buried in the mostly nonsense wall of text > boilerplate he usually includes. > > mallocarray serves an important function a last ditch seatbelt > against overflowing allocations that can trivially replace existing > naive malloc calls containing multiplication.Trivial heap corruption > is replaced with DoS a strict improvement.That is all it does. > The fact that you trivially dismiss the detailed explanation of why the function isn't useful without even reading it means that the only real option is to also trivially dismiss anything you have to say on the subject. I agree that Bruce's long missives are often full of non-actionable information, and I usually don't bother to read them unless I intend to respond on the subject being discussed. But when the arguments presented in them are on-point, however tediously expressed, then you litterally CANNOT dismiss them and expect anyone to take you seriously. And for what it's worth, I also come down on the side of removing and not using mallocarray(), but I freely admit it's more of a gut-reaction thing for me than something I arrived at by careful analysis (so my opinion is also pretty easily dismissable -- after 40 years at this, I tend to trust my gut, but I don't expect anyone else to). -- Ian From owner-svn-src-all@freebsd.org Wed Jan 24 18:05:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7229EB9261 for ; Wed, 24 Jan 2018 18:05:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (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 281696CFC3 for ; Wed, 24 Jan 2018 18:05:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x234.google.com with SMTP id v123so10295698wmd.5 for ; Wed, 24 Jan 2018 10:05:26 -0800 (PST) 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=8EZp464fjPIQhNjh2ltYHDS58c1nRjG9zPEZNztGFZk=; b=SDbBt57Rxt/84a/wRSivCsRQ/WXh/vrzCSj1uz6L81fEoSNxyBlk68AjjFEs8W2cKV C6n+PvssCKJ1HgSlPY3o+AETlE6SJSFB6hRG6pBdQL6yHO4nxr9R+R4lcq3bJSS/s82G o729NyEKOdqc9MvF9A1d6sJxqhMwBT5SfYO96M/h/6DII8y6ta+evtmdgfKG35cn40kz U4az2UeoQzu1tPvbw4dSX74oY9o16WwXSPBat41uVHRrLQ0D4AX2tswm5XApSaRdQXdE XUlmefCK9n405RjngTy/1+V/+VhFSSXQFuNpFJPHrUjZnnlD6nnQT0crh74w5m1/LY/n EIcA== 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=8EZp464fjPIQhNjh2ltYHDS58c1nRjG9zPEZNztGFZk=; b=r9eniv06P/ulxTXJB1H4duPsMfs+qeVlP4f2nRzcJiLg3rBPEDGM2u4ex2hcoh7rPc EI8JqE44V+8+UFU307YxbN3H8jGZTrCuuSP6pafB6U6JL1PPnosv32ZGq0pl9xprodbP PHFxxvhW1q3zjq8E6MW/1uOqCHZYvLFKwvQnDhLjP8FW/YfMQD/ZVNmMFa4/8WBy2yLE phF13IHEe3Jhue0XbRs5PTc5RlXUQuZ+unSXj8jSHa8y4WDaGZGJM9hfJHAlOcEJPmmO QS/F+OzWXQL9cw04TbgVK4aLqvWPP1tt+1JruOIzMnxy/+iTTcXOsgJohMVXnWh1Al+0 ltaA== X-Gm-Message-State: AKwxytf0oihxkTUg3ehBLmD9xWEHu3jpJlHzkOGwg+l3iwGq7nCBo6MR Rlyra4e2BOkg+8A/fwAJfoZKgJZPImmsVQs4tE5Msuqf X-Google-Smtp-Source: AH8x224HdSZsicKS7KA4nKKHC2MrM5NqWuHzMAJAYFan/+JlkLbSbSNOyJs6ojVyB48sbEPgisf3Tw/HYgTkrf2b+1k= X-Received: by 10.80.217.202 with SMTP id x10mr19908343edj.118.1516817124970; Wed, 24 Jan 2018 10:05:24 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.133.195 with HTTP; Wed, 24 Jan 2018 10:05:24 -0800 (PST) X-Originating-IP: [50.227.106.226] In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> From: Warner Losh Date: Wed, 24 Jan 2018 11:05:24 -0700 X-Google-Sender-Auth: 9q-vpAnnZFlwEgvdvWGIqRoXT18 Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: "Conrad E. Meyer" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 18:05:27 -0000 On Wed, Jan 24, 2018 at 10:34 AM, Conrad Meyer wrote: > On Wed, Jan 24, 2018 at 7:44 AM, Warner Losh wrote: > > I agree completely. It doesn't do what you think it is doing, for all t= he > > reasons that Bruce outlines. We thought it was a bad idea when it came > up 2 > > years ago and nothing has really changed. > > I disagree. I'm not sure what you mean by "it doesn't do what you > think it is doing." Do you think the manual page is unclear or needs > more detail? It seems clear to me, but it also does what I think it > does. > It changes the fundamental 'can't fail' allocations into 'maybe panic' allocations, which was my big objection. > Your description of two years ago is inaccurate =E2=80=94 you thought it = was a > bad idea, and were the most vocal on the mailing list about it, but > that viewpoint was not universally shared. In a pure headcount vote I > think you were even outvoted, but as the initiative was headed by a > non-committer, it sputtered out. > I don't recall that happening. But regardless, mallocarray, as implemented today, is useless. > If Bruce has made some important point or illumination, please > highlight it. It's buried in the mostly nonsense wall of text > boilerplate he usually includes. > Let's start with his point about u_long vs size_t causing problems: void *malloc(unsigned long size, struct malloc_type *type, int flags) vs void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, Since size_t is long long on i386, for example, this can result in undetected overflows. Such inattention to detail makes me extremely uneasy about the rest of the code. mallocarray serves an important function =E2=80=94 a last ditch seatbelt > against overflowing allocations that can trivially replace existing > naive malloc calls containing multiplication. Trivial heap corruption > is replaced with DoS =E2=80=94 a strict improvement. That is all it does= . > It's an important function, but it's so poorly implement we should try again. It is not safe nor wise to use it blindly, which was bde's larger point. #define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 8 / 2)) static inline bool WOULD_OVERFLOW(size_t nmemb, size_t size) { return ((nmemb >=3D MUL_NO_OVERFLOW || size >=3D MUL_NO_OVERFLOW) &= & nmemb > 0 && __SIZE_T_MAX / nmemb < size); } So if I pass in 1GB and 10, this will tell me it won't overflow because of size_t can handle 10GB, but u_long can't. On amd64, it won't, but on i386 it will since long is 32 bits leading to issues in this code: void * mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) { if (WOULD_OVERFLOW(nmemb, size)) panic("mallocarray: %zu * %zu overflowed", nmemb, size); return (malloc(size * nmemb, type, flags)); } since malloc takes u_long, size * nmemb would overflow yielding bad results= . Many places that use mallocarray likely should use WOULD_OVERFLOW instead to do proper error handling, assuming it is fixed to match the actual malloc interface. This is especially true in the NO_WAIT cases. Warner From owner-svn-src-all@freebsd.org Wed Jan 24 18:08:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29595EB949B; Wed, 24 Jan 2018 18:08:38 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C86176D1A8; Wed, 24 Jan 2018 18:08:37 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEF18210CC; Wed, 24 Jan 2018 18:08:37 +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 w0OI8b1j068290; Wed, 24 Jan 2018 18:08:37 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OI8bLE068288; Wed, 24 Jan 2018 18:08:37 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201801241808.w0OI8bLE068288@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 24 Jan 2018 18:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328347 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 328347 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 18:08:38 -0000 Author: bdrewery Date: Wed Jan 24 18:08:37 2018 New Revision: 328347 URL: https://svnweb.freebsd.org/changeset/base/328347 Log: X_COMPILER_* may not be defined. Sponsored by: Dell EMC Modified: head/Makefile.inc1 head/Makefile.libcompat Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Jan 24 17:58:48 2018 (r328346) +++ head/Makefile.inc1 Wed Jan 24 18:08:37 2018 (r328347) @@ -637,7 +637,8 @@ XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTM # combined with --sysroot. XCFLAGS+= -B${WORLDTMP}/usr/lib # Force using libc++ for external GCC. -.if ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 +.if defined(X_COMPILER_TYPE) && \ + ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \ -nostdinc++ .endif @@ -2880,7 +2881,8 @@ CD2CFLAGS+= -isystem ${XDDESTDIR}/usr/include -L${XDDE # combined with --sysroot. CD2CFLAGS+= -B${XDDESTDIR}/usr/lib # Force using libc++ for external GCC. -.if ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 +.if defined(X_COMPILER_TYPE) && \ + ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 CD2CXXFLAGS+= -isystem ${XDDESTDIR}/usr/include/c++/v1 -std=c++11 \ -nostdinc++ .endif Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Wed Jan 24 17:58:48 2018 (r328346) +++ head/Makefile.libcompat Wed Jan 24 18:08:37 2018 (r328347) @@ -108,7 +108,8 @@ LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat # sysroot path which --sysroot does not actually do for headers. LIBCOMPATCFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include # Force using libc++ for external GCC. -.if ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 && \ +.if defined(X_COMPILER_TYPE) && \ + ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 && \ (${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no") LIBCOMPATCXXFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \ -nostdinc++ From owner-svn-src-all@freebsd.org Wed Jan 24 18:09:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CED4EB9574; Wed, 24 Jan 2018 18:09:45 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E76216D302; Wed, 24 Jan 2018 18:09:44 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2638210CD; Wed, 24 Jan 2018 18:09:44 +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 w0OI9iA4068374; Wed, 24 Jan 2018 18:09:44 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OI9ih4068373; Wed, 24 Jan 2018 18:09:44 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201801241809.w0OI9ih4068373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 24 Jan 2018 18:09:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328348 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 328348 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 18:09:45 -0000 Author: bdrewery Date: Wed Jan 24 18:09:44 2018 New Revision: 328348 URL: https://svnweb.freebsd.org/changeset/base/328348 Log: test-system-compiler: Display X_ variants for compiler/linker. Sponsored by: Dell EMC Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Jan 24 18:08:37 2018 (r328347) +++ head/Makefile.inc1 Wed Jan 24 18:09:44 2018 (r328348) @@ -144,7 +144,10 @@ TEST_SYSTEM_COMPILER_VARS= \ WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_FREEBSD_VERSION_FILE \ CC COMPILER_TYPE COMPILER_FEATURES COMPILER_VERSION \ COMPILER_FREEBSD_VERSION \ - LINKER_TYPE LINKER_FEATURES LINKER_VERSION + X_COMPILER_TYPE X_COMPILER_FEATURES X_COMPILER_VERSION \ + X_COMPILER_FREEBSD_VERSION \ + LINKER_TYPE LINKER_FEATURES LINKER_VERSION \ + X_LINKER_TYPE X_LINKER_FEATURES X_LINKER_VERSION test-system-compiler: .PHONY .for v in ${TEST_SYSTEM_COMPILER_VARS} ${_+_}@printf "%-35s= %s\n" "${v}" "${${v}}" From owner-svn-src-all@freebsd.org Wed Jan 24 18:10:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A97AEB9620; Wed, 24 Jan 2018 18:10:12 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F29EA6D453; Wed, 24 Jan 2018 18:10:11 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDA5D210D1; Wed, 24 Jan 2018 18:10:11 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OIABY4068468; Wed, 24 Jan 2018 18:10:11 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OIAB7l068466; Wed, 24 Jan 2018 18:10:11 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801241810.w0OIAB7l068466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 24 Jan 2018 18:10:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328349 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 328349 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 18:10:12 -0000 Author: ian Date: Wed Jan 24 18:10:11 2018 New Revision: 328349 URL: https://svnweb.freebsd.org/changeset/base/328349 Log: Make the trivial imx_soc_family() function an inline in imx_machdep.h. The imx_machdep.c file is on the fast path to non-existance and this would be the only thing left in it after some watchdog changes are completed. Modified: head/sys/arm/freescale/imx/imx_machdep.c head/sys/arm/freescale/imx/imx_machdep.h Modified: head/sys/arm/freescale/imx/imx_machdep.c ============================================================================== --- head/sys/arm/freescale/imx/imx_machdep.c Wed Jan 24 18:09:44 2018 (r328348) +++ head/sys/arm/freescale/imx/imx_machdep.c Wed Jan 24 18:10:11 2018 (r328349) @@ -105,10 +105,3 @@ imx_wdog_init_last_reset(vm_offset_t wdsr_phys) } } -u_int -imx_soc_family(void) -{ - return (imx_soc_type() >> IMXSOC_FAMSHIFT); -} - - Modified: head/sys/arm/freescale/imx/imx_machdep.h ============================================================================== --- head/sys/arm/freescale/imx/imx_machdep.h Wed Jan 24 18:09:44 2018 (r328348) +++ head/sys/arm/freescale/imx/imx_machdep.h Wed Jan 24 18:10:11 2018 (r328349) @@ -61,7 +61,12 @@ void imx_wdog_init_last_reset(vm_offset_t _wdsr_phys); #define IMXSOC_FAMSHIFT 28 u_int imx_soc_type(void); -u_int imx_soc_family(void); + +static inline u_int +imx_soc_family(void) +{ + return (imx_soc_type() >> IMXSOC_FAMSHIFT); +} #endif From owner-svn-src-all@freebsd.org Wed Jan 24 18:19:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6319CEB9FC1 for ; Wed, 24 Jan 2018 18:19:03 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic304-35.consmr.mail.ne1.yahoo.com (sonic304-35.consmr.mail.ne1.yahoo.com [66.163.191.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1C1E6DB9E for ; Wed, 24 Jan 2018 18:19:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1516817942; bh=x4DyohQ61xkt8TDv0BALYrA/BsgyN84jnEU9DNr/rxU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=rRywoMVe7EXMK5Ocm3Bo0egwCBFZkINjDkGbP8/ocFWzTw6MCoFYGO4mxz9jfBliOmkT/yAYxjt3kJtlvMJmYEEz7snnkK+J7qWxdrfwcZqvxxgW5SneKvyu781wOwXrf74OAV7V8VmSvjmiUPpxDHrt/LvmpWrNPQ9lWDcfCKAZNMZdWPQG3clTdZCrFNRuzuvJPCghfJACyEaS2JUuEecMc/AlU4QCGwy/yVZjO6DJEH/XGkzmq5OyxKKfC5/7ES6Dka0eZkd67WI2+cUuy9yFZK3eVeIU5eycze9ppXzSwvbrscZ4utJskvX8/BSaUMMYUzPutHroD9B5c84Gpw== X-YMail-OSG: BNPgUdIVM1mtoasaqmVcMI3_3SVbR0_fa8O6FLQcWfdbqsyQIQUBjq.FAovG34g dsH0uKjNdVDU8VmlaaswawSF003XJpomQaGn6_d4fh3KVAcVF4H__IRIU.gaRbdfr29.1A9e.5ru JObQBQUQ.Ej9DYAdt.iSc1w2cGERLffECGKGF8ydHUQFdTIR_3Sda3Wqm3KW6617Ec5Eabx3ajlG R_RmVeFStBA_OB68.awGJnn3tn_yHWG58hTgypxjFZHmSC.El9KSPuCnlL0jjahWoJPIAm_qw288 Mz7nsclqRmiNtPjcCJK.._lZYOuSxAfVEt2m5KD_A_c1u0YIDYYxbKAlADWO0cuP0jy.SMOkE7tj d2RW5fRRiwjGXi7UtNwATLz_jr5zpvVoioCkppUPJE2Mp0aicWcVBdRHbFsXlYsNHhh.LPnQoAXl IU8ey6hWRmTpv0lEWUAAJ3u_s6alqTz5q5et_CD_ohcjFYeEm5mTuu4P6zsTMSwjPwcxV3Rc7ZGQ Jfvgz8yh7mg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.ne1.yahoo.com with HTTP; Wed, 24 Jan 2018 18:19:02 +0000 Received: from smtp230.mail.ne1.yahoo.com (EHLO [192.168.0.8]) ([10.218.253.211]) by smtp403.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 55b3ad14fada2636cb412d93e8430ef3; Wed, 24 Jan 2018 18:18:57 +0000 (UTC) Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> From: Pedro Giffuni Message-ID: <544fb5e8-b9b9-9f11-553f-4685b75387c7@FreeBSD.org> Date: Wed, 24 Jan 2018 13:18:56 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 18:19:03 -0000 On 01/24/18 12:37, Conrad Meyer wrote: > On Tue, Jan 23, 2018 at 11:40 AM, Pedro Giffuni wrote: >> On 23/01/2018 14:08, Conrad Meyer wrote: >>> On Sun, Jan 21, 2018 at 7:42 AM, Pedro F. Giffuni wrote: >>>> Author: pfg >>>> Date: Sun Jan 21 15:42:36 2018 >>>> New Revision: 328218 >>> I'm confused about this change. Wouldn't it be better to remove the >>> annotation/attributes from mallocarray() than to remove the protection >>> against overflow? >> >> Not in my opinion: it would be better to detect such overflows at compile >> time (or through a static analyzer) than to have late notification though >> panics. > Sure, it would be better, but some situations are only detected at > runtime -- hence mallocarray. And occasional use of the annotations > on systems with plenty of RAM would keep the source tree free of > compiler-detectable overflows, which I suspect are incredibly > uncommon. I think the runtime error cases are way more uncommon, specially if the checks are unnecessary. In any case I collected the patch with malloc--> mallocarray changes in PR 225197. Maybe their are useful with fuzzing. >> The blind use of mallocarray(9) is probably a mistake also: we >> shouldn't use it unless there is some real risk of overflow. > I'm not sure I follow that. You normally don't get "tainted" values in the kernel. Most of the allocations in question were variables with very small number multiplied by the size of an int. As Bruce mentioned, we don't do big allocations with malloc(9), at least not the size required to get an unsigned number overflow. In such cases checking for an overflow is a complete waste of time. And then there is also the bug of mallocarray(9) size types not matching malloc(9). >>> (If the compiler is fixed in the future to not use >>> excessive memory with these attributes, they can be conditionalized on >>> compiler version, of course.) >> All in all, the compiler is not provably wrong: it's just using more swap >> space, which is rather inconvenient for small platforms but not necessarily >> wrong. > Seems wrong if it's a noticeable amount. Maybe we could flip the > annotations on or off with a low-ram build knob or something like > that. There is actually no proof that this was related to the attributes. I absolutely dislike the idea of disabling the attributes and even more the idea of adding complex machinery to the system headers to account for such case. Pedro. From owner-svn-src-all@freebsd.org Wed Jan 24 18:20:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02422EBB0BE; Wed, 24 Jan 2018 18:20:00 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f176.google.com (mail-io0-f176.google.com [209.85.223.176]) (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 8E1356DD36; Wed, 24 Jan 2018 18:19:59 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f176.google.com with SMTP id z6so5782896iob.11; Wed, 24 Jan 2018 10:19:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=j80KO7kcPAjpW9JmCNyZH5kPDaA5jyfvTxCPkUAMwo4=; b=CVGxottJATbOpmpOEazlaHppLp1qR1u/52iq7bwmD0zSt4wLmDVZu9fYRZ5Hna297C AZSHsLFlfxXN73sUX7yrApuPDrkE6QYvYkKCtjQHkP8FZdv6Nr0Uxu1n1woLB3nu4Ku0 mCtRwzj7pSImQF6sYViKXt2fZAcFKWi0BYAFINei9AaoSZ2Ereoy17Uy8NR0dB0AH88F rCbntXyL7jPYUgbWrjzmfJlYnJW+54GwaYaR72nEe+3gB88E5dMQsPal5EzNS1sgZyfI LZcY8eiNk214ZmnriWwcnc+9sT+nS5J2HoDavekcNzNvsCuNq2BCCkgLD6ovmLEuT0ku guHg== X-Gm-Message-State: AKwxytcN8xtA23FIQsWb2s8d6zlJrGLXU7/Vi/r4wOC8UWPDNMbTnodD ixsxO26hCGUs4qfsSVLYxZ5geMpN X-Google-Smtp-Source: AH8x226XZmhhYYc/Kz7qKIyC0RI8bfxnqDMyLP6lSbi4fRxDULCorxInh/wl725o5E+uEuC6eFvXiQ== X-Received: by 10.107.78.12 with SMTP id c12mr8828857iob.229.1516817992945; Wed, 24 Jan 2018 10:19:52 -0800 (PST) Received: from mail-io0-f169.google.com (mail-io0-f169.google.com. [209.85.223.169]) by smtp.gmail.com with ESMTPSA id m184sm452882itg.8.2018.01.24.10.19.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 10:19:52 -0800 (PST) Received: by mail-io0-f169.google.com with SMTP id z6so5782856iob.11; Wed, 24 Jan 2018 10:19:52 -0800 (PST) X-Received: by 10.107.131.210 with SMTP id n79mr9211932ioi.215.1516817992365; Wed, 24 Jan 2018 10:19:52 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Wed, 24 Jan 2018 10:19:51 -0800 (PST) In-Reply-To: <1516817048.42536.182.camel@freebsd.org> References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> From: Conrad Meyer Date: Wed, 24 Jan 2018 10:19:51 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Ian Lepore 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.25 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, 24 Jan 2018 18:20:00 -0000 Please point out what in Bruce's rant is actually relevant. Again, I usually start reading them and get sidetracked in things that are opinions stated as fact, or outright incorrect. At which point, I give up on them. From owner-svn-src-all@freebsd.org Wed Jan 24 18:27:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDFEEEBB7FF; Wed, 24 Jan 2018 18:27:01 +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 2837D6E34E; Wed, 24 Jan 2018 18:27:01 +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 w0OIQprl035860 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 24 Jan 2018 20:26:54 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w0OIQprl035860 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w0OIQp9v035859; Wed, 24 Jan 2018 20:26:51 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 24 Jan 2018 20:26:51 +0200 From: Konstantin Belousov To: Warner Losh Cc: "Conrad E. Meyer" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... Message-ID: <20180124182651.GP55707@kib.kiev.ua> References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) 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.25 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, 24 Jan 2018 18:27:02 -0000 On Wed, Jan 24, 2018 at 11:05:24AM -0700, Warner Losh wrote: > Let's start with his point about u_long vs size_t causing problems: > > void *malloc(unsigned long size, struct malloc_type *type, int flags) > vs > void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, > > Since size_t is long long on i386, for example, this can result in > undetected overflows. Such inattention to detail makes me extremely uneasy > about the rest of the code. size_t has same representation as u_long on all supported arches. size_t is 32bit on i386, why could it need to be 64bit on 32bit architecture ? From owner-svn-src-all@freebsd.org Wed Jan 24 18:28:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E66BEBB940 for ; Wed, 24 Jan 2018 18:28:13 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (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 1450B6E58F for ; Wed, 24 Jan 2018 18:28:13 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x229.google.com with SMTP id i186so10159464wmi.4 for ; Wed, 24 Jan 2018 10:28:13 -0800 (PST) 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=5zDN+0S0j0nsSo7b23lUMor2Cy8T2CLdEMuesUWJbig=; b=p67iZ6o2oiZuRSXNWZ/jwk/mP25NLbC3TMikoUgpC9IBdSnFDR2XfQxfph0rRH7Po2 1TewinJMv1WLKVQJ4ZGx1owXqmgwkDxL7hiTtGFiWvWlS0F0ZnpMdCzSYYBjbdYMfBOI jDCZ2rpv2Gw8jzgHDVJnrNyKtADPkQaJAfcYRyqWN3ls8lwJUys1RRwN6LmiAMhtjG1u 1OVJe0tm3UgTXEVOJMVJe/7yOoplOQTlCcdQ1E72a7bAGgV45kXQiM9O20pFbwOvAp/S vzU7eWYmoF6CmGm+9FoCTNimoiMLAyo37kjvENiFv7iuyZ/Fzo+xTI0rB4uqDrI/viae WDvg== 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=5zDN+0S0j0nsSo7b23lUMor2Cy8T2CLdEMuesUWJbig=; b=RLVKOp2demsC+u121mPjVXbM/e1BsOTrzGjeFuYjB+KnJzDwnLFxT+Fq83BCZwOK1O /a/dXuRHDhMbVpvciUQaeWMH8d+joawLStwcW8SySAZxfihqTXwULHWY7JWQ8Mg3Omr0 DdCJ8KLsLQOYOKzBRyEHZD6TQflWh2PQh1TcPnFTaLFJopxIC9tubIeR5s3pGrMdzpiS C4g2amUnsuDVaN+X3GzOuk+lEHkGxNAMFFU6cu8bsZt2fqGgP8ftd/4sAr447p6NZ6Hj P+bXhxk0R7IaFKLSy+8dTx7B36++TUV2H6ed7iqdpHOCudesPI3ddAasEI0bheX5TBlb X6vQ== X-Gm-Message-State: AKwxytfLO3WGuyR/dGzJ2CIY3STj+a/1+EaTeCbf42Hpyu5Cl/0lLmE1 IC4olFNq8D5uKqlKId2nphQh5oxYKeIXy6y4FN+MQw== X-Google-Smtp-Source: AH8x224sqpsv/CWAt36uQufvXExvrrsfRmeDqf0jDlkgrk7BEi69VHf2y2zPSSyqGwcJoau56g6bi+npSsQFoztFd6M= X-Received: by 10.80.170.24 with SMTP id o24mr25581492edc.258.1516818491240; Wed, 24 Jan 2018 10:28:11 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.133.195 with HTTP; Wed, 24 Jan 2018 10:28:10 -0800 (PST) X-Originating-IP: [2607:fb90:6e68:68b0:42a:15fb:b5a2:56de] Received: by 10.80.133.195 with HTTP; Wed, 24 Jan 2018 10:28:10 -0800 (PST) In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> From: Warner Losh Date: Wed, 24 Jan 2018 11:28:10 -0700 X-Google-Sender-Auth: NDM40rsMyNqKSq7eY2xmNc6c_i8 Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: "Conrad E. Meyer" Cc: Ian Lepore , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 18:28:13 -0000 Does mallocarray(10 ,1Gb) panic on i386? It does not. It should. Warner On Jan 24, 2018 11:20 AM, "Conrad Meyer" wrote: > Please point out what in Bruce's rant is actually relevant. Again, I > usually start reading them and get sidetracked in things that are > opinions stated as fact, or outright incorrect. At which point, I > give up on them. > > From owner-svn-src-all@freebsd.org Wed Jan 24 18:30:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 882B8EBBBDE; Wed, 24 Jan 2018 18:30:05 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f177.google.com (mail-io0-f177.google.com [209.85.223.177]) (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 1EA4C6E940; Wed, 24 Jan 2018 18:30:04 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f177.google.com with SMTP id t22so5832802ioa.7; Wed, 24 Jan 2018 10:30:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=kcMin/AbLyXvvyoAtKVeJBcp5zEygg4tlm3QThaRG24=; b=JaLHdww3AQ0Llr10DmnErE/dEx3BrOnzNGtZNL2ER0UMvaGyfzcjmnDGbkPUQFEZwd XWi7v4myw1N4Cm1JXlhnenH6uE39Vg/2encm8gZ0Jb59U5pUaAl6VGffNXkukdjDgRLQ yUEh/srC7dh1cgYXehQl2to1wHSjIvLCV6ijKLS8zATXVB94XKYbuDaOSzowplz+l1/O od7G+lfA6rPtMx13bKPpnPjeAlZXcQsI7+mQlqCyHj1iTs3iwQ7F6G5t8iMIJFDNcAMj TY4rpLtWT2Ep35m1Eu7JKyRlPW9WUvgaceuHWH9vAN1znardJYgmXcPLKWTsrWgy0UwG NQQg== X-Gm-Message-State: AKwxytcBR7MgSNVLbGP8FFYof+HBOje4WxicmlxnAcrbf33YnxGQ1V9T xQbDABDcSkFpQKqDP6VzZLZclRqa X-Google-Smtp-Source: AH8x227LtAe8rQrwx8itxzCg9CbDFfeK244Q2mUotV//7cT2V/bhVHTO9imSyAc6WIZnMvxiVkJJHw== X-Received: by 10.107.16.71 with SMTP id y68mr9689480ioi.266.1516818603855; Wed, 24 Jan 2018 10:30:03 -0800 (PST) Received: from mail-io0-f180.google.com (mail-io0-f180.google.com. [209.85.223.180]) by smtp.gmail.com with ESMTPSA id y35sm445024ita.20.2018.01.24.10.30.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 10:30:03 -0800 (PST) Received: by mail-io0-f180.google.com with SMTP id d13so5840968iog.5; Wed, 24 Jan 2018 10:30:03 -0800 (PST) X-Received: by 10.107.15.89 with SMTP id x86mr9878981ioi.38.1516818603506; Wed, 24 Jan 2018 10:30:03 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Wed, 24 Jan 2018 10:30:03 -0800 (PST) In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> From: Conrad Meyer Date: Wed, 24 Jan 2018 10:30:03 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Warner Losh Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 18:30:05 -0000 On Wed, Jan 24, 2018 at 10:05 AM, Warner Losh wrote: > It changes the fundamental 'can't fail' allocations into 'maybe panic' > allocations, which was my big objection. No, it doesn't make any such change. The only calls that will panic now would have "succeeded" before but returned a smaller size than the naive caller thought they were asking for. This allows an attacker to dereference beyond the ends of the actually allocated region. >> Your description of two years ago is inaccurate =E2=80=94 you thought it= was a >> bad idea, and were the most vocal on the mailing list about it, but >> that viewpoint was not universally shared. In a pure headcount vote I >> think you were even outvoted, but as the initiative was headed by a >> non-committer, it sputtered out. > > > I don't recall that happening. But regardless, mallocarray, as implemente= d > today, is useless. Search your email inbox for the mallocarray thread from Feb 2016. I don't think it's useless. > Let's start with his point about u_long vs size_t causing problems: > > void *malloc(unsigned long size, struct malloc_type *type, int flags) > vs > void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, > > Since size_t is long long on i386, for example, It is? Since when? __size_t is uint32_t on !__LP64__. > this can result in > undetected overflows. Such inattention to detail makes me extremely uneas= y > about the rest of the code. A similar snarky comment can be made here about inattention to detail when making criticisms. If __LP64__ is true, long long is the same size as long anyway. (malloc() should also use size_t.) > It's an important function, but it's so poorly implement we should try > again. It is not safe nor wise to use it blindly, which was bde's larger > point. Citation needed? > #define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 8 / 2)) > static inline bool > WOULD_OVERFLOW(size_t nmemb, size_t size) > { > > return ((nmemb >=3D MUL_NO_OVERFLOW || size >=3D MUL_NO_OVERFLOW)= && > nmemb > 0 && __SIZE_T_MAX / nmemb < size); > } > > So if I pass in 1GB and 10, this will tell me it won't overflow because o= f > size_t can handle 10GB, but u_long can't. This whole argument hinges upon incorrect assumption that size_t is larger than u_long. > ... (deleted bogus argument) > Many places that use mallocarray likely should use WOULD_OVERFLOW instead= to > do proper error handling, assuming it is fixed to match the actual malloc > interface. This is especially true in the NO_WAIT cases. I disagree. They should be doing a much more restrictive check instead. WOULD_OVERFLOW is really the lowest bar, a seatbelt. I agree with Bruce that most callers should instead be checking for sizes in the dozens of kB range. Both checks are useful. Best, Conrad From owner-svn-src-all@freebsd.org Wed Jan 24 18:33:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09D02EBD056; Wed, 24 Jan 2018 18:33:33 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f170.google.com (mail-io0-f170.google.com [209.85.223.170]) (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 90BB26EDB1; Wed, 24 Jan 2018 18:33:32 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f170.google.com with SMTP id t22so5843789ioa.7; Wed, 24 Jan 2018 10:33:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=xTVQMtWw+yuUQIzSdrMDY715bw0yQXVpOdaoN4/7bjo=; b=rbbCr6MqCfq1mbRthnWGd02abNN3TjMI0MqCUoxRYYCDSShK5CEu1isXBhhTtu+r1s P2zJJWJzdYJ4lrpj+lmEUjq0zVt50Tyy77jbg/zmNxuTMPYdCcZx4OfbvPbnXh7wKDGl YZOAorL3t72eE3daiUXbtx+iD1lA7RPWVff3jccpP0FW2PlqNuw9GnbUM+4a5KIgkQUA WadfsPA11RTRdZxopW5FrGlbj2Hh2aewRiwQK8D3rKNHiSNfCPioh1M1juH2DwCJrrbL S1IPvDyJo0wXZXtoEGYyM79owPxolQ9grPk8cSgG1kFjZYwXErua6RoJ/h4OYnbyyboh 1jLQ== X-Gm-Message-State: AKwxytdlzx7M0VTHj7PqQqwjnfm1LFQRlhdmZpYc+nJxuEJGroHnSGRv i+OuyAj9AvUY9JuV6ul/Mww5GZnk X-Google-Smtp-Source: AH8x225AQeF0jys3JFm3ynXKfaMG7gRzVeKFLLfJ72KsOLThcmmBNIvRO+JS6PrpxCQdrp/u5cuBSA== X-Received: by 10.107.22.199 with SMTP id 190mr10308664iow.242.1516818805876; Wed, 24 Jan 2018 10:33:25 -0800 (PST) Received: from mail-io0-f175.google.com (mail-io0-f175.google.com. [209.85.223.175]) by smtp.gmail.com with ESMTPSA id s70sm593494itb.0.2018.01.24.10.33.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 10:33:25 -0800 (PST) Received: by mail-io0-f175.google.com with SMTP id f34so5837440ioi.13; Wed, 24 Jan 2018 10:33:25 -0800 (PST) X-Received: by 10.107.6.130 with SMTP id f2mr9396220ioi.117.1516818805399; Wed, 24 Jan 2018 10:33:25 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Wed, 24 Jan 2018 10:33:24 -0800 (PST) In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> From: Conrad Meyer Date: Wed, 24 Jan 2018 10:33:24 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Warner Losh 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.25 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, 24 Jan 2018 18:33:33 -0000 Bruce didn't get this wrong, you've just misread his (style / opinion) complaint as an actual bug (which is kind of the whole reason why it's hard to treat his complaints seriously): > size_t happens to have the same representation as u_long on all supported arches So yes, the check works on i386. Best, Conrad On Wed, Jan 24, 2018 at 10:28 AM, Warner Losh wrote: > Does mallocarray(10 ,1Gb) panic on i386? It does not. It should. > > Warner > > On Jan 24, 2018 11:20 AM, "Conrad Meyer" wrote: >> >> Please point out what in Bruce's rant is actually relevant. Again, I >> usually start reading them and get sidetracked in things that are >> opinions stated as fact, or outright incorrect. At which point, I >> give up on them. >> > From owner-svn-src-all@freebsd.org Wed Jan 24 18:43:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77B49EBDA31; Wed, 24 Jan 2018 18:43:15 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (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 15DC76F55F; Wed, 24 Jan 2018 18:43:14 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 7676226009E; Wed, 24 Jan 2018 19:43:13 +0100 (CET) Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Warner Losh , "Conrad E. Meyer" Cc: Ian Lepore , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> From: Hans Petter Selasky Message-ID: <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org> Date: Wed, 24 Jan 2018 19:40:15 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: 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.25 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, 24 Jan 2018 18:43:15 -0000 On 01/24/18 19:28, Warner Losh wrote: > Does mallocarray(10 ,1Gb) panic on i386? It does not. It should. Hi, If M_WAITOK is specified, then sleep forever and print a message. Else return NULL ? --HPS From owner-svn-src-all@freebsd.org Wed Jan 24 18:47:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31D17EBE2B5 for ; Wed, 24 Jan 2018 18:47:20 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::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 B286A70E6B for ; Wed, 24 Jan 2018 18:47:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x236.google.com with SMTP id b21so10516103wme.4 for ; Wed, 24 Jan 2018 10:47:18 -0800 (PST) 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=fKo6PfS6lYVLMtVchDY1gZmuHIBQqS2QGbB2NHIpifc=; b=zLgE8bCFRjS7WosyX1K0DB/2yTO2urIbJKdH0S/ab0pEajkIfJ4ackYvDdKo8CCgOH p/kT4Re7T/wb7wz0aG/LlkR6dy+wReDUsAU0YWpp1VZTix8f4rLboDfl/D6NBgEZIZSA isxaJGxg/FxYI7xxdazoeXVA+3LMz83nIr8nXkpzVscUj4crZiIU8WjPDnmzV5oRIFkE s/PUaTXBng6XAOIVJrvPfR+KACTC9vD2LySYyx+EvQmbqyXTgEOXPgbPT26IL/0tQlL+ 9U0WYesvDCedcJ/AAa9AQ0hLbh/jDkuZR7VZk9ADY5Jn58TpFL4Uy8hPj8J6OdGM+Kd+ WsVA== 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=fKo6PfS6lYVLMtVchDY1gZmuHIBQqS2QGbB2NHIpifc=; b=fqrM1OyXpjHnkVLlzwL9WTtNL4AMPOsNFZ0uqPiBGfCsb5oLrF+He5ePEU/3crnCn5 5YSeN0iG2/DpXWJRKaLAMkKlQOKtxLoXMa73/gSh5fDTqSatQzUTH6/lyBo/Wvh8f0cu GyivShakoYY3/8ykZ18giXsJOQZ1lsUyPthbkJEVRhnruSVLE12fJAcP5wFuzUys5Z1k SUWQScF5eKUEb2jnB5Vh6xBH+ZlXyh6N2SZJjlc+mqXOGUKymWGn+7kq73rwGubmVKT8 0ipb/HloVrbpXIUczi0hXWVK4MzaFVbF+9EbDjx62LbzOM5OoHZQQXtUpMobxEGWG48v 4uoQ== X-Gm-Message-State: AKwxytcnR2/nRhsQAJ9uxoAYJVE8Lz9ds1hFhiAu5VgZst5ymEdqkDYY ixwLAIgZ+xcl7ms1NOkD8QFWTGzLY6cbyhkDfcwK6w== X-Google-Smtp-Source: AH8x2279SbX2cCTlGvKcNWEHNk8jqbNVImc8RkwIx/5ai91p7cD7rGTeUstBNczgfOKzO8cNn1WvMqBaI4wwPMi5PUo= X-Received: by 10.80.217.202 with SMTP id x10mr20039080edj.118.1516819637274; Wed, 24 Jan 2018 10:47:17 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.133.195 with HTTP; Wed, 24 Jan 2018 10:47:16 -0800 (PST) X-Originating-IP: [2607:fb90:6e68:68b0:2c74:a381:7e69:9962] Received: by 10.80.133.195 with HTTP; Wed, 24 Jan 2018 10:47:16 -0800 (PST) In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> From: Warner Losh Date: Wed, 24 Jan 2018 11:47:16 -0700 X-Google-Sender-Auth: BxSipvt4huAiNenqmBpCKPvBFFY Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: "Conrad E. Meyer" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 18:47:20 -0000 On Jan 24, 2018 11:33 AM, "Conrad Meyer" wrote: Bruce didn't get this wrong, you've just misread his (style / opinion) complaint as an actual bug (which is kind of the whole reason why it's hard to treat his complaints seriously): > size_t happens to have the same representation as u_long on all supported arches So yes, the check works on i386. I confused off_t and size_t, so much of what I said turns out not to be relevant. I'd be fine with just fixing the style issue, renaming WOULD_OVERFLOW to malloc_would_overrflow and using that for most of the NO_WAIT cases as a precheck.... Warner Warner Best, Conrad On Wed, Jan 24, 2018 at 10:28 AM, Warner Losh wrote: > Does mallocarray(10 ,1Gb) panic on i386? It does not. It should. > > Warner > > On Jan 24, 2018 11:20 AM, "Conrad Meyer" wrote: >> >> Please point out what in Bruce's rant is actually relevant. Again, I >> usually start reading them and get sidetracked in things that are >> opinions stated as fact, or outright incorrect. At which point, I >> give up on them. >> > From owner-svn-src-all@freebsd.org Wed Jan 24 18:48:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5A78EBE499; Wed, 24 Jan 2018 18:48:51 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f178.google.com (mail-io0-f178.google.com [209.85.223.178]) (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 748E071194; Wed, 24 Jan 2018 18:48:51 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f178.google.com with SMTP id 25so5884751ioj.9; Wed, 24 Jan 2018 10:48:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=yNk1pS/k2Om3BQp/MLcuH2JM4iOUh+7tPbfgzSWUZHI=; b=HnH5+sUzgWBLxqEdicRNxlZVnNxjEHsHR46/MJVKBP7ad18yyMZoeAkSHThriRchBi Lxlok9i1eUxZSiMPDilmIN0/8/Iqm7yVGxt+JYes/ceslnqplFNQWflbK7Dyda0vM5W+ q50siaAe1p3xrr4UTFrQn66uRD5rcJq93CXZ5b8AdAncDtuo6TfDcPNJ3d4UE64lKgUX nFvYzl99dWilKukNnhWA7/c1YhaaLN+jxbCnAIw18I9iffRWiXWz3bkiTwhXyI3PozoK +RMQ4kykO22eqhFDaAab5vlFM8nkSDbAmriecZRcgnfklpnyi8GP4Bzm0we1yVpFqiU7 Dzig== X-Gm-Message-State: AKwxytcYrr8KAKsz6f+w1wkGf7WNPTVi0NsRu/CCfuwFy0ZvCnWjRWau x8m6AmOWMU++AXxbCzYhkhv1jbYX X-Google-Smtp-Source: AH8x225XtoQFc+9vxXqPefWUtRJbL5XVi7u6qwWT9cI+Ji2HMxPb9T5NUIr8bmGq1PC2mKxmoL7moQ== X-Received: by 10.107.136.201 with SMTP id s70mr9493533ioi.177.1516819724794; Wed, 24 Jan 2018 10:48:44 -0800 (PST) Received: from mail-it0-f49.google.com (mail-it0-f49.google.com. [209.85.214.49]) by smtp.gmail.com with ESMTPSA id t21sm513367ioi.48.2018.01.24.10.48.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 10:48:44 -0800 (PST) Received: by mail-it0-f49.google.com with SMTP id q8so6331073itb.2; Wed, 24 Jan 2018 10:48:44 -0800 (PST) X-Received: by 10.36.114.193 with SMTP id x184mr184070itc.71.1516819724288; Wed, 24 Jan 2018 10:48:44 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Wed, 24 Jan 2018 10:48:43 -0800 (PST) In-Reply-To: <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org> References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org> From: Conrad Meyer Date: Wed, 24 Jan 2018 10:48:43 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Hans Petter Selasky 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.25 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, 24 Jan 2018 18:48:52 -0000 On Wed, Jan 24, 2018 at 10:40 AM, Hans Petter Selasky wrote: > On 01/24/18 19:28, Warner Losh wrote: >> >> Does mallocarray(10 ,1Gb) panic on i386? It does not. It should. > > > Hi, > > If M_WAITOK is specified, then sleep forever and print a message. > Else return NULL ? Depends on the machine. From malloc.9: > If the multiplication of nmemb and size would cause an integer overflow, the mallocarray() function induces a panic. 64-bit arch does not experience overflow and will sleep until 10GB is available. (This is why the caller should do a narrower check.) 32-bit panics, since 10 * 1GB overflows 32-bit size_t (== u_long). Best, Conrad From owner-svn-src-all@freebsd.org Wed Jan 24 18:54:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E778BEBEA61 for ; Wed, 24 Jan 2018 18:54:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic307-17.consmr.mail.bf2.yahoo.com (sonic307-17.consmr.mail.bf2.yahoo.com [74.6.134.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E1DA716CC for ; Wed, 24 Jan 2018 18:54:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1516820063; bh=AsKaLoTMkeaEYXNUMrRW5Fztpr+i/Q4jZoy+wXowe58=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=haIXw4lOSdWftT7O2WjJVtMXco3YdstadDHIO5mUYXP7aedDAWrLcUaCz09cNs/jQeoc+aJv12tbptR/3FItrva4fhWzMbqkoRM7LRaCL7C1ctvjRhqhAOppI88zjyiPUfW3s1l0VOYjYM23bOHCEI5sPmuaN3WH6HvdR/HisDcQAkrn1EljqNpHmH7Kiu1RNzyK7ooKiJfyRsb08iw5yGI3zg7DYWlwfMPhQ4fVNm6WjYEZ1+11z7Sspd/2SAxikqF7by6gsPzbu6++zhCRv5l4LLfdD1FVzuzsjxFDyh9z1G1+Khy3raJyS1owaWEHZ0DlFOTonlmojoDuvUH5dQ== X-YMail-OSG: OWvGv44VM1klrNKo99iRkDZLYgCCDqnljcUXzCwrDLyekFQ5HFLLAvbHYsae.yt fDSgWvNf8UYoDRfmdoc6XjcjDsH4WuqtBNNa_at5nQ3t9Rx7d8lO7h74Kkj0HTCC5BzaRoxKisyl AXYgRL9R2Zth2aHd31sygdBHwsREVBylCqiLuiFSJYPU43nc6kVvrndDskueEbw2CvxQSoHolBPj Mp5tdxofP907oJqGhPompTYFRPJ3bavuHTlY3xo2sgpWaIy0lUOyVnEPksSGfYriAnrul5bhXreg 3p5nPoD4gnyZF3qD1BGstsY_yn80.zbTnw9.r_0afVKlrhNQefibQip4S.LNbmEkyIWgAfsQBrbd PICc38hJlQVQtewqTSipzcuCHtFo_WKyxQxugNPD7OS1Q507f2gaXGy_91_DF6CF751LX4E7mPeR Q3h3DJmKU5eD4BKquUcpRtdAO3bPFcaAjoZLHOO_VRwqxU2e69ug6dwne9aVDHRQ4ellPcaDazjC rU0QI7Hcwuw-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.bf2.yahoo.com with HTTP; Wed, 24 Jan 2018 18:54:23 +0000 Received: from smtp101.rhel.mail.bf1.yahoo.com (EHLO [192.168.0.8]) ([68.142.231.32]) by smtp403.mail.bf1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 3e5842f496bf1a70f1e01858ada2b306; Wed, 24 Jan 2018 18:44:13 +0000 (UTC) Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: cem@freebsd.org, Warner Losh Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: Date: Wed, 24 Jan 2018 13:44:12 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 18:54:25 -0000 ... On 24/01/2018 13:30, Conrad Meyer wrote: > ... > size_t can handle 10GB, but u_long can't. > This whole argument hinges upon incorrect assumption that size_t is > larger than u_long. Hmm... Lets just make it "unsigned long" to be consistent with malloc(9) and avoid confusion? Pedro. From owner-svn-src-all@freebsd.org Wed Jan 24 19:01:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BFFDEBF132 for ; Wed, 24 Jan 2018 19:01:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic307-17.consmr.mail.bf2.yahoo.com (sonic307-17.consmr.mail.bf2.yahoo.com [74.6.134.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AEF6E71D06 for ; Wed, 24 Jan 2018 19:01:16 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1516820476; bh=8eEUqp88QIXBRGyyaKzraP9CPOmrSr6y5PpQbQUf9AA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=dE+wG2gHvklGZxdcRepN5hwSL+XlpFF+A0SjN0EFu3hyTfMAE0RqdN4QC7iQMqcX5NIT2mq8bW3NDkHFbvrNpIQOFQYFpgAwDcsxJXkwj0kyDCxh/YAP9gprQyWxTzaQB84/exOPDN1qOcpRWogE5xOLFzlU8yVvpPXLBsXWOORVZv/FZa23CGKKl3AJEtTzENH/lGQM6jMY3le49iSbPij8SQX0utv1WnZFpHuuYspiR7KLmMZSeac/eK9H8klB/2qRAXw389Cdm+112OCPrTPDlNQ6mTk3nS5uvf+dYehhVlFsc3orkYVQ4ghO8iXZwaeZY/EhbKYw7GTW1hrrpA== X-YMail-OSG: tVKcFqsVM1md7Pr8O1oNWodjO385tKcxAAq6jn8MG6KXTqkuhghkITzxlZU0080 tjiIjlO1iAg_Wz.x74dQ1zleuxGOoXuccWye0QmWCNvSfLjHv2_InNCJ0J.kwALXgOmg83K.Ztt8 Ry4jVqc6doJJ0faspfCvfCNTcZNcIbnDWq6tu16Rd00R1MyYgdsj.AR4sZXc_1_Q3ppauwXMx5AB vPfNWdDpYsPv.UYWqpB71YT8w1PTwIbHr1nEW6DYmxykucS08hIkGiGkB_pGwkdvnuV3T.h6Negg jt5jUoQ0.PIPV_YufxzQSw0I4PQO2R1b91tVwE3GidQw0WDDA1mP0xOYfXa.6hqjoVTSilJ4qtBl htcjCswhhvd_FBACWDK5sEDJlYyvDPSjp6W_Krf2s75JxScPoTwgYSibDkaZn6P_gGMN5Jgx__Bz 6csXQ1UnwvcNOlfwIK7rvUhCMwjpDcq4TzlZryxdVJydd0.IhxYdOQVOm2ScmAkCL8uEki_FxHuO nYep1asDBPg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.bf2.yahoo.com with HTTP; Wed, 24 Jan 2018 19:01:16 +0000 Received: from smtpgate102.mail.bf1.yahoo.com (EHLO [192.168.0.8]) ([72.30.28.113]) by smtp404.mail.bf1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID cb225daf5bf9a0b2ebc75a9128af1e4d; Wed, 24 Jan 2018 18:51:08 +0000 (UTC) Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Hans Petter Selasky , Warner Losh , "Conrad E. Meyer" Cc: Ian Lepore , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: Date: Wed, 24 Jan 2018 13:51:07 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 19:01:17 -0000 On 24/01/2018 13:40, Hans Petter Selasky wrote: > On 01/24/18 19:28, Warner Losh wrote: >> Does mallocarray(10 ,1Gb) panic on i386? It does not. It should. > > Hi, > > If M_WAITOK is specified, then sleep forever and print a message. > Else return NULL ? > FWIW, I suggested a panic for M_WAITOK and returning NULL for M_NOWAIT, but cem didn't like it because it was inconsistent. I think the current argument is more about the size/trigger than the behavior though. Cheers, Pedro. From owner-svn-src-all@freebsd.org Wed Jan 24 19:06:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46234EBF553; Wed, 24 Jan 2018 19:06:45 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F111172231; Wed, 24 Jan 2018 19:06:44 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC05421ABF; Wed, 24 Jan 2018 19:06:44 +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 w0OJ6ihi002466; Wed, 24 Jan 2018 19:06:44 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OJ6iiB002465; Wed, 24 Jan 2018 19:06:44 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201801241906.w0OJ6iiB002465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 24 Jan 2018 19:06:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328350 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 328350 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 19:06:45 -0000 Author: ae Date: Wed Jan 24 19:06:44 2018 New Revision: 328350 URL: https://svnweb.freebsd.org/changeset/base/328350 Log: Merge revision 1.35 from NetBSD: fix pointer/offset mistakes in handling of IPv4 options Reported by: Maxime Villard MFC after: 1 week Modified: head/sys/netipsec/xform_ah.c Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Wed Jan 24 18:10:11 2018 (r328349) +++ head/sys/netipsec/xform_ah.c Wed Jan 24 19:06:44 2018 (r328350) @@ -293,7 +293,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk else ip->ip_off = htons(0); - ptr = mtod(m, unsigned char *) + sizeof(struct ip); + ptr = mtod(m, unsigned char *); /* IPv4 option processing */ for (off = sizeof(struct ip); off < skip;) { @@ -374,7 +374,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk /* Zeroize all other options. */ count = ptr[off + 1]; - bcopy(ipseczeroes, ptr, count); + bcopy(ipseczeroes, ptr + off, count); off += count; break; } From owner-svn-src-all@freebsd.org Wed Jan 24 19:24:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CD47EC088A; Wed, 24 Jan 2018 19:24:28 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f46.google.com (mail-it0-f46.google.com [209.85.214.46]) (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 33311730F0; Wed, 24 Jan 2018 19:24:27 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f46.google.com with SMTP id p124so6459046ite.1; Wed, 24 Jan 2018 11:24:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=YkW/b0Z0T+fIOZupMqYddksECFZF/AMKs+g4UYjGBMc=; b=lTLB7gnfapkRmHdgiQj5Hq+VARpA+0lXypFO6JwwutjXCAoEX7t0WwqD/Fut0JoV9Y vNHrCUMZRrTODvRpxaOz1DPhOlS6rdwimiWSTU1KR4QVcUcozt3NPnVQlpJ7B6SuLNOj KAyIM0Nh1pEaxjssqrrAEabK6UV/9xwlm6gZdtq//sQpo5XErcd9yOZarCdpaTiZ/ZI+ ZUlywgCXQBjE76rW+wawpmyCQD5nuYYaF/mZChRpax1dJeTKoLdzDklahl8oz/TiA3fy q194Tg0P4U7nTDPk9TUxpexy5BYM/X4gk0wkHcqITVBXTo6KzDSDmC7qSVYhEqEkF/v/ OvVA== X-Gm-Message-State: AKwxytcdyuS2Xpr3sxZoM39+U9nrQgT82t1qcwMSc5gjnlbP58l93t8W i4i5E2+u4ZA8+b36Z01gSdEW6sIE X-Google-Smtp-Source: AH8x2244yuKlsC8d+YcbqWRuQFQiPXW8j+NQlBKhGBW3jHXknSpdsCra5xgo7IrRx/jmE/QYIJoYTQ== X-Received: by 10.36.31.196 with SMTP id d187mr9458846itd.96.1516821867121; Wed, 24 Jan 2018 11:24:27 -0800 (PST) Received: from mail-it0-f52.google.com (mail-it0-f52.google.com. [209.85.214.52]) by smtp.gmail.com with ESMTPSA id e83sm525349iof.71.2018.01.24.11.24.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 11:24:26 -0800 (PST) Received: by mail-it0-f52.google.com with SMTP id e1so6485006ita.0; Wed, 24 Jan 2018 11:24:26 -0800 (PST) X-Received: by 10.36.101.2 with SMTP id u2mr1449400itb.55.1516821866518; Wed, 24 Jan 2018 11:24:26 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Wed, 24 Jan 2018 11:24:25 -0800 (PST) In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org> From: Conrad Meyer Date: Wed, 24 Jan 2018 11:24:25 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Pedro Giffuni 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.25 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, 24 Jan 2018 19:24:28 -0000 On Wed, Jan 24, 2018 at 10:51 AM, Pedro Giffuni wrote: > FWIW, I suggested a panic for M_WAITOK and returning NULL for M_NOWAIT, but > cem didn't like it because it was inconsistent. > > I think the current argument is more about the size/trigger than the > behavior though. Yeah. If an overflow happens in a path, we want to flag it -- regardless of whether that was a M_NOWAIT or M_WAITOK request. Best, Conrad From owner-svn-src-all@freebsd.org Wed Jan 24 19:25:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F89DEC09AC; Wed, 24 Jan 2018 19:25:31 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f180.google.com (mail-io0-f180.google.com [209.85.223.180]) (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 A17F37326B; Wed, 24 Jan 2018 19:25:30 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f180.google.com with SMTP id 72so5998921iom.10; Wed, 24 Jan 2018 11:25:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=va8e0qIPHfIlHF7OgJR+xaP0scQ8SM8pd/W/QLHRhbo=; b=YLotgLpX3eJQHBa4OPZlmZh879E/tajeC4zLztdx3Gb1+fATU0MF6Q50yxsL+d55mm jfzi3/pUOxpDzE/Ms2Q+35Ae3i+8p7R5WN+MVb4qvNW6a7BIsJY6qpZmE/f6EaSKUTuv Xsxbb8TqnjHM9YZEBxc7TSHoSyrdChojX3Y8VvmsVYdk0kaWOINTZ/2OZ1gBBqsrHBbU dZ6kcA+uf+DVkGkFnEPSbBFVovTL2Z62dWK8iRoYVH+ibSiFjOAigNI6AM4Yzdn3h7w4 sFriXoNcL/YjYGxpeTFg4qICdkhOkhx5Iwjgbh/d2wB6VnFr53G5FFCBW2OYpxq7/ot4 Oqgw== X-Gm-Message-State: AKwxytdbR5IlsP7In8LB77lh606Pjuh5Fg3bKSU5UsrACEV6agd+qe5s sVdRp8z7ViSpoPjkrfdLMwTg0cGR X-Google-Smtp-Source: AH8x226Ox0H9rUEbg0J1YJ7JzVPfOMg855szhFdvhex4UWNWt3KarMe6FvsuSLL8sZpmYqFWh1Pcyw== X-Received: by 10.107.199.7 with SMTP id x7mr10173734iof.64.1516821929586; Wed, 24 Jan 2018 11:25:29 -0800 (PST) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com. [209.85.214.45]) by smtp.gmail.com with ESMTPSA id v198sm522983ita.3.2018.01.24.11.25.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 11:25:29 -0800 (PST) Received: by mail-it0-f45.google.com with SMTP id x42so6433642ita.4; Wed, 24 Jan 2018 11:25:29 -0800 (PST) X-Received: by 10.36.84.205 with SMTP id t196mr10279774ita.128.1516821929096; Wed, 24 Jan 2018 11:25:29 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Wed, 24 Jan 2018 11:25:28 -0800 (PST) In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> From: Conrad Meyer Date: Wed, 24 Jan 2018 11:25:28 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Pedro Giffuni 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.25 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, 24 Jan 2018 19:25:31 -0000 On Wed, Jan 24, 2018 at 10:44 AM, Pedro Giffuni wrote: > ... > On 24/01/2018 13:30, Conrad Meyer wrote: >> >> ... >> size_t can handle 10GB, but u_long can't. >> This whole argument hinges upon incorrect assumption that size_t is >> larger than u_long. > > > Hmm... > > Lets just make it "unsigned long" to be consistent with malloc(9) and avoid > confusion? The opposite, I think -- change malloc(9) and realloc*(9) to size_t to be more consistent with the C standard and malloc(3). Best, Conrad From owner-svn-src-all@freebsd.org Wed Jan 24 19:27:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B70FEC0C67 for ; Wed, 24 Jan 2018 19:27:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (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 DDE31734D4 for ; Wed, 24 Jan 2018 19:27:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x244.google.com with SMTP id g1so10465370wmg.2 for ; Wed, 24 Jan 2018 11:27:43 -0800 (PST) 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=4UJAl2UoqyiSCPSCzE/gGvC0aICWsqXE6hX9Y75LiM0=; b=KViFiAIYREOYKD1uMCGZIjAsVCtpb9cACholmN/NU+2kMQOk658p8MR4juxJ6APW96 pfkWMT6moGSov6Tud5zdQXBpSQp3D/N+pJs+XPNrr9kjJMix8odc79kIzdb6/GZ4D7qv oQKBWQZ/hXQ61rXltonBdl5iJtDmzIOpAvCpICNWQpumQzIcSTKoEb1EYmvAIr/ZQyKn fyJ8K+mOobyXJ+CxVRmSR392g1y38XCRsz43p+bFnayC/SKnZ1Nn378AOFCq4xm/ubNf jNpb1HKM88J6vLqvsY+bHbKfZJ3Efz1+//QHwft+thUcGTzotB/qwG7pL1drDjjFaIvy LVkQ== 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=4UJAl2UoqyiSCPSCzE/gGvC0aICWsqXE6hX9Y75LiM0=; b=fafQ77e9npXpsymuIQl1jwSlYPCpBG60JYxZ2qHTLEQsLflj7/RmKVO75U2Xcxury8 pUHHE7A8Ra3wwb7uwroS1JJmIBy8ToDXbfJViT5qmZtXbS5vo0SY7/YWgyexPY5lUnR2 Htxu9YTC6T3wIUf7SiMso/yFu3cHa+EB4enDHvYwrMUOh753Slj5D1aywLDYSfF2VCdy LSpPjopK3BUhxgqDwbawiHu+RiIsmPR6TaZHCkjPXH6ss1nbsFfyXsxkkvYHf+OG5jZR UpGu2bx2BX6iKqyB0MyMpwtkcNnTXFGFZVTTC6UZY16wRkYDRQOrItXrlNmAtoq60PVM MSww== X-Gm-Message-State: AKwxyteNAO/biQjXzdYVzyYEH4VHDSXZOwppCir1+SBkYExPiq6gegpB yR3veIwm/pEOl4BLvh0JecT+YJNsSwFE+A4YYQyH4A== X-Google-Smtp-Source: AH8x224/15VbwXfIlKhLbB3uqEDoKyHOP8s1iBLH+ZLFi8/2y1+temxQ6JE6GUwdkC3j7MNrMymeq+nR+2nRMBlsDpI= X-Received: by 10.80.217.202 with SMTP id x10mr20165878edj.118.1516822062742; Wed, 24 Jan 2018 11:27:42 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.133.195 with HTTP; Wed, 24 Jan 2018 11:27:42 -0800 (PST) X-Originating-IP: [2607:fb90:6e68:68b0:2c74:a381:7e69:9962] Received: by 10.80.133.195 with HTTP; Wed, 24 Jan 2018 11:27:42 -0800 (PST) In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org> From: Warner Losh Date: Wed, 24 Jan 2018 12:27:42 -0700 X-Google-Sender-Auth: QbpB8D85i3rYYgotEJS9ajZR2Rg Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: "Conrad E. Meyer" Cc: Pedro Giffuni , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 19:27:44 -0000 On Jan 24, 2018 12:24 PM, "Conrad Meyer" wrote: On Wed, Jan 24, 2018 at 10:51 AM, Pedro Giffuni wrote: > FWIW, I suggested a panic for M_WAITOK and returning NULL for M_NOWAIT, but > cem didn't like it because it was inconsistent. > > I think the current argument is more about the size/trigger than the > behavior though. Yeah. If an overflow happens in a path, we want to flag it -- regardless of whether that was a M_NOWAIT or M_WAITOK request. Which is why we should add check overflows for most of the no wait cases. They should be checked, but not primarily with mallocarray... Warner From owner-svn-src-all@freebsd.org Wed Jan 24 19:37:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F291EC147B; Wed, 24 Jan 2018 19:37:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F215973A75; Wed, 24 Jan 2018 19:37:18 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE04721F88; Wed, 24 Jan 2018 19:37:18 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OJbItJ017473; Wed, 24 Jan 2018 19:37:18 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OJbI8U017470; Wed, 24 Jan 2018 19:37:18 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801241937.w0OJbI8U017470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 24 Jan 2018 19:37:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328351 - in head: share/man/man9 sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 328351 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 19:37:19 -0000 Author: cem Date: Wed Jan 24 19:37:18 2018 New Revision: 328351 URL: https://svnweb.freebsd.org/changeset/base/328351 Log: malloc(9): Change nominal size to size_t to match standard C No functional change -- size_t matches unsigned long on all platforms. Reported by: bde Discussed with: jhb Sponsored by: Dell EMC Isilon Modified: head/share/man/man9/malloc.9 head/sys/kern/kern_malloc.c head/sys/sys/malloc.h Modified: head/share/man/man9/malloc.9 ============================================================================== --- head/share/man/man9/malloc.9 Wed Jan 24 19:06:44 2018 (r328350) +++ head/share/man/man9/malloc.9 Wed Jan 24 19:37:18 2018 (r328351) @@ -29,7 +29,7 @@ .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $ .\" $FreeBSD$ .\" -.Dd January 10, 2018 +.Dd January 24, 2018 .Dt MALLOC 9 .Os .Sh NAME @@ -44,15 +44,15 @@ .In sys/types.h .In sys/malloc.h .Ft void * -.Fn malloc "unsigned long size" "struct malloc_type *type" "int flags" +.Fn malloc "size_t size" "struct malloc_type *type" "int flags" .Ft void * .Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags" .Ft void .Fn free "void *addr" "struct malloc_type *type" .Ft void * -.Fn realloc "void *addr" "unsigned long size" "struct malloc_type *type" "int flags" +.Fn realloc "void *addr" "size_t size" "struct malloc_type *type" "int flags" .Ft void * -.Fn reallocf "void *addr" "unsigned long size" "struct malloc_type *type" "int flags" +.Fn reallocf "void *addr" "size_t size" "struct malloc_type *type" "int flags" .Fn MALLOC_DECLARE type .In sys/param.h .In sys/malloc.h Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Wed Jan 24 19:06:44 2018 (r328350) +++ head/sys/kern/kern_malloc.c Wed Jan 24 19:37:18 2018 (r328351) @@ -518,7 +518,7 @@ malloc_dbg(caddr_t *vap, unsigned long *sizep, struct * the allocation fails. */ void * -malloc(unsigned long size, struct malloc_type *mtp, int flags) +malloc(size_t size, struct malloc_type *mtp, int flags) { int indx; struct malloc_type_internal *mtip; @@ -567,7 +567,7 @@ malloc(unsigned long size, struct malloc_type *mtp, in } void * -malloc_domain(unsigned long size, struct malloc_type *mtp, int domain, +malloc_domain(size_t size, struct malloc_type *mtp, int domain, int flags) { int indx; @@ -754,7 +754,7 @@ free_domain(void *addr, struct malloc_type *mtp) * realloc: change the size of a memory block */ void * -realloc(void *addr, unsigned long size, struct malloc_type *mtp, int flags) +realloc(void *addr, size_t size, struct malloc_type *mtp, int flags) { uma_slab_t slab; unsigned long alloc; @@ -815,7 +815,7 @@ realloc(void *addr, unsigned long size, struct malloc_ * reallocf: same as realloc() but free memory on failure. */ void * -reallocf(void *addr, unsigned long size, struct malloc_type *mtp, int flags) +reallocf(void *addr, size_t size, struct malloc_type *mtp, int flags) { void *mem; Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Wed Jan 24 19:06:44 2018 (r328350) +++ head/sys/sys/malloc.h Wed Jan 24 19:37:18 2018 (r328351) @@ -181,11 +181,10 @@ void *contigmalloc_domain(unsigned long size, struct m __malloc_like __result_use_check __alloc_size(1) __alloc_align(6); void free(void *addr, struct malloc_type *type); void free_domain(void *addr, struct malloc_type *type); -void *malloc(unsigned long size, struct malloc_type *type, int flags) - __malloc_like __result_use_check __alloc_size(1); -void *malloc_domain(unsigned long size, struct malloc_type *type, - int domain, int flags) - __malloc_like __result_use_check __alloc_size(1); +void *malloc(size_t size, struct malloc_type *type, int flags) __malloc_like + __result_use_check __alloc_size(1); +void *malloc_domain(size_t size, struct malloc_type *type, int domain, + int flags) __malloc_like __result_use_check __alloc_size(1); void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) __malloc_like __result_use_check __alloc_size2(1, 2); @@ -195,10 +194,10 @@ void malloc_type_allocated(struct malloc_type *type, u void malloc_type_freed(struct malloc_type *type, unsigned long size); void malloc_type_list(malloc_type_list_func_t *, void *); void malloc_uninit(void *); -void *realloc(void *addr, unsigned long size, struct malloc_type *type, - int flags) __result_use_check __alloc_size(2); -void *reallocf(void *addr, unsigned long size, struct malloc_type *type, - int flags) __result_use_check __alloc_size(2); +void *realloc(void *addr, size_t size, struct malloc_type *type, int flags) + __result_use_check __alloc_size(2); +void *reallocf(void *addr, size_t size, struct malloc_type *type, int flags) + __result_use_check __alloc_size(2); struct malloc_type *malloc_desc2type(const char *desc); From owner-svn-src-all@freebsd.org Wed Jan 24 19:40:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0134EEC16B3; Wed, 24 Jan 2018 19:40:11 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f50.google.com (mail-it0-f50.google.com [209.85.214.50]) (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 8E98873C3C; Wed, 24 Jan 2018 19:40:10 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f50.google.com with SMTP id x42so6481527ita.4; Wed, 24 Jan 2018 11:40:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=CZrnInW0mqGAHBDxeOE+4Ca0+NcMZY8rVb4r3Tui6CM=; b=JR5NFTb7wAdp9lz+hZpAgJJDbSESyr9N3SFPNNOU00CzPqRy6ja5+yExSdCjMt4Hid Nq+PFm84q9h0iciWVlFWumq9ur7bjAVuhu+NwJS36tgquFzFM/93rWdyDpmGNiULlY8h GjB1+n8x62QbXibtzNrjHb7R0Bdtr4v6mXaEzn6s4fSta3C4LpfsYSDiD6cjlfe2+fsQ EdabMu36PZHz1533eKccu4RG/qyYhFct6ZRTZAbjJp5THLFUmHvbxDwofRWyD+pvMUzY zREVdnRxs2rqFLpS/hROlSWPNZAfHOIY+2eXTh9P4NWoNoomneoHqrNuwksxGaSThuvt IEnQ== X-Gm-Message-State: AKwxytfUCDRI7FlN5RKTpCp4LoT8icyGTvpvappgbbrZLUFVC3T9ImNx HEbBjhIrlsXQWYha0sKxCtMbY+9E X-Google-Smtp-Source: AH8x2241Yof9+JCoAEf8yUguPRQdxKQHNG0ui/rMFNXGmbfn7LfgCmimODO5VzicVFHUZFEAPK4ssw== X-Received: by 10.36.6.143 with SMTP id 137mr10069225itv.34.1516822804227; Wed, 24 Jan 2018 11:40:04 -0800 (PST) Received: from mail-io0-f181.google.com (mail-io0-f181.google.com. [209.85.223.181]) by smtp.gmail.com with ESMTPSA id 137sm577617ioo.22.2018.01.24.11.40.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 11:40:04 -0800 (PST) Received: by mail-io0-f181.google.com with SMTP id l17so6049486ioc.3; Wed, 24 Jan 2018 11:40:03 -0800 (PST) X-Received: by 10.107.15.89 with SMTP id x86mr10122966ioi.38.1516822803739; Wed, 24 Jan 2018 11:40:03 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Wed, 24 Jan 2018 11:40:03 -0800 (PST) In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org> From: Conrad Meyer Date: Wed, 24 Jan 2018 11:40:03 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Warner Losh 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.25 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, 24 Jan 2018 19:40:11 -0000 On Wed, Jan 24, 2018 at 11:27 AM, Warner Losh wrote: > > Which is why we should add check overflows for most of the no wait cases. > They should be checked, but not primarily with mallocarray... I don't understand what the distinction is here. Can you help me understand why the overflow check should be lifted from mallocarray into the caller for no wait cases? Or is that not what you're suggesting? Thanks, Conrad From owner-svn-src-all@freebsd.org Wed Jan 24 19:48:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9807EC1C86; Wed, 24 Jan 2018 19:48:25 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F04474173; Wed, 24 Jan 2018 19:48:25 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75F722211C; Wed, 24 Jan 2018 19:48:25 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OJmPii022488; Wed, 24 Jan 2018 19:48:25 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OJmPus022487; Wed, 24 Jan 2018 19:48:25 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201801241948.w0OJmPus022487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 24 Jan 2018 19:48:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328352 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 328352 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 19:48:26 -0000 Author: ae Date: Wed Jan 24 19:48:25 2018 New Revision: 328352 URL: https://svnweb.freebsd.org/changeset/base/328352 Log: Adopt revision 1.76 and 1.77 from NetBSD: Fix a vulnerability in IPsec-IPv6-AH, that allows an attacker to remotely crash the kernel with a single packet. In this loop we need to increment 'ad' by two, because the length field of the option header does not count the size of the option header itself. If the length is zero, then 'count' is incremented by zero, and there's an infinite loop. Beyond that, this code was written with the assumption that since the IPv6 packet already went through the generic IPv6 option parser, several fields are guaranteed to be valid; but this assumption does not hold because of the missing '+2', and there's as a result a triggerable buffer overflow (write zeros after the end of the mbuf, potentially to the next mbuf in memory since it's a pool). Add the missing '+2', this place will be reinforced in separate commits. Reported by: Maxime Villard MFC after: 1 week Modified: head/sys/netipsec/xform_ah.c Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Wed Jan 24 19:37:18 2018 (r328351) +++ head/sys/netipsec/xform_ah.c Wed Jan 24 19:48:25 2018 (r328352) @@ -264,7 +264,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk #ifdef INET6 struct ip6_ext *ip6e; struct ip6_hdr ip6; - int alloc, len, ad; + int ad, alloc, nxt, noff; #endif /* INET6 */ switch (proto) { @@ -447,61 +447,44 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk } else break; - off = ip6.ip6_nxt & 0xff; /* Next header type. */ + nxt = ip6.ip6_nxt & 0xff; /* Next header type. */ - for (len = 0; len < skip - sizeof(struct ip6_hdr);) - switch (off) { + for (off = 0; off < skip - sizeof(struct ip6_hdr);) + switch (nxt) { case IPPROTO_HOPOPTS: case IPPROTO_DSTOPTS: - ip6e = (struct ip6_ext *) (ptr + len); + ip6e = (struct ip6_ext *)(ptr + off); + noff = off + ((ip6e->ip6e_len + 1) << 3); + /* Sanity check. */ + if (noff > skip - sizeof(struct ip6_hdr)) + goto error6; + /* - * Process the mutable/immutable - * options -- borrows heavily from the - * KAME code. + * Zero out mutable options. */ - for (count = len + sizeof(struct ip6_ext); - count < len + ((ip6e->ip6e_len + 1) << 3);) { + for (count = off + sizeof(struct ip6_ext); + count < noff;) { if (ptr[count] == IP6OPT_PAD1) { count++; continue; /* Skip padding. */ } - /* Sanity check. */ - if (count > len + - ((ip6e->ip6e_len + 1) << 3)) { - m_freem(m); + ad = ptr[count + 1] + 2; + if (count + ad > noff) + goto error6; - /* Free, if we allocated. */ - if (alloc) - free(ptr, M_XDATA); - return EINVAL; - } - - ad = ptr[count + 1]; - - /* If mutable option, zeroize. */ if (ptr[count] & IP6OPT_MUTABLE) - bcopy(ipseczeroes, ptr + count, - ptr[count + 1]); - + memset(ptr + count, 0, ad); count += ad; - - /* Sanity check. */ - if (count > - skip - sizeof(struct ip6_hdr)) { - m_freem(m); - - /* Free, if we allocated. */ - if (alloc) - free(ptr, M_XDATA); - return EINVAL; - } } + if (count != noff) + goto error6; + /* Advance. */ - len += ((ip6e->ip6e_len + 1) << 3); - off = ip6e->ip6e_nxt; + off += ((ip6e->ip6e_len + 1) << 3); + nxt = ip6e->ip6e_nxt; break; case IPPROTO_ROUTING: @@ -509,14 +492,15 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk * Always include routing headers in * computation. */ - ip6e = (struct ip6_ext *) (ptr + len); - len += ((ip6e->ip6e_len + 1) << 3); - off = ip6e->ip6e_nxt; + ip6e = (struct ip6_ext *) (ptr + off); + off += ((ip6e->ip6e_len + 1) << 3); + nxt = ip6e->ip6e_nxt; break; default: DPRINTF(("%s: unexpected IPv6 header type %d", __func__, off)); +error6: if (alloc) free(ptr, M_XDATA); m_freem(m); From owner-svn-src-all@freebsd.org Wed Jan 24 20:04:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FED3EC270F; Wed, 24 Jan 2018 20:04:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B7AD874A85; Wed, 24 Jan 2018 20:04:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B298F2244C; Wed, 24 Jan 2018 20:04:08 +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 w0OK48d2032166; Wed, 24 Jan 2018 20:04:08 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OK48JY032165; Wed, 24 Jan 2018 20:04:08 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801242004.w0OK48JY032165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 20:04:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328353 - head/sys/dev/cxgbe/crypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 328353 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:04:09 -0000 Author: jhb Date: Wed Jan 24 20:04:08 2018 New Revision: 328353 URL: https://svnweb.freebsd.org/changeset/base/328353 Log: Always store the IV in the immediate portion of a work request. Combined authentication-encryption and GCM requests already stored the IV in the immediate explicitly. This extends this behavior to block cipher requests to work around a firmware bug. While here, simplify the AEAD and GCM handlers to not include always-true conditions. Submitted by: Harsh Jain @ Chelsio Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 19:48:25 2018 (r328352) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:04:08 2018 (r328353) @@ -546,7 +546,7 @@ ccr_blkcipher(struct ccr_softc *sc, uint32_t sid, stru struct wrqe *wr; struct cryptodesc *crd; char *dst; - u_int iv_loc, kctx_len, key_half, op_type, transhdr_len, wr_len; + u_int kctx_len, key_half, op_type, transhdr_len, wr_len; u_int imm_len; int dsgl_nsegs, dsgl_len; int sgl_nsegs, sgl_len; @@ -564,24 +564,22 @@ ccr_blkcipher(struct ccr_softc *sc, uint32_t sid, stru if (crd->crd_len > MAX_REQUEST_SIZE) return (EFBIG); - iv_loc = IV_NOP; if (crd->crd_flags & CRD_F_ENCRYPT) { op_type = CHCR_ENCRYPT_OP; if (crd->crd_flags & CRD_F_IV_EXPLICIT) memcpy(iv, crd->crd_iv, s->blkcipher.iv_len); else arc4rand(iv, s->blkcipher.iv_len, 0); - iv_loc = IV_IMMEDIATE; if ((crd->crd_flags & CRD_F_IV_PRESENT) == 0) crypto_copyback(crp->crp_flags, crp->crp_buf, crd->crd_inject, s->blkcipher.iv_len, iv); } else { op_type = CHCR_DECRYPT_OP; - if (crd->crd_flags & CRD_F_IV_EXPLICIT) { + if (crd->crd_flags & CRD_F_IV_EXPLICIT) memcpy(iv, crd->crd_iv, s->blkcipher.iv_len); - iv_loc = IV_IMMEDIATE; - } else - iv_loc = IV_DSGL; + else + crypto_copydata(crp->crp_flags, crp->crp_buf, + crd->crd_inject, s->blkcipher.iv_len, iv); } sglist_reset(sc->sg_dsgl); @@ -601,22 +599,11 @@ ccr_blkcipher(struct ccr_softc *sc, uint32_t sid, stru if (ccr_use_imm_data(transhdr_len, crd->crd_len + s->blkcipher.iv_len)) { imm_len = crd->crd_len; - if (iv_loc == IV_DSGL) { - crypto_copydata(crp->crp_flags, crp->crp_buf, - crd->crd_inject, s->blkcipher.iv_len, iv); - iv_loc = IV_IMMEDIATE; - } sgl_nsegs = 0; sgl_len = 0; } else { imm_len = 0; sglist_reset(sc->sg_ulptx); - if (iv_loc == IV_DSGL) { - error = sglist_append_sglist(sc->sg_ulptx, sc->sg_crp, - crd->crd_inject, s->blkcipher.iv_len); - if (error) - return (error); - } error = sglist_append_sglist(sc->sg_ulptx, sc->sg_crp, crd->crd_skip, crd->crd_len); if (error) @@ -625,9 +612,8 @@ ccr_blkcipher(struct ccr_softc *sc, uint32_t sid, stru sgl_len = ccr_ulptx_sgl_len(sgl_nsegs); } - wr_len = roundup2(transhdr_len, 16) + roundup2(imm_len, 16) + sgl_len; - if (iv_loc == IV_IMMEDIATE) - wr_len += s->blkcipher.iv_len; + wr_len = roundup2(transhdr_len, 16) + s->blkcipher.iv_len + + roundup2(imm_len, 16) + sgl_len; wr = alloc_wrqe(wr_len, sc->txq); if (wr == NULL) { sc->stats_wr_nomem++; @@ -637,7 +623,7 @@ ccr_blkcipher(struct ccr_softc *sc, uint32_t sid, stru memset(crwr, 0, wr_len); ccr_populate_wreq(sc, crwr, kctx_len, wr_len, sid, imm_len, sgl_len, 0, - iv_loc, crp); + IV_IMMEDIATE, crp); /* XXX: Hardcodes SGE loopback channel of 0. */ crwr->sec_cpl.op_ivinsrtofst = htobe32( @@ -700,10 +686,8 @@ ccr_blkcipher(struct ccr_softc *sc, uint32_t sid, stru dst = (char *)(crwr + 1) + kctx_len; ccr_write_phys_dsgl(sc, dst, dsgl_nsegs); dst += sizeof(struct cpl_rx_phys_dsgl) + dsgl_len; - if (iv_loc == IV_IMMEDIATE) { - memcpy(dst, iv, s->blkcipher.iv_len); - dst += s->blkcipher.iv_len; - } + memcpy(dst, iv, s->blkcipher.iv_len); + dst += s->blkcipher.iv_len; if (imm_len != 0) crypto_copydata(crp->crp_flags, crp->crp_buf, crd->crd_skip, crd->crd_len, dst); @@ -755,7 +739,7 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct struct wrqe *wr; struct auth_hash *axf; char *dst; - u_int iv_loc, kctx_len, key_half, op_type, transhdr_len, wr_len; + u_int kctx_len, key_half, op_type, transhdr_len, wr_len; u_int hash_size_in_response, imm_len, iopad_size; u_int aad_start, aad_len, aad_stop; u_int auth_start, auth_stop, auth_insert; @@ -791,7 +775,6 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct * engine doesn't work properly if the IV offset points inside * of the AAD region, so a second copy is always required. */ - iv_loc = IV_IMMEDIATE; if (crde->crd_flags & CRD_F_ENCRYPT) { op_type = CHCR_ENCRYPT_OP; if (crde->crd_flags & CRD_F_IV_EXPLICIT) @@ -935,9 +918,8 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct else auth_insert = 0; - wr_len = roundup2(transhdr_len, 16) + roundup2(imm_len, 16) + sgl_len; - if (iv_loc == IV_IMMEDIATE) - wr_len += s->blkcipher.iv_len; + wr_len = roundup2(transhdr_len, 16) + s->blkcipher.iv_len + + roundup2(imm_len, 16) + sgl_len; wr = alloc_wrqe(wr_len, sc->txq); if (wr == NULL) { sc->stats_wr_nomem++; @@ -947,8 +929,8 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct memset(crwr, 0, wr_len); ccr_populate_wreq(sc, crwr, kctx_len, wr_len, sid, imm_len, sgl_len, - op_type == CHCR_DECRYPT_OP ? hash_size_in_response : 0, iv_loc, - crp); + op_type == CHCR_DECRYPT_OP ? hash_size_in_response : 0, + IV_IMMEDIATE, crp); /* XXX: Hardcodes SGE loopback channel of 0. */ crwr->sec_cpl.op_ivinsrtofst = htobe32( @@ -1022,10 +1004,8 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct dst = (char *)(crwr + 1) + kctx_len; ccr_write_phys_dsgl(sc, dst, dsgl_nsegs); dst += sizeof(struct cpl_rx_phys_dsgl) + dsgl_len; - if (iv_loc == IV_IMMEDIATE) { - memcpy(dst, iv, s->blkcipher.iv_len); - dst += s->blkcipher.iv_len; - } + memcpy(dst, iv, s->blkcipher.iv_len); + dst += s->blkcipher.iv_len; if (imm_len != 0) { if (aad_len != 0) { crypto_copydata(crp->crp_flags, crp->crp_buf, @@ -1085,7 +1065,7 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr struct chcr_wr *crwr; struct wrqe *wr; char *dst; - u_int iv_len, iv_loc, kctx_len, op_type, transhdr_len, wr_len; + u_int iv_len, kctx_len, op_type, transhdr_len, wr_len; u_int hash_size_in_response, imm_len; u_int aad_start, aad_stop, cipher_start, cipher_stop, auth_insert; u_int hmac_ctrl, input_len; @@ -1119,7 +1099,6 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr * always assumes a 12-byte IV and initializes the low 4 byte * counter to 1. */ - iv_loc = IV_IMMEDIATE; if (crde->crd_flags & CRD_F_ENCRYPT) { op_type = CHCR_ENCRYPT_OP; if (crde->crd_flags & CRD_F_IV_EXPLICIT) @@ -1237,9 +1216,8 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr else auth_insert = 0; - wr_len = roundup2(transhdr_len, 16) + roundup2(imm_len, 16) + sgl_len; - if (iv_loc == IV_IMMEDIATE) - wr_len += iv_len; + wr_len = roundup2(transhdr_len, 16) + iv_len + roundup2(imm_len, 16) + + sgl_len; wr = alloc_wrqe(wr_len, sc->txq); if (wr == NULL) { sc->stats_wr_nomem++; @@ -1249,7 +1227,7 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr memset(crwr, 0, wr_len); ccr_populate_wreq(sc, crwr, kctx_len, wr_len, sid, imm_len, sgl_len, - 0, iv_loc, crp); + 0, IV_IMMEDIATE, crp); /* XXX: Hardcodes SGE loopback channel of 0. */ crwr->sec_cpl.op_ivinsrtofst = htobe32( @@ -1307,10 +1285,8 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr dst = (char *)(crwr + 1) + kctx_len; ccr_write_phys_dsgl(sc, dst, dsgl_nsegs); dst += sizeof(struct cpl_rx_phys_dsgl) + dsgl_len; - if (iv_loc == IV_IMMEDIATE) { - memcpy(dst, iv, iv_len); - dst += iv_len; - } + memcpy(dst, iv, iv_len); + dst += iv_len; if (imm_len != 0) { if (crda->crd_len != 0) { crypto_copydata(crp->crp_flags, crp->crp_buf, From owner-svn-src-all@freebsd.org Wed Jan 24 20:06:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E91DEC2898; Wed, 24 Jan 2018 20:06:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 24B2074C24; Wed, 24 Jan 2018 20:06:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B2322244D; Wed, 24 Jan 2018 20:06:03 +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 w0OK62WD032281; Wed, 24 Jan 2018 20:06:02 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OK62PZ032280; Wed, 24 Jan 2018 20:06:02 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801242006.w0OK62PZ032280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 20:06:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328354 - head/sys/dev/cxgbe/crypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 328354 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:06:03 -0000 Author: jhb Date: Wed Jan 24 20:06:02 2018 New Revision: 328354 URL: https://svnweb.freebsd.org/changeset/base/328354 Log: Always set the IV location to IV_NOP. The firmware ignores this field in the FW_CRYPTO_LOOKASIDE_WR work request. Submitted by: Harsh Jain @ Chelsio Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:04:08 2018 (r328353) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:06:02 2018 (r328354) @@ -365,7 +365,7 @@ ccr_use_imm_data(u_int transhdr_len, u_int input_len) static void ccr_populate_wreq(struct ccr_softc *sc, struct chcr_wr *crwr, u_int kctx_len, u_int wr_len, uint32_t sid, u_int imm_len, u_int sgl_len, u_int hash_size, - u_int iv_loc, struct cryptop *crp) + struct cryptop *crp) { u_int cctx_size; @@ -383,7 +383,7 @@ ccr_populate_wreq(struct ccr_softc *sc, struct chcr_wr V_FW_CRYPTO_LOOKASIDE_WR_RX_CHID(sc->tx_channel_id) | V_FW_CRYPTO_LOOKASIDE_WR_LCB(0) | V_FW_CRYPTO_LOOKASIDE_WR_PHASH(0) | - V_FW_CRYPTO_LOOKASIDE_WR_IV(iv_loc) | + V_FW_CRYPTO_LOOKASIDE_WR_IV(IV_NOP) | V_FW_CRYPTO_LOOKASIDE_WR_FQIDX(0) | V_FW_CRYPTO_LOOKASIDE_WR_TX_CH(0) | V_FW_CRYPTO_LOOKASIDE_WR_RX_Q_ID(sc->rxq->iq.abs_id)); @@ -467,7 +467,7 @@ ccr_hmac(struct ccr_softc *sc, uint32_t sid, struct cc memset(crwr, 0, wr_len); ccr_populate_wreq(sc, crwr, kctx_len, wr_len, sid, imm_len, sgl_len, - hash_size_in_response, IV_NOP, crp); + hash_size_in_response, crp); /* XXX: Hardcodes SGE loopback channel of 0. */ crwr->sec_cpl.op_ivinsrtofst = htobe32( @@ -623,7 +623,7 @@ ccr_blkcipher(struct ccr_softc *sc, uint32_t sid, stru memset(crwr, 0, wr_len); ccr_populate_wreq(sc, crwr, kctx_len, wr_len, sid, imm_len, sgl_len, 0, - IV_IMMEDIATE, crp); + crp); /* XXX: Hardcodes SGE loopback channel of 0. */ crwr->sec_cpl.op_ivinsrtofst = htobe32( @@ -929,8 +929,7 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct memset(crwr, 0, wr_len); ccr_populate_wreq(sc, crwr, kctx_len, wr_len, sid, imm_len, sgl_len, - op_type == CHCR_DECRYPT_OP ? hash_size_in_response : 0, - IV_IMMEDIATE, crp); + op_type == CHCR_DECRYPT_OP ? hash_size_in_response : 0, crp); /* XXX: Hardcodes SGE loopback channel of 0. */ crwr->sec_cpl.op_ivinsrtofst = htobe32( @@ -1227,7 +1226,7 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr memset(crwr, 0, wr_len); ccr_populate_wreq(sc, crwr, kctx_len, wr_len, sid, imm_len, sgl_len, - 0, IV_IMMEDIATE, crp); + 0, crp); /* XXX: Hardcodes SGE loopback channel of 0. */ crwr->sec_cpl.op_ivinsrtofst = htobe32( From owner-svn-src-all@freebsd.org Wed Jan 24 20:08:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6630EC2B44; Wed, 24 Jan 2018 20:08:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6999D74EB7; Wed, 24 Jan 2018 20:08:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 608152244E; Wed, 24 Jan 2018 20:08:10 +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 w0OK8Ain032389; Wed, 24 Jan 2018 20:08:10 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OK8AuB032388; Wed, 24 Jan 2018 20:08:10 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801242008.w0OK8AuB032388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 20:08:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328355 - head/sys/dev/cxgbe/crypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 328355 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:08:11 -0000 Author: jhb Date: Wed Jan 24 20:08:10 2018 New Revision: 328355 URL: https://svnweb.freebsd.org/changeset/base/328355 Log: Reject requests with AAD and IV larger than 511 bytes. The T6 crypto engine's control messages only support a total AAD length (including the prefixed IV) of 511 bytes. Reject requests with large AAD rather than returning incorrect results. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:06:02 2018 (r328354) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:08:10 2018 (r328355) @@ -111,6 +111,11 @@ __FBSDID("$FreeBSD$"); */ /* + * The crypto engine supports a maximum AAD size of 511 bytes. + */ +#define MAX_AAD_LEN 511 + +/* * The documentation for CPL_RX_PHYS_DSGL claims a maximum of 32 * SG entries. */ @@ -760,11 +765,23 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct return (EINVAL); /* - * AAD is only permitted before the cipher/plain text, not - * after. + * Compute the length of the AAD (data covered by the + * authentication descriptor but not the encryption + * descriptor). To simplify the logic, AAD is only permitted + * before the cipher/plain text, not after. This is true of + * all currently-generated requests. */ if (crda->crd_len + crda->crd_skip > crde->crd_len + crde->crd_skip) return (EINVAL); + if (crda->crd_skip < crde->crd_skip) { + if (crda->crd_skip + crda->crd_len > crde->crd_skip) + aad_len = (crde->crd_skip - crda->crd_skip); + else + aad_len = crda->crd_len; + } else + aad_len = 0; + if (aad_len + s->blkcipher.iv_len > MAX_AAD_LEN) + return (EINVAL); axf = s->hmac.auth_hash; hash_size_in_response = s->hmac.hash_len; @@ -836,13 +853,6 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct * cipher/plain text. For decryption requests the hash is * appended after the cipher text. */ - if (crda->crd_skip < crde->crd_skip) { - if (crda->crd_skip + crda->crd_len > crde->crd_skip) - aad_len = (crde->crd_skip - crda->crd_skip); - else - aad_len = crda->crd_len; - } else - aad_len = 0; input_len = aad_len + crde->crd_len; /* @@ -1080,6 +1090,9 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr * after. */ if (crda->crd_len + crda->crd_skip > crde->crd_len + crde->crd_skip) + return (EINVAL); + + if (crda->crd_len + AES_BLOCK_LEN > MAX_AAD_LEN) return (EINVAL); hash_size_in_response = s->gmac.hash_len; From owner-svn-src-all@freebsd.org Wed Jan 24 20:11:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF092EC2DBB; Wed, 24 Jan 2018 20:11:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 80B4475114; Wed, 24 Jan 2018 20:11:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B6312247C; Wed, 24 Jan 2018 20:11:00 +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 w0OKB0Oc033464; Wed, 24 Jan 2018 20:11:00 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKB02c033463; Wed, 24 Jan 2018 20:11:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801242011.w0OKB02c033463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 20:11:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328356 - head/sys/dev/cxgbe/crypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 328356 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:11:01 -0000 Author: jhb Date: Wed Jan 24 20:11:00 2018 New Revision: 328356 URL: https://svnweb.freebsd.org/changeset/base/328356 Log: Don't discard AAD and IV output data for AEAD requests. The T6 can hang when processing certain AEAD requests if the request sets a flag asking the crypto engine to discard the input IV and AAD rather than copying them into the output buffer. The existing driver always discards the IV and AAD as we do not need it. As a workaround, allocate a single "dummy" buffer when the ccr driver attaches and change all AEAD requests to write the IV and AAD to this scratch buffer. The contents of the scratch buffer are never used (similar to "bogus_page"), and it is ok for multiple in-flight requests to share this dummy buffer. Submitted by: Harsh Jain @ Chelsio (original version) Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:08:10 2018 (r328355) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:11:00 2018 (r328356) @@ -190,6 +190,13 @@ struct ccr_softc { struct sglist *sg_ulptx; struct sglist *sg_dsgl; + /* + * Pre-allocate a dummy output buffer for the IV and AAD for + * AEAD requests. + */ + char *iv_aad_buf; + struct sglist *sg_iv_aad; + /* Statistics. */ uint64_t stats_blkcipher_encrypt; uint64_t stats_blkcipher_decrypt; @@ -814,15 +821,25 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct * The output buffer consists of the cipher text followed by * the hash when encrypting. For decryption it only contains * the plain text. + * + * Due to a firmware bug, the output buffer must include a + * dummy output buffer for the IV and AAD prior to the real + * output buffer. */ if (op_type == CHCR_ENCRYPT_OP) { - if (crde->crd_len + hash_size_in_response > MAX_REQUEST_SIZE) + if (s->blkcipher.iv_len + aad_len + crde->crd_len + + hash_size_in_response > MAX_REQUEST_SIZE) return (EFBIG); } else { - if (crde->crd_len > MAX_REQUEST_SIZE) + if (s->blkcipher.iv_len + aad_len + crde->crd_len > + MAX_REQUEST_SIZE) return (EFBIG); } sglist_reset(sc->sg_dsgl); + error = sglist_append_sglist(sc->sg_dsgl, sc->sg_iv_aad, 0, + s->blkcipher.iv_len + aad_len); + if (error) + return (error); error = sglist_append_sglist(sc->sg_dsgl, sc->sg_crp, crde->crd_skip, crde->crd_len); if (error) @@ -977,7 +994,7 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct crwr->sec_cpl.ivgen_hdrlen = htobe32( V_SCMD_IV_GEN_CTRL(0) | V_SCMD_MORE_FRAGS(0) | V_SCMD_LAST_FRAG(0) | V_SCMD_MAC_ONLY(0) | - V_SCMD_AADIVDROP(1) | V_SCMD_HDR_LEN(dsgl_len)); + V_SCMD_AADIVDROP(0) | V_SCMD_HDR_LEN(dsgl_len)); crwr->key_ctx.ctx_hdr = s->blkcipher.key_ctx_hdr; switch (crde->crd_alg) { @@ -1143,15 +1160,24 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr * The output buffer consists of the cipher text followed by * the tag when encrypting. For decryption it only contains * the plain text. + * + * Due to a firmware bug, the output buffer must include a + * dummy output buffer for the IV and AAD prior to the real + * output buffer. */ if (op_type == CHCR_ENCRYPT_OP) { - if (crde->crd_len + hash_size_in_response > MAX_REQUEST_SIZE) + if (iv_len + crda->crd_len + crde->crd_len + + hash_size_in_response > MAX_REQUEST_SIZE) return (EFBIG); } else { - if (crde->crd_len > MAX_REQUEST_SIZE) + if (iv_len + crda->crd_len + crde->crd_len > MAX_REQUEST_SIZE) return (EFBIG); } sglist_reset(sc->sg_dsgl); + error = sglist_append_sglist(sc->sg_dsgl, sc->sg_iv_aad, 0, iv_len + + crda->crd_len); + if (error) + return (error); error = sglist_append_sglist(sc->sg_dsgl, sc->sg_crp, crde->crd_skip, crde->crd_len); if (error) @@ -1287,7 +1313,7 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr crwr->sec_cpl.ivgen_hdrlen = htobe32( V_SCMD_IV_GEN_CTRL(0) | V_SCMD_MORE_FRAGS(0) | V_SCMD_LAST_FRAG(0) | V_SCMD_MAC_ONLY(0) | - V_SCMD_AADIVDROP(1) | V_SCMD_HDR_LEN(dsgl_len)); + V_SCMD_AADIVDROP(0) | V_SCMD_HDR_LEN(dsgl_len)); crwr->key_ctx.ctx_hdr = s->blkcipher.key_ctx_hdr; memcpy(crwr->key_ctx.key, s->blkcipher.enckey, s->blkcipher.key_len); @@ -1511,6 +1537,8 @@ ccr_attach(device_t dev) sc->sg_crp = sglist_alloc(TX_SGL_SEGS, M_WAITOK); sc->sg_ulptx = sglist_alloc(TX_SGL_SEGS, M_WAITOK); sc->sg_dsgl = sglist_alloc(MAX_RX_PHYS_DSGL_SGE, M_WAITOK); + sc->iv_aad_buf = malloc(MAX_AAD_LEN, M_CCR, M_WAITOK); + sc->sg_iv_aad = sglist_build(sc->iv_aad_buf, MAX_AAD_LEN, M_WAITOK); ccr_sysctls(sc); crypto_register(cid, CRYPTO_SHA1_HMAC, 0, 0); @@ -1548,6 +1576,8 @@ ccr_detach(device_t dev) crypto_unregister_all(sc->cid); free(sc->sessions, M_CCR); mtx_destroy(&sc->lock); + sglist_free(sc->sg_iv_aad); + free(sc->iv_aad_buf, M_CCR); sglist_free(sc->sg_dsgl); sglist_free(sc->sg_ulptx); sglist_free(sc->sg_crp); From owner-svn-src-all@freebsd.org Wed Jan 24 20:12:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F975EC301E; Wed, 24 Jan 2018 20:12:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4283B7544E; Wed, 24 Jan 2018 20:12:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D97A225B1; Wed, 24 Jan 2018 20:12:01 +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 w0OKC141034227; Wed, 24 Jan 2018 20:12:01 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKC1lA034226; Wed, 24 Jan 2018 20:12:01 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801242012.w0OKC1lA034226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 20:12:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328357 - head/sys/dev/cxgbe/crypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 328357 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:12:01 -0000 Author: jhb Date: Wed Jan 24 20:12:00 2018 New Revision: 328357 URL: https://svnweb.freebsd.org/changeset/base/328357 Log: Fail crypto requests when the resulting work request is too large. Most crypto requests will not trigger this condition, but a request with a highly-fragmented data buffer (and a resulting "large" S/G list) could trigger it. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:11:00 2018 (r328356) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:12:00 2018 (r328357) @@ -470,6 +470,8 @@ ccr_hmac(struct ccr_softc *sc, uint32_t sid, struct cc } wr_len = roundup2(transhdr_len, 16) + roundup2(imm_len, 16) + sgl_len; + if (wr_len > SGE_MAX_WR_LEN) + return (EFBIG); wr = alloc_wrqe(wr_len, sc->txq); if (wr == NULL) { sc->stats_wr_nomem++; @@ -626,6 +628,8 @@ ccr_blkcipher(struct ccr_softc *sc, uint32_t sid, stru wr_len = roundup2(transhdr_len, 16) + s->blkcipher.iv_len + roundup2(imm_len, 16) + sgl_len; + if (wr_len > SGE_MAX_WR_LEN) + return (EFBIG); wr = alloc_wrqe(wr_len, sc->txq); if (wr == NULL) { sc->stats_wr_nomem++; @@ -947,6 +951,8 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct wr_len = roundup2(transhdr_len, 16) + s->blkcipher.iv_len + roundup2(imm_len, 16) + sgl_len; + if (wr_len > SGE_MAX_WR_LEN) + return (EFBIG); wr = alloc_wrqe(wr_len, sc->txq); if (wr == NULL) { sc->stats_wr_nomem++; @@ -1256,6 +1262,8 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr wr_len = roundup2(transhdr_len, 16) + iv_len + roundup2(imm_len, 16) + sgl_len; + if (wr_len > SGE_MAX_WR_LEN) + return (EFBIG); wr = alloc_wrqe(wr_len, sc->txq); if (wr == NULL) { sc->stats_wr_nomem++; From owner-svn-src-all@freebsd.org Wed Jan 24 20:13:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61625EC3171; Wed, 24 Jan 2018 20:13:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13FB47562D; Wed, 24 Jan 2018 20:13:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EF63225DC; Wed, 24 Jan 2018 20:13:08 +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 w0OKD7Gb037371; Wed, 24 Jan 2018 20:13:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKD7iJ037370; Wed, 24 Jan 2018 20:13:07 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801242013.w0OKD7iJ037370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 20:13:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328358 - head/sys/dev/cxgbe/crypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 328358 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:13:08 -0000 Author: jhb Date: Wed Jan 24 20:13:07 2018 New Revision: 328358 URL: https://svnweb.freebsd.org/changeset/base/328358 Log: Clamp DSGL entries to a length of 2KB. This works around an issue in the T6 that can result in DMA engine stalls if an error occurs while processing a DSGL entry with a length larger than 2KB. Submitted by: Harsh Jain @ Chelsio Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:12:00 2018 (r328357) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:13:07 2018 (r328358) @@ -116,11 +116,13 @@ __FBSDID("$FreeBSD$"); #define MAX_AAD_LEN 511 /* - * The documentation for CPL_RX_PHYS_DSGL claims a maximum of 32 - * SG entries. + * The documentation for CPL_RX_PHYS_DSGL claims a maximum of 32 SG + * entries. While the CPL includes a 16-bit length field, the T6 can + * sometimes hang if an error occurs while processing a request with a + * single DSGL entry larger than 2k. */ #define MAX_RX_PHYS_DSGL_SGE 32 -#define DSGL_SGE_MAXLEN 65535 +#define DSGL_SGE_MAXLEN 2048 /* * The adapter only supports requests with a total input or output From owner-svn-src-all@freebsd.org Wed Jan 24 20:14:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BE5FEC32A6; Wed, 24 Jan 2018 20:14:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B4B9757C6; Wed, 24 Jan 2018 20:14: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 361B6225DE; Wed, 24 Jan 2018 20:14:58 +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 w0OKEw1R037472; Wed, 24 Jan 2018 20:14:58 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKEwOw037471; Wed, 24 Jan 2018 20:14:58 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801242014.w0OKEwOw037471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 20:14:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328359 - head/sys/dev/cxgbe/crypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 328359 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:14:58 -0000 Author: jhb Date: Wed Jan 24 20:14:57 2018 New Revision: 328359 URL: https://svnweb.freebsd.org/changeset/base/328359 Log: Expand the software fallback for GCM to cover more cases. - Extend ccr_gcm_soft() to handle requests with a non-empty payload. While here, switch to allocating the GMAC context instead of placing it on the stack since it is over 1KB in size. - Allow ccr_gcm() to return a special error value (EMSGSIZE) which triggers a fallback to ccr_gcm_soft(). Move the existing empty payload check into ccr_gcm() and change a few other cases (e.g. large AAD) to fallback to software via EMSGSIZE as well. - Add a new 'sw_fallback' stat to count the number of requests processed via the software fallback. Submitted by: Harsh Jain @ Chelsio (original version) Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:13:07 2018 (r328358) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:14:57 2018 (r328359) @@ -214,6 +214,7 @@ struct ccr_softc { uint64_t stats_bad_session; uint64_t stats_sglist_error; uint64_t stats_process_error; + uint64_t stats_sw_fallback; }; /* @@ -1111,14 +1112,21 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr return (EINVAL); /* + * The crypto engine doesn't handle GCM requests with an empty + * payload, so handle those in software instead. + */ + if (crde->crd_len == 0) + return (EMSGSIZE); + + /* * AAD is only permitted before the cipher/plain text, not * after. */ if (crda->crd_len + crda->crd_skip > crde->crd_len + crde->crd_skip) - return (EINVAL); + return (EMSGSIZE); if (crda->crd_len + AES_BLOCK_LEN > MAX_AAD_LEN) - return (EINVAL); + return (EMSGSIZE); hash_size_in_response = s->gmac.hash_len; @@ -1371,19 +1379,55 @@ ccr_gcm_done(struct ccr_softc *sc, struct ccr_session } /* - * Handle a GCM request with an empty payload by performing the - * operation in software. Derived from swcr_authenc(). + * Handle a GCM request that is not supported by the crypto engine by + * performing the operation in software. Derived from swcr_authenc(). */ static void ccr_gcm_soft(struct ccr_session *s, struct cryptop *crp, struct cryptodesc *crda, struct cryptodesc *crde) { - struct aes_gmac_ctx gmac_ctx; + struct auth_hash *axf; + struct enc_xform *exf; + void *auth_ctx; + uint8_t *kschedule; char block[GMAC_BLOCK_LEN]; char digest[GMAC_DIGEST_LEN]; char iv[AES_BLOCK_LEN]; - int i, len; + int error, i, len; + auth_ctx = NULL; + kschedule = NULL; + + /* Initialize the MAC. */ + switch (s->blkcipher.key_len) { + case 16: + axf = &auth_hash_nist_gmac_aes_128; + break; + case 24: + axf = &auth_hash_nist_gmac_aes_192; + break; + case 32: + axf = &auth_hash_nist_gmac_aes_256; + break; + default: + error = EINVAL; + goto out; + } + auth_ctx = malloc(axf->ctxsize, M_CCR, M_NOWAIT); + if (auth_ctx == NULL) { + error = ENOMEM; + goto out; + } + axf->Init(auth_ctx); + axf->Setkey(auth_ctx, s->blkcipher.enckey, s->blkcipher.key_len); + + /* Initialize the cipher. */ + exf = &enc_xform_aes_nist_gcm; + error = exf->setkey(&kschedule, s->blkcipher.enckey, + s->blkcipher.key_len); + if (error) + goto out; + /* * This assumes a 12-byte IV from the crp. See longer comment * above in ccr_gcm() for more details. @@ -1402,10 +1446,7 @@ ccr_gcm_soft(struct ccr_session *s, struct cryptop *cr } *(uint32_t *)&iv[12] = htobe32(1); - /* Initialize the MAC. */ - AES_GMAC_Init(&gmac_ctx); - AES_GMAC_Setkey(&gmac_ctx, s->blkcipher.enckey, s->blkcipher.key_len); - AES_GMAC_Reinit(&gmac_ctx, iv, sizeof(iv)); + axf->Reinit(auth_ctx, iv, sizeof(iv)); /* MAC the AAD. */ for (i = 0; i < crda->crd_len; i += sizeof(block)) { @@ -1413,29 +1454,70 @@ ccr_gcm_soft(struct ccr_session *s, struct cryptop *cr crypto_copydata(crp->crp_flags, crp->crp_buf, crda->crd_skip + i, len, block); bzero(block + len, sizeof(block) - len); - AES_GMAC_Update(&gmac_ctx, block, sizeof(block)); + axf->Update(auth_ctx, block, sizeof(block)); } + exf->reinit(kschedule, iv); + + /* Do encryption with MAC */ + for (i = 0; i < crde->crd_len; i += sizeof(block)) { + len = imin(crde->crd_len - i, sizeof(block)); + crypto_copydata(crp->crp_flags, crp->crp_buf, crde->crd_skip + + i, len, block); + bzero(block + len, sizeof(block) - len); + if (crde->crd_flags & CRD_F_ENCRYPT) { + exf->encrypt(kschedule, block); + axf->Update(auth_ctx, block, len); + crypto_copyback(crp->crp_flags, crp->crp_buf, + crde->crd_skip + i, len, block); + } else { + axf->Update(auth_ctx, block, len); + } + } + /* Length block. */ bzero(block, sizeof(block)); ((uint32_t *)block)[1] = htobe32(crda->crd_len * 8); - AES_GMAC_Update(&gmac_ctx, block, sizeof(block)); - AES_GMAC_Final(digest, &gmac_ctx); + ((uint32_t *)block)[3] = htobe32(crde->crd_len * 8); + axf->Update(auth_ctx, block, sizeof(block)); + /* Finalize MAC. */ + axf->Final(digest, auth_ctx); + + /* Inject or validate tag. */ if (crde->crd_flags & CRD_F_ENCRYPT) { crypto_copyback(crp->crp_flags, crp->crp_buf, crda->crd_inject, sizeof(digest), digest); - crp->crp_etype = 0; + error = 0; } else { char digest2[GMAC_DIGEST_LEN]; crypto_copydata(crp->crp_flags, crp->crp_buf, crda->crd_inject, sizeof(digest2), digest2); - if (timingsafe_bcmp(digest, digest2, sizeof(digest)) == 0) - crp->crp_etype = 0; - else - crp->crp_etype = EBADMSG; + if (timingsafe_bcmp(digest, digest2, sizeof(digest)) == 0) { + error = 0; + + /* Tag matches, decrypt data. */ + for (i = 0; i < crde->crd_len; i += sizeof(block)) { + len = imin(crde->crd_len - i, sizeof(block)); + crypto_copydata(crp->crp_flags, crp->crp_buf, + crde->crd_skip + i, len, block); + bzero(block + len, sizeof(block) - len); + exf->decrypt(kschedule, block); + crypto_copyback(crp->crp_flags, crp->crp_buf, + crde->crd_skip + i, len, block); + } + } else + error = EBADMSG; } + + exf->zerokey(&kschedule); +out: + if (auth_ctx != NULL) { + memset(auth_ctx, 0, axf->ctxsize); + free(auth_ctx, M_CCR); + } + crp->crp_etype = error; crypto_done(crp); } @@ -1513,6 +1595,9 @@ ccr_sysctls(struct ccr_softc *sc) "Requests for which DMA mapping failed"); SYSCTL_ADD_U64(ctx, children, OID_AUTO, "process_error", CTLFLAG_RD, &sc->stats_process_error, 0, "Requests failed during queueing"); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "sw_fallback", CTLFLAG_RD, + &sc->stats_sw_fallback, 0, + "Requests processed by falling back to software"); } static int @@ -2135,6 +2220,12 @@ ccr_process(device_t dev, struct cryptop *crp, int hin return (0); } error = ccr_gcm(sc, sid, s, crp, crda, crde); + if (error == EMSGSIZE) { + sc->stats_sw_fallback++; + mtx_unlock(&sc->lock); + ccr_gcm_soft(s, crp, crda, crde); + return (0); + } if (error == 0) { if (crde->crd_flags & CRD_F_ENCRYPT) sc->stats_gcm_encrypt++; From owner-svn-src-all@freebsd.org Wed Jan 24 20:15:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A44B8EC3378; Wed, 24 Jan 2018 20:15:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5938775919; Wed, 24 Jan 2018 20:15:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54303225E0; Wed, 24 Jan 2018 20:15:49 +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 w0OKFnWF037555; Wed, 24 Jan 2018 20:15:49 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKFnHF037554; Wed, 24 Jan 2018 20:15:49 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801242015.w0OKFnHF037554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 20:15:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328360 - head/sys/dev/cxgbe/crypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 328360 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:15:49 -0000 Author: jhb Date: Wed Jan 24 20:15:49 2018 New Revision: 328360 URL: https://svnweb.freebsd.org/changeset/base/328360 Log: Don't read or generate an IV until all error checking is complete. In particular, this avoids edge cases where a generated IV might be written into the output buffer even though the request is failed with an error. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:14:57 2018 (r328359) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:15:49 2018 (r328360) @@ -581,24 +581,11 @@ ccr_blkcipher(struct ccr_softc *sc, uint32_t sid, stru if (crd->crd_len > MAX_REQUEST_SIZE) return (EFBIG); - if (crd->crd_flags & CRD_F_ENCRYPT) { + if (crd->crd_flags & CRD_F_ENCRYPT) op_type = CHCR_ENCRYPT_OP; - if (crd->crd_flags & CRD_F_IV_EXPLICIT) - memcpy(iv, crd->crd_iv, s->blkcipher.iv_len); - else - arc4rand(iv, s->blkcipher.iv_len, 0); - if ((crd->crd_flags & CRD_F_IV_PRESENT) == 0) - crypto_copyback(crp->crp_flags, crp->crp_buf, - crd->crd_inject, s->blkcipher.iv_len, iv); - } else { + else op_type = CHCR_DECRYPT_OP; - if (crd->crd_flags & CRD_F_IV_EXPLICIT) - memcpy(iv, crd->crd_iv, s->blkcipher.iv_len); - else - crypto_copydata(crp->crp_flags, crp->crp_buf, - crd->crd_inject, s->blkcipher.iv_len, iv); - } - + sglist_reset(sc->sg_dsgl); error = sglist_append_sglist(sc->sg_dsgl, sc->sg_crp, crd->crd_skip, crd->crd_len); @@ -641,6 +628,27 @@ ccr_blkcipher(struct ccr_softc *sc, uint32_t sid, stru crwr = wrtod(wr); memset(crwr, 0, wr_len); + /* + * Read the existing IV from the request or generate a random + * one if none is provided. Optionally copy the generated IV + * into the output buffer if requested. + */ + if (op_type == CHCR_ENCRYPT_OP) { + if (crd->crd_flags & CRD_F_IV_EXPLICIT) + memcpy(iv, crd->crd_iv, s->blkcipher.iv_len); + else + arc4rand(iv, s->blkcipher.iv_len, 0); + if ((crd->crd_flags & CRD_F_IV_PRESENT) == 0) + crypto_copyback(crp->crp_flags, crp->crp_buf, + crd->crd_inject, s->blkcipher.iv_len, iv); + } else { + if (crd->crd_flags & CRD_F_IV_EXPLICIT) + memcpy(iv, crd->crd_iv, s->blkcipher.iv_len); + else + crypto_copydata(crp->crp_flags, crp->crp_buf, + crd->crd_inject, s->blkcipher.iv_len, iv); + } + ccr_populate_wreq(sc, crwr, kctx_len, wr_len, sid, imm_len, sgl_len, 0, crp); @@ -799,30 +807,10 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct axf = s->hmac.auth_hash; hash_size_in_response = s->hmac.hash_len; - - /* - * The IV is always stored at the start of the buffer even - * though it may be duplicated in the payload. The crypto - * engine doesn't work properly if the IV offset points inside - * of the AAD region, so a second copy is always required. - */ - if (crde->crd_flags & CRD_F_ENCRYPT) { + if (crde->crd_flags & CRD_F_ENCRYPT) op_type = CHCR_ENCRYPT_OP; - if (crde->crd_flags & CRD_F_IV_EXPLICIT) - memcpy(iv, crde->crd_iv, s->blkcipher.iv_len); - else - arc4rand(iv, s->blkcipher.iv_len, 0); - if ((crde->crd_flags & CRD_F_IV_PRESENT) == 0) - crypto_copyback(crp->crp_flags, crp->crp_buf, - crde->crd_inject, s->blkcipher.iv_len, iv); - } else { + else op_type = CHCR_DECRYPT_OP; - if (crde->crd_flags & CRD_F_IV_EXPLICIT) - memcpy(iv, crde->crd_iv, s->blkcipher.iv_len); - else - crypto_copydata(crp->crp_flags, crp->crp_buf, - crde->crd_inject, s->blkcipher.iv_len, iv); - } /* * The output buffer consists of the cipher text followed by @@ -876,6 +864,12 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct * The input buffer consists of the IV, any AAD, and then the * cipher/plain text. For decryption requests the hash is * appended after the cipher text. + * + * The IV is always stored at the start of the input buffer + * even though it may be duplicated in the payload. The + * crypto engine doesn't work properly if the IV offset points + * inside of the AAD region, so a second copy is always + * required. */ input_len = aad_len + crde->crd_len; @@ -964,6 +958,27 @@ ccr_authenc(struct ccr_softc *sc, uint32_t sid, struct crwr = wrtod(wr); memset(crwr, 0, wr_len); + /* + * Read the existing IV from the request or generate a random + * one if none is provided. Optionally copy the generated IV + * into the output buffer if requested. + */ + if (op_type == CHCR_ENCRYPT_OP) { + if (crde->crd_flags & CRD_F_IV_EXPLICIT) + memcpy(iv, crde->crd_iv, s->blkcipher.iv_len); + else + arc4rand(iv, s->blkcipher.iv_len, 0); + if ((crde->crd_flags & CRD_F_IV_PRESENT) == 0) + crypto_copyback(crp->crp_flags, crp->crp_buf, + crde->crd_inject, s->blkcipher.iv_len, iv); + } else { + if (crde->crd_flags & CRD_F_IV_EXPLICIT) + memcpy(iv, crde->crd_iv, s->blkcipher.iv_len); + else + crypto_copydata(crp->crp_flags, crp->crp_buf, + crde->crd_inject, s->blkcipher.iv_len, iv); + } + ccr_populate_wreq(sc, crwr, kctx_len, wr_len, sid, imm_len, sgl_len, op_type == CHCR_DECRYPT_OP ? hash_size_in_response : 0, crp); @@ -1129,47 +1144,30 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr return (EMSGSIZE); hash_size_in_response = s->gmac.hash_len; - - /* - * The IV is always stored at the start of the buffer even - * though it may be duplicated in the payload. The crypto - * engine doesn't work properly if the IV offset points inside - * of the AAD region, so a second copy is always required. - * - * The IV for GCM is further complicated in that IPSec - * provides a full 16-byte IV (including the counter), whereas - * the /dev/crypto interface sometimes provides a full 16-byte - * IV (if no IV is provided in the ioctl) and sometimes a - * 12-byte IV (if the IV was explicit). For now the driver - * always assumes a 12-byte IV and initializes the low 4 byte - * counter to 1. - */ - if (crde->crd_flags & CRD_F_ENCRYPT) { + if (crde->crd_flags & CRD_F_ENCRYPT) op_type = CHCR_ENCRYPT_OP; - if (crde->crd_flags & CRD_F_IV_EXPLICIT) - memcpy(iv, crde->crd_iv, s->blkcipher.iv_len); - else - arc4rand(iv, s->blkcipher.iv_len, 0); - if ((crde->crd_flags & CRD_F_IV_PRESENT) == 0) - crypto_copyback(crp->crp_flags, crp->crp_buf, - crde->crd_inject, s->blkcipher.iv_len, iv); - } else { + else op_type = CHCR_DECRYPT_OP; - if (crde->crd_flags & CRD_F_IV_EXPLICIT) - memcpy(iv, crde->crd_iv, s->blkcipher.iv_len); - else - crypto_copydata(crp->crp_flags, crp->crp_buf, - crde->crd_inject, s->blkcipher.iv_len, iv); - } /* - * If the input IV is 12 bytes, append an explicit counter of - * 1. + * The IV handling for GCM in OCF is a bit more complicated in + * that IPSec provides a full 16-byte IV (including the + * counter), whereas the /dev/crypto interface sometimes + * provides a full 16-byte IV (if no IV is provided in the + * ioctl) and sometimes a 12-byte IV (if the IV was explicit). + * + * When provided a 12-byte IV, assume the IV is really 16 bytes + * with a counter in the last 4 bytes initialized to 1. + * + * While iv_len is checked below, the value is currently + * always set to 12 when creating a GCM session in this driver + * due to limitations in OCF (there is no way to know what the + * IV length of a given request will be). This means that the + * driver always assumes as 12-byte IV for now. */ - if (s->blkcipher.iv_len == 12) { - *(uint32_t *)&iv[12] = htobe32(1); + if (s->blkcipher.iv_len == 12) iv_len = AES_BLOCK_LEN; - } else + else iv_len = s->blkcipher.iv_len; /* @@ -1220,6 +1218,12 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr * The input buffer consists of the IV, any AAD, and then the * cipher/plain text. For decryption requests the hash is * appended after the cipher text. + * + * The IV is always stored at the start of the input buffer + * even though it may be duplicated in the payload. The + * crypto engine doesn't work properly if the IV offset points + * inside of the AAD region, so a second copy is always + * required. */ input_len = crda->crd_len + crde->crd_len; if (op_type == CHCR_DECRYPT_OP) @@ -1281,6 +1285,32 @@ ccr_gcm(struct ccr_softc *sc, uint32_t sid, struct ccr } crwr = wrtod(wr); memset(crwr, 0, wr_len); + + /* + * Read the existing IV from the request or generate a random + * one if none is provided. Optionally copy the generated IV + * into the output buffer if requested. + * + * If the input IV is 12 bytes, append an explicit 4-byte + * counter of 1. + */ + if (op_type == CHCR_ENCRYPT_OP) { + if (crde->crd_flags & CRD_F_IV_EXPLICIT) + memcpy(iv, crde->crd_iv, s->blkcipher.iv_len); + else + arc4rand(iv, s->blkcipher.iv_len, 0); + if ((crde->crd_flags & CRD_F_IV_PRESENT) == 0) + crypto_copyback(crp->crp_flags, crp->crp_buf, + crde->crd_inject, s->blkcipher.iv_len, iv); + } else { + if (crde->crd_flags & CRD_F_IV_EXPLICIT) + memcpy(iv, crde->crd_iv, s->blkcipher.iv_len); + else + crypto_copydata(crp->crp_flags, crp->crp_buf, + crde->crd_inject, s->blkcipher.iv_len, iv); + } + if (s->blkcipher.iv_len == 12) + *(uint32_t *)&iv[12] = htobe32(1); ccr_populate_wreq(sc, crwr, kctx_len, wr_len, sid, imm_len, sgl_len, 0, crp); From owner-svn-src-all@freebsd.org Wed Jan 24 20:16:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B867EC349B; Wed, 24 Jan 2018 20:16:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 417CE75B54; Wed, 24 Jan 2018 20:16:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C625225E2; Wed, 24 Jan 2018 20:16:49 +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 w0OKGnCW037767; Wed, 24 Jan 2018 20:16:49 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKGneM037766; Wed, 24 Jan 2018 20:16:49 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801242016.w0OKGneM037766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 20:16:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328361 - head/sys/dev/cxgbe/crypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 328361 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:16:49 -0000 Author: jhb Date: Wed Jan 24 20:16:48 2018 New Revision: 328361 URL: https://svnweb.freebsd.org/changeset/base/328361 Log: Store IV in output buffer in GCM software fallback when requested. Properly honor the lack of the CRD_F_IV_PRESENT flag in the GCM software fallback case for encryption requests. Submitted by: Harsh Jain @ Chelsio Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:15:49 2018 (r328360) +++ head/sys/dev/cxgbe/crypto/t4_crypto.c Wed Jan 24 20:16:48 2018 (r328361) @@ -1467,6 +1467,9 @@ ccr_gcm_soft(struct ccr_session *s, struct cryptop *cr memcpy(iv, crde->crd_iv, 12); else arc4rand(iv, 12, 0); + if ((crde->crd_flags & CRD_F_IV_PRESENT) == 0) + crypto_copyback(crp->crp_flags, crp->crp_buf, + crde->crd_inject, 12, iv); } else { if (crde->crd_flags & CRD_F_IV_EXPLICIT) memcpy(iv, crde->crd_iv, 12); From owner-svn-src-all@freebsd.org Wed Jan 24 20:23:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E624EC3A7F; Wed, 24 Jan 2018 20:23:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B08FA7606D; Wed, 24 Jan 2018 20:23:50 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB26E2278B; Wed, 24 Jan 2018 20:23:50 +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 w0OKNoQL042597; Wed, 24 Jan 2018 20:23:50 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKNmj7042575; Wed, 24 Jan 2018 20:23:48 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801242023.w0OKNmj7042575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 24 Jan 2018 20:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328362 - in vendor/llvm/dist-release_60: cmake/modules docs include/llvm/Analysis include/llvm/CodeGen include/llvm/MC include/llvm/Support include/llvm/Transforms/Vectorize lib/CodeGe... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/llvm/dist-release_60: cmake/modules docs include/llvm/Analysis include/llvm/CodeGen include/llvm/MC include/llvm/Support include/llvm/Transforms/Vectorize lib/CodeGen lib/CodeGen/SelectionDA... X-SVN-Commit-Revision: 328362 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:23:51 -0000 Author: dim Date: Wed Jan 24 20:23:48 2018 New Revision: 328362 URL: https://svnweb.freebsd.org/changeset/base/328362 Log: Vendor import of llvm release_60 branch r323338: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323338 Added: vendor/llvm/dist-release_60/test/CodeGen/AArch64/GlobalISel/select-gv-cmodel-large.mir vendor/llvm/dist-release_60/test/CodeGen/ARM/global-merge-dllexport.ll vendor/llvm/dist-release_60/test/CodeGen/ARM/peephole-phi.mir vendor/llvm/dist-release_60/test/CodeGen/PowerPC/PR35812-neg-cmpxchg.ll vendor/llvm/dist-release_60/test/CodeGen/X86/pr35761.ll vendor/llvm/dist-release_60/test/CodeGen/X86/pr35972.ll vendor/llvm/dist-release_60/test/CodeGen/X86/pr37563.ll vendor/llvm/dist-release_60/test/ThinLTO/X86/Inputs/dicompositetype-unique2.ll vendor/llvm/dist-release_60/test/ThinLTO/X86/dicompositetype-unique2.ll vendor/llvm/dist-release_60/test/Transforms/CodeGenPrepare/X86/sink-addrmode-select.ll vendor/llvm/dist-release_60/test/Transforms/JumpThreading/ddt-crash3.ll vendor/llvm/dist-release_60/test/Transforms/JumpThreading/ddt-crash4.ll vendor/llvm/dist-release_60/test/Transforms/LoopVectorize/pr35773.ll vendor/llvm/dist-release_60/test/Transforms/SLPVectorizer/X86/PR35628_1.ll vendor/llvm/dist-release_60/test/Transforms/SLPVectorizer/X86/PR35628_2.ll vendor/llvm/dist-release_60/test/Transforms/SLPVectorizer/X86/PR35777.ll vendor/llvm/dist-release_60/test/Transforms/SLPVectorizer/X86/PR35865.ll vendor/llvm/dist-release_60/test/Transforms/StructurizeCFG/AMDGPU/ vendor/llvm/dist-release_60/test/Transforms/StructurizeCFG/AMDGPU/backedge-id-bug-xfail.ll vendor/llvm/dist-release_60/test/Transforms/StructurizeCFG/AMDGPU/backedge-id-bug.ll vendor/llvm/dist-release_60/test/Transforms/StructurizeCFG/AMDGPU/lit.local.cfg vendor/llvm/dist-release_60/test/tools/llvm-readobj/macho-needed-libs.test Modified: vendor/llvm/dist-release_60/cmake/modules/LLVMConfig.cmake.in vendor/llvm/dist-release_60/docs/ReleaseNotes.rst vendor/llvm/dist-release_60/include/llvm/Analysis/RegionInfoImpl.h vendor/llvm/dist-release_60/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h vendor/llvm/dist-release_60/include/llvm/MC/MCCodeView.h vendor/llvm/dist-release_60/include/llvm/Support/GenericDomTreeConstruction.h vendor/llvm/dist-release_60/include/llvm/Transforms/Vectorize/SLPVectorizer.h vendor/llvm/dist-release_60/lib/CodeGen/CodeGenPrepare.cpp vendor/llvm/dist-release_60/lib/CodeGen/GlobalMerge.cpp vendor/llvm/dist-release_60/lib/CodeGen/PeepholeOptimizer.cpp vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/DAGCombiner.cpp vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/SelectionDAG.cpp vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp vendor/llvm/dist-release_60/lib/CodeGen/TargetLoweringBase.cpp vendor/llvm/dist-release_60/lib/Linker/IRMover.cpp vendor/llvm/dist-release_60/lib/MC/MCCodeView.cpp vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64InstructionSelector.cpp vendor/llvm/dist-release_60/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp vendor/llvm/dist-release_60/lib/Target/PowerPC/PPCISelLowering.cpp vendor/llvm/dist-release_60/lib/Target/PowerPC/PPCISelLowering.h vendor/llvm/dist-release_60/lib/Target/PowerPC/PPCInstrInfo.td vendor/llvm/dist-release_60/lib/Target/X86/AsmParser/X86AsmParser.cpp vendor/llvm/dist-release_60/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist-release_60/lib/Target/X86/X86TargetTransformInfo.cpp vendor/llvm/dist-release_60/lib/Transforms/Scalar/GVNHoist.cpp vendor/llvm/dist-release_60/lib/Transforms/Scalar/StructurizeCFG.cpp vendor/llvm/dist-release_60/lib/Transforms/Vectorize/LoopVectorize.cpp vendor/llvm/dist-release_60/lib/Transforms/Vectorize/SLPVectorizer.cpp vendor/llvm/dist-release_60/test/CodeGen/AArch64/atomic-ops-lse.ll vendor/llvm/dist-release_60/test/CodeGen/AMDGPU/multilevel-break.ll vendor/llvm/dist-release_60/test/CodeGen/AMDGPU/nested-loop-conditions.ll vendor/llvm/dist-release_60/test/CodeGen/ARM/and-load-combine.ll vendor/llvm/dist-release_60/test/CodeGen/ARM/atomic-cmpxchg.ll vendor/llvm/dist-release_60/test/CodeGen/ARM/cmpxchg-O0.ll vendor/llvm/dist-release_60/test/CodeGen/ARM/global-merge-external.ll vendor/llvm/dist-release_60/test/CodeGen/PowerPC/atomics-regression.ll vendor/llvm/dist-release_60/test/CodeGen/X86/avx512-shuffles/partial_permute.ll vendor/llvm/dist-release_60/test/CodeGen/X86/darwin-bzero.ll vendor/llvm/dist-release_60/test/CodeGen/X86/inline-asm-A-constraint.ll vendor/llvm/dist-release_60/test/CodeGen/X86/var-permute-128.ll vendor/llvm/dist-release_60/test/CodeGen/X86/var-permute-256.ll vendor/llvm/dist-release_60/test/MC/COFF/cv-inline-linetable.s vendor/llvm/dist-release_60/test/MC/X86/x86-64.s vendor/llvm/dist-release_60/test/Transforms/GVNHoist/pr35222-hoist-load.ll vendor/llvm/dist-release_60/test/Transforms/SLPVectorizer/X86/insert-element-build-vector.ll vendor/llvm/dist-release_60/test/Transforms/SLPVectorizer/X86/insertvalue.ll vendor/llvm/dist-release_60/test/Transforms/SLPVectorizer/X86/value-bug.ll vendor/llvm/dist-release_60/test/Transforms/StructurizeCFG/nested-loop-order.ll vendor/llvm/dist-release_60/tools/llvm-readobj/MachODumper.cpp vendor/llvm/dist-release_60/unittests/IR/DominatorTreeBatchUpdatesTest.cpp vendor/llvm/dist-release_60/unittests/IR/DominatorTreeTest.cpp vendor/llvm/dist-release_60/utils/release/test-release.sh Modified: vendor/llvm/dist-release_60/cmake/modules/LLVMConfig.cmake.in ============================================================================== --- vendor/llvm/dist-release_60/cmake/modules/LLVMConfig.cmake.in Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/cmake/modules/LLVMConfig.cmake.in Wed Jan 24 20:23:48 2018 (r328362) @@ -37,6 +37,8 @@ set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS@) set(LLVM_ENABLE_ZLIB @LLVM_ENABLE_ZLIB@) +set(LLVM_LIBXML2_ENABLED @LLVM_LIBXML2_ENABLED@) + set(LLVM_ENABLE_DIA_SDK @LLVM_ENABLE_DIA_SDK@) set(LLVM_NATIVE_ARCH @LLVM_NATIVE_ARCH@) Modified: vendor/llvm/dist-release_60/docs/ReleaseNotes.rst ============================================================================== --- vendor/llvm/dist-release_60/docs/ReleaseNotes.rst Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/docs/ReleaseNotes.rst Wed Jan 24 20:23:48 2018 (r328362) @@ -54,6 +54,8 @@ Non-comprehensive list of changes in this release ``DIVariables`` to the instructions in a ``Module``. The ``CheckDebugify`` pass determines how much of the metadata is lost. +* Significantly improved quality of CodeView debug info for Windows. + * Note.. .. NOTE @@ -69,12 +71,15 @@ Non-comprehensive list of changes in this release Changes to the LLVM IR ---------------------- -Changes to the ARM Backend --------------------------- +Changes to the ARM Target +------------------------- - During this release ... +During this release the ARM target has: +* Got support for enabling SjLj exception handling on platforms where it + isn't the default. + Changes to the MIPS Target -------------------------- @@ -89,8 +94,11 @@ Changes to the PowerPC Target Changes to the X86 Target ------------------------- - During this release ... +During this release ... +* Got support for enabling SjLj exception handling on platforms where it + isn't the default. + Changes to the AMDGPU Target ----------------------------- @@ -116,8 +124,46 @@ Changes to the C API External Open Source Projects Using LLVM 6 ========================================== -* A project... +JFS - JIT Fuzzing Solver +------------------------ +`JFS `_ is an experimental constraint solver +designed to investigate using coverage guided fuzzing as an incomplete strategy +for solving boolean, BitVector, and floating-point constraints. +It is built on top of LLVM, Clang, LibFuzzer, and Z3. + +The solver works by generating a C++ program where the reachability of an +`abort()` statement is equivalent to finding a satisfying assignment to the +constraints. This program is then compiled by Clang with `SanitizerCoverage +`_ +instrumentation and then fuzzed using :doc:`LibFuzzer `. + +Zig Programming Language +------------------------ + +`Zig `_ is an open-source programming language designed +for robustness, optimality, and clarity. It is intended to replace C. It +provides high level features such as Generics, +Compile Time Function Execution, and Partial Evaluation, yet exposes low level +LLVM IR features such as Aliases. Zig uses Clang to provide automatic +import of .h symbols - even inline functions and macros. Zig uses LLD combined +with lazily building compiler-rt to provide out-of-the-box cross-compiling for +all supported targets. + +LDC - the LLVM-based D compiler +------------------------------- + +`D `_ is a language with C-like syntax and static typing. It +pragmatically combines efficiency, control, and modeling power, with safety and +programmer productivity. D supports powerful concepts like Compile-Time Function +Execution (CTFE) and Template Meta-Programming, provides an innovative approach +to concurrency and offers many classical paradigms. + +`LDC `_ uses the frontend from the reference compiler +combined with LLVM as backend to produce efficient native code. LDC targets +x86/x86_64 systems like Linux, OS X, FreeBSD and Windows and also Linux on ARM +and PowerPC (32/64 bit). Ports to other architectures like AArch64 and MIPS64 +are underway. Additional Information ====================== Modified: vendor/llvm/dist-release_60/include/llvm/Analysis/RegionInfoImpl.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/Analysis/RegionInfoImpl.h Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/include/llvm/Analysis/RegionInfoImpl.h Wed Jan 24 20:23:48 2018 (r328362) @@ -254,23 +254,23 @@ std::string RegionBase::getNameStr() const { template void RegionBase::verifyBBInRegion(BlockT *BB) const { if (!contains(BB)) - llvm_unreachable("Broken region found: enumerated BB not in region!"); + report_fatal_error("Broken region found: enumerated BB not in region!"); BlockT *entry = getEntry(), *exit = getExit(); for (BlockT *Succ : make_range(BlockTraits::child_begin(BB), BlockTraits::child_end(BB))) { if (!contains(Succ) && exit != Succ) - llvm_unreachable("Broken region found: edges leaving the region must go " - "to the exit node!"); + report_fatal_error("Broken region found: edges leaving the region must go " + "to the exit node!"); } if (entry != BB) { for (BlockT *Pred : make_range(InvBlockTraits::child_begin(BB), InvBlockTraits::child_end(BB))) { if (!contains(Pred)) - llvm_unreachable("Broken region found: edges entering the region must " - "go to the entry node!"); + report_fatal_error("Broken region found: edges entering the region must " + "go to the entry node!"); } } } @@ -557,7 +557,7 @@ void RegionInfoBase::verifyBBMap(const RegionT *R) } else { BlockT *BB = Element->template getNodeAs(); if (getRegionFor(BB) != R) - llvm_unreachable("BB map does not match region nesting"); + report_fatal_error("BB map does not match region nesting"); } } } Modified: vendor/llvm/dist-release_60/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h Wed Jan 24 20:23:48 2018 (r328362) @@ -56,7 +56,7 @@ class BaseIndexOffset { (public) int64_t &Off); /// Parses tree in Ptr for base, index, offset addresses. - static BaseIndexOffset match(SDValue Ptr, const SelectionDAG &DAG); + static BaseIndexOffset match(LSBaseSDNode *N, const SelectionDAG &DAG); }; } // end namespace llvm Modified: vendor/llvm/dist-release_60/include/llvm/MC/MCCodeView.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/MC/MCCodeView.h Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/include/llvm/MC/MCCodeView.h Wed Jan 24 20:23:48 2018 (r328362) @@ -177,13 +177,7 @@ class CodeViewContext { (public) unsigned IACol); /// Retreive the function info if this is a valid function id, or nullptr. - MCCVFunctionInfo *getCVFunctionInfo(unsigned FuncId) { - if (FuncId >= Functions.size()) - return nullptr; - if (Functions[FuncId].isUnallocatedFunctionInfo()) - return nullptr; - return &Functions[FuncId]; - } + MCCVFunctionInfo *getCVFunctionInfo(unsigned FuncId); /// Saves the information from the currently parsed .cv_loc directive /// and sets CVLocSeen. When the next instruction is assembled an entry @@ -199,50 +193,22 @@ class CodeViewContext { (public) CurrentCVLoc.setIsStmt(IsStmt); CVLocSeen = true; } - void clearCVLocSeen() { CVLocSeen = false; } bool getCVLocSeen() { return CVLocSeen; } + void clearCVLocSeen() { CVLocSeen = false; } + const MCCVLoc &getCurrentCVLoc() { return CurrentCVLoc; } bool isValidCVFileNumber(unsigned FileNumber); /// \brief Add a line entry. - void addLineEntry(const MCCVLineEntry &LineEntry) { - size_t Offset = MCCVLines.size(); - auto I = MCCVLineStartStop.insert( - {LineEntry.getFunctionId(), {Offset, Offset + 1}}); - if (!I.second) - I.first->second.second = Offset + 1; - MCCVLines.push_back(LineEntry); - } + void addLineEntry(const MCCVLineEntry &LineEntry); - std::vector getFunctionLineEntries(unsigned FuncId) { - std::vector FilteredLines; + std::vector getFunctionLineEntries(unsigned FuncId); - auto I = MCCVLineStartStop.find(FuncId); - if (I != MCCVLineStartStop.end()) - for (size_t Idx = I->second.first, End = I->second.second; Idx != End; - ++Idx) - if (MCCVLines[Idx].getFunctionId() == FuncId) - FilteredLines.push_back(MCCVLines[Idx]); - return FilteredLines; - } + std::pair getLineExtent(unsigned FuncId); - std::pair getLineExtent(unsigned FuncId) { - auto I = MCCVLineStartStop.find(FuncId); - // Return an empty extent if there are no cv_locs for this function id. - if (I == MCCVLineStartStop.end()) - return {~0ULL, 0}; - return I->second; - } - - ArrayRef getLinesForExtent(size_t L, size_t R) { - if (R <= L) - return None; - if (L >= MCCVLines.size()) - return None; - return makeArrayRef(&MCCVLines[L], R - L); - } + ArrayRef getLinesForExtent(size_t L, size_t R); /// Emits a line table substream. void emitLineTableForFunction(MCObjectStreamer &OS, unsigned FuncId, Modified: vendor/llvm/dist-release_60/include/llvm/Support/GenericDomTreeConstruction.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/Support/GenericDomTreeConstruction.h Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/include/llvm/Support/GenericDomTreeConstruction.h Wed Jan 24 20:23:48 2018 (r328362) @@ -628,7 +628,7 @@ struct SemiNCAInfo { DecreasingLevel> Bucket; // Queue of tree nodes sorted by level in descending order. SmallDenseSet Affected; - SmallDenseSet Visited; + SmallDenseMap Visited; SmallVector AffectedQueue; SmallVector VisitedNotAffectedQueue; }; @@ -706,7 +706,7 @@ struct SemiNCAInfo { // algorithm does not really know or use the set of roots and can make a // different (implicit) decision about which nodes within an infinite loop // becomes a root. - if (DT.isVirtualRoot(TN->getIDom())) { + if (TN && !DT.isVirtualRoot(TN->getIDom())) { DEBUG(dbgs() << "Root " << BlockNamePrinter(R) << " is not virtual root's child\n" << "The entire tree needs to be rebuilt\n"); @@ -753,14 +753,16 @@ struct SemiNCAInfo { while (!II.Bucket.empty()) { const TreeNodePtr CurrentNode = II.Bucket.top().second; + const unsigned CurrentLevel = CurrentNode->getLevel(); II.Bucket.pop(); DEBUG(dbgs() << "\tAdding to Visited and AffectedQueue: " << BlockNamePrinter(CurrentNode) << "\n"); - II.Visited.insert(CurrentNode); + + II.Visited.insert({CurrentNode, CurrentLevel}); II.AffectedQueue.push_back(CurrentNode); // Discover and collect affected successors of the current node. - VisitInsertion(DT, BUI, CurrentNode, CurrentNode->getLevel(), NCD, II); + VisitInsertion(DT, BUI, CurrentNode, CurrentLevel, NCD, II); } // Finish by updating immediate dominators and levels. @@ -772,13 +774,17 @@ struct SemiNCAInfo { const TreeNodePtr TN, const unsigned RootLevel, const TreeNodePtr NCD, InsertionInfo &II) { const unsigned NCDLevel = NCD->getLevel(); - DEBUG(dbgs() << "Visiting " << BlockNamePrinter(TN) << "\n"); + DEBUG(dbgs() << "Visiting " << BlockNamePrinter(TN) << ", RootLevel " + << RootLevel << "\n"); SmallVector Stack = {TN}; assert(TN->getBlock() && II.Visited.count(TN) && "Preconditions!"); + SmallPtrSet Processed; + do { TreeNodePtr Next = Stack.pop_back_val(); + DEBUG(dbgs() << " Next: " << BlockNamePrinter(Next) << "\n"); for (const NodePtr Succ : ChildrenGetter::Get(Next->getBlock(), BUI)) { @@ -786,19 +792,31 @@ struct SemiNCAInfo { assert(SuccTN && "Unreachable successor found at reachable insertion"); const unsigned SuccLevel = SuccTN->getLevel(); - DEBUG(dbgs() << "\tSuccessor " << BlockNamePrinter(Succ) - << ", level = " << SuccLevel << "\n"); + DEBUG(dbgs() << "\tSuccessor " << BlockNamePrinter(Succ) << ", level = " + << SuccLevel << "\n"); + // Do not process the same node multiple times. + if (Processed.count(Next) > 0) + continue; + // Succ dominated by subtree From -- not affected. // (Based on the lemma 2.5 from the second paper.) if (SuccLevel > RootLevel) { DEBUG(dbgs() << "\t\tDominated by subtree From\n"); - if (II.Visited.count(SuccTN) != 0) - continue; + if (II.Visited.count(SuccTN) != 0) { + DEBUG(dbgs() << "\t\t\talready visited at level " + << II.Visited[SuccTN] << "\n\t\t\tcurrent level " + << RootLevel << ")\n"); + // A node can be necessary to visit again if we see it again at + // a lower level than before. + if (II.Visited[SuccTN] >= RootLevel) + continue; + } + DEBUG(dbgs() << "\t\tMarking visited not affected " << BlockNamePrinter(Succ) << "\n"); - II.Visited.insert(SuccTN); + II.Visited.insert({SuccTN, RootLevel}); II.VisitedNotAffectedQueue.push_back(SuccTN); Stack.push_back(SuccTN); } else if ((SuccLevel > NCDLevel + 1) && @@ -809,6 +827,8 @@ struct SemiNCAInfo { II.Bucket.push({SuccLevel, SuccTN}); } } + + Processed.insert(Next); } while (!Stack.empty()); } @@ -920,21 +940,21 @@ struct SemiNCAInfo { const NodePtr NCDBlock = DT.findNearestCommonDominator(From, To); const TreeNodePtr NCD = DT.getNode(NCDBlock); - // To dominates From -- nothing to do. - if (ToTN == NCD) return; + // If To dominates From -- nothing to do. + if (ToTN != NCD) { + DT.DFSInfoValid = false; - DT.DFSInfoValid = false; + const TreeNodePtr ToIDom = ToTN->getIDom(); + DEBUG(dbgs() << "\tNCD " << BlockNamePrinter(NCD) << ", ToIDom " + << BlockNamePrinter(ToIDom) << "\n"); - const TreeNodePtr ToIDom = ToTN->getIDom(); - DEBUG(dbgs() << "\tNCD " << BlockNamePrinter(NCD) << ", ToIDom " - << BlockNamePrinter(ToIDom) << "\n"); - - // To remains reachable after deletion. - // (Based on the caption under Figure 4. from the second paper.) - if (FromTN != ToIDom || HasProperSupport(DT, BUI, ToTN)) - DeleteReachable(DT, BUI, FromTN, ToTN); - else - DeleteUnreachable(DT, BUI, ToTN); + // To remains reachable after deletion. + // (Based on the caption under Figure 4. from the second paper.) + if (FromTN != ToIDom || HasProperSupport(DT, BUI, ToTN)) + DeleteReachable(DT, BUI, FromTN, ToTN); + else + DeleteUnreachable(DT, BUI, ToTN); + } if (IsPostDom) UpdateRootsAfterUpdate(DT, BUI); } Modified: vendor/llvm/dist-release_60/include/llvm/Transforms/Vectorize/SLPVectorizer.h ============================================================================== --- vendor/llvm/dist-release_60/include/llvm/Transforms/Vectorize/SLPVectorizer.h Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/include/llvm/Transforms/Vectorize/SLPVectorizer.h Wed Jan 24 20:23:48 2018 (r328362) @@ -95,14 +95,9 @@ struct SLPVectorizerPass : public PassInfoMixin VL, slpvectorizer::BoUpSLP &R, - ArrayRef BuildVector = None, - bool AllowReorder = false, - bool NeedExtraction = false); + bool AllowReorder = false); /// \brief Try to vectorize a chain that may start at the operands of \p I. bool tryToVectorize(Instruction *I, slpvectorizer::BoUpSLP &R); Modified: vendor/llvm/dist-release_60/lib/CodeGen/CodeGenPrepare.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/CodeGenPrepare.cpp Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/lib/CodeGen/CodeGenPrepare.cpp Wed Jan 24 20:23:48 2018 (r328362) @@ -2700,8 +2700,13 @@ class AddressingModeCombiner { (public) // we still need to collect it due to original value is different. // And later we will need all original values as anchors during // finding the common Phi node. + // We also must reject the case when base offset is different and + // scale reg is not null, we cannot handle this case due to merge of + // different offsets will be used as ScaleReg. if (DifferentField != ExtAddrMode::MultipleFields && - DifferentField != ExtAddrMode::ScaleField) { + DifferentField != ExtAddrMode::ScaleField && + (DifferentField != ExtAddrMode::BaseOffsField || + !NewAddrMode.ScaledReg)) { AddrModes.emplace_back(NewAddrMode); return true; } Modified: vendor/llvm/dist-release_60/lib/CodeGen/GlobalMerge.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/GlobalMerge.cpp Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/lib/CodeGen/GlobalMerge.cpp Wed Jan 24 20:23:48 2018 (r328362) @@ -577,7 +577,8 @@ bool GlobalMerge::doInitialization(Module &M) { for (auto &GV : M.globals()) { // Merge is safe for "normal" internal or external globals only if (GV.isDeclaration() || GV.isThreadLocal() || - GV.hasSection() || GV.hasImplicitSection()) + GV.hasSection() || GV.hasImplicitSection() || + GV.hasDLLExportStorageClass()) continue; // It's not safe to merge globals that may be preempted Modified: vendor/llvm/dist-release_60/lib/CodeGen/PeepholeOptimizer.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/PeepholeOptimizer.cpp Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/lib/CodeGen/PeepholeOptimizer.cpp Wed Jan 24 20:23:48 2018 (r328362) @@ -719,15 +719,14 @@ bool PeepholeOptimizer::findNextSource(unsigned Reg, u CurSrcPair = Pair; ValueTracker ValTracker(CurSrcPair.Reg, CurSrcPair.SubReg, *MRI, !DisableAdvCopyOpt, TII); - ValueTrackerResult Res; - bool ShouldRewrite = false; - do { - // Follow the chain of copies until we reach the top of the use-def chain - // or find a more suitable source. - Res = ValTracker.getNextSource(); + // Follow the chain of copies until we find a more suitable source, a phi + // or have to abort. + while (true) { + ValueTrackerResult Res = ValTracker.getNextSource(); + // Abort at the end of a chain (without finding a suitable source). if (!Res.isValid()) - break; + return false; // Insert the Def -> Use entry for the recently found source. ValueTrackerResult CurSrcRes = RewriteMap.lookup(CurSrcPair); @@ -763,26 +762,21 @@ bool PeepholeOptimizer::findNextSource(unsigned Reg, u if (TargetRegisterInfo::isPhysicalRegister(CurSrcPair.Reg)) return false; + // Keep following the chain if the value isn't any better yet. const TargetRegisterClass *SrcRC = MRI->getRegClass(CurSrcPair.Reg); - ShouldRewrite = TRI->shouldRewriteCopySrc(DefRC, SubReg, SrcRC, - CurSrcPair.SubReg); - } while (!ShouldRewrite); + if (!TRI->shouldRewriteCopySrc(DefRC, SubReg, SrcRC, CurSrcPair.SubReg)) + continue; - // Continue looking for new sources... - if (Res.isValid()) - continue; + // We currently cannot deal with subreg operands on PHI instructions + // (see insertPHI()). + if (PHICount > 0 && CurSrcPair.SubReg != 0) + continue; - // Do not continue searching for a new source if the there's at least - // one use-def which cannot be rewritten. - if (!ShouldRewrite) - return false; + // We found a suitable source, and are done with this chain. + break; + } } - if (PHICount >= RewritePHILimit) { - DEBUG(dbgs() << "findNextSource: PHI limit reached\n"); - return false; - } - // If we did not find a more suitable source, there is nothing to optimize. return CurSrcPair.Reg != Reg; } @@ -799,6 +793,9 @@ insertPHI(MachineRegisterInfo *MRI, const TargetInstrI assert(!SrcRegs.empty() && "No sources to create a PHI instruction?"); const TargetRegisterClass *NewRC = MRI->getRegClass(SrcRegs[0].Reg); + // NewRC is only correct if no subregisters are involved. findNextSource() + // should have rejected those cases already. + assert(SrcRegs[0].SubReg == 0 && "should not have subreg operand"); unsigned NewVR = MRI->createVirtualRegister(NewRC); MachineBasicBlock *MBB = OrigPHI->getParent(); MachineInstrBuilder MIB = BuildMI(*MBB, OrigPHI, OrigPHI->getDebugLoc(), Modified: vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/DAGCombiner.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Jan 24 20:23:48 2018 (r328362) @@ -3842,9 +3842,16 @@ bool DAGCombiner::SearchForAndLoads(SDNode *N, EVT ExtVT; if (isAndLoadExtLoad(Mask, Load, Load->getValueType(0), ExtVT) && isLegalNarrowLoad(Load, ISD::ZEXTLOAD, ExtVT)) { - // Only add this load if we can make it more narrow. - if (ExtVT.bitsLT(Load->getMemoryVT())) + + // ZEXTLOAD is already small enough. + if (Load->getExtensionType() == ISD::ZEXTLOAD && + ExtVT.bitsGE(Load->getMemoryVT())) + continue; + + // Use LE to convert equal sized loads to zext. + if (ExtVT.bitsLE(Load->getMemoryVT())) Loads.insert(Load); + continue; } return false; @@ -3899,11 +3906,13 @@ bool DAGCombiner::BackwardsPropagateMask(SDNode *N, Se if (Loads.size() == 0) return false; + DEBUG(dbgs() << "Backwards propagate AND: "; N->dump()); SDValue MaskOp = N->getOperand(1); // If it exists, fixup the single node we allow in the tree that needs // masking. if (FixupNode) { + DEBUG(dbgs() << "First, need to fix up: "; FixupNode->dump()); SDValue And = DAG.getNode(ISD::AND, SDLoc(FixupNode), FixupNode->getValueType(0), SDValue(FixupNode, 0), MaskOp); @@ -3914,14 +3923,21 @@ bool DAGCombiner::BackwardsPropagateMask(SDNode *N, Se // Narrow any constants that need it. for (auto *LogicN : NodesWithConsts) { - auto *C = cast(LogicN->getOperand(1)); - SDValue And = DAG.getNode(ISD::AND, SDLoc(C), C->getValueType(0), - SDValue(C, 0), MaskOp); - DAG.UpdateNodeOperands(LogicN, LogicN->getOperand(0), And); + SDValue Op0 = LogicN->getOperand(0); + SDValue Op1 = LogicN->getOperand(1); + + if (isa(Op0)) + std::swap(Op0, Op1); + + SDValue And = DAG.getNode(ISD::AND, SDLoc(Op1), Op1.getValueType(), + Op1, MaskOp); + + DAG.UpdateNodeOperands(LogicN, Op0, And); } // Create narrow loads. for (auto *Load : Loads) { + DEBUG(dbgs() << "Propagate AND back to: "; Load->dump()); SDValue And = DAG.getNode(ISD::AND, SDLoc(Load), Load->getValueType(0), SDValue(Load, 0), MaskOp); DAG.ReplaceAllUsesOfValueWith(SDValue(Load, 0), And); @@ -5209,7 +5225,7 @@ SDValue DAGCombiner::MatchLoadCombine(SDNode *N) { return SDValue(); // Loads must share the same base address - BaseIndexOffset Ptr = BaseIndexOffset::match(L->getBasePtr(), DAG); + BaseIndexOffset Ptr = BaseIndexOffset::match(L, DAG); int64_t ByteOffsetFromBase = 0; if (!Base) Base = Ptr; @@ -12928,7 +12944,7 @@ void DAGCombiner::getStoreMergeCandidates( StoreSDNode *St, SmallVectorImpl &StoreNodes) { // This holds the base pointer, index, and the offset in bytes from the base // pointer. - BaseIndexOffset BasePtr = BaseIndexOffset::match(St->getBasePtr(), DAG); + BaseIndexOffset BasePtr = BaseIndexOffset::match(St, DAG); EVT MemVT = St->getMemoryVT(); SDValue Val = peekThroughBitcast(St->getValue()); @@ -12949,7 +12965,7 @@ void DAGCombiner::getStoreMergeCandidates( EVT LoadVT; if (IsLoadSrc) { auto *Ld = cast(Val); - LBasePtr = BaseIndexOffset::match(Ld->getBasePtr(), DAG); + LBasePtr = BaseIndexOffset::match(Ld, DAG); LoadVT = Ld->getMemoryVT(); // Load and store should be the same type. if (MemVT != LoadVT) @@ -12968,7 +12984,7 @@ void DAGCombiner::getStoreMergeCandidates( return false; // The Load's Base Ptr must also match if (LoadSDNode *OtherLd = dyn_cast(Val)) { - auto LPtr = BaseIndexOffset::match(OtherLd->getBasePtr(), DAG); + auto LPtr = BaseIndexOffset::match(OtherLd, DAG); if (LoadVT != OtherLd->getMemoryVT()) return false; if (!(LBasePtr.equalBaseIndex(LPtr, DAG))) @@ -12992,7 +13008,7 @@ void DAGCombiner::getStoreMergeCandidates( Val.getOpcode() != ISD::EXTRACT_SUBVECTOR) return false; } - Ptr = BaseIndexOffset::match(Other->getBasePtr(), DAG); + Ptr = BaseIndexOffset::match(Other, DAG); return (BasePtr.equalBaseIndex(Ptr, DAG, Offset)); }; @@ -13365,7 +13381,7 @@ bool DAGCombiner::MergeConsecutiveStores(StoreSDNode * if (Ld->getMemoryVT() != MemVT) break; - BaseIndexOffset LdPtr = BaseIndexOffset::match(Ld->getBasePtr(), DAG); + BaseIndexOffset LdPtr = BaseIndexOffset::match(Ld, DAG); // If this is not the first ptr that we check. int64_t LdOffset = 0; if (LdBasePtr.getBase().getNode()) { @@ -17432,44 +17448,46 @@ bool DAGCombiner::isAlias(LSBaseSDNode *Op0, LSBaseSDN unsigned NumBytes1 = Op1->getMemoryVT().getStoreSize(); // Check for BaseIndexOffset matching. - BaseIndexOffset BasePtr0 = BaseIndexOffset::match(Op0->getBasePtr(), DAG); - BaseIndexOffset BasePtr1 = BaseIndexOffset::match(Op1->getBasePtr(), DAG); + BaseIndexOffset BasePtr0 = BaseIndexOffset::match(Op0, DAG); + BaseIndexOffset BasePtr1 = BaseIndexOffset::match(Op1, DAG); int64_t PtrDiff; - if (BasePtr0.equalBaseIndex(BasePtr1, DAG, PtrDiff)) - return !((NumBytes0 <= PtrDiff) || (PtrDiff + NumBytes1 <= 0)); + if (BasePtr0.getBase().getNode() && BasePtr1.getBase().getNode()) { + if (BasePtr0.equalBaseIndex(BasePtr1, DAG, PtrDiff)) + return !((NumBytes0 <= PtrDiff) || (PtrDiff + NumBytes1 <= 0)); - // If both BasePtr0 and BasePtr1 are FrameIndexes, we will not be - // able to calculate their relative offset if at least one arises - // from an alloca. However, these allocas cannot overlap and we - // can infer there is no alias. - if (auto *A = dyn_cast(BasePtr0.getBase())) - if (auto *B = dyn_cast(BasePtr1.getBase())) { - MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo(); - // If the base are the same frame index but the we couldn't find a - // constant offset, (indices are different) be conservative. - if (A != B && (!MFI.isFixedObjectIndex(A->getIndex()) || - !MFI.isFixedObjectIndex(B->getIndex()))) - return false; - } + // If both BasePtr0 and BasePtr1 are FrameIndexes, we will not be + // able to calculate their relative offset if at least one arises + // from an alloca. However, these allocas cannot overlap and we + // can infer there is no alias. + if (auto *A = dyn_cast(BasePtr0.getBase())) + if (auto *B = dyn_cast(BasePtr1.getBase())) { + MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo(); + // If the base are the same frame index but the we couldn't find a + // constant offset, (indices are different) be conservative. + if (A != B && (!MFI.isFixedObjectIndex(A->getIndex()) || + !MFI.isFixedObjectIndex(B->getIndex()))) + return false; + } - bool IsFI0 = isa(BasePtr0.getBase()); - bool IsFI1 = isa(BasePtr1.getBase()); - bool IsGV0 = isa(BasePtr0.getBase()); - bool IsGV1 = isa(BasePtr1.getBase()); - bool IsCV0 = isa(BasePtr0.getBase()); - bool IsCV1 = isa(BasePtr1.getBase()); + bool IsFI0 = isa(BasePtr0.getBase()); + bool IsFI1 = isa(BasePtr1.getBase()); + bool IsGV0 = isa(BasePtr0.getBase()); + bool IsGV1 = isa(BasePtr1.getBase()); + bool IsCV0 = isa(BasePtr0.getBase()); + bool IsCV1 = isa(BasePtr1.getBase()); - // If of mismatched base types or checkable indices we can check - // they do not alias. - if ((BasePtr0.getIndex() == BasePtr1.getIndex() || (IsFI0 != IsFI1) || - (IsGV0 != IsGV1) || (IsCV0 != IsCV1)) && - (IsFI0 || IsGV0 || IsCV0) && (IsFI1 || IsGV1 || IsCV1)) - return false; + // If of mismatched base types or checkable indices we can check + // they do not alias. + if ((BasePtr0.getIndex() == BasePtr1.getIndex() || (IsFI0 != IsFI1) || + (IsGV0 != IsGV1) || (IsCV0 != IsCV1)) && + (IsFI0 || IsGV0 || IsCV0) && (IsFI1 || IsGV1 || IsCV1)) + return false; + } - // If we know required SrcValue1 and SrcValue2 have relatively large alignment - // compared to the size and offset of the access, we may be able to prove they - // do not alias. This check is conservative for now to catch cases created by - // splitting vector types. + // If we know required SrcValue1 and SrcValue2 have relatively large + // alignment compared to the size and offset of the access, we may be able + // to prove they do not alias. This check is conservative for now to catch + // cases created by splitting vector types. int64_t SrcValOffset0 = Op0->getSrcValueOffset(); int64_t SrcValOffset1 = Op1->getSrcValueOffset(); unsigned OrigAlignment0 = Op0->getOriginalAlignment(); @@ -17479,8 +17497,8 @@ bool DAGCombiner::isAlias(LSBaseSDNode *Op0, LSBaseSDN int64_t OffAlign0 = SrcValOffset0 % OrigAlignment0; int64_t OffAlign1 = SrcValOffset1 % OrigAlignment1; - // There is no overlap between these relatively aligned accesses of similar - // size. Return no alias. + // There is no overlap between these relatively aligned accesses of + // similar size. Return no alias. if ((OffAlign0 + NumBytes0) <= OffAlign1 || (OffAlign1 + NumBytes1) <= OffAlign0) return false; @@ -17643,7 +17661,7 @@ bool DAGCombiner::findBetterNeighborChains(StoreSDNode // This holds the base pointer, index, and the offset in bytes from the base // pointer. - BaseIndexOffset BasePtr = BaseIndexOffset::match(St->getBasePtr(), DAG); + BaseIndexOffset BasePtr = BaseIndexOffset::match(St, DAG); // We must have a base and an offset. if (!BasePtr.getBase().getNode()) @@ -17669,7 +17687,7 @@ bool DAGCombiner::findBetterNeighborChains(StoreSDNode break; // Find the base pointer and offset for this memory node. - BaseIndexOffset Ptr = BaseIndexOffset::match(Index->getBasePtr(), DAG); + BaseIndexOffset Ptr = BaseIndexOffset::match(Index, DAG); // Check that the base pointer is the same as the original one. if (!BasePtr.equalBaseIndex(Ptr, DAG)) Modified: vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jan 24 20:23:48 2018 (r328362) @@ -2965,12 +2965,12 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) { case ISD::ZERO_EXTEND: LHS = DAG.getNode(ISD::AssertZext, dl, OuterType, Res, DAG.getValueType(AtomicType)); - RHS = DAG.getNode(ISD::ZERO_EXTEND, dl, OuterType, Node->getOperand(2)); + RHS = DAG.getZeroExtendInReg(Node->getOperand(2), dl, AtomicType); ExtRes = LHS; break; case ISD::ANY_EXTEND: LHS = DAG.getZeroExtendInReg(Res, dl, AtomicType); - RHS = DAG.getNode(ISD::ZERO_EXTEND, dl, OuterType, Node->getOperand(2)); + RHS = DAG.getZeroExtendInReg(Node->getOperand(2), dl, AtomicType); break; default: llvm_unreachable("Invalid atomic op extension"); Modified: vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/SelectionDAG.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jan 24 20:23:48 2018 (r328362) @@ -7947,11 +7947,8 @@ bool SelectionDAG::areNonVolatileConsecutiveLoads(Load if (VT.getSizeInBits() / 8 != Bytes) return false; - SDValue Loc = LD->getOperand(1); - SDValue BaseLoc = Base->getOperand(1); - - auto BaseLocDecomp = BaseIndexOffset::match(BaseLoc, *this); - auto LocDecomp = BaseIndexOffset::match(Loc, *this); + auto BaseLocDecomp = BaseIndexOffset::match(Base, *this); + auto LocDecomp = BaseIndexOffset::match(LD, *this); int64_t Offset = 0; if (BaseLocDecomp.equalBaseIndex(LocDecomp, *this, Offset)) Modified: vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp Wed Jan 24 20:23:48 2018 (r328362) @@ -21,6 +21,9 @@ using namespace llvm; bool BaseIndexOffset::equalBaseIndex(BaseIndexOffset &Other, const SelectionDAG &DAG, int64_t &Off) { + // Conservatively fail if we a match failed.. + if (!Base.getNode() || !Other.Base.getNode()) + return false; // Initial Offset difference. Off = Other.Offset - Offset; @@ -72,12 +75,28 @@ bool BaseIndexOffset::equalBaseIndex(BaseIndexOffset & } /// Parses tree in Ptr for base, index, offset addresses. -BaseIndexOffset BaseIndexOffset::match(SDValue Ptr, const SelectionDAG &DAG) { +BaseIndexOffset BaseIndexOffset::match(LSBaseSDNode *N, + const SelectionDAG &DAG) { + SDValue Ptr = N->getBasePtr(); + // (((B + I*M) + c)) + c ... SDValue Base = DAG.getTargetLoweringInfo().unwrapAddress(Ptr); SDValue Index = SDValue(); int64_t Offset = 0; bool IsIndexSignExt = false; + + // pre-inc/pre-dec ops are components of EA. + if (N->getAddressingMode() == ISD::PRE_INC) { + if (auto *C = dyn_cast(N->getOffset())) + Offset += C->getSExtValue(); + else // If unknown, give up now. + return BaseIndexOffset(SDValue(), SDValue(), 0, false); + } else if (N->getAddressingMode() == ISD::PRE_DEC) { + if (auto *C = dyn_cast(N->getOffset())) + Offset -= C->getSExtValue(); + else // If unknown, give up now. + return BaseIndexOffset(SDValue(), SDValue(), 0, false); + } // Consume constant adds & ors with appropriate masking. while (Base->getOpcode() == ISD::ADD || Base->getOpcode() == ISD::OR) { Modified: vendor/llvm/dist-release_60/lib/CodeGen/TargetLoweringBase.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/CodeGen/TargetLoweringBase.cpp Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/lib/CodeGen/TargetLoweringBase.cpp Wed Jan 24 20:23:48 2018 (r328362) @@ -132,9 +132,18 @@ void TargetLoweringBase::InitLibcalls(const Triple &TT setLibcallName(RTLIB::FPEXT_F16_F32, "__extendhfsf2"); setLibcallName(RTLIB::FPROUND_F32_F16, "__truncsfhf2"); - // Darwin 10 and higher has an optimized __bzero. - if (!TT.isMacOSX() || !TT.isMacOSXVersionLT(10, 6) || TT.isArch64Bit()) { - setLibcallName(RTLIB::BZERO, TT.isAArch64() ? "bzero" : "__bzero"); + // Some darwins have an optimized __bzero/bzero function. + switch (TT.getArch()) { + case Triple::x86: + case Triple::x86_64: + if (TT.isMacOSX() && !TT.isMacOSXVersionLT(10, 6)) + setLibcallName(RTLIB::BZERO, "__bzero"); + break; + case Triple::aarch64: + setLibcallName(RTLIB::BZERO, "bzero"); + break; + default: + break; } if (darwinHasSinCos(TT)) { Modified: vendor/llvm/dist-release_60/lib/Linker/IRMover.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Linker/IRMover.cpp Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/lib/Linker/IRMover.cpp Wed Jan 24 20:23:48 2018 (r328362) @@ -954,7 +954,12 @@ Expected IRLinker::linkGlobalValueProto(Gl NewGV->setLinkage(GlobalValue::InternalLinkage); Constant *C = NewGV; - if (DGV) + // Only create a bitcast if necessary. In particular, with + // DebugTypeODRUniquing we may reach metadata in the destination module + // containing a GV from the source module, in which case SGV will be + // the same as DGV and NewGV, and TypeMap.get() will assert since it + // assumes it is being invoked on a type in the source module. + if (DGV && NewGV != SGV) C = ConstantExpr::getBitCast(NewGV, TypeMap.get(SGV->getType())); if (DGV && NewGV != DGV) { Modified: vendor/llvm/dist-release_60/lib/MC/MCCodeView.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/MC/MCCodeView.cpp Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/lib/MC/MCCodeView.cpp Wed Jan 24 20:23:48 2018 (r328362) @@ -76,6 +76,14 @@ bool CodeViewContext::addFile(MCStreamer &OS, unsigned return true; } +MCCVFunctionInfo *CodeViewContext::getCVFunctionInfo(unsigned FuncId) { + if (FuncId >= Functions.size()) + return nullptr; + if (Functions[FuncId].isUnallocatedFunctionInfo()) + return nullptr; + return &Functions[FuncId]; +} + bool CodeViewContext::recordFunctionId(unsigned FuncId) { if (FuncId >= Functions.size()) Functions.resize(FuncId + 1); @@ -245,6 +253,67 @@ void CodeViewContext::emitFileChecksumOffset(MCObjectS MCSymbolRefExpr::create(Files[Idx].ChecksumTableOffset, OS.getContext()); OS.EmitValueImpl(SRE, 4); +} + +void CodeViewContext::addLineEntry(const MCCVLineEntry &LineEntry) { + size_t Offset = MCCVLines.size(); + auto I = MCCVLineStartStop.insert( + {LineEntry.getFunctionId(), {Offset, Offset + 1}}); + if (!I.second) + I.first->second.second = Offset + 1; + MCCVLines.push_back(LineEntry); +} + +std::vector +CodeViewContext::getFunctionLineEntries(unsigned FuncId) { + std::vector FilteredLines; + auto I = MCCVLineStartStop.find(FuncId); + if (I != MCCVLineStartStop.end()) { + MCCVFunctionInfo *SiteInfo = getCVFunctionInfo(FuncId); + for (size_t Idx = I->second.first, End = I->second.second; Idx != End; + ++Idx) { + unsigned LocationFuncId = MCCVLines[Idx].getFunctionId(); + if (LocationFuncId == FuncId) { + // This was a .cv_loc directly for FuncId, so record it. + FilteredLines.push_back(MCCVLines[Idx]); + } else { + // Check if the current location is inlined in this function. If it is, + // synthesize a statement .cv_loc at the original inlined call site. + auto I = SiteInfo->InlinedAtMap.find(LocationFuncId); + if (I != SiteInfo->InlinedAtMap.end()) { + MCCVFunctionInfo::LineInfo &IA = I->second; + // Only add the location if it differs from the previous location. + // Large inlined calls will have many .cv_loc entries and we only need + // one line table entry in the parent function. + if (FilteredLines.empty() || + FilteredLines.back().getFileNum() != IA.File || + FilteredLines.back().getLine() != IA.Line || + FilteredLines.back().getColumn() != IA.Col) { + FilteredLines.push_back(MCCVLineEntry( + MCCVLines[Idx].getLabel(), + MCCVLoc(FuncId, IA.File, IA.Line, IA.Col, false, false))); + } + } + } + } + } + return FilteredLines; +} + +std::pair CodeViewContext::getLineExtent(unsigned FuncId) { + auto I = MCCVLineStartStop.find(FuncId); + // Return an empty extent if there are no cv_locs for this function id. + if (I == MCCVLineStartStop.end()) + return {~0ULL, 0}; + return I->second; +} + +ArrayRef CodeViewContext::getLinesForExtent(size_t L, size_t R) { + if (R <= L) + return None; + if (L >= MCCVLines.size()) + return None; + return makeArrayRef(&MCCVLines[L], R - L); } void CodeViewContext::emitLineTableForFunction(MCObjectStreamer &OS, Modified: vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64InstructionSelector.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64InstructionSelector.cpp Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/lib/Target/AArch64/AArch64InstructionSelector.cpp Wed Jan 24 20:23:48 2018 (r328362) @@ -868,6 +868,40 @@ bool AArch64InstructionSelector::select(MachineInstr & if (OpFlags & AArch64II::MO_GOT) { I.setDesc(TII.get(AArch64::LOADgot)); I.getOperand(1).setTargetFlags(OpFlags); + } else if (TM.getCodeModel() == CodeModel::Large) { + // Materialize the global using movz/movk instructions. + unsigned MovZDstReg = MRI.createVirtualRegister(&AArch64::GPR64RegClass); + auto InsertPt = std::next(I.getIterator()); + auto MovZ = + BuildMI(MBB, InsertPt, I.getDebugLoc(), TII.get(AArch64::MOVZXi)) + .addDef(MovZDstReg); + MovZ->addOperand(MF, I.getOperand(1)); + MovZ->getOperand(1).setTargetFlags(OpFlags | AArch64II::MO_G0 | + AArch64II::MO_NC); + MovZ->addOperand(MF, MachineOperand::CreateImm(0)); + constrainSelectedInstRegOperands(*MovZ, TII, TRI, RBI); + + auto BuildMovK = [&](unsigned SrcReg, unsigned char Flags, + unsigned Offset, unsigned ForceDstReg) { + unsigned DstReg = + ForceDstReg ? ForceDstReg + : MRI.createVirtualRegister(&AArch64::GPR64RegClass); + auto MovI = BuildMI(MBB, InsertPt, MovZ->getDebugLoc(), + TII.get(AArch64::MOVKXi)) + .addDef(DstReg) + .addReg(SrcReg); + MovI->addOperand(MF, MachineOperand::CreateGA( + GV, MovZ->getOperand(1).getOffset(), Flags)); + MovI->addOperand(MF, MachineOperand::CreateImm(Offset)); + constrainSelectedInstRegOperands(*MovI, TII, TRI, RBI); + return DstReg; + }; + unsigned DstReg = BuildMovK(MovZ->getOperand(0).getReg(), + AArch64II::MO_G1 | AArch64II::MO_NC, 16, 0); + DstReg = BuildMovK(DstReg, AArch64II::MO_G2 | AArch64II::MO_NC, 32, 0); + BuildMovK(DstReg, AArch64II::MO_G3, 48, I.getOperand(0).getReg()); + I.eraseFromParent(); + return true; } else { I.setDesc(TII.get(AArch64::MOVaddr)); I.getOperand(1).setTargetFlags(OpFlags | AArch64II::MO_PAGE); Modified: vendor/llvm/dist-release_60/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp Wed Jan 24 20:23:48 2018 (r328362) @@ -821,7 +821,6 @@ namespace llvm { MutableArrayRef NewMask, unsigned Options = None); OpRef packp(ShuffleMask SM, OpRef Va, OpRef Vb, ResultStack &Results, MutableArrayRef NewMask); - OpRef zerous(ShuffleMask SM, OpRef Va, ResultStack &Results); OpRef vmuxs(ArrayRef Bytes, OpRef Va, OpRef Vb, ResultStack &Results); OpRef vmuxp(ArrayRef Bytes, OpRef Va, OpRef Vb, @@ -1137,25 +1136,6 @@ OpRef HvxSelector::packp(ShuffleMask SM, OpRef Va, OpR } return concat(Out[0], Out[1], Results); -} - -OpRef HvxSelector::zerous(ShuffleMask SM, OpRef Va, ResultStack &Results) { - DEBUG_WITH_TYPE("isel", {dbgs() << __func__ << '\n';}); - - int VecLen = SM.Mask.size(); - SmallVector UsedBytes(VecLen); - bool HasUnused = false; - for (int I = 0; I != VecLen; ++I) { - if (SM.Mask[I] != -1) - UsedBytes[I] = 0xFF; - else - HasUnused = true; - } - if (!HasUnused) - return Va; - SDValue B = getVectorConstant(UsedBytes, SDLoc(Results.InpNode)); - Results.push(Hexagon::V6_vand, getSingleVT(MVT::i8), {Va, OpRef(B)}); - return OpRef::res(Results.top()); } OpRef HvxSelector::vmuxs(ArrayRef Bytes, OpRef Va, OpRef Vb, Modified: vendor/llvm/dist-release_60/lib/Target/PowerPC/PPCISelLowering.cpp ============================================================================== --- vendor/llvm/dist-release_60/lib/Target/PowerPC/PPCISelLowering.cpp Wed Jan 24 20:16:48 2018 (r328361) +++ vendor/llvm/dist-release_60/lib/Target/PowerPC/PPCISelLowering.cpp Wed Jan 24 20:23:48 2018 (r328362) @@ -142,6 +142,9 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMa setOperationAction(ISD::BITREVERSE, MVT::i32, Legal); setOperationAction(ISD::BITREVERSE, MVT::i64, Legal); + // Sub-word ATOMIC_CMP_SWAP need to ensure that the input is zero-extended. + setOperationAction(ISD::ATOMIC_CMP_SWAP, MVT::i32, Custom); + // PowerPC has an i16 but no i8 (or i1) SEXTLOAD. for (MVT VT : MVT::integer_valuetypes()) { setLoadExtAction(ISD::SEXTLOAD, VT, MVT::i1, Promote); @@ -1154,6 +1157,8 @@ const char *PPCTargetLowering::getTargetNodeName(unsig *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Jan 24 20:23:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2321DEC3A95; Wed, 24 Jan 2018 20:23:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5FF7E760FB; Wed, 24 Jan 2018 20:23:56 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 295002278C; Wed, 24 Jan 2018 20:23:55 +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 w0OKNsKr042645; Wed, 24 Jan 2018 20:23:54 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKNsr1042644; Wed, 24 Jan 2018 20:23:54 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801242023.w0OKNsr1042644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 24 Jan 2018 20:23:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328363 - vendor/llvm/llvm-release_60-r323338 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm/llvm-release_60-r323338 X-SVN-Commit-Revision: 328363 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:23:57 -0000 Author: dim Date: Wed Jan 24 20:23:54 2018 New Revision: 328363 URL: https://svnweb.freebsd.org/changeset/base/328363 Log: Tag llvm release_60 branch r323338. Added: vendor/llvm/llvm-release_60-r323338/ - copied from r328362, vendor/llvm/dist-release_60/ From owner-svn-src-all@freebsd.org Wed Jan 24 20:25:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF7FEEC3C41; Wed, 24 Jan 2018 20:25:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6CACB76312; Wed, 24 Jan 2018 20:25: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 674F822792; Wed, 24 Jan 2018 20:25:41 +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 w0OKPf2p042816; Wed, 24 Jan 2018 20:25:41 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKPbbH042776; Wed, 24 Jan 2018 20:25:37 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801242025.w0OKPbbH042776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 24 Jan 2018 20:25:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328364 - in vendor/clang/dist-release_60: docs include/clang/Basic include/clang/StaticAnalyzer/Core/BugReporter lib/AST lib/CodeGen lib/Frontend lib/Lex lib/Sema lib/StaticAnalyzer/Ch... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist-release_60: docs include/clang/Basic include/clang/StaticAnalyzer/Core/BugReporter lib/AST lib/CodeGen lib/Frontend lib/Lex lib/Sema lib/StaticAnalyzer/Checkers test/Analysis test... X-SVN-Commit-Revision: 328364 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:25:42 -0000 Author: dim Date: Wed Jan 24 20:25:37 2018 New Revision: 328364 URL: https://svnweb.freebsd.org/changeset/base/328364 Log: Vendor import of clang release_60 branch r323338: https://llvm.org/svn/llvm-project/cfe/branches/release_60@323338 Added: vendor/clang/dist-release_60/docs/OpenMPSupport.rst vendor/clang/dist-release_60/test/CodeCompletion/Inputs/comments.h (contents, props changed) vendor/clang/dist-release_60/test/CodeCompletion/comments.cpp (contents, props changed) vendor/clang/dist-release_60/test/Lexer/null-character-in-literal.c (contents, props changed) vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/ vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/Box.h (contents, props changed) vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/M1.h (contents, props changed) vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/M2.h (contents, props changed) vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/M3.h (contents, props changed) vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/module.modulemap vendor/clang/dist-release_60/test/Modules/odr_hash-Friend.cpp (contents, props changed) vendor/clang/dist-release_60/test/Modules/odr_hash-blocks.cpp (contents, props changed) Deleted: vendor/clang/dist-release_60/test/Sema/_Float128.c Modified: vendor/clang/dist-release_60/docs/ReleaseNotes.rst vendor/clang/dist-release_60/docs/index.rst vendor/clang/dist-release_60/include/clang/Basic/Attr.td vendor/clang/dist-release_60/include/clang/Basic/BuiltinsX86.def vendor/clang/dist-release_60/include/clang/Basic/DiagnosticGroups.td vendor/clang/dist-release_60/include/clang/Basic/TokenKinds.def vendor/clang/dist-release_60/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h vendor/clang/dist-release_60/lib/AST/DeclBase.cpp vendor/clang/dist-release_60/lib/AST/ODRHash.cpp vendor/clang/dist-release_60/lib/CodeGen/CGBuiltin.cpp vendor/clang/dist-release_60/lib/CodeGen/ObjectFilePCHContainerOperations.cpp vendor/clang/dist-release_60/lib/Frontend/InitPreprocessor.cpp vendor/clang/dist-release_60/lib/Lex/Lexer.cpp vendor/clang/dist-release_60/lib/Lex/PPCaching.cpp vendor/clang/dist-release_60/lib/Lex/PPLexerChange.cpp vendor/clang/dist-release_60/lib/Sema/Scope.cpp vendor/clang/dist-release_60/lib/Sema/SemaTemplateDeduction.cpp vendor/clang/dist-release_60/lib/Sema/SemaTemplateInstantiateDecl.cpp vendor/clang/dist-release_60/lib/StaticAnalyzer/Checkers/MallocChecker.cpp vendor/clang/dist-release_60/lib/StaticAnalyzer/Checkers/ValistChecker.cpp vendor/clang/dist-release_60/test/Analysis/malloc.c vendor/clang/dist-release_60/test/CodeGen/builtins-overflow.c vendor/clang/dist-release_60/test/CodeGenCXX/cxx1z-inline-variables.cpp vendor/clang/dist-release_60/test/Modules/ExtDebugInfo.cpp vendor/clang/dist-release_60/test/Modules/Inputs/DebugCXX.h vendor/clang/dist-release_60/test/Modules/ModuleDebugInfo.cpp vendor/clang/dist-release_60/test/Preprocessor/cuda-types.cu vendor/clang/dist-release_60/test/Sema/tautological-constant-compare.c vendor/clang/dist-release_60/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp vendor/clang/dist-release_60/test/SemaTemplate/alignas.cpp vendor/clang/dist-release_60/test/SemaTemplate/cxx17-inline-variables.cpp vendor/clang/dist-release_60/unittests/Lex/LexerTest.cpp Added: vendor/clang/dist-release_60/docs/OpenMPSupport.rst ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_60/docs/OpenMPSupport.rst Wed Jan 24 20:25:37 2018 (r328364) @@ -0,0 +1,68 @@ +.. raw:: html + + + +.. role:: none +.. role:: partial +.. role:: good + +================== +OpenMP Support +================== + +Clang fully supports OpenMP 3.1 + some elements of OpenMP 4.5. Clang supports offloading to X86_64, AArch64 and PPC64[LE] devices. +Support for Cuda devices is not ready yet. +The status of major OpenMP 4.5 features support in Clang. + +Standalone directives +===================== + +* #pragma omp [for] simd: :good:`Complete`. + +* #pragma omp declare simd: :partial:`Partial`. We support parsing/semantic + analysis + generation of special attributes for X86 target, but still + missing the LLVM pass for vectorization. + +* #pragma omp taskloop [simd]: :good:`Complete`. + +* #pragma omp target [enter|exit] data: :good:`Complete`. + +* #pragma omp target update: :good:`Complete`. + +* #pragma omp target: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp declare target: :partial:`Partial`. No full codegen support. + +* #pragma omp teams: :good:`Complete`. + +* #pragma omp distribute [simd]: :good:`Complete`. + +* #pragma omp distribute parallel for [simd]: :good:`Complete`. + +Combined directives +=================== + +* #pragma omp parallel for simd: :good:`Complete`. + +* #pragma omp target parallel: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp target parallel for [simd]: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp target simd: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp target teams: :partial:`Partial`. No support for the `depend` clauses. + +* #pragma omp teams distribute [simd]: :good:`Complete`. + +* #pragma omp target teams distribute [simd]: :partial:`Partial`. No support for the and `depend` clauses. + +* #pragma omp teams distribute parallel for [simd]: :good:`Complete`. + +* #pragma omp target teams distribute parallel for [simd]: :partial:`Partial`. No full codegen support. + +Clang does not support any constructs/updates from upcoming OpenMP 5.0 except for `reduction`-based clauses in the `task` and `target`-based directives. +In addition, the LLVM OpenMP runtime `libomp` supports the OpenMP Tools Interface (OMPT) on x86, x86_64, AArch64, and PPC64 on Linux, Windows, and mac OS. Modified: vendor/clang/dist-release_60/docs/ReleaseNotes.rst ============================================================================== --- vendor/clang/dist-release_60/docs/ReleaseNotes.rst Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/docs/ReleaseNotes.rst Wed Jan 24 20:25:37 2018 (r328364) @@ -163,6 +163,15 @@ Attribute Changes in Clang - The presence of __attribute__((availability(...))) on a declaration no longer implies default visibility for that declaration on macOS. +- Clang now supports configuration files. These are collections of driver + options, which can be applied by specifying the configuration file, either + using command line option `--config foo.cfg` or encoding it into executable + name `foo-clang`. Clang behaves as if the options from this file were inserted + before the options specified in command line. This feature is primary intended + to facilitate cross compilation. Details can be found in + `Clang Compiler User's Manual + `. + - ... Windows Support @@ -209,7 +218,7 @@ OpenCL C Language Changes in Clang OpenMP Support in Clang ---------------------------------- -- Added options `-f[no]-openmp-simd` that support code emission only foe OpenMP +- Added options `-f[no]-openmp-simd` that support code emission only for OpenMP SIMD-based directives, like `#pragma omp simd`, `#pragma omp parallel for simd` etc. The code is emitted only for simd-based part of the combined directives and clauses. @@ -221,6 +230,13 @@ OpenMP Support in Clang - Added support for `reduction`-based clauses on `task`-based directives from upcoming OpenMP 5.0. + +- The LLVM OpenMP runtime `libomp` now supports the OpenMP Tools Interface (OMPT) + on x86, x86_64, AArch64, and PPC64 on Linux, Windows, and macOS. If you observe + a measurable performance impact on one of your applications without a tool + attached, please rebuild the runtime library with `-DLIBOMP_OMPT_SUPPORT=OFF` and + file a bug at `LLVM's Bugzilla `_ or send a message to the + `OpenMP development list `_. Internal API Changes -------------------- Modified: vendor/clang/dist-release_60/docs/index.rst ============================================================================== --- vendor/clang/dist-release_60/docs/index.rst Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/docs/index.rst Wed Jan 24 20:25:37 2018 (r328364) @@ -39,6 +39,7 @@ Using Clang as a Compiler SourceBasedCodeCoverage Modules MSVCCompatibility + OpenMPSupport ThinLTO CommandGuide/index FAQ Modified: vendor/clang/dist-release_60/include/clang/Basic/Attr.td ============================================================================== --- vendor/clang/dist-release_60/include/clang/Basic/Attr.td Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/include/clang/Basic/Attr.td Wed Jan 24 20:25:37 2018 (r328364) @@ -549,6 +549,7 @@ def Aligned : InheritableAttr { Keyword<"_Alignas">]>, Accessor<"isDeclspec",[Declspec<"align">]>]; let Documentation = [Undocumented]; + let DuplicatesAllowedWhileMerging = 1; } def AlignValue : Attr { Modified: vendor/clang/dist-release_60/include/clang/Basic/BuiltinsX86.def ============================================================================== --- vendor/clang/dist-release_60/include/clang/Basic/BuiltinsX86.def Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/include/clang/Basic/BuiltinsX86.def Wed Jan 24 20:25:37 2018 (r328364) @@ -1357,15 +1357,15 @@ TARGET_BUILTIN(__builtin_ia32_vpshrdvw128_maskz, "V8sV TARGET_BUILTIN(__builtin_ia32_vpshrdvw256_maskz, "V16sV16sV16sV16sUs", "", "avx512vl,avx512vbmi2") TARGET_BUILTIN(__builtin_ia32_vpshrdvw512_maskz, "V32sV32sV32sV32sUi", "", "avx512vbmi2") -TARGET_BUILTIN(__builtin_ia32_vpshrdd128_mask, "V4iV4iV4iiV4iUc", "", "avx512vl,avx512vbmi2") -TARGET_BUILTIN(__builtin_ia32_vpshrdd256_mask, "V8iV8iV8iiV8iUc", "", "avx512vl,avx512vbmi2") -TARGET_BUILTIN(__builtin_ia32_vpshrdd512_mask, "V16iV16iV16iiV16iUs", "", "avx512vbmi2") -TARGET_BUILTIN(__builtin_ia32_vpshrdq128_mask, "V2LLiV2LLiV2LLiiV2LLiUc", "", "avx512vl,avx512vbmi2") -TARGET_BUILTIN(__builtin_ia32_vpshrdq256_mask, "V4LLiV4LLiV4LLiiV4LLiUc", "", "avx512vl,avx512vbmi2") -TARGET_BUILTIN(__builtin_ia32_vpshrdq512_mask, "V8LLiV8LLiV8LLiiV8LLiUc", "", "avx512vbmi2") -TARGET_BUILTIN(__builtin_ia32_vpshrdw128_mask, "V8sV8sV8siV8sUc", "", "avx512vl,avx512vbmi2") -TARGET_BUILTIN(__builtin_ia32_vpshrdw256_mask, "V16sV16sV16siV16sUs", "", "avx512vl,avx512vbmi2") -TARGET_BUILTIN(__builtin_ia32_vpshrdw512_mask, "V32sV32sV32siV32sUi", "", "avx512vbmi2") +TARGET_BUILTIN(__builtin_ia32_vpshrdd128_mask, "V4iV4iV4iIiV4iUc", "", "avx512vl,avx512vbmi2") +TARGET_BUILTIN(__builtin_ia32_vpshrdd256_mask, "V8iV8iV8iIiV8iUc", "", "avx512vl,avx512vbmi2") +TARGET_BUILTIN(__builtin_ia32_vpshrdd512_mask, "V16iV16iV16iIiV16iUs", "", "avx512vbmi2") +TARGET_BUILTIN(__builtin_ia32_vpshrdq128_mask, "V2LLiV2LLiV2LLiIiV2LLiUc", "", "avx512vl,avx512vbmi2") +TARGET_BUILTIN(__builtin_ia32_vpshrdq256_mask, "V4LLiV4LLiV4LLiIiV4LLiUc", "", "avx512vl,avx512vbmi2") +TARGET_BUILTIN(__builtin_ia32_vpshrdq512_mask, "V8LLiV8LLiV8LLiIiV8LLiUc", "", "avx512vbmi2") +TARGET_BUILTIN(__builtin_ia32_vpshrdw128_mask, "V8sV8sV8sIiV8sUc", "", "avx512vl,avx512vbmi2") +TARGET_BUILTIN(__builtin_ia32_vpshrdw256_mask, "V16sV16sV16sIiV16sUs", "", "avx512vl,avx512vbmi2") +TARGET_BUILTIN(__builtin_ia32_vpshrdw512_mask, "V32sV32sV32sIiV32sUi", "", "avx512vbmi2") TARGET_BUILTIN(__builtin_ia32_pmovswb512_mask, "V32cV32sV32cUi", "", "avx512bw") TARGET_BUILTIN(__builtin_ia32_pmovuswb512_mask, "V32cV32sV32cUi", "", "avx512bw") Modified: vendor/clang/dist-release_60/include/clang/Basic/DiagnosticGroups.td ============================================================================== --- vendor/clang/dist-release_60/include/clang/Basic/DiagnosticGroups.td Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/include/clang/Basic/DiagnosticGroups.td Wed Jan 24 20:25:37 2018 (r328364) @@ -444,8 +444,7 @@ def TautologicalInRangeCompare : DiagGroup<"tautologic TautologicalUnsignedEnumZeroCompare]>; def TautologicalOutOfRangeCompare : DiagGroup<"tautological-constant-out-of-range-compare">; def TautologicalConstantCompare : DiagGroup<"tautological-constant-compare", - [TautologicalInRangeCompare, - TautologicalOutOfRangeCompare]>; + [TautologicalOutOfRangeCompare]>; def TautologicalPointerCompare : DiagGroup<"tautological-pointer-compare">; def TautologicalOverlapCompare : DiagGroup<"tautological-overlap-compare">; def TautologicalUndefinedCompare : DiagGroup<"tautological-undefined-compare">; @@ -719,7 +718,6 @@ def IntToPointerCast : DiagGroup<"int-to-pointer-cast" def Move : DiagGroup<"move", [PessimizingMove, RedundantMove, SelfMove]>; def Extra : DiagGroup<"extra", [ - TautologicalInRangeCompare, MissingFieldInitializers, IgnoredQualifiers, InitializerOverrides, Modified: vendor/clang/dist-release_60/include/clang/Basic/TokenKinds.def ============================================================================== --- vendor/clang/dist-release_60/include/clang/Basic/TokenKinds.def Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/include/clang/Basic/TokenKinds.def Wed Jan 24 20:25:37 2018 (r328364) @@ -398,7 +398,6 @@ TYPE_TRAIT_2(__builtin_types_compatible_p, TypeCompati KEYWORD(__builtin_va_arg , KEYALL) KEYWORD(__extension__ , KEYALL) KEYWORD(__float128 , KEYALL) -ALIAS("_Float128", __float128 , KEYNOCXX) KEYWORD(__imag , KEYALL) KEYWORD(__int128 , KEYALL) KEYWORD(__label__ , KEYALL) Modified: vendor/clang/dist-release_60/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h ============================================================================== --- vendor/clang/dist-release_60/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h Wed Jan 24 20:25:37 2018 (r328364) @@ -32,27 +32,39 @@ class BugType { (private) const CheckName Check; const std::string Name; const std::string Category; - bool SuppressonSink; + const CheckerBase *Checker; + bool SuppressOnSink; virtual void anchor(); + public: - BugType(class CheckName check, StringRef name, StringRef cat) - : Check(check), Name(name), Category(cat), SuppressonSink(false) {} - BugType(const CheckerBase *checker, StringRef name, StringRef cat) - : Check(checker->getCheckName()), Name(name), Category(cat), - SuppressonSink(false) {} - virtual ~BugType() {} + BugType(CheckName Check, StringRef Name, StringRef Cat) + : Check(Check), Name(Name), Category(Cat), Checker(nullptr), + SuppressOnSink(false) {} + BugType(const CheckerBase *Checker, StringRef Name, StringRef Cat) + : Check(Checker->getCheckName()), Name(Name), Category(Cat), + Checker(Checker), SuppressOnSink(false) {} + virtual ~BugType() = default; - // FIXME: Should these be made strings as well? StringRef getName() const { return Name; } StringRef getCategory() const { return Category; } - StringRef getCheckName() const { return Check.getName(); } + StringRef getCheckName() const { + // FIXME: This is a workaround to ensure that the correct check name is used + // The check names are set after the constructors are run. + // In case the BugType object is initialized in the checker's ctor + // the Check field will be empty. To circumvent this problem we use + // CheckerBase whenever it is possible. + StringRef CheckName = + Checker ? Checker->getCheckName().getName() : Check.getName(); + assert(!CheckName.empty() && "Check name is not set properly."); + return CheckName; + } /// isSuppressOnSink - Returns true if bug reports associated with this bug /// type should be suppressed if the end node of the report is post-dominated /// by a sink node. - bool isSuppressOnSink() const { return SuppressonSink; } - void setSuppressOnSink(bool x) { SuppressonSink = x; } + bool isSuppressOnSink() const { return SuppressOnSink; } + void setSuppressOnSink(bool x) { SuppressOnSink = x; } virtual void FlushReports(BugReporter& BR); }; @@ -74,7 +86,7 @@ class BuiltinBug : public BugType { (public) StringRef getDescription() const { return desc; } }; -} // end GR namespace +} // end ento namespace } // end clang namespace #endif Modified: vendor/clang/dist-release_60/lib/AST/DeclBase.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/AST/DeclBase.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/lib/AST/DeclBase.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -891,12 +891,14 @@ bool Decl::AccessDeclContextSanity() const { // 4. the context is not a record // 5. it's invalid // 6. it's a C++0x static_assert. + // 7. it's a block literal declaration if (isa(this) || isa(this) || isa(this) || !isa(getDeclContext()) || isInvalidDecl() || isa(this) || + isa(this) || // FIXME: a ParmVarDecl can have ClassTemplateSpecialization // as DeclContext (?). isa(this) || Modified: vendor/clang/dist-release_60/lib/AST/ODRHash.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/AST/ODRHash.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/lib/AST/ODRHash.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -478,6 +478,8 @@ void ODRHash::AddFunctionDecl(const FunctionDecl *Func // TODO: Fix hashing for class methods. if (isa(Function)) return; + // And friend functions. + if (Function->getFriendObjectKind()) return; // Skip functions that are specializations or in specialization context. const DeclContext *DC = Function; Modified: vendor/clang/dist-release_60/lib/CodeGen/CGBuiltin.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/CodeGen/CGBuiltin.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/lib/CodeGen/CGBuiltin.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -915,7 +915,11 @@ EmitCheckedMixedSignMultiply(CodeGenFunction &CGF, con Overflow = CGF.Builder.CreateOr(Overflow, TruncOverflow); } - Result = CGF.Builder.CreateTrunc(UnsignedResult, ResTy); + // Negate the product if it would be negative in infinite precision. + Result = CGF.Builder.CreateSelect( + IsNegative, CGF.Builder.CreateNeg(UnsignedResult), UnsignedResult); + + Result = CGF.Builder.CreateTrunc(Result, ResTy); } assert(Overflow && Result && "Missing overflow or result"); Modified: vendor/clang/dist-release_60/lib/CodeGen/ObjectFilePCHContainerOperations.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -229,6 +229,11 @@ class PCHContainerGenerator : public ASTConsumer { (pu Builder->getModuleDebugInfo()->completeRequiredType(RD); } + void HandleImplicitImportDecl(ImportDecl *D) override { + if (!D->getImportedOwningModule()) + Builder->getModuleDebugInfo()->EmitImportDecl(*D); + } + /// Emit a container holding the serialized AST. void HandleTranslationUnit(ASTContext &Ctx) override { assert(M && VMContext && Builder); Modified: vendor/clang/dist-release_60/lib/Frontend/InitPreprocessor.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/Frontend/InitPreprocessor.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/lib/Frontend/InitPreprocessor.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -817,10 +817,6 @@ static void InitializePredefinedMacros(const TargetInf DefineFloatMacros(Builder, "FLT", &TI.getFloatFormat(), "F"); DefineFloatMacros(Builder, "DBL", &TI.getDoubleFormat(), ""); DefineFloatMacros(Builder, "LDBL", &TI.getLongDoubleFormat(), "L"); - if (TI.hasFloat128Type()) - // FIXME: Switch away from the non-standard "Q" when we can - DefineFloatMacros(Builder, "FLT128", &TI.getFloat128Format(), "Q"); - // Define a __POINTER_WIDTH__ macro for stdint.h. Builder.defineMacro("__POINTER_WIDTH__", Modified: vendor/clang/dist-release_60/lib/Lex/Lexer.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/Lex/Lexer.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/lib/Lex/Lexer.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -2009,18 +2009,21 @@ bool Lexer::LexAngledStringLiteral(Token &Result, cons const char *AfterLessPos = CurPtr; char C = getAndAdvanceChar(CurPtr, Result); while (C != '>') { - // Skip escaped characters. - if (C == '\\' && CurPtr < BufferEnd) { - // Skip the escaped character. - getAndAdvanceChar(CurPtr, Result); - } else if (C == '\n' || C == '\r' || // Newline. - (C == 0 && (CurPtr-1 == BufferEnd || // End of file. - isCodeCompletionPoint(CurPtr-1)))) { + // Skip escaped characters. Escaped newlines will already be processed by + // getAndAdvanceChar. + if (C == '\\') + C = getAndAdvanceChar(CurPtr, Result); + + if (C == '\n' || C == '\r' || // Newline. + (C == 0 && (CurPtr-1 == BufferEnd || // End of file. + isCodeCompletionPoint(CurPtr-1)))) { // If the filename is unterminated, then it must just be a lone < // character. Return this as such. FormTokenWithChars(Result, AfterLessPos, tok::less); return true; - } else if (C == 0) { + } + + if (C == 0) { NulCharacter = CurPtr-1; } C = getAndAdvanceChar(CurPtr, Result); Modified: vendor/clang/dist-release_60/lib/Lex/PPCaching.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/Lex/PPCaching.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/lib/Lex/PPCaching.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -105,8 +105,10 @@ void Preprocessor::CachingLex(Token &Result) { } void Preprocessor::EnterCachingLexMode() { - if (InCachingLexMode()) + if (InCachingLexMode()) { + assert(CurLexerKind == CLK_CachingLexer && "Unexpected lexer kind"); return; + } PushIncludeMacroStack(); CurLexerKind = CLK_CachingLexer; Modified: vendor/clang/dist-release_60/lib/Lex/PPLexerChange.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/Lex/PPLexerChange.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/lib/Lex/PPLexerChange.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -444,6 +444,7 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool } CurPPLexer = nullptr; + recomputeCurLexerKind(); return true; } Modified: vendor/clang/dist-release_60/lib/Sema/Scope.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/Sema/Scope.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/lib/Sema/Scope.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -143,72 +143,43 @@ void Scope::dumpImpl(raw_ostream &OS) const { if (HasFlags) OS << "Flags: "; - while (Flags) { - if (Flags & FnScope) { - OS << "FnScope"; - Flags &= ~FnScope; - } else if (Flags & BreakScope) { - OS << "BreakScope"; - Flags &= ~BreakScope; - } else if (Flags & ContinueScope) { - OS << "ContinueScope"; - Flags &= ~ContinueScope; - } else if (Flags & DeclScope) { - OS << "DeclScope"; - Flags &= ~DeclScope; - } else if (Flags & ControlScope) { - OS << "ControlScope"; - Flags &= ~ControlScope; - } else if (Flags & ClassScope) { - OS << "ClassScope"; - Flags &= ~ClassScope; - } else if (Flags & BlockScope) { - OS << "BlockScope"; - Flags &= ~BlockScope; - } else if (Flags & TemplateParamScope) { - OS << "TemplateParamScope"; - Flags &= ~TemplateParamScope; - } else if (Flags & FunctionPrototypeScope) { - OS << "FunctionPrototypeScope"; - Flags &= ~FunctionPrototypeScope; - } else if (Flags & FunctionDeclarationScope) { - OS << "FunctionDeclarationScope"; - Flags &= ~FunctionDeclarationScope; - } else if (Flags & AtCatchScope) { - OS << "AtCatchScope"; - Flags &= ~AtCatchScope; - } else if (Flags & ObjCMethodScope) { - OS << "ObjCMethodScope"; - Flags &= ~ObjCMethodScope; - } else if (Flags & SwitchScope) { - OS << "SwitchScope"; - Flags &= ~SwitchScope; - } else if (Flags & TryScope) { - OS << "TryScope"; - Flags &= ~TryScope; - } else if (Flags & FnTryCatchScope) { - OS << "FnTryCatchScope"; - Flags &= ~FnTryCatchScope; - } else if (Flags & SEHTryScope) { - OS << "SEHTryScope"; - Flags &= ~SEHTryScope; - } else if (Flags & SEHExceptScope) { - OS << "SEHExceptScope"; - Flags &= ~SEHExceptScope; - } else if (Flags & OpenMPDirectiveScope) { - OS << "OpenMPDirectiveScope"; - Flags &= ~OpenMPDirectiveScope; - } else if (Flags & OpenMPLoopDirectiveScope) { - OS << "OpenMPLoopDirectiveScope"; - Flags &= ~OpenMPLoopDirectiveScope; - } else if (Flags & OpenMPSimdDirectiveScope) { - OS << "OpenMPSimdDirectiveScope"; - Flags &= ~OpenMPSimdDirectiveScope; - } + std::pair FlagInfo[] = { + {FnScope, "FnScope"}, + {BreakScope, "BreakScope"}, + {ContinueScope, "ContinueScope"}, + {DeclScope, "DeclScope"}, + {ControlScope, "ControlScope"}, + {ClassScope, "ClassScope"}, + {BlockScope, "BlockScope"}, + {TemplateParamScope, "TemplateParamScope"}, + {FunctionPrototypeScope, "FunctionPrototypeScope"}, + {FunctionDeclarationScope, "FunctionDeclarationScope"}, + {AtCatchScope, "AtCatchScope"}, + {ObjCMethodScope, "ObjCMethodScope"}, + {SwitchScope, "SwitchScope"}, + {TryScope, "TryScope"}, + {FnTryCatchScope, "FnTryCatchScope"}, + {OpenMPDirectiveScope, "OpenMPDirectiveScope"}, + {OpenMPLoopDirectiveScope, "OpenMPLoopDirectiveScope"}, + {OpenMPSimdDirectiveScope, "OpenMPSimdDirectiveScope"}, + {EnumScope, "EnumScope"}, + {SEHTryScope, "SEHTryScope"}, + {SEHExceptScope, "SEHExceptScope"}, + {SEHFilterScope, "SEHFilterScope"}, + {CompoundStmtScope, "CompoundStmtScope"}, + {ClassInheritanceScope, "ClassInheritanceScope"}}; - if (Flags) - OS << " | "; + for (auto Info : FlagInfo) { + if (Flags & Info.first) { + OS << Info.second; + Flags &= ~Info.first; + if (Flags) + OS << " | "; + } } + + assert(Flags == 0 && "Unknown scope flags"); + if (HasFlags) OS << '\n'; Modified: vendor/clang/dist-release_60/lib/Sema/SemaTemplateDeduction.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/Sema/SemaTemplateDeduction.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/lib/Sema/SemaTemplateDeduction.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -502,6 +502,10 @@ DeduceTemplateArguments(Sema &S, SmallVectorImpl &Deduced) { assert(Arg.isCanonical() && "Argument type must be canonical"); + // Treat an injected-class-name as its underlying template-id. + if (auto *Injected = dyn_cast(Arg)) + Arg = Injected->getInjectedSpecializationType(); + // Check whether the template argument is a dependent template-id. if (const TemplateSpecializationType *SpecArg = dyn_cast(Arg)) { Modified: vendor/clang/dist-release_60/lib/Sema/SemaTemplateInstantiateDecl.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/Sema/SemaTemplateInstantiateDecl.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/lib/Sema/SemaTemplateInstantiateDecl.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -4160,7 +4160,8 @@ void Sema::BuildVariableInstantiation( // it right away if the type contains 'auto'. if ((!isa(NewVar) && !InstantiatingVarTemplate && - !(OldVar->isInline() && OldVar->isThisDeclarationADefinition())) || + !(OldVar->isInline() && OldVar->isThisDeclarationADefinition() && + !NewVar->isThisDeclarationADefinition())) || NewVar->getType()->isUndeducedType()) InstantiateVariableInitializer(NewVar, OldVar, TemplateArgs); Modified: vendor/clang/dist-release_60/lib/StaticAnalyzer/Checkers/MallocChecker.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -2900,8 +2900,13 @@ void ento::registerNewDeleteLeaksChecker(CheckerManage mgr.getCurrentCheckName(); // We currently treat NewDeleteLeaks checker as a subchecker of NewDelete // checker. - if (!checker->ChecksEnabled[MallocChecker::CK_NewDeleteChecker]) + if (!checker->ChecksEnabled[MallocChecker::CK_NewDeleteChecker]) { checker->ChecksEnabled[MallocChecker::CK_NewDeleteChecker] = true; + // FIXME: This does not set the correct name, but without this workaround + // no name will be set at all. + checker->CheckNames[MallocChecker::CK_NewDeleteChecker] = + mgr.getCurrentCheckName(); + } } #define REGISTER_CHECKER(name) \ Modified: vendor/clang/dist-release_60/lib/StaticAnalyzer/Checkers/ValistChecker.cpp ============================================================================== --- vendor/clang/dist-release_60/lib/StaticAnalyzer/Checkers/ValistChecker.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/lib/StaticAnalyzer/Checkers/ValistChecker.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -64,7 +64,7 @@ class ValistChecker : public CheckersetSuppressOnSink(true); } @@ -375,7 +379,7 @@ void ValistChecker::checkVAListEndCall(const CallEvent std::shared_ptr ValistChecker::ValistBugVisitor::VisitNode( const ExplodedNode *N, const ExplodedNode *PrevN, BugReporterContext &BRC, - BugReport &BR) { + BugReport &) { ProgramStateRef State = N->getState(); ProgramStateRef StatePrev = PrevN->getState(); Modified: vendor/clang/dist-release_60/test/Analysis/malloc.c ============================================================================== --- vendor/clang/dist-release_60/test/Analysis/malloc.c Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/test/Analysis/malloc.c Wed Jan 24 20:25:37 2018 (r328364) @@ -1720,13 +1720,6 @@ void *smallocWarn(size_t size) { } } -char *dupstrWarn(const char *s) { - const int len = strlen(s); - char *p = (char*) smallocWarn(len + 1); - strcpy(p, s); // expected-warning{{String copy function overflows destination buffer}} - return p; -} - int *radar15580979() { int *data = (int *)malloc(32); int *p = data ?: (int*)malloc(32); // no warning Added: vendor/clang/dist-release_60/test/CodeCompletion/Inputs/comments.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_60/test/CodeCompletion/Inputs/comments.h Wed Jan 24 20:25:37 2018 (r328364) @@ -0,0 +1,4 @@ +// PR32732 +struct B { + // <- code completion +}; Added: vendor/clang/dist-release_60/test/CodeCompletion/comments.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_60/test/CodeCompletion/comments.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -0,0 +1,13 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +#include "comments.h" + +struct A { + // <- code completion + /* <- code completion */ +}; + +// RUN: %clang_cc1 -I %S/Inputs -fsyntax-only -code-completion-at=%s:7:6 %s +// RUN: %clang_cc1 -I %S/Inputs -fsyntax-only -code-completion-at=%s:8:6 %s +// RUN: %clang_cc1 -I %S/Inputs -fsyntax-only -code-completion-at=%S/Inputs/comments.h:3:6 %s Modified: vendor/clang/dist-release_60/test/CodeGen/builtins-overflow.c ============================================================================== --- vendor/clang/dist-release_60/test/CodeGen/builtins-overflow.c Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/test/CodeGen/builtins-overflow.c Wed Jan 24 20:25:37 2018 (r328364) @@ -373,7 +373,9 @@ int test_mixed_sign_mull_overflow_unsigned(int x, unsi // CHECK-NEXT: [[NotNull:%.*]] = icmp ne i32 [[UnsignedResult]], 0 // CHECK-NEXT: [[Underflow:%.*]] = and i1 [[IsNeg]], [[NotNull]] // CHECK-NEXT: [[OFlow:%.*]] = or i1 [[UnsignedOFlow]], [[Underflow]] -// CHECK-NEXT: store i32 [[UnsignedResult]], i32* %{{.*}}, align 4 +// CHECK-NEXT: [[NegatedResult:%.*]] = sub i32 0, [[UnsignedResult]] +// CHECK-NEXT: [[Result:%.*]] = select i1 [[IsNeg]], i32 [[NegatedResult]], i32 [[UnsignedResult]] +// CHECK-NEXT: store i32 [[Result]], i32* %{{.*}}, align 4 // CHECK: br i1 [[OFlow]] unsigned result; @@ -432,7 +434,9 @@ long long test_mixed_sign_mulll_overflow_trunc_unsigne // CHECK-NEXT: [[OVERFLOW_PRE_TRUNC:%.*]] = or i1 {{.*}}, [[UNDERFLOW]] // CHECK-NEXT: [[TRUNC_OVERFLOW:%.*]] = icmp ugt i64 [[UNSIGNED_RESULT]], 4294967295 // CHECK-NEXT: [[OVERFLOW:%.*]] = or i1 [[OVERFLOW_PRE_TRUNC]], [[TRUNC_OVERFLOW]] -// CHECK-NEXT: trunc i64 [[UNSIGNED_RESULT]] to i32 +// CHECK-NEXT: [[NEGATED:%.*]] = sub i64 0, [[UNSIGNED_RESULT]] +// CHECK-NEXT: [[RESULT:%.*]] = select i1 {{.*}}, i64 [[NEGATED]], i64 [[UNSIGNED_RESULT]] +// CHECK-NEXT: trunc i64 [[RESULT]] to i32 // CHECK-NEXT: store unsigned result; if (__builtin_mul_overflow(y, x, &result)) Modified: vendor/clang/dist-release_60/test/CodeGenCXX/cxx1z-inline-variables.cpp ============================================================================== --- vendor/clang/dist-release_60/test/CodeGenCXX/cxx1z-inline-variables.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/test/CodeGenCXX/cxx1z-inline-variables.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -58,14 +58,22 @@ template struct X { static int a; static inline int b; static int c; + static const int d; + static int e; }; // CHECK: @_ZN1XIiE1aE = linkonce_odr global i32 10 // CHECK: @_ZN1XIiE1bE = global i32 20 // CHECK-NOT: @_ZN1XIiE1cE +// CHECK: @_ZN1XIiE1dE = linkonce_odr constant i32 40 +// CHECK: @_ZN1XIiE1eE = linkonce_odr global i32 50 template<> inline int X::a = 10; int &use3 = X::a; template<> int X::b = 20; template<> inline int X::c = 30; +template constexpr int X::d = 40; +template inline int X::e = 50; +const int *use_x_int_d = &X::d; +const int *use_x_int_e = &X::e; template struct Y; template<> struct Y { Added: vendor/clang/dist-release_60/test/Lexer/null-character-in-literal.c ============================================================================== Binary file. No diff available. Modified: vendor/clang/dist-release_60/test/Modules/ExtDebugInfo.cpp ============================================================================== --- vendor/clang/dist-release_60/test/Modules/ExtDebugInfo.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/test/Modules/ExtDebugInfo.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -187,7 +187,7 @@ void foo() { // CHECK: !DIGlobalVariable(name: "anon_enum", {{.*}}, type: ![[ANON_ENUM:[0-9]+]] // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, scope: ![[NS]], -// CHECK-SAME: line: 16 +// CHECK-SAME: line: 19 // CHECK: !DIGlobalVariable(name: "GlobalUnion", // CHECK-SAME: type: ![[GLOBAL_UNION:[0-9]+]] Modified: vendor/clang/dist-release_60/test/Modules/Inputs/DebugCXX.h ============================================================================== --- vendor/clang/dist-release_60/test/Modules/Inputs/DebugCXX.h Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/test/Modules/Inputs/DebugCXX.h Wed Jan 24 20:25:37 2018 (r328364) @@ -1,4 +1,7 @@ /* -*- C++ -*- */ + +#include "dummy.h" + namespace DebugCXX { // Records. struct Struct { Added: vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/Box.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/Box.h Wed Jan 24 20:25:37 2018 (r328364) @@ -0,0 +1,14 @@ +template +struct iterator { + void Compare(const iterator &x) { } + friend void Check(iterator) {} +}; + +template struct Box { + iterator I; + + void test() { + Check(I); + I.Compare(I); + } +}; Added: vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/M1.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/M1.h Wed Jan 24 20:25:37 2018 (r328364) @@ -0,0 +1,6 @@ +#include "Box.h" + +void Peek() { + Box<> Gift; + Gift.test(); +} Added: vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/M2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/M2.h Wed Jan 24 20:25:37 2018 (r328364) @@ -0,0 +1,5 @@ +#include "Box.h" +void x() { + Box<> Unused; + //Unused.test(); +} Added: vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/M3.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/M3.h Wed Jan 24 20:25:37 2018 (r328364) @@ -0,0 +1,7 @@ +#include "Box.h" +#include "M2.h" + +void Party() { + Box<> Present; + Present.test(); +} Added: vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/module.modulemap ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_60/test/Modules/Inputs/odr_hash-Friend/module.modulemap Wed Jan 24 20:25:37 2018 (r328364) @@ -0,0 +1,15 @@ +module Box { + header "Box.h" +} + +module Module1 { + header "M1.h" +} + +module Module2 { + header "M2.h" +} + +module Module3 { + header "M3.h" +} Modified: vendor/clang/dist-release_60/test/Modules/ModuleDebugInfo.cpp ============================================================================== --- vendor/clang/dist-release_60/test/Modules/ModuleDebugInfo.cpp Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/test/Modules/ModuleDebugInfo.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -5,12 +5,13 @@ // Modules: // RUN: rm -rf %t -// RUN: %clang_cc1 -triple %itanium_abi_triple -x objective-c++ -std=c++11 -debug-info-kind=limited -fmodules -fmodule-format=obj -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t.ll -mllvm -debug-only=pchcontainer &>%t-mod.ll +// RUN: %clang_cc1 -triple %itanium_abi_triple -x objective-c++ -std=c++11 -debugger-tuning=lldb -debug-info-kind=limited -fmodules -fmodule-format=obj -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t.ll -mllvm -debug-only=pchcontainer &>%t-mod.ll // RUN: cat %t-mod.ll | FileCheck %s // RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-NEG %s +// RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-MOD %s // PCH: -// RUN: %clang_cc1 -triple %itanium_abi_triple -x c++ -std=c++11 -emit-pch -fmodule-format=obj -I %S/Inputs -o %t.pch %S/Inputs/DebugCXX.h -mllvm -debug-only=pchcontainer &>%t-pch.ll +// RUN: %clang_cc1 -triple %itanium_abi_triple -x c++ -std=c++11 -debugger-tuning=lldb -emit-pch -fmodule-format=obj -I %S/Inputs -o %t.pch %S/Inputs/DebugCXX.h -mllvm -debug-only=pchcontainer &>%t-pch.ll // RUN: cat %t-pch.ll | FileCheck %s // RUN: cat %t-pch.ll | FileCheck --check-prefix=CHECK-NEG %s @@ -18,6 +19,9 @@ @import DebugCXX; #endif +// CHECK-MOD: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus, +// CHECK-MOD: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus, + // CHECK: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus, // CHECK-SAME: isOptimized: false, // CHECK-NOT: splitDebugFilename: @@ -27,6 +31,8 @@ // CHECK-SAME: identifier: "_ZTSN8DebugCXX4EnumE") // CHECK: !DINamespace(name: "DebugCXX" +// CHECK-MOD: ![[DEBUGCXX:.*]] = !DIModule(scope: null, name: "DebugCXX + // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, // CHECK-NOT: name: // CHECK-SAME: ) @@ -149,5 +155,12 @@ // CHECK: ![[SPECIALIZEDBASE]] = !DICompositeType(tag: DW_TAG_class_type, // CHECK-SAME: name: "WithSpecializedBase", // CHECK-SAME: flags: DIFlagFwdDecl, + +// CHECK-MOD: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: ![[DEBUGCXX]], +// CHECK-MOD-SAME: entity: ![[DUMMY:[0-9]+]], +// CHECK-MOD-SAME: line: 3) +// CHECK-MOD: ![[DUMMY]] = !DIModule(scope: null, name: "dummy", +// CHECK-MOD: distinct !DICompileUnit(language: DW_LANG_ObjC_plus_plus, +// CHECK-MOD-SAME: splitDebugFilename: "{{.*}}dummy{{.*}}.pcm", // CHECK-NEG-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "PureForwardDecl" Added: vendor/clang/dist-release_60/test/Modules/odr_hash-Friend.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_60/test/Modules/odr_hash-Friend.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -0,0 +1,22 @@ +// RUN: rm -rf %t + +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/modules.cache \ +// RUN: -I %S/Inputs/odr_hash-Friend \ +// RUN: -emit-obj -o /dev/null \ +// RUN: -fmodules \ +// RUN: -fimplicit-module-maps \ +// RUN: -fmodules-cache-path=%t/modules.cache \ +// RUN: -std=c++11 -x c++ %s -verify + +// PR35939: MicrosoftMangle.cpp triggers an assertion failure on this test. +// UNSUPPORTED: system-windows + +// expected-no-diagnostics + +#include "Box.h" +#include "M1.h" +#include "M3.h" + +void Run() { + Box<> Present; +} Added: vendor/clang/dist-release_60/test/Modules/odr_hash-blocks.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_60/test/Modules/odr_hash-blocks.cpp Wed Jan 24 20:25:37 2018 (r328364) @@ -0,0 +1,119 @@ +// Clear and create directories +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: mkdir %t/cache +// RUN: mkdir %t/Inputs + +// Build first header file +// RUN: echo "#define FIRST" >> %t/Inputs/first.h +// RUN: cat %s >> %t/Inputs/first.h + +// Build second header file +// RUN: echo "#define SECOND" >> %t/Inputs/second.h +// RUN: cat %s >> %t/Inputs/second.h + +// Test that each header can compile +// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++11 -fblocks %t/Inputs/first.h +// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++11 -fblocks %t/Inputs/second.h + +// Build module map file +// RUN: echo "module FirstModule {" >> %t/Inputs/module.map +// RUN: echo " header \"first.h\"" >> %t/Inputs/module.map +// RUN: echo "}" >> %t/Inputs/module.map +// RUN: echo "module SecondModule {" >> %t/Inputs/module.map +// RUN: echo " header \"second.h\"" >> %t/Inputs/module.map +// RUN: echo "}" >> %t/Inputs/module.map + +// Run test +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps \ +// RUN: -fmodules-cache-path=%t/cache -x c++ -I%t/Inputs \ +// RUN: -verify %s -std=c++11 -fblocks + +#if !defined(FIRST) && !defined(SECOND) +#include "first.h" +#include "second.h" +#endif + +// Used for testing +#if defined(FIRST) +#define ACCESS public: +#elif defined(SECOND) +#define ACCESS private: +#endif + +// TODO: S1, S2, and S3 should generate errors. +namespace Blocks { +#if defined(FIRST) +struct S1 { + void (^block)(int x) = ^(int x) { }; +}; +#elif defined(SECOND) +struct S1 { + void (^block)(int x) = ^(int y) { }; +}; +#else +S1 s1; +#endif + +#if defined(FIRST) +struct S2 { + int (^block)(int x) = ^(int x) { return x + 1; }; +}; +#elif defined(SECOND) +struct S2 { + int (^block)(int x) = ^(int x) { return x; }; +}; +#else +S2 s2; +#endif + +#if defined(FIRST) +struct S3 { + void run(int (^block)(int x)); +}; +#elif defined(SECOND) +struct S3 { + void run(int (^block)(int x, int y)); +}; +#else +S3 s3; +#endif + +#define DECLS \ + int (^block)(int x) = ^(int x) { return x + x; }; \ + void run(int (^block)(int x, int y)); + +#if defined(FIRST) || defined(SECOND) +struct Valid1 { + DECLS +}; +#else +Valid1 v1; +#endif + +#if defined(FIRST) || defined(SECOND) +struct Invalid1 { + DECLS + ACCESS +}; +#else +Invalid1 i1; +// expected-error@second.h:* {{'Blocks::Invalid1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}} +// expected-note@first.h:* {{but in 'FirstModule' found public access specifier}} +#endif + +#undef DECLS +} + +// Keep macros contained to one file. +#ifdef FIRST +#undef FIRST +#endif + +#ifdef SECOND +#undef SECOND +#endif + +#ifdef ACCESS +#undef ACCESS +#endif Modified: vendor/clang/dist-release_60/test/Preprocessor/cuda-types.cu ============================================================================== --- vendor/clang/dist-release_60/test/Preprocessor/cuda-types.cu Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/test/Preprocessor/cuda-types.cu Wed Jan 24 20:25:37 2018 (r328364) @@ -9,40 +9,40 @@ // RUN: %clang --cuda-host-only -nocudainc -target i386-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \ // RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \ -// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/i386-host-defines-filtered +// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-host-defines-filtered // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target i386-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \ // RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \ -// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/i386-device-defines-filtered +// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-device-defines-filtered // RUN: diff %t/i386-host-defines-filtered %t/i386-device-defines-filtered // RUN: %clang --cuda-host-only -nocudainc -target x86_64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \ // RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \ -// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/x86_64-host-defines-filtered +// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-host-defines-filtered // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target x86_64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \ // RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \ -// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/x86_64-device-defines-filtered +// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-device-defines-filtered // RUN: diff %t/x86_64-host-defines-filtered %t/x86_64-device-defines-filtered // RUN: %clang --cuda-host-only -nocudainc -target powerpc64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \ // RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \ -// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/powerpc64-host-defines-filtered +// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/powerpc64-host-defines-filtered // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target powerpc64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \ // RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \ -// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/powerpc64-device-defines-filtered +// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/powerpc64-device-defines-filtered // RUN: diff %t/powerpc64-host-defines-filtered %t/powerpc64-device-defines-filtered // RUN: %clang --cuda-host-only -nocudainc -target i386-windows-msvc -x cuda -E -dM -o - /dev/null \ // RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \ -// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/i386-msvc-host-defines-filtered +// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-msvc-host-defines-filtered // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target i386-windows-msvc -x cuda -E -dM -o - /dev/null \ // RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \ -// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/i386-msvc-device-defines-filtered +// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-msvc-device-defines-filtered // RUN: diff %t/i386-msvc-host-defines-filtered %t/i386-msvc-device-defines-filtered // RUN: %clang --cuda-host-only -nocudainc -target x86_64-windows-msvc -x cuda -E -dM -o - /dev/null \ // RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \ -// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/x86_64-msvc-host-defines-filtered +// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-msvc-host-defines-filtered // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target x86_64-windows-msvc -x cuda -E -dM -o - /dev/null \ // RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \ -// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/x86_64-msvc-device-defines-filtered +// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-msvc-device-defines-filtered // RUN: diff %t/x86_64-msvc-host-defines-filtered %t/x86_64-msvc-device-defines-filtered Modified: vendor/clang/dist-release_60/test/Sema/tautological-constant-compare.c ============================================================================== --- vendor/clang/dist-release_60/test/Sema/tautological-constant-compare.c Wed Jan 24 20:23:54 2018 (r328363) +++ vendor/clang/dist-release_60/test/Sema/tautological-constant-compare.c Wed Jan 24 20:25:37 2018 (r328364) @@ -2,8 +2,8 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wtautological-constant-in-range-compare -DTEST -verify -x c++ %s // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wtautological-type-limit-compare -DTEST -verify %s *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Jan 24 20:25:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC71DEC3C60; Wed, 24 Jan 2018 20:25:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CF75F763BE; Wed, 24 Jan 2018 20:25: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80A6322793; Wed, 24 Jan 2018 20:25:46 +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 w0OKPkZk042864; Wed, 24 Jan 2018 20:25:46 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKPkIJ042863; Wed, 24 Jan 2018 20:25:46 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801242025.w0OKPkIJ042863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 24 Jan 2018 20:25:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328365 - vendor/clang/clang-release_60-r323338 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/clang/clang-release_60-r323338 X-SVN-Commit-Revision: 328365 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:25:49 -0000 Author: dim Date: Wed Jan 24 20:25:46 2018 New Revision: 328365 URL: https://svnweb.freebsd.org/changeset/base/328365 Log: Tag clang release_60 branch r323338. Added: vendor/clang/clang-release_60-r323338/ - copied from r328364, vendor/clang/dist-release_60/ From owner-svn-src-all@freebsd.org Wed Jan 24 20:25:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 819F0EC3C67; Wed, 24 Jan 2018 20:25:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 088AF763EA; Wed, 24 Jan 2018 20:25:49 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA60722794; Wed, 24 Jan 2018 20:25:48 +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 w0OKPmHT042911; Wed, 24 Jan 2018 20:25:48 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKPml1042910; Wed, 24 Jan 2018 20:25:48 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801242025.w0OKPml1042910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 24 Jan 2018 20:25:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328366 - vendor/compiler-rt/dist-release_60/lib/builtins X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/compiler-rt/dist-release_60/lib/builtins X-SVN-Commit-Revision: 328366 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:25:49 -0000 Author: dim Date: Wed Jan 24 20:25:48 2018 New Revision: 328366 URL: https://svnweb.freebsd.org/changeset/base/328366 Log: Vendor import of compiler-rt release_60 branch r323338: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_60@323338 Modified: vendor/compiler-rt/dist-release_60/lib/builtins/clear_cache.c Modified: vendor/compiler-rt/dist-release_60/lib/builtins/clear_cache.c ============================================================================== --- vendor/compiler-rt/dist-release_60/lib/builtins/clear_cache.c Wed Jan 24 20:25:46 2018 (r328365) +++ vendor/compiler-rt/dist-release_60/lib/builtins/clear_cache.c Wed Jan 24 20:25:48 2018 (r328366) @@ -33,6 +33,11 @@ uintptr_t GetCurrentProcess(void); #include #endif +#if defined(__OpenBSD__) && defined(__mips__) + #include + #include +#endif + #if defined(__linux__) && defined(__mips__) #include #include @@ -142,6 +147,8 @@ void __clear_cache(void *start, void *end) { #else syscall(__NR_cacheflush, start, (end_int - start_int), BCACHE); #endif +#elif defined(__mips__) && defined(__OpenBSD__) + cacheflush(start, (uintptr_t)end - (uintptr_t)start, BCACHE); #elif defined(__aarch64__) && !defined(__APPLE__) uint64_t xstart = (uint64_t)(uintptr_t) start; uint64_t xend = (uint64_t)(uintptr_t) end; @@ -156,12 +163,14 @@ void __clear_cache(void *start, void *end) { * uintptr_t in case this runs in an IPL32 environment. */ const size_t dcache_line_size = 4 << ((ctr_el0 >> 16) & 15); - for (addr = xstart; addr < xend; addr += dcache_line_size) + for (addr = xstart & ~(dcache_line_size - 1); addr < xend; + addr += dcache_line_size) __asm __volatile("dc cvau, %0" :: "r"(addr)); __asm __volatile("dsb ish"); const size_t icache_line_size = 4 << ((ctr_el0 >> 0) & 15); - for (addr = xstart; addr < xend; addr += icache_line_size) + for (addr = xstart & ~(icache_line_size - 1); addr < xend; + addr += icache_line_size) __asm __volatile("ic ivau, %0" :: "r"(addr)); __asm __volatile("isb sy"); #elif defined (__powerpc64__) From owner-svn-src-all@freebsd.org Wed Jan 24 20:26:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E5B8EC3CBB; Wed, 24 Jan 2018 20:26:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C9CA2765B5; Wed, 24 Jan 2018 20:25:59 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9206722797; Wed, 24 Jan 2018 20:25:59 +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 w0OKPxS8043057; Wed, 24 Jan 2018 20:25:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKPx3Z043056; Wed, 24 Jan 2018 20:25:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801242025.w0OKPx3Z043056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 24 Jan 2018 20:25:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328369 - vendor/libc++/libc++-release_60-r323338 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/libc++-release_60-r323338 X-SVN-Commit-Revision: 328369 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:26:00 -0000 Author: dim Date: Wed Jan 24 20:25:59 2018 New Revision: 328369 URL: https://svnweb.freebsd.org/changeset/base/328369 Log: Tag libc++ release_60 branch r323338. Added: vendor/libc++/libc++-release_60-r323338/ - copied from r328368, vendor/libc++/dist-release_60/ From owner-svn-src-all@freebsd.org Wed Jan 24 20:25:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41ED1EC3CB7; Wed, 24 Jan 2018 20:25:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 65E0C76551; Wed, 24 Jan 2018 20:25:56 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8834C22796; Wed, 24 Jan 2018 20:25:56 +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 w0OKPuW1043008; Wed, 24 Jan 2018 20:25:56 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKPuoI043006; Wed, 24 Jan 2018 20:25:56 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801242025.w0OKPuoI043006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 24 Jan 2018 20:25:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328368 - in vendor/libc++/dist-release_60: include test/std/utilities/meta/meta.unary/meta.unary.prop X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/libc++/dist-release_60: include test/std/utilities/meta/meta.unary/meta.unary.prop X-SVN-Commit-Revision: 328368 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:25:58 -0000 Author: dim Date: Wed Jan 24 20:25:56 2018 New Revision: 328368 URL: https://svnweb.freebsd.org/changeset/base/328368 Log: Vendor import of libc++ release_60 branch r323338: https://llvm.org/svn/llvm-project/libcxx/branches/release_60@323338 Modified: vendor/libc++/dist-release_60/include/type_traits vendor/libc++/dist-release_60/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp Modified: vendor/libc++/dist-release_60/include/type_traits ============================================================================== --- vendor/libc++/dist-release_60/include/type_traits Wed Jan 24 20:25:51 2018 (r328367) +++ vendor/libc++/dist-release_60/include/type_traits Wed Jan 24 20:25:56 2018 (r328368) @@ -3172,6 +3172,14 @@ template false_type __is_constructible2_test(__any, _A0&, _A1&); +template +decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>(), _VSTD::declval<_A2>()), true_type())) +__is_constructible3_test(_Tp&, _A0&, _A1&, _A2&); + +template +false_type +__is_constructible3_test(__any, _A0&, _A1&, _A2&); + template struct __is_constructible0_imp // false, _Tp is not a scalar : public common_type @@ -3196,6 +3204,14 @@ struct __is_constructible2_imp // false, _Tp is not a >::type {}; +template +struct __is_constructible3_imp // false, _Tp is not a scalar + : public common_type + < + decltype(__is_constructible3_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>(), declval<_A2>())) + >::type + {}; + // handle scalars and reference types // Scalars are default constructible, references are not @@ -3215,6 +3231,11 @@ struct __is_constructible2_imp : public false_type {}; +template +struct __is_constructible3_imp + : public false_type + {}; + // Treat scalars and reference types separately template @@ -3235,6 +3256,12 @@ struct __is_constructible2_void_check _Tp, _A0, _A1> {}; +template +struct __is_constructible3_void_check + : public __is_constructible3_imp::value || is_reference<_Tp>::value, + _Tp, _A0, _A1, _A2> + {}; + // If any of T or Args is void, is_constructible should be false template @@ -3252,17 +3279,24 @@ struct __is_constructible2_void_check +struct __is_constructible3_void_check + : public false_type + {}; + // is_constructible entry point template + class _A1 = __is_construct::__nat, + class _A2 = __is_construct::__nat> struct _LIBCPP_TEMPLATE_VIS is_constructible - : public __is_constructible2_void_check::value + : public __is_constructible3_void_check::value || is_abstract<_Tp>::value || is_function<_Tp>::value || is_void<_A0>::value - || is_void<_A1>::value, - _Tp, _A0, _A1> + || is_void<_A1>::value + || is_void<_A2>::value, + _Tp, _A0, _A1, _A2> {}; template @@ -3282,6 +3316,16 @@ struct _LIBCPP_TEMPLATE_VIS is_constructible<_Tp, _A0, _Tp, _A0> {}; +template +struct _LIBCPP_TEMPLATE_VIS is_constructible<_Tp, _A0, _A1, __is_construct::__nat> + : public __is_constructible2_void_check::value + || is_abstract<_Tp>::value + || is_function<_Tp>::value + || is_void<_A0>::value + || is_void<_A1>::value, + _Tp, _A0, _A1> + {}; + // Array types are default constructible if their element type // is default constructible @@ -3300,6 +3344,11 @@ struct __is_constructible2_imp +struct __is_constructible3_imp + : public false_type + {}; + // Incomplete array types are not constructible template @@ -3314,6 +3363,11 @@ struct __is_constructible1_imp template struct __is_constructible2_imp + : public false_type + {}; + +template +struct __is_constructible3_imp : public false_type {}; Modified: vendor/libc++/dist-release_60/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp ============================================================================== --- vendor/libc++/dist-release_60/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp Wed Jan 24 20:25:51 2018 (r328367) +++ vendor/libc++/dist-release_60/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp Wed Jan 24 20:25:56 2018 (r328368) @@ -30,6 +30,7 @@ struct A { explicit A(int); A(int, double); + A(int, long, double); #if TEST_STD_VER >= 11 private: #endif @@ -106,6 +107,16 @@ void test_is_constructible() #endif } +template +void test_is_constructible() +{ + static_assert(( std::is_constructible::value), ""); + LIBCPP11_STATIC_ASSERT((std::__libcpp_is_constructible::type::value), ""); +#if TEST_STD_VER > 14 + static_assert(( std::is_constructible_v), ""); +#endif +} + template void test_is_not_constructible() { @@ -146,6 +157,7 @@ int main() test_is_constructible (); test_is_constructible (); test_is_constructible (); + test_is_constructible (); test_is_constructible (); test_is_not_constructible (); From owner-svn-src-all@freebsd.org Wed Jan 24 20:25:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B5FEEC3C8B; Wed, 24 Jan 2018 20:25:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F607764B0; Wed, 24 Jan 2018 20:25:52 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E92C422795; Wed, 24 Jan 2018 20:25:51 +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 w0OKPpWR042960; Wed, 24 Jan 2018 20:25:51 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKPppe042959; Wed, 24 Jan 2018 20:25:51 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801242025.w0OKPppe042959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 24 Jan 2018 20:25:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328367 - vendor/compiler-rt/compiler-rt-release_60-r323338 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/compiler-rt/compiler-rt-release_60-r323338 X-SVN-Commit-Revision: 328367 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:25:54 -0000 Author: dim Date: Wed Jan 24 20:25:51 2018 New Revision: 328367 URL: https://svnweb.freebsd.org/changeset/base/328367 Log: Tag compiler-rt release_60 branch r323338. Added: vendor/compiler-rt/compiler-rt-release_60-r323338/ - copied from r328366, vendor/compiler-rt/dist-release_60/ From owner-svn-src-all@freebsd.org Wed Jan 24 20:26:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6788AEC3D36; Wed, 24 Jan 2018 20:26:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8820C766AB; Wed, 24 Jan 2018 20:26:05 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7367422798; Wed, 24 Jan 2018 20:26:05 +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 w0OKQ5nF043125; Wed, 24 Jan 2018 20:26:05 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKQ3G1043107; Wed, 24 Jan 2018 20:26:03 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801242026.w0OKQ3G1043107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 24 Jan 2018 20:26:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328370 - in vendor/lld/dist-release_60: COFF ELF test/ELF test/ELF/Inputs test/ELF/linkerscript X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lld/dist-release_60: COFF ELF test/ELF test/ELF/Inputs test/ELF/linkerscript X-SVN-Commit-Revision: 328370 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:26:10 -0000 Author: dim Date: Wed Jan 24 20:26:03 2018 New Revision: 328370 URL: https://svnweb.freebsd.org/changeset/base/328370 Log: Vendor import of lld release_60 branch r323338: https://llvm.org/svn/llvm-project/lld/branches/release_60@323338 Added: vendor/lld/dist-release_60/test/ELF/Inputs/as-needed-lazy.s (contents, props changed) vendor/lld/dist-release_60/test/ELF/Inputs/compress-debug.s (contents, props changed) vendor/lld/dist-release_60/test/ELF/as-needed-lazy.s (contents, props changed) vendor/lld/dist-release_60/test/ELF/compress-debug-sections-reloc.s (contents, props changed) vendor/lld/dist-release_60/test/ELF/linkerscript/at-self-reference.s (contents, props changed) vendor/lld/dist-release_60/test/ELF/linkerscript/at2.s (contents, props changed) vendor/lld/dist-release_60/test/ELF/linkerscript/compress-debug-sections-custom.s (contents, props changed) vendor/lld/dist-release_60/test/ELF/linkerscript/parse-section-in-addr.s (contents, props changed) vendor/lld/dist-release_60/test/ELF/sysv-hash-no-rosegment.s (contents, props changed) Modified: vendor/lld/dist-release_60/COFF/Driver.cpp vendor/lld/dist-release_60/ELF/LinkerScript.cpp vendor/lld/dist-release_60/ELF/OutputSections.cpp vendor/lld/dist-release_60/ELF/OutputSections.h vendor/lld/dist-release_60/ELF/ScriptParser.cpp vendor/lld/dist-release_60/ELF/SymbolTable.cpp vendor/lld/dist-release_60/ELF/SyntheticSections.cpp vendor/lld/dist-release_60/ELF/Writer.cpp Modified: vendor/lld/dist-release_60/COFF/Driver.cpp ============================================================================== --- vendor/lld/dist-release_60/COFF/Driver.cpp Wed Jan 24 20:25:59 2018 (r328369) +++ vendor/lld/dist-release_60/COFF/Driver.cpp Wed Jan 24 20:26:03 2018 (r328370) @@ -57,6 +57,7 @@ bool link(ArrayRef Args, bool CanExitEar errorHandler().ErrorLimitExceededMsg = "too many errors emitted, stopping now" " (use /ERRORLIMIT:0 to see all errors)"; + errorHandler().ExitEarly = CanExitEarly; Config = make(); Config->Argv = {Args.begin(), Args.end()}; Config->CanExitEarly = CanExitEarly; Modified: vendor/lld/dist-release_60/ELF/LinkerScript.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/LinkerScript.cpp Wed Jan 24 20:25:59 2018 (r328369) +++ vendor/lld/dist-release_60/ELF/LinkerScript.cpp Wed Jan 24 20:26:03 2018 (r328370) @@ -608,13 +608,6 @@ void LinkerScript::switchTo(OutputSection *Sec) { Ctx->OutSec = Sec; Ctx->OutSec->Addr = advance(0, Ctx->OutSec->Alignment); - - // If neither AT nor AT> is specified for an allocatable section, the linker - // will set the LMA such that the difference between VMA and LMA for the - // section is the same as the preceding output section in the same region - // https://sourceware.org/binutils/docs-2.20/ld/Output-Section-LMA.html - if (Ctx->LMAOffset) - Ctx->OutSec->LMAOffset = Ctx->LMAOffset(); } // This function searches for a memory region to place the given output @@ -662,17 +655,28 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { if (Ctx->MemRegion) Dot = Ctx->MemRegionOffset[Ctx->MemRegion]; + switchTo(Sec); + if (Sec->LMAExpr) { uint64_t D = Dot; Ctx->LMAOffset = [=] { return Sec->LMAExpr().getValue() - D; }; } - switchTo(Sec); + if (!Sec->LMARegionName.empty()) { + if (MemoryRegion *MR = MemoryRegions.lookup(Sec->LMARegionName)) { + uint64_t Offset = MR->Origin - Dot; + Ctx->LMAOffset = [=] { return Offset; }; + } else { + error("memory region '" + Sec->LMARegionName + "' not declared"); + } + } - // We do not support custom layout for compressed debug sectons. - // At this point we already know their size and have compressed content. - if (Ctx->OutSec->Flags & SHF_COMPRESSED) - return; + // If neither AT nor AT> is specified for an allocatable section, the linker + // will set the LMA such that the difference between VMA and LMA for the + // section is the same as the preceding output section in the same region + // https://sourceware.org/binutils/docs-2.20/ld/Output-Section-LMA.html + if (Ctx->LMAOffset) + Ctx->OutSec->LMAOffset = Ctx->LMAOffset(); // The Size previously denoted how many InputSections had been added to this // section, and was used for sorting SHF_LINK_ORDER sections. Reset it to Modified: vendor/lld/dist-release_60/ELF/OutputSections.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/OutputSections.cpp Wed Jan 24 20:25:59 2018 (r328369) +++ vendor/lld/dist-release_60/ELF/OutputSections.cpp Wed Jan 24 20:26:03 2018 (r328370) @@ -183,15 +183,6 @@ template void OutputSection::maybeCompres !Name.startswith(".debug_")) return; - // Calculate the section offsets and size pre-compression. - Size = 0; - for (BaseCommand *Cmd : SectionCommands) - if (auto *ISD = dyn_cast(Cmd)) - for (InputSection *IS : ISD->Sections) { - IS->OutSecOff = alignTo(Size, IS->Alignment); - this->Size = IS->OutSecOff + IS->getSize(); - } - // Create a section header. ZDebugHeader.resize(sizeof(Elf_Chdr)); auto *Hdr = reinterpret_cast(ZDebugHeader.data()); Modified: vendor/lld/dist-release_60/ELF/OutputSections.h ============================================================================== --- vendor/lld/dist-release_60/ELF/OutputSections.h Wed Jan 24 20:25:59 2018 (r328369) +++ vendor/lld/dist-release_60/ELF/OutputSections.h Wed Jan 24 20:26:03 2018 (r328370) @@ -99,6 +99,7 @@ class OutputSection final : public BaseCommand, public ConstraintKind Constraint = ConstraintKind::NoConstraint; std::string Location; std::string MemoryRegionName; + std::string LMARegionName; bool Noload = false; template void finalize(); Modified: vendor/lld/dist-release_60/ELF/ScriptParser.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/ScriptParser.cpp Wed Jan 24 20:25:59 2018 (r328369) +++ vendor/lld/dist-release_60/ELF/ScriptParser.cpp Wed Jan 24 20:26:03 2018 (r328370) @@ -709,6 +709,14 @@ OutputSection *ScriptParser::readOutputSectionDescript if (consume(">")) Cmd->MemoryRegionName = next(); + if (consume("AT")) { + expect(">"); + Cmd->LMARegionName = next(); + } + + if (Cmd->LMAExpr && !Cmd->LMARegionName.empty()) + error("section can't have both LMA and a load region"); + Cmd->Phdrs = readOutputSectionPhdrs(); if (consume("=")) @@ -922,7 +930,10 @@ ByteCommand *ScriptParser::readByteCommand(StringRef T StringRef ScriptParser::readParenLiteral() { expect("("); + bool Orig = InExpr; + InExpr = false; StringRef Tok = next(); + InExpr = Orig; expect(")"); return Tok; } Modified: vendor/lld/dist-release_60/ELF/SymbolTable.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/SymbolTable.cpp Wed Jan 24 20:25:59 2018 (r328369) +++ vendor/lld/dist-release_60/ELF/SymbolTable.cpp Wed Jan 24 20:26:03 2018 (r328370) @@ -491,12 +491,13 @@ void SymbolTable::addShared(StringRef Name, SharedFile if (WasInserted || ((S->isUndefined() || S->isLazy()) && S->getVisibility() == STV_DEFAULT)) { uint8_t Binding = S->Binding; + bool WasUndefined = S->isUndefined(); replaceSymbol(S, File, Name, Sym.getBinding(), Sym.st_other, Sym.getType(), Sym.st_value, Sym.st_size, Alignment, VerdefIndex); if (!WasInserted) { S->Binding = Binding; - if (!S->isWeak() && !Config->GcSections) + if (!S->isWeak() && !Config->GcSections && WasUndefined) File.IsNeeded = true; } } Modified: vendor/lld/dist-release_60/ELF/SyntheticSections.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/SyntheticSections.cpp Wed Jan 24 20:25:59 2018 (r328369) +++ vendor/lld/dist-release_60/ELF/SyntheticSections.cpp Wed Jan 24 20:26:03 2018 (r328370) @@ -1823,6 +1823,9 @@ void HashTableSection::finalizeContents() { } void HashTableSection::writeTo(uint8_t *Buf) { + // See comment in GnuHashTableSection::writeTo. + memset(Buf, 0, Size); + unsigned NumSymbols = InX::DynSymTab->getNumSymbols(); uint32_t *P = reinterpret_cast(Buf); @@ -2435,10 +2438,8 @@ void MergeNoTailSection::finalizeContents() { parallelForEachN(0, Concurrency, [&](size_t ThreadId) { for (MergeInputSection *Sec : Sections) { for (size_t I = 0, E = Sec->Pieces.size(); I != E; ++I) { - if (!Sec->Pieces[I].Live) - continue; size_t ShardId = getShardId(Sec->Pieces[I].Hash); - if ((ShardId & (Concurrency - 1)) == ThreadId) + if ((ShardId & (Concurrency - 1)) == ThreadId && Sec->Pieces[I].Live) Sec->Pieces[I].OutputOff = Shards[ShardId].add(Sec->getData(I)); } } Modified: vendor/lld/dist-release_60/ELF/Writer.cpp ============================================================================== --- vendor/lld/dist-release_60/ELF/Writer.cpp Wed Jan 24 20:25:59 2018 (r328369) +++ vendor/lld/dist-release_60/ELF/Writer.cpp Wed Jan 24 20:26:03 2018 (r328370) @@ -427,13 +427,14 @@ template void Writer::run() { if (errorCount()) return; + Script->assignAddresses(); + // If -compressed-debug-sections is specified, we need to compress // .debug_* sections. Do it right now because it changes the size of // output sections. - parallelForEach(OutputSections, - [](OutputSection *Sec) { Sec->maybeCompress(); }); + for (OutputSection *Sec : OutputSections) + Sec->maybeCompress(); - Script->assignAddresses(); Script->allocateHeaders(Phdrs); // Remove empty PT_LOAD to avoid causing the dynamic linker to try to mmap a Added: vendor/lld/dist-release_60/test/ELF/Inputs/as-needed-lazy.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/Inputs/as-needed-lazy.s Wed Jan 24 20:26:03 2018 (r328370) @@ -0,0 +1,3 @@ +.global foo +foo: + nop Added: vendor/lld/dist-release_60/test/ELF/Inputs/compress-debug.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/Inputs/compress-debug.s Wed Jan 24 20:26:03 2018 (r328370) @@ -0,0 +1,5 @@ +.text +.fill 0x44 + +.section .debug_info,"",@progbits +.fill 0x43 Added: vendor/lld/dist-release_60/test/ELF/as-needed-lazy.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/as-needed-lazy.s Wed Jan 24 20:26:03 2018 (r328370) @@ -0,0 +1,14 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/as-needed-lazy.s -o %t2.o +# RUN: ld.lld %t2.o -o %t2.so -shared +# RUN: rm -f %t2.a +# RUN: llvm-ar rc %t2.a %t2.o +# RUN: ld.lld %t1.o %t2.a --as-needed %t2.so -o %t +# RUN: llvm-readobj -d %t | FileCheck %s + +# CHECK-NOT: NEEDED + +.global _start +_start: + nop Added: vendor/lld/dist-release_60/test/ELF/compress-debug-sections-reloc.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/compress-debug-sections-reloc.s Wed Jan 24 20:26:03 2018 (r328370) @@ -0,0 +1,26 @@ +# REQUIRES: x86, zlib + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/compress-debug.s -o %t2.o +# RUN: ld.lld %t2.o %t.o -o %t1 --compress-debug-sections=zlib -Ttext=0 +# RUN: llvm-dwarfdump %t1 -debug-str | FileCheck %s +# These two checks correspond to the patched values of a_sym and a_debug_sym. +# D = 0x44 - address of .text input section for this file (the start address of +# .text is 0 as requested on the command line, and the size of the +# preceding .text in the other input file is 0x44). +# C = 0x43 - offset of .debug_info section for this file (the size of +# the preceding .debug_info from the other input file is 0x43). +# CHECK: 0x00000000: "D" +# CHECK: 0x00000004: "C" + +.text +a_sym: +nop + +.section .debug_str,"",@progbits +.long a_sym +.long a_debug_sym + +.section .debug_info,"",@progbits +a_debug_sym: +.long 0x88776655 Added: vendor/lld/dist-release_60/test/ELF/linkerscript/at-self-reference.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/linkerscript/at-self-reference.s Wed Jan 24 20:26:03 2018 (r328370) @@ -0,0 +1,63 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: echo "SECTIONS { \ +# RUN: . = 0x1000; \ +# RUN: .aaa : AT(ADDR(.aaa)) { *(.aaa) } \ +# RUN: .bbb : AT(ADDR(.bbb)) { *(.bbb) } \ +# RUN: }" > %t.script +# RUN: ld.lld %t --script %t.script -o %t2 +# RUN: llvm-readobj -program-headers %t2 | FileCheck %s + +# CHECK: ProgramHeaders [ +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_LOAD (0x1) +# CHECK-NEXT: Offset: 0x1000 +# CHECK-NEXT: VirtualAddress: 0x1000 +# CHECK-NEXT: PhysicalAddress: 0x1000 +# CHECK-NEXT: FileSize: 3 +# CHECK-NEXT: MemSize: 3 +# CHECK-NEXT: Flags [ (0x5) +# CHECK-NEXT: PF_R (0x4) +# CHECK-NEXT: PF_X (0x1) +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 4096 +# CHECK-NEXT: } +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_LOAD (0x1) +# CHECK-NEXT: Offset: 0x1008 +# CHECK-NEXT: VirtualAddress: 0x1008 +# CHECK-NEXT: PhysicalAddress: 0x1008 +# CHECK-NEXT: FileSize: 9 +# CHECK-NEXT: MemSize: 9 +# CHECK-NEXT: Flags [ (0x5) +# CHECK-NEXT: PF_R (0x4) +# CHECK-NEXT: PF_X (0x1) +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 4096 +# CHECK-NEXT: } +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_GNU_STACK (0x6474E551) +# CHECK-NEXT: Offset: 0x0 +# CHECK-NEXT: VirtualAddress: 0x0 +# CHECK-NEXT: PhysicalAddress: 0x0 +# CHECK-NEXT: FileSize: 0 +# CHECK-NEXT: MemSize: 0 +# CHECK-NEXT: Flags [ (0x6) +# CHECK-NEXT: PF_R (0x4) +# CHECK-NEXT: PF_W (0x2) +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 0 +# CHECK-NEXT: } +# CHECK-NEXT:] + +.global _start +_start: + nop + + +.section .aaa, "a" +.asciz "aa" + +.section .bbb, "a" +.align 8 +.quad 0 Added: vendor/lld/dist-release_60/test/ELF/linkerscript/at2.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/linkerscript/at2.s Wed Jan 24 20:26:03 2018 (r328370) @@ -0,0 +1,81 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: echo "MEMORY { \ +# RUN: AX (ax) : ORIGIN = 0x2000, LENGTH = 0x100 \ +# RUN: AW (aw) : ORIGIN = 0x3000, LENGTH = 0x100 \ +# RUN: FLASH (ax) : ORIGIN = 0x6000, LENGTH = 0x100 \ +# RUN: RAM (aw) : ORIGIN = 0x7000, LENGTH = 0x100 } \ +# RUN: SECTIONS { \ +# RUN: .foo1 : { *(.foo1) } > AX AT>FLASH \ +# RUN: .foo2 : { *(.foo2) } > AX \ +# RUN: .bar1 : { *(.bar1) } > AW AT> RAM \ +# RUN: .bar2 : { *(.bar2) } > AW AT > RAM \ +# RUN: .bar3 : { *(.bar3) } > AW AT >RAM \ +# RUN: }" > %t.script +# RUN: ld.lld %t --script %t.script -o %t2 +# RUN: llvm-readobj -program-headers %t2 | FileCheck %s +# RUN: llvm-objdump -section-headers %t2 | FileCheck %s --check-prefix=SECTIONS + +# CHECK: ProgramHeaders [ +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_LOAD +# CHECK-NEXT: Offset: 0x1000 +# CHECK-NEXT: VirtualAddress: 0x2000 +# CHECK-NEXT: PhysicalAddress: 0x6000 +# CHECK-NEXT: FileSize: 16 +# CHECK-NEXT: MemSize: 16 +# CHECK-NEXT: Flags [ +# CHECK-NEXT: PF_R +# CHECK-NEXT: PF_X +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: +# CHECK-NEXT: } +# CHECK-NEXT: ProgramHeader { +# CHECK-NEXT: Type: PT_LOAD +# CHECK-NEXT: Offset: 0x2000 +# CHECK-NEXT: VirtualAddress: 0x3000 +# CHECK-NEXT: PhysicalAddress: 0x7000 +# CHECK-NEXT: FileSize: 24 +# CHECK-NEXT: MemSize: 24 +# CHECK-NEXT: Flags [ +# CHECK-NEXT: PF_R +# CHECK-NEXT: PF_W +# CHECK-NEXT: ] +# CHECK-NEXT: Alignment: 4096 +# CHECK-NEXT: } + +# SECTIONS: Sections: +# SECTIONS-NEXT: Idx Name Size Address +# SECTIONS-NEXT: 0 00000000 0000000000000000 +# SECTIONS-NEXT: 1 .foo1 00000008 0000000000002000 +# SECTIONS-NEXT: 2 .foo2 00000008 0000000000002008 +# SECTIONS-NEXT: 3 .text 00000000 0000000000002010 +# SECTIONS-NEXT: 4 .bar1 00000008 0000000000003000 +# SECTIONS-NEXT: 5 .bar2 00000008 0000000000003008 +# SECTIONS-NEXT: 6 .bar3 00000008 0000000000003010 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: echo "MEMORY { \ +# RUN: FLASH (ax) : ORIGIN = 0x2000, LENGTH = 0x100 \ +# RUN: RAM (aw) : ORIGIN = 0x5000, LENGTH = 0x100 } \ +# RUN: SECTIONS { \ +# RUN: .foo1 : AT(0x500) { *(.foo1) } > FLASH AT>FLASH \ +# RUN: }" > %t2.script +# RUN: not ld.lld %t --script %t2.script -o %t2 2>&1 | \ +# RUN: FileCheck %s --check-prefix=ERR +# ERR: error: section can't have both LMA and a load region + +.section .foo1, "ax" +.quad 0 + +.section .foo2, "ax" +.quad 0 + +.section .bar1, "aw" +.quad 0 + +.section .bar2, "aw" +.quad 0 + +.section .bar3, "aw" +.quad 0 Added: vendor/lld/dist-release_60/test/ELF/linkerscript/compress-debug-sections-custom.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/linkerscript/compress-debug-sections-custom.s Wed Jan 24 20:26:03 2018 (r328370) @@ -0,0 +1,35 @@ +# REQUIRES: x86, zlib + +# RUN: echo "SECTIONS { \ +# RUN: .text : { . += 0x10; *(.text) } \ +# RUN: .debug_str : { . += 0x10; *(.debug_str) } \ +# RUN: .debug_info : { . += 0x10; *(.debug_info) } \ +# RUN: }" > %t.script + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/../Inputs/compress-debug.s -o %t2.o +# RUN: ld.lld %t2.o %t.o -o %t1 --compress-debug-sections=zlib -T %t.script +# RUN: llvm-dwarfdump %t1 -debug-str | FileCheck %s +# These two checks correspond to the patched values of a_sym and a_debug_sym. +# T = 0x54 - address of .text input section for this file (the start address of +# .text is 0 by default, the size of the preceding .text in the other input +# file is 0x44, and the linker script adds an additional 0x10). +# S = 0x53 - offset of .debug_info section for this file (the size of +# the preceding .debug_info from the other input file is 0x43, and the +# linker script adds an additional 0x10). +# Also note that the .debug_str offsets are also offset by 0x10, as directed by +# the linker script. +# CHECK: 0x00000010: "T" +# CHECK: 0x00000014: "S" + +.text +a_sym: +nop + +.section .debug_str,"",@progbits +.long a_sym +.long a_debug_sym + +.section .debug_info,"",@progbits +a_debug_sym: +.long 0x88776655 Added: vendor/lld/dist-release_60/test/ELF/linkerscript/parse-section-in-addr.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/linkerscript/parse-section-in-addr.s Wed Jan 24 20:26:03 2018 (r328370) @@ -0,0 +1,10 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o + +# RUN: echo "SECTIONS { \ +# RUN: .foo-bar : AT(ADDR(.foo-bar)) { *(.text) } \ +# RUN: }" > %t.script +# RUN: ld.lld -o %t.so --script %t.script %t.o -shared +# RUN: llvm-readelf -S %t.so | FileCheck %s + +# CHECK: .foo-bar Added: vendor/lld/dist-release_60/test/ELF/sysv-hash-no-rosegment.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist-release_60/test/ELF/sysv-hash-no-rosegment.s Wed Jan 24 20:26:03 2018 (r328370) @@ -0,0 +1,13 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: ld.lld -shared --no-rosegment -o %t %t.o +# RUN: llvm-readobj -hash-table %t | FileCheck %s + +# CHECK: HashTable { +# CHECK-NEXT: Num Buckets: 2 +# CHECK-NEXT: Num Chains: 2 +# CHECK-NEXT: Buckets: [1, 0] +# CHECK-NEXT: Chains: [0, 0] +# CHECK-NEXT: } + +callq undef@PLT From owner-svn-src-all@freebsd.org Wed Jan 24 20:26:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5E49EC3D54; Wed, 24 Jan 2018 20:26:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C5DA376770; Wed, 24 Jan 2018 20:26:08 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7ECF922799; Wed, 24 Jan 2018 20:26:08 +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 w0OKQ8A0043173; Wed, 24 Jan 2018 20:26:08 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKQ8DF043172; Wed, 24 Jan 2018 20:26:08 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801242026.w0OKQ8DF043172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 24 Jan 2018 20:26:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328371 - vendor/lld/lld-release_60-r323338 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lld/lld-release_60-r323338 X-SVN-Commit-Revision: 328371 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:26:13 -0000 Author: dim Date: Wed Jan 24 20:26:08 2018 New Revision: 328371 URL: https://svnweb.freebsd.org/changeset/base/328371 Log: Tag lld release_60 branch r323338. Added: vendor/lld/lld-release_60-r323338/ - copied from r328370, vendor/lld/dist-release_60/ From owner-svn-src-all@freebsd.org Wed Jan 24 20:26:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D46C5EC3D9C; Wed, 24 Jan 2018 20:26:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 82BE376882; Wed, 24 Jan 2018 20:26:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B34B2279B; Wed, 24 Jan 2018 20:26:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OKQGjK043271; Wed, 24 Jan 2018 20:26:16 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKQG9U043270; Wed, 24 Jan 2018 20:26:16 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801242026.w0OKQG9U043270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 24 Jan 2018 20:26:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328373 - vendor/lldb/lldb-release_60-r323338 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-release_60-r323338 X-SVN-Commit-Revision: 328373 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:26:18 -0000 Author: dim Date: Wed Jan 24 20:26:15 2018 New Revision: 328373 URL: https://svnweb.freebsd.org/changeset/base/328373 Log: Tag lldb release_60 branch r323338. Added: vendor/lldb/lldb-release_60-r323338/ - copied from r328372, vendor/lldb/dist-release_60/ From owner-svn-src-all@freebsd.org Wed Jan 24 20:26:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 538A0EC3D94; Wed, 24 Jan 2018 20:26:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F8E576851; Wed, 24 Jan 2018 20:26: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36A922279A; Wed, 24 Jan 2018 20:26: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 w0OKQDhm043223; Wed, 24 Jan 2018 20:26:13 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OKQCmo043220; Wed, 24 Jan 2018 20:26:12 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801242026.w0OKQCmo043220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 24 Jan 2018 20:26:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328372 - vendor/lldb/dist-release_60/lit X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/dist-release_60/lit X-SVN-Commit-Revision: 328372 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 20:26:17 -0000 Author: dim Date: Wed Jan 24 20:26:12 2018 New Revision: 328372 URL: https://svnweb.freebsd.org/changeset/base/328372 Log: Vendor import of lldb release_60 branch r323338: https://llvm.org/svn/llvm-project/lldb/branches/release_60@323338 Modified: vendor/lldb/dist-release_60/lit/CMakeLists.txt vendor/lldb/dist-release_60/lit/lit.cfg vendor/lldb/dist-release_60/lit/lit.site.cfg.in Modified: vendor/lldb/dist-release_60/lit/CMakeLists.txt ============================================================================== --- vendor/lldb/dist-release_60/lit/CMakeLists.txt Wed Jan 24 20:26:08 2018 (r328371) +++ vendor/lldb/dist-release_60/lit/CMakeLists.txt Wed Jan 24 20:26:12 2018 (r328372) @@ -11,6 +11,10 @@ else() set(ENABLE_SHARED 0) endif(BUILD_SHARED_LIBS) +# the value is not canonicalized within LLVM +llvm_canonicalize_cmake_booleans( + LLVM_ENABLE_ZLIB) + configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg) Modified: vendor/lldb/dist-release_60/lit/lit.cfg ============================================================================== --- vendor/lldb/dist-release_60/lit/lit.cfg Wed Jan 24 20:26:08 2018 (r328371) +++ vendor/lldb/dist-release_60/lit/lit.cfg Wed Jan 24 20:26:12 2018 (r328372) @@ -91,11 +91,11 @@ for pattern in [r"\bFileCheck\b", pattern) tool_pipe = tool_match.group(2) tool_name = tool_match.group(4) - tool_path = lit.util.which(tool_name, config.llvm_tools_dir) + tool_path = lit.util.which(tool_name, config.environment['PATH']) if not tool_path: # Warn, but still provide a substitution. lit_config.note( - 'Did not find ' + tool_name + ' in ' + config.llvm_tools_dir) + 'Did not find ' + tool_name + ' in ' + config.environment['PATH']) config.substitutions.append((pattern, tool_pipe + tool_path)) # Shell execution Modified: vendor/lldb/dist-release_60/lit/lit.site.cfg.in ============================================================================== --- vendor/lldb/dist-release_60/lit/lit.site.cfg.in Wed Jan 24 20:26:08 2018 (r328371) +++ vendor/lldb/dist-release_60/lit/lit.site.cfg.in Wed Jan 24 20:26:12 2018 (r328372) @@ -12,7 +12,7 @@ config.target_triple = "@TARGET_TRIPLE@" config.python_executable = "@PYTHON_EXECUTABLE@" config.cc = "@LLDB_TEST_C_COMPILER@" config.cxx = "@LLDB_TEST_CXX_COMPILER@" -config.have_zlib = @HAVE_LIBZ@ +config.have_zlib = @LLVM_ENABLE_ZLIB@ # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time. From owner-svn-src-all@freebsd.org Wed Jan 24 21:11:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3DD0EC629C; Wed, 24 Jan 2018 21:11:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 80D9C783D1; Wed, 24 Jan 2018 21:11:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BE6922F71; Wed, 24 Jan 2018 21:11:35 +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 w0OLBZV4065761; Wed, 24 Jan 2018 21:11:35 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OLBZYp065760; Wed, 24 Jan 2018 21:11:35 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801242111.w0OLBZYp065760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 24 Jan 2018 21:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328374 - head/share/man/man8 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man8 X-SVN-Commit-Revision: 328374 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 21:11:36 -0000 Author: emaste Date: Wed Jan 24 21:11:35 2018 New Revision: 328374 URL: https://svnweb.freebsd.org/changeset/base/328374 Log: uefi.8: update HISTORY and remove incomplete AUTHORS - EFI support appeared in 5.0 for ia64 - arm64 UEFI support added in 11.0 The AUTHORS section included the folks responsible for the bulk of the work to bring UEFI support to amd64, but missed those who did the original work on ia64, the initial port to i386, the ports to arm64 and arm, and have generally maintained and improved general UEFI support since then. It's unwieldly to include everyone and would quickly become outdated again anyhow, so just remove the AUTHORS section. Reviewed by: manu Discussed with: jhb Differential Revision: https://reviews.freebsd.org/D14033 Modified: head/share/man/man8/uefi.8 Modified: head/share/man/man8/uefi.8 ============================================================================== --- head/share/man/man8/uefi.8 Wed Jan 24 20:26:15 2018 (r328373) +++ head/share/man/man8/uefi.8 Wed Jan 24 21:11:35 2018 (r328374) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 23, 2017 +.Dd January 24, 2018 .Dt UEFI 8 .Os .Sh NAME @@ -143,20 +143,13 @@ typical non-default kernel (optional) .Xr gpart 8 , .Xr uefisign 8 .Sh HISTORY +EFI boot support for the ia64 architecture first appeared in +.Fx 5.0 . .Nm -boot support first appeared in -.Fx 10.1 . -.Sh AUTHORS -.An -nosplit -.Nm -boot support was developed by -.An Benno Rice Aq Mt benno@FreeBSD.org , -.An \&Ed Maste Aq Mt emaste@FreeBSD.org , -and -.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org . -The -.Fx -Foundation sponsored portions of the work. +boot support for amd64 first appeared in +.Fx 10.1 +and for arm64 in +.Fx 11.0 . .Sh CAVEATS EFI environment variables are not supported by .Xr loader 8 From owner-svn-src-all@freebsd.org Wed Jan 24 21:13:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F351BEC657C for ; Wed, 24 Jan 2018 21:13:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (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 4F48878727 for ; Wed, 24 Jan 2018 21:13:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x229.google.com with SMTP id t74so11008877wme.3 for ; Wed, 24 Jan 2018 13:13:33 -0800 (PST) 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=FfemW3Va+D3OTJAjuYjIgsXmjF/+WPmVbjUG0aBvKl0=; b=0ZHHXZsgWvK1G0uwfiTd4tdduw9oPoO/nN49dO5Tq6GzOC1CEmEW+MJXu0tJtvQzs6 6VnVMQd8CKYmSASihCVxE4in8TSQ3/Xn603AtybJi/fE6HAeHpEZU0BL2XRFwwt3ovAy n6cs5YyAQdvt+mLfmqH+sSY3rfxjV3+YKyUS61DPw5+P4lxN0iF9jg5OygTI6ZtBi270 dK6suC28mVnVu2Tkgm0iKr3onVU48graXhiS/10xl2hV1E952tjCu/pQDsZGmGmTwsms 4lggcNd2qYtoD450Ze0E32ciVf0D8ZHYtHyd6GUStcJQFw51XH0/DAu6k7BG3fxYC7Ch wSAA== 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=FfemW3Va+D3OTJAjuYjIgsXmjF/+WPmVbjUG0aBvKl0=; b=fWXgDN6jplfnPD4W/br2qN9CTsxpbLAX9+HdB1R6geoOOaM4iy7d46TNHKdCkGBM5E tXW/dyXh2s1Vj4jhOsRsCTYUelYp+aNJeFHhfRDWUGNrYFKiUBxwz7sgBA3vi32ZS2Yn TrpBJPNG3qa9stREv5ANT8ZZ0wVP+eAcUmrVgzOwzzGR3NRB8TsE/5lxVVnwsHtU7waB M5Aiu3uz5kfX8TzbAvzXbaVxgeYS1jrbxcoJlnWQf1yjtko9O+N+1hF2biOAiUGe17bQ m9Xw9b6h/Z7XoR8tk2V9C9L9L8TkwsnLfc11xK4e2BpIqrJVZY7OIuEMQlbf73Qj4tXK 69Fg== X-Gm-Message-State: AKwxyte4FxxrcLA1Wyv8G11QzWtTi0PoWx3FQbIHvjkbEy4a1Sq1q6L6 xmJUAbcswDsP/THT9aSxoHc2of73hGuMYxIonzbOSg== X-Google-Smtp-Source: AH8x226/l2h7YSLBBv9Ob8puqnppxpgwEKPQJLdqsVFi/9rIR+VH/BX+TfFcxFQ7czXdZCImW/jTCh6hwrfoUyINluU= X-Received: by 10.80.151.22 with SMTP id c22mr26429688edb.225.1516828412227; Wed, 24 Jan 2018 13:13:32 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.133.195 with HTTP; Wed, 24 Jan 2018 13:13:31 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org> From: Warner Losh Date: Wed, 24 Jan 2018 14:13:31 -0700 X-Google-Sender-Auth: 0uAgF_FljxpqC90LWoK69cuEgvE Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: "Conrad E. Meyer" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 21:13:34 -0000 On Wed, Jan 24, 2018 at 12:40 PM, Conrad Meyer wrote: > On Wed, Jan 24, 2018 at 11:27 AM, Warner Losh wrote: > > > > Which is why we should add check overflows for most of the no wait cases. > > They should be checked, but not primarily with mallocarray... > > I don't understand what the distinction is here. Can you help me > understand why the overflow check should be lifted from mallocarray > into the caller for no wait cases? Or is that not what you're > suggesting? > mallocarray should be the last line of defense, not the only line of defense. most of the time, it's more correct to say if (WOULD_OVERFLOW(a,b)) return EINVAL; ptr = mallocarray(a,b...); since an error return, assuming it's handled correctly is preferable to a panic. I thought this was more true for NOWAIT than for WAITOK cases, but I've realized it's more true always. And that's why I have such a problem with mallocarray: it's only useful when people are lazy and haven't checked, and then it creates a DoS path for things that don't check. We'll change it now and think we're safe, when we still have issues, just different issues than before. It may be a necessary change, but it certainly isn't sufficient. Warner From owner-svn-src-all@freebsd.org Wed Jan 24 21:20:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69AB3EC68C7; Wed, 24 Jan 2018 21:20:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 187CF789EE; Wed, 24 Jan 2018 21:20:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12B9C22FDF; Wed, 24 Jan 2018 21:20:25 +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 w0OLKOSQ068248; Wed, 24 Jan 2018 21:20:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OLKONW068247; Wed, 24 Jan 2018 21:20:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801242120.w0OLKONW068247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 24 Jan 2018 21:20:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328375 - head/share/man/man8 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man8 X-SVN-Commit-Revision: 328375 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 21:20:25 -0000 Author: emaste Date: Wed Jan 24 21:20:24 2018 New Revision: 328375 URL: https://svnweb.freebsd.org/changeset/base/328375 Log: uefi.8: note that UEFI and EFI are used interchangeably Modified: head/share/man/man8/uefi.8 Modified: head/share/man/man8/uefi.8 ============================================================================== --- head/share/man/man8/uefi.8 Wed Jan 24 21:11:35 2018 (r328374) +++ head/share/man/man8/uefi.8 Wed Jan 24 21:20:24 2018 (r328375) @@ -39,6 +39,10 @@ to operating systems. is a replacement for the legacy BIOS on the i386 and amd64 CPU architectures, and is also used on arm, arm64 and ia64. .Pp +The UEFI specification is the successor to the Extensible Firmware Interface +(EFI) specification. +The terms are often used interchangeably. +.Pp The .Nm boot process loads system bootstrap code located in an EFI System Partition From owner-svn-src-all@freebsd.org Wed Jan 24 21:26:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0C05EC6E10; Wed, 24 Jan 2018 21:26:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7362F78EF0; Wed, 24 Jan 2018 21:26:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E4C82316E; Wed, 24 Jan 2018 21:26:01 +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 w0OLQ1TO072909; Wed, 24 Jan 2018 21:26:01 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OLQ1np072908; Wed, 24 Jan 2018 21:26:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801242126.w0OLQ1np072908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 24 Jan 2018 21:26:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328376 - head/share/man/man8 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man8 X-SVN-Commit-Revision: 328376 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 21:26:01 -0000 Author: emaste Date: Wed Jan 24 21:26:01 2018 New Revision: 328376 URL: https://svnweb.freebsd.org/changeset/base/328376 Log: uefi.8: add .Xr cross references to new efi tools Modified: head/share/man/man8/uefi.8 Modified: head/share/man/man8/uefi.8 ============================================================================== --- head/share/man/man8/uefi.8 Wed Jan 24 21:20:24 2018 (r328375) +++ head/share/man/man8/uefi.8 Wed Jan 24 21:26:01 2018 (r328376) @@ -144,6 +144,9 @@ typical non-default kernel (optional) .Xr boot.config 5 , .Xr msdosfs 5 , .Xr boot 8 , +.Xr efibootmgr 8 , +.Xr efidp 8 , +.Xr efivar 8 , .Xr gpart 8 , .Xr uefisign 8 .Sh HISTORY From owner-svn-src-all@freebsd.org Wed Jan 24 21:33:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97A2AEC731D; Wed, 24 Jan 2018 21:33:19 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4537579480; Wed, 24 Jan 2018 21:33:19 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4024E23311; Wed, 24 Jan 2018 21:33:19 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OLXJDU078289; Wed, 24 Jan 2018 21:33:19 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OLXIOe078281; Wed, 24 Jan 2018 21:33:18 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201801242133.w0OLXIOe078281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Wed, 24 Jan 2018 21:33:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328377 - in head/sys/dev/etherswitch: arswitch e6000sw infineon ip17x micrel mtkswitch rtl8366 ukswitch X-SVN-Group: head X-SVN-Commit-Author: mizhka X-SVN-Commit-Paths: in head/sys/dev/etherswitch: arswitch e6000sw infineon ip17x micrel mtkswitch rtl8366 ukswitch X-SVN-Commit-Revision: 328377 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 21:33:19 -0000 Author: mizhka Date: Wed Jan 24 21:33:18 2018 New Revision: 328377 URL: https://svnweb.freebsd.org/changeset/base/328377 Log: [etherswitch] check if_alloc returns NULL This patch is cosmetic. It checks if allocation of ifnet structure failed. It's better to have this check rather than assume positive scenario. Submitted by: Dmitry Luhtionov Reported by: Dmitry Luhtionov Modified: head/sys/dev/etherswitch/arswitch/arswitch.c head/sys/dev/etherswitch/e6000sw/e6060sw.c head/sys/dev/etherswitch/infineon/adm6996fc.c head/sys/dev/etherswitch/ip17x/ip17x.c head/sys/dev/etherswitch/micrel/ksz8995ma.c head/sys/dev/etherswitch/mtkswitch/mtkswitch.c head/sys/dev/etherswitch/rtl8366/rtl8366rb.c head/sys/dev/etherswitch/ukswitch/ukswitch.c Modified: head/sys/dev/etherswitch/arswitch/arswitch.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch.c Wed Jan 24 21:26:01 2018 (r328376) +++ head/sys/dev/etherswitch/arswitch/arswitch.c Wed Jan 24 21:33:18 2018 (r328377) @@ -177,6 +177,12 @@ arswitch_attach_phys(struct arswitch_softc *sc) snprintf(name, IFNAMSIZ, "%sport", device_get_nameunit(sc->sc_dev)); for (phy = 0; phy < sc->numphys; phy++) { sc->ifp[phy] = if_alloc(IFT_ETHER); + if (sc->ifp[phy] == NULL) { + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); + err = ENOMEM; + break; + } + sc->ifp[phy]->if_softc = sc; sc->ifp[phy]->if_flags |= IFF_UP | IFF_BROADCAST | IFF_DRV_RUNNING | IFF_SIMPLEX; Modified: head/sys/dev/etherswitch/e6000sw/e6060sw.c ============================================================================== --- head/sys/dev/etherswitch/e6000sw/e6060sw.c Wed Jan 24 21:26:01 2018 (r328376) +++ head/sys/dev/etherswitch/e6000sw/e6060sw.c Wed Jan 24 21:33:18 2018 (r328377) @@ -218,6 +218,12 @@ e6060sw_attach_phys(struct e6060sw_softc *sc) sc->ifpport[phy] = port; sc->portphy[port] = phy; sc->ifp[port] = if_alloc(IFT_ETHER); + if (sc->ifp[port] == NULL) { + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); + err = ENOMEM; + break; + } + sc->ifp[port]->if_softc = sc; sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | IFF_DRV_RUNNING | IFF_SIMPLEX; Modified: head/sys/dev/etherswitch/infineon/adm6996fc.c ============================================================================== --- head/sys/dev/etherswitch/infineon/adm6996fc.c Wed Jan 24 21:26:01 2018 (r328376) +++ head/sys/dev/etherswitch/infineon/adm6996fc.c Wed Jan 24 21:33:18 2018 (r328377) @@ -175,6 +175,12 @@ adm6996fc_attach_phys(struct adm6996fc_softc *sc) sc->ifpport[phy] = port; sc->portphy[port] = phy; sc->ifp[port] = if_alloc(IFT_ETHER); + if (sc->ifp[port] == NULL) { + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); + err = ENOMEM; + break; + } + sc->ifp[port]->if_softc = sc; sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | IFF_DRV_RUNNING | IFF_SIMPLEX; Modified: head/sys/dev/etherswitch/ip17x/ip17x.c ============================================================================== --- head/sys/dev/etherswitch/ip17x/ip17x.c Wed Jan 24 21:26:01 2018 (r328376) +++ head/sys/dev/etherswitch/ip17x/ip17x.c Wed Jan 24 21:33:18 2018 (r328377) @@ -174,6 +174,12 @@ ip17x_attach_phys(struct ip17x_softc *sc) sc->phyport[phy] = port; sc->portphy[port] = phy; sc->ifp[port] = if_alloc(IFT_ETHER); + if (sc->ifp[port] == NULL) { + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); + err = ENOMEM; + break; + } + sc->ifp[port]->if_softc = sc; sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | IFF_DRV_RUNNING | IFF_SIMPLEX; Modified: head/sys/dev/etherswitch/micrel/ksz8995ma.c ============================================================================== --- head/sys/dev/etherswitch/micrel/ksz8995ma.c Wed Jan 24 21:26:01 2018 (r328376) +++ head/sys/dev/etherswitch/micrel/ksz8995ma.c Wed Jan 24 21:33:18 2018 (r328377) @@ -221,6 +221,12 @@ ksz8995ma_attach_phys(struct ksz8995ma_softc *sc) sc->ifpport[phy] = port; sc->portphy[port] = phy; sc->ifp[port] = if_alloc(IFT_ETHER); + if (sc->ifp[port] == NULL) { + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); + err = ENOMEM; + break; + } + sc->ifp[port]->if_softc = sc; sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | IFF_DRV_RUNNING | IFF_SIMPLEX; Modified: head/sys/dev/etherswitch/mtkswitch/mtkswitch.c ============================================================================== --- head/sys/dev/etherswitch/mtkswitch/mtkswitch.c Wed Jan 24 21:26:01 2018 (r328376) +++ head/sys/dev/etherswitch/mtkswitch/mtkswitch.c Wed Jan 24 21:33:18 2018 (r328377) @@ -122,6 +122,12 @@ mtkswitch_attach_phys(struct mtkswitch_softc *sc) continue; } sc->ifp[phy] = if_alloc(IFT_ETHER); + if (sc->ifp[phy] == NULL) { + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); + err = ENOMEM; + break; + } + sc->ifp[phy]->if_softc = sc; sc->ifp[phy]->if_flags |= IFF_UP | IFF_BROADCAST | IFF_DRV_RUNNING | IFF_SIMPLEX; Modified: head/sys/dev/etherswitch/rtl8366/rtl8366rb.c ============================================================================== --- head/sys/dev/etherswitch/rtl8366/rtl8366rb.c Wed Jan 24 21:26:01 2018 (r328376) +++ head/sys/dev/etherswitch/rtl8366/rtl8366rb.c Wed Jan 24 21:33:18 2018 (r328377) @@ -239,6 +239,12 @@ rtl8366rb_attach(device_t dev) /* PHYs need an interface, so we generate a dummy one */ for (i = 0; i < sc->numphys; i++) { sc->ifp[i] = if_alloc(IFT_ETHER); + if (sc->ifp[i] == NULL) { + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); + err = ENOMEM; + break; + } + sc->ifp[i]->if_softc = sc; sc->ifp[i]->if_flags |= IFF_UP | IFF_BROADCAST | IFF_DRV_RUNNING | IFF_SIMPLEX; Modified: head/sys/dev/etherswitch/ukswitch/ukswitch.c ============================================================================== --- head/sys/dev/etherswitch/ukswitch/ukswitch.c Wed Jan 24 21:26:01 2018 (r328376) +++ head/sys/dev/etherswitch/ukswitch/ukswitch.c Wed Jan 24 21:33:18 2018 (r328377) @@ -126,6 +126,12 @@ ukswitch_attach_phys(struct ukswitch_softc *sc) sc->ifpport[phy] = port; sc->portphy[port] = phy; sc->ifp[port] = if_alloc(IFT_ETHER); + if (sc->ifp[port] == NULL) { + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); + err = ENOMEM; + break; + } + sc->ifp[port]->if_softc = sc; sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | IFF_DRV_RUNNING | IFF_SIMPLEX; From owner-svn-src-all@freebsd.org Wed Jan 24 21:39:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7672EEC775B; Wed, 24 Jan 2018 21:39:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 225557989A; Wed, 24 Jan 2018 21:39:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B2642331C; Wed, 24 Jan 2018 21:39:41 +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 w0OLdePh078726; Wed, 24 Jan 2018 21:39:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OLdeU5078725; Wed, 24 Jan 2018 21:39:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801242139.w0OLdeU5078725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 24 Jan 2018 21:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328378 - head/share/man/man8 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man8 X-SVN-Commit-Revision: 328378 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 21:39:41 -0000 Author: emaste Date: Wed Jan 24 21:39:40 2018 New Revision: 328378 URL: https://svnweb.freebsd.org/changeset/base/328378 Log: Add efi.8 as a man page link to uefi.8 FreeBSD and industry has been inconsistent in the use of UEFI and EFI. They are essentially just different versions of the same specification and are often used interchangeably. Make it easier for users to find information by making efi(8) an alias for uefi(8). Reported by: imp, jhb Modified: head/share/man/man8/Makefile Modified: head/share/man/man8/Makefile ============================================================================== --- head/share/man/man8/Makefile Wed Jan 24 21:33:18 2018 (r328377) +++ head/share/man/man8/Makefile Wed Jan 24 21:39:40 2018 (r328378) @@ -29,7 +29,8 @@ MLINKS= \ .if ${MK_NIS} != "no" MAN+= yp.8 -MLINKS+=yp.8 NIS.8 \ +MLINKS+=uefi.8 efi.8 \ + yp.8 NIS.8 \ yp.8 nis.8 \ yp.8 YP.8 .endif From owner-svn-src-all@freebsd.org Wed Jan 24 21:40:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1FD7EC7817; Wed, 24 Jan 2018 21:40:37 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f46.google.com (mail-it0-f46.google.com [209.85.214.46]) (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 7DC6F79A00; Wed, 24 Jan 2018 21:40:37 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f46.google.com with SMTP id 196so6900024iti.5; Wed, 24 Jan 2018 13:40:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=Rt0KD1gJTRC+DGWepIrt1HQpqhxoQR7rqzg8thCA80g=; b=rDJbdVVPkWwu/wLy1bR6KSTKrlvDymYVVgFY6TV6bFrjgbumdaQ2tvYt96exJBLL/W 02fMCGce1U9KpCvvRAY9MpdFHoTE5A+702Dv+pS2EuTdeq4Io2VDIkPrf2UPgjIZdhwU hyVO91RPBviCAoBxrT9Xfo32rCDocVrCgQdu3BIPHK+JBCMlWW4P+evLl6itGHqAaBYM L2bwNZqbeQrB6HOzkmsIeB2no23ehw2JF65mALSxqKjSvnF1eU3dzBl9fg6r+tKoXfZR WFgm3rmFKWhK9wggNVku+xx9Xgbtj+7SCbj3ZZYtW30Z650/+lrl2jKRSHe6HXieBBB8 d8nQ== X-Gm-Message-State: AKwxyte7UHX/j4p/EGmqGGkH5K6MK2Hld6cS8mvoeSMDqEI1vhTTu8Qs v4jmL8N8UiU/IvsFB5jjMXY3wHFO X-Google-Smtp-Source: AH8x226MUrYaC65EcBXIUNfB3u4ROmbEcG+a9WvNWAwrsLdmrMxE/Yiqjfi7TP8dQQ+Mx1+xqFgssQ== X-Received: by 10.36.64.136 with SMTP id n130mr10921827ita.105.1516830036572; Wed, 24 Jan 2018 13:40:36 -0800 (PST) Received: from mail-io0-f174.google.com (mail-io0-f174.google.com. [209.85.223.174]) by smtp.gmail.com with ESMTPSA id e185sm637144itb.27.2018.01.24.13.40.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 13:40:36 -0800 (PST) Received: by mail-io0-f174.google.com with SMTP id f4so6400479ioh.8; Wed, 24 Jan 2018 13:40:36 -0800 (PST) X-Received: by 10.107.15.89 with SMTP id x86mr10530315ioi.38.1516830035813; Wed, 24 Jan 2018 13:40:35 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Wed, 24 Jan 2018 13:40:35 -0800 (PST) In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org> From: Conrad Meyer Date: Wed, 24 Jan 2018 13:40:35 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: Warner Losh 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.25 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, 24 Jan 2018 21:40:38 -0000 On Wed, Jan 24, 2018 at 1:13 PM, Warner Losh wrote: > mallocarray should be the last line of defense, not the only line of > defense. Agreed. > most of the time, it's more correct to say > > if (WOULD_OVERFLOW(a,b)) > return EINVAL; > ptr = mallocarray(a,b...); Disagree -- the right check to have outside is much more constrained than just "will this overflow?" A 10GB allocation request is still insane on amd64, just for a different reason than on i386. I think BDE said something along the lines of max 32 kB for most allocations, and I don't really disagree with that. Picking a specific number for mallocarray itself (other than overflow) restricts the generality, though. > since an error return, assuming it's handled correctly is preferable to a > panic. Agreed. > I thought this was more true for NOWAIT than for WAITOK cases, but I've > realized it's more true always. Yeah, I think it's equally true of M_WAITOK and M_NOWAIT. > And that's why I have such a problem with mallocarray: it's only useful when > people are lazy and haven't checked, It's useful as a seatbelt. Empirically, people are not perfect at doing the checking. I can understand that it feels like admitting laziness to accept that we need a final seatbelt check at all, but I don't think having the seatbelt hurts. > and then it creates a DoS path for > things that don't check. No, again; it doesn't "create" a DoS. Any DoS path was already present as a heap corruption path. The DoS is strictly an improvement. > We'll change it now and think we're safe, when we > still have issues, just different issues than before. Don't think that, then? We have replaced some classes of heap corruption with a DoS. That's it; nothing more. I don't think anyone promoting mallocarray is overrepresenting what it does or claims to do. > It may be a necessary > change, but it certainly isn't sufficient. I don't disagree. Best, Conrad From owner-svn-src-all@freebsd.org Wed Jan 24 21:41:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4060EC7A34; Wed, 24 Jan 2018 21:41:38 +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 2486979D47; Wed, 24 Jan 2018 21:41:37 +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 w0OLfYX4097127; Wed, 24 Jan 2018 13:41:34 -0800 (PST) (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 w0OLfYMd097126; Wed, 24 Jan 2018 13:41:34 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801242141.w0OLfYMd097126@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r328378 - head/share/man/man8 In-Reply-To: <201801242139.w0OLdeU5078725@repo.freebsd.org> To: Ed Maste Date: Wed, 24 Jan 2018 13:41:34 -0800 (PST) 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.25 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, 24 Jan 2018 21:41:38 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: emaste > Date: Wed Jan 24 21:39:40 2018 > New Revision: 328378 > URL: https://svnweb.freebsd.org/changeset/base/328378 > > Log: > Add efi.8 as a man page link to uefi.8 > > FreeBSD and industry has been inconsistent in the use of UEFI and EFI. > They are essentially just different versions of the same specification > and are often used interchangeably. Make it easier for users to find > information by making efi(8) an alias for uefi(8). > > Reported by: imp, jhb > > Modified: > head/share/man/man8/Makefile > > Modified: head/share/man/man8/Makefile > ============================================================================== > --- head/share/man/man8/Makefile Wed Jan 24 21:33:18 2018 (r328377) > +++ head/share/man/man8/Makefile Wed Jan 24 21:39:40 2018 (r328378) > @@ -29,7 +29,8 @@ MLINKS= \ > .if ${MK_NIS} != "no" > MAN+= yp.8 > > -MLINKS+=yp.8 NIS.8 \ Uh oh, you yp and NIS are very different that uefi and efi.... > +MLINKS+=uefi.8 efi.8 \ > + yp.8 NIS.8 \ > yp.8 nis.8 \ > yp.8 YP.8 > .endif -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Wed Jan 24 21:48:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B322FEC8380; Wed, 24 Jan 2018 21:48:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 593C77A304; Wed, 24 Jan 2018 21:48:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5096C234BC; Wed, 24 Jan 2018 21:48:40 +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 w0OLme1T083527; Wed, 24 Jan 2018 21:48:40 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OLmdTr083524; Wed, 24 Jan 2018 21:48:39 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801242148.w0OLmdTr083524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 21:48: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: r328379 - in stable: 10/sys/kern 10/sys/sys 10/tests/sys/kern 11/sys/kern 11/sys/sys 11/tests/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/sys/kern 10/sys/sys 10/tests/sys/kern 11/sys/kern 11/sys/sys 11/tests/sys/kern X-SVN-Commit-Revision: 328379 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 21:48:41 -0000 Author: jhb Date: Wed Jan 24 21:48:39 2018 New Revision: 328379 URL: https://svnweb.freebsd.org/changeset/base/328379 Log: MFC 325028,328344: Discard the correct thread event reported for a ptrace stop. 325028: Discard the correct thread event reported for a ptrace stop. When multiple threads wish to report a tracing event to a debugger, both threads call ptracestop() and one thread will win the race to be the reporting thread (p->p_xthread). The debugger uses PT_LWPINFO with the process ID to determine which thread / LWP is reporting an event and the details of that event. This event is cleared as a side effect of the subsequent ptrace event that resumed the process (PT_CONTINUE, PT_STEP, etc.). However, ptrace() was clearing the event identified by the LWP ID passed to the resume request even if that wasn't the 'p_xthread'. This could result in clearing an event that had not yet been observed by the debugger and leaving the existing event for 'p_thread' pending so that it was reported a second time. Specifically, if the debugger stopped due to a software breakpoint in one thread, but then switched to another thread that was used to resume (e.g. if the user switched to a different thread and issued a step), the resume request (PT_STEP) cleared a pending event (if any) for the thread being stepped. However, the process immediately stopped and the first thread reported it's breakpoint event a second time. The debugger decremented the PC for "both" breakpoint events which resulted in the PC now pointing into the middle of an instruction (on x86) and a SIGILL fault when the process was resumed a second time. To fix, always clear the pending event for 'p_xthread' when resuming a process. ptrace() still honors the requested LWP ID when enabling single-stepping (PT_STEP) or setting a different PC (PT_CONTINUE). 328344: Mark the unused argument to continue_thread() as such. clang in HEAD and 11 does not warn about this, but clang in 10 does. Modified: stable/10/sys/kern/sys_process.c stable/10/sys/sys/param.h stable/10/tests/sys/kern/ptrace_test.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/kern/sys_process.c stable/11/sys/sys/param.h stable/11/tests/sys/kern/ptrace_test.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/kern/sys_process.c ============================================================================== --- stable/10/sys/kern/sys_process.c Wed Jan 24 21:39:40 2018 (r328378) +++ stable/10/sys/kern/sys_process.c Wed Jan 24 21:48:39 2018 (r328379) @@ -1072,6 +1072,13 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi } sendsig: + /* + * Clear the pending event for the thread that just + * reported its event (p_xthread). This may not be + * the thread passed to PT_CONTINUE, PT_STEP, etc. if + * the debugger is resuming a different thread. + */ + td2 = p->p_xthread; if (proctree_locked) { sx_xunlock(&proctree_lock); proctree_locked = 0; Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Wed Jan 24 21:39:40 2018 (r328378) +++ stable/10/sys/sys/param.h Wed Jan 24 21:48:39 2018 (r328379) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1004500 /* Master, propagated to newvers */ +#define __FreeBSD_version 1004501 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: stable/10/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/10/tests/sys/kern/ptrace_test.c Wed Jan 24 21:39:40 2018 (r328378) +++ stable/10/tests/sys/kern/ptrace_test.c Wed Jan 24 21:48:39 2018 (r328379) @@ -2944,6 +2944,174 @@ ATF_TC_BODY(ptrace__event_mask_sigkill_discard, tc) ATF_REQUIRE(errno == ECHILD); } +#if defined(__amd64__) || defined(__i386__) +/* + * Only x86 both define breakpoint() and have a PC after breakpoint so + * that restarting doesn't retrigger the breakpoint. + */ +static void * +continue_thread(void *arg __unused) +{ + breakpoint(); + return (NULL); +} + +static __dead2 void +continue_thread_main(void) +{ + pthread_t threads[2]; + + CHILD_REQUIRE(pthread_create(&threads[0], NULL, continue_thread, + NULL) == 0); + CHILD_REQUIRE(pthread_create(&threads[1], NULL, continue_thread, + NULL) == 0); + CHILD_REQUIRE(pthread_join(threads[0], NULL) == 0); + CHILD_REQUIRE(pthread_join(threads[1], NULL) == 0); + exit(1); +} + +/* + * Ensure that PT_CONTINUE clears the status of the thread that + * triggered the stop even if a different thread's LWP was passed to + * PT_CONTINUE. + */ +ATF_TC_WITHOUT_HEAD(ptrace__PT_CONTINUE_different_thread); +ATF_TC_BODY(ptrace__PT_CONTINUE_different_thread, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + lwpid_t lwps[2]; + bool hit_break[2]; + int i, j, status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + continue_thread_main(); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, + sizeof(pl)) != -1); + + ATF_REQUIRE(ptrace(PT_LWP_EVENTS, wpid, NULL, 1) == 0); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* One of the new threads should report it's birth. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) == + (PL_FLAG_BORN | PL_FLAG_SCX)); + lwps[0] = pl.pl_lwpid; + + /* + * Suspend this thread to ensure both threads are alive before + * hitting the breakpoint. + */ + ATF_REQUIRE(ptrace(PT_SUSPEND, lwps[0], NULL, 0) != -1); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* Second thread should report it's birth. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) == + (PL_FLAG_BORN | PL_FLAG_SCX)); + ATF_REQUIRE(pl.pl_lwpid != lwps[0]); + lwps[1] = pl.pl_lwpid; + + /* Resume both threads waiting for breakpoint events. */ + hit_break[0] = hit_break[1] = false; + ATF_REQUIRE(ptrace(PT_RESUME, lwps[0], NULL, 0) != -1); + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* One thread should report a breakpoint. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP && + pl.pl_siginfo.si_code == TRAP_BRKPT); + if (pl.pl_lwpid == lwps[0]) + i = 0; + else + i = 1; + hit_break[i] = true; + + /* + * Resume both threads but pass the other thread's LWPID to + * PT_CONTINUE. + */ + ATF_REQUIRE(ptrace(PT_CONTINUE, lwps[i ^ 1], (caddr_t)1, 0) == 0); + + /* + * Will now get two thread exit events and one more breakpoint + * event. + */ + for (j = 0; j < 3; j++) { + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, + sizeof(pl)) != -1); + + if (pl.pl_lwpid == lwps[0]) + i = 0; + else + i = 1; + + ATF_REQUIRE_MSG(lwps[i] != 0, "event for exited thread"); + if (pl.pl_flags & PL_FLAG_EXITED) { + ATF_REQUIRE_MSG(hit_break[i], + "exited thread did not report breakpoint"); + lwps[i] = 0; + } else { + ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP && + pl.pl_siginfo.si_code == TRAP_BRKPT); + ATF_REQUIRE_MSG(!hit_break[i], + "double breakpoint event"); + hit_break[i] = true; + } + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + } + + /* Both threads should have exited. */ + ATF_REQUIRE(lwps[0] == 0); + ATF_REQUIRE(lwps[1] == 0); + + /* The last event should be for the child process's exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} +#endif + ATF_TP_ADD_TCS(tp) { @@ -2990,6 +3158,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__parent_terminate_with_pending_sigstop1); ATF_TP_ADD_TC(tp, ptrace__parent_terminate_with_pending_sigstop2); ATF_TP_ADD_TC(tp, ptrace__event_mask_sigkill_discard); +#if defined(__amd64__) || defined(__i386__) + ATF_TP_ADD_TC(tp, ptrace__PT_CONTINUE_different_thread); +#endif return (atf_no_error()); } From owner-svn-src-all@freebsd.org Wed Jan 24 21:48:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 304FDEC8384; Wed, 24 Jan 2018 21:48:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4C617A305; Wed, 24 Jan 2018 21:48:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFB2B234BD; Wed, 24 Jan 2018 21:48:40 +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 w0OLmeem083535; Wed, 24 Jan 2018 21:48:40 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OLmeQc083532; Wed, 24 Jan 2018 21:48:40 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801242148.w0OLmeQc083532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 21:48: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: r328379 - in stable: 10/sys/kern 10/sys/sys 10/tests/sys/kern 11/sys/kern 11/sys/sys 11/tests/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/sys/kern 10/sys/sys 10/tests/sys/kern 11/sys/kern 11/sys/sys 11/tests/sys/kern X-SVN-Commit-Revision: 328379 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 21:48:41 -0000 Author: jhb Date: Wed Jan 24 21:48:39 2018 New Revision: 328379 URL: https://svnweb.freebsd.org/changeset/base/328379 Log: MFC 325028,328344: Discard the correct thread event reported for a ptrace stop. 325028: Discard the correct thread event reported for a ptrace stop. When multiple threads wish to report a tracing event to a debugger, both threads call ptracestop() and one thread will win the race to be the reporting thread (p->p_xthread). The debugger uses PT_LWPINFO with the process ID to determine which thread / LWP is reporting an event and the details of that event. This event is cleared as a side effect of the subsequent ptrace event that resumed the process (PT_CONTINUE, PT_STEP, etc.). However, ptrace() was clearing the event identified by the LWP ID passed to the resume request even if that wasn't the 'p_xthread'. This could result in clearing an event that had not yet been observed by the debugger and leaving the existing event for 'p_thread' pending so that it was reported a second time. Specifically, if the debugger stopped due to a software breakpoint in one thread, but then switched to another thread that was used to resume (e.g. if the user switched to a different thread and issued a step), the resume request (PT_STEP) cleared a pending event (if any) for the thread being stepped. However, the process immediately stopped and the first thread reported it's breakpoint event a second time. The debugger decremented the PC for "both" breakpoint events which resulted in the PC now pointing into the middle of an instruction (on x86) and a SIGILL fault when the process was resumed a second time. To fix, always clear the pending event for 'p_xthread' when resuming a process. ptrace() still honors the requested LWP ID when enabling single-stepping (PT_STEP) or setting a different PC (PT_CONTINUE). 328344: Mark the unused argument to continue_thread() as such. clang in HEAD and 11 does not warn about this, but clang in 10 does. Modified: stable/11/sys/kern/sys_process.c stable/11/sys/sys/param.h stable/11/tests/sys/kern/ptrace_test.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/kern/sys_process.c stable/10/sys/sys/param.h stable/10/tests/sys/kern/ptrace_test.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/kern/sys_process.c ============================================================================== --- stable/11/sys/kern/sys_process.c Wed Jan 24 21:39:40 2018 (r328378) +++ stable/11/sys/kern/sys_process.c Wed Jan 24 21:48:39 2018 (r328379) @@ -1130,6 +1130,13 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi } sendsig: + /* + * Clear the pending event for the thread that just + * reported its event (p_xthread). This may not be + * the thread passed to PT_CONTINUE, PT_STEP, etc. if + * the debugger is resuming a different thread. + */ + td2 = p->p_xthread; if (proctree_locked) { sx_xunlock(&proctree_lock); proctree_locked = 0; Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Wed Jan 24 21:39:40 2018 (r328378) +++ stable/11/sys/sys/param.h Wed Jan 24 21:48:39 2018 (r328379) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1101506 /* Master, propagated to newvers */ +#define __FreeBSD_version 1101507 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: stable/11/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/11/tests/sys/kern/ptrace_test.c Wed Jan 24 21:39:40 2018 (r328378) +++ stable/11/tests/sys/kern/ptrace_test.c Wed Jan 24 21:48:39 2018 (r328379) @@ -3468,6 +3468,174 @@ ATF_TC_BODY(ptrace__PT_STEP_with_signal, tc) ATF_REQUIRE(errno == ECHILD); } +#if defined(__amd64__) || defined(__i386__) +/* + * Only x86 both define breakpoint() and have a PC after breakpoint so + * that restarting doesn't retrigger the breakpoint. + */ +static void * +continue_thread(void *arg __unused) +{ + breakpoint(); + return (NULL); +} + +static __dead2 void +continue_thread_main(void) +{ + pthread_t threads[2]; + + CHILD_REQUIRE(pthread_create(&threads[0], NULL, continue_thread, + NULL) == 0); + CHILD_REQUIRE(pthread_create(&threads[1], NULL, continue_thread, + NULL) == 0); + CHILD_REQUIRE(pthread_join(threads[0], NULL) == 0); + CHILD_REQUIRE(pthread_join(threads[1], NULL) == 0); + exit(1); +} + +/* + * Ensure that PT_CONTINUE clears the status of the thread that + * triggered the stop even if a different thread's LWP was passed to + * PT_CONTINUE. + */ +ATF_TC_WITHOUT_HEAD(ptrace__PT_CONTINUE_different_thread); +ATF_TC_BODY(ptrace__PT_CONTINUE_different_thread, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + lwpid_t lwps[2]; + bool hit_break[2]; + int i, j, status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + continue_thread_main(); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, + sizeof(pl)) != -1); + + ATF_REQUIRE(ptrace(PT_LWP_EVENTS, wpid, NULL, 1) == 0); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* One of the new threads should report it's birth. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) == + (PL_FLAG_BORN | PL_FLAG_SCX)); + lwps[0] = pl.pl_lwpid; + + /* + * Suspend this thread to ensure both threads are alive before + * hitting the breakpoint. + */ + ATF_REQUIRE(ptrace(PT_SUSPEND, lwps[0], NULL, 0) != -1); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* Second thread should report it's birth. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) == + (PL_FLAG_BORN | PL_FLAG_SCX)); + ATF_REQUIRE(pl.pl_lwpid != lwps[0]); + lwps[1] = pl.pl_lwpid; + + /* Resume both threads waiting for breakpoint events. */ + hit_break[0] = hit_break[1] = false; + ATF_REQUIRE(ptrace(PT_RESUME, lwps[0], NULL, 0) != -1); + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* One thread should report a breakpoint. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP && + pl.pl_siginfo.si_code == TRAP_BRKPT); + if (pl.pl_lwpid == lwps[0]) + i = 0; + else + i = 1; + hit_break[i] = true; + + /* + * Resume both threads but pass the other thread's LWPID to + * PT_CONTINUE. + */ + ATF_REQUIRE(ptrace(PT_CONTINUE, lwps[i ^ 1], (caddr_t)1, 0) == 0); + + /* + * Will now get two thread exit events and one more breakpoint + * event. + */ + for (j = 0; j < 3; j++) { + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, + sizeof(pl)) != -1); + + if (pl.pl_lwpid == lwps[0]) + i = 0; + else + i = 1; + + ATF_REQUIRE_MSG(lwps[i] != 0, "event for exited thread"); + if (pl.pl_flags & PL_FLAG_EXITED) { + ATF_REQUIRE_MSG(hit_break[i], + "exited thread did not report breakpoint"); + lwps[i] = 0; + } else { + ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP && + pl.pl_siginfo.si_code == TRAP_BRKPT); + ATF_REQUIRE_MSG(!hit_break[i], + "double breakpoint event"); + hit_break[i] = true; + } + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + } + + /* Both threads should have exited. */ + ATF_REQUIRE(lwps[0] == 0); + ATF_REQUIRE(lwps[1] == 0); + + /* The last event should be for the child process's exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} +#endif + ATF_TP_ADD_TCS(tp) { @@ -3520,6 +3688,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__event_mask_sigkill_discard); ATF_TP_ADD_TC(tp, ptrace__PT_ATTACH_with_SBDRY_thread); ATF_TP_ADD_TC(tp, ptrace__PT_STEP_with_signal); +#if defined(__amd64__) || defined(__i386__) + ATF_TP_ADD_TC(tp, ptrace__PT_CONTINUE_different_thread); +#endif return (atf_no_error()); } From owner-svn-src-all@freebsd.org Wed Jan 24 21:51:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 496A1EC8740 for ; Wed, 24 Jan 2018 21:51:31 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::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 94FFF7A6A6 for ; Wed, 24 Jan 2018 21:51:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x22c.google.com with SMTP id v123so11352092wmd.5 for ; Wed, 24 Jan 2018 13:51:30 -0800 (PST) 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=Uf/eQMifOyCeWtl5qOyeuGEHyfSUxYdHyfPCSl48vDg=; b=ZLD5eGbvSahS5wiohOFL1V3RElzu9t0UMTzhhrlyVoEB1UPYnYu5Uw07pVb6GgDDD6 e6G17MMI0r9qv7w75MsQTMZVvnK5/9xX7tzMSUQVOfQtI+Dit+tw2D3XEvurHcMdvFai p1kIFlk7h4Pes1r/hS7qBxfRR9yUDYgAOc7nVD3NdNfSvfV9ULqT9t60gOjYTidKrvJM A5D4AJo9NA+51x/klE5r5KF7f0/2YE3WeqvH5Naiq9pifgVmLzKc/TPaG3+pnp596hov ZY5BMVu8k6ifhm6ck4i737Rr/SQOWQsPP2XEOqzZMnv8jfdCNfAuluCYcaRTtWHpCnDa NnWw== 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=Uf/eQMifOyCeWtl5qOyeuGEHyfSUxYdHyfPCSl48vDg=; b=pKllQJwr2SaKWe4iIFzGXELrZnq9ojBF+ac7CvARm4JuS/zin/vAnjCa4CtsBZ0erL ayzS0bN60MkX3e7qcWuZy0eMl6hRkwvd94NHm/Z6WXDUIGD1m7wsVr3g+nDteM75ONhk IMh8IfmeU3vvpmgAOsPzbYVKrlvOStFYmVoO97cdzRMnC6T5xyBvxAMz4Hfxarwmd3P7 TSGQmAjSMPB7rPWSG06BJMPqK/Cx0ScjNmPpJoUH2njpqIPuq0glHYlh7jiIBcmP242l h6mBMGT11c+3K7jXzHk/xgnyOfuOiIxa9dcxhRn9xCFt+KTptTvEUeXEZYEOFMxNM7xD KFWg== X-Gm-Message-State: AKwxyteFppXMqN2lzKS8StdnlKo4pA9VGtGbXJKjdH8hgfuk5F2wFvdU /sSwf7VvPXbdw0DOJo4O9w2KFiBkCyaLjvYh3hqzpg== X-Google-Smtp-Source: AH8x226VlUss8kWpTnitxqJT1JB52iIOVBrPuHd3jiT7eEl8zD25QzLWIM+1hD7ND5oXNtXOIKpzBDGQ9Q2TPSDgYeU= X-Received: by 10.80.170.24 with SMTP id o24mr26154629edc.258.1516830689433; Wed, 24 Jan 2018 13:51:29 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.133.195 with HTTP; Wed, 24 Jan 2018 13:51:29 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org> From: Warner Losh Date: Wed, 24 Jan 2018 14:51:29 -0700 X-Google-Sender-Auth: u1yzUfuZg94m5EHnAoOxM6JEZ1o Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: "Conrad E. Meyer" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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, 24 Jan 2018 21:51:31 -0000 On Wed, Jan 24, 2018 at 2:40 PM, Conrad Meyer wrote: > On Wed, Jan 24, 2018 at 1:13 PM, Warner Losh wrote: > > mallocarray should be the last line of defense, not the only line of > > defense. > > Agreed. > > > most of the time, it's more correct to say > > > > if (WOULD_OVERFLOW(a,b)) > > return EINVAL; > > ptr = mallocarray(a,b...); > > Disagree -- the right check to have outside is much more constrained > than just "will this overflow?" A 10GB allocation request is still > insane on amd64, just for a different reason than on i386. I think > BDE said something along the lines of max 32 kB for most allocations, > and I don't really disagree with that. Picking a specific number for > mallocarray itself (other than overflow) restricts the generality, > though. Well, you're right. there's more context here. You want all these changes to be nops because the upper layers have effectively vetted the arguments. Those that don't need something like the above at the very least. WOULD_OVERFLOW is the least-restrictive version of "is this sane" we have. In the absence of other data, though, it's the last line. > since an error return, assuming it's handled correctly is preferable to a > > panic. > > Agreed. > > > I thought this was more true for NOWAIT than for WAITOK cases, but I've > > realized it's more true always. > > Yeah, I think it's equally true of M_WAITOK and M_NOWAIT. Yea. Upon reflection I've come around to this way of thinking. > And that's why I have such a problem with mallocarray: it's only useful > when > > people are lazy and haven't checked, > > It's useful as a seatbelt. Empirically, people are not perfect at > doing the checking. I can understand that it feels like admitting > laziness to accept that we need a final seatbelt check at all, but I > don't think having the seatbelt hurts. > > > and then it creates a DoS path for > > things that don't check. > > No, again; it doesn't "create" a DoS. Any DoS path was already > present as a heap corruption path. The DoS is strictly an > improvement. Fair enough. We've traded one problem for another. Depending on your threat model one or the other may be preferable. A heap overflow that's not exploitable that the integer overflow may enable might be preferable to a crash if the system uptime is important though. Both are problems that need better filtering. > > We'll change it now and think we're safe, when we > > still have issues, just different issues than before. > > Don't think that, then? We have replaced some classes of heap > corruption with a DoS. That's it; nothing more. I don't think anyone > promoting mallocarray is overrepresenting what it does or claims to > do. My worry is that people are going through and adding it in a sweep based on regexp hits without looking more closely to see if there could possibly be a bigger problem by doing a more in-depth data flow analysis. > It may be a necessary > > change, but it certainly isn't sufficient. > > I don't disagree. > Yea. Warner From owner-svn-src-all@freebsd.org Wed Jan 24 22:04:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A15A1EC8FAB; Wed, 24 Jan 2018 22:04:17 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 56B6D7AE6F; Wed, 24 Jan 2018 22:04:17 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D21F237FE; Wed, 24 Jan 2018 22:04:17 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OM4H8u093119; Wed, 24 Jan 2018 22:04:17 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OM4HmF093118; Wed, 24 Jan 2018 22:04:17 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201801242204.w0OM4HmF093118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 24 Jan 2018 22:04:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328380 - in head/sys: arm/conf arm/lpc dev/uart modules/uart X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm/conf arm/lpc dev/uart modules/uart X-SVN-Commit-Revision: 328380 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 22:04:17 -0000 Author: manu Date: Wed Jan 24 22:04:16 2018 New Revision: 328380 URL: https://svnweb.freebsd.org/changeset/base/328380 Log: arm: lpc: Remove support Code hasn't been touch this it's original commit in 2012 beside api changes. Reviewed by: ian Differential Revision: https://reviews.freebsd.org/D13625 Discussed with: freebsd-arm@freebsd.org (no reply) Deleted: head/sys/arm/conf/EA3250 head/sys/arm/lpc/files.lpc head/sys/arm/lpc/if_lpe.c head/sys/arm/lpc/if_lpereg.h head/sys/arm/lpc/lpc_dmac.c head/sys/arm/lpc/lpc_fb.c head/sys/arm/lpc/lpc_gpio.c head/sys/arm/lpc/lpc_intc.c head/sys/arm/lpc/lpc_machdep.c head/sys/arm/lpc/lpc_mmc.c head/sys/arm/lpc/lpc_ohci.c head/sys/arm/lpc/lpc_pll.c head/sys/arm/lpc/lpc_pwr.c head/sys/arm/lpc/lpc_rtc.c head/sys/arm/lpc/lpc_spi.c head/sys/arm/lpc/lpc_timer.c head/sys/arm/lpc/lpcreg.h head/sys/arm/lpc/lpcvar.h head/sys/arm/lpc/ssd1289.c head/sys/arm/lpc/std.lpc head/sys/dev/uart/uart_dev_lpc.c Modified: head/sys/modules/uart/Makefile Modified: head/sys/modules/uart/Makefile ============================================================================== --- head/sys/modules/uart/Makefile Wed Jan 24 21:48:39 2018 (r328379) +++ head/sys/modules/uart/Makefile Wed Jan 24 22:04:16 2018 (r328380) @@ -6,10 +6,6 @@ uart_bus_ebus= uart_bus_ebus.c .endif -.if ${MACHINE_CPUARCH} == "arm" -uart_dev_lpc= uart_dev_lpc.c -.endif - .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" || \ ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "riscv" || \ ${MACHINE_CPUARCH} == "sparc64" @@ -33,7 +29,7 @@ KMOD= uart SRCS= uart_bus_acpi.c ${uart_bus_ebus} uart_bus_isa.c uart_bus_pccard.c \ uart_bus_pci.c uart_bus_puc.c uart_bus_scc.c \ uart_core.c ${uart_cpu_machine} uart_dbg.c \ - ${uart_dev_lpc} ${uart_dev_mvebu} uart_dev_ns8250.c uart_dev_quicc.c \ + ${uart_dev_mvebu} uart_dev_ns8250.c uart_dev_quicc.c \ uart_dev_sab82532.c uart_dev_z8530.c \ uart_if.c uart_if.h uart_subr.c uart_tty.c From owner-svn-src-all@freebsd.org Wed Jan 24 22:35:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60B02ECA3F6; Wed, 24 Jan 2018 22:35:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 146587BDF9; Wed, 24 Jan 2018 22:35:03 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AD0423CBC; Wed, 24 Jan 2018 22:35:03 +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 w0OMZ2tZ008166; Wed, 24 Jan 2018 22:35:02 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OMZ0xv008145; Wed, 24 Jan 2018 22:35:00 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201801242235.w0OMZ0xv008145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 24 Jan 2018 22:35:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328381 - in head: contrib/compiler-rt/lib/builtins contrib/llvm/include/llvm/Analysis contrib/llvm/include/llvm/CodeGen contrib/llvm/include/llvm/MC contrib/llvm/include/llvm/Support c... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/compiler-rt/lib/builtins contrib/llvm/include/llvm/Analysis contrib/llvm/include/llvm/CodeGen contrib/llvm/include/llvm/MC contrib/llvm/include/llvm/Support contrib/llvm/lib/CodeGen c... X-SVN-Commit-Revision: 328381 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 22:35:03 -0000 Author: dim Date: Wed Jan 24 22:35:00 2018 New Revision: 328381 URL: https://svnweb.freebsd.org/changeset/base/328381 Log: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 6.0.0 (branches/release_60 r323338). MFC after: 3 months X-MFC-With: r327952 PR: 224669 Modified: head/contrib/compiler-rt/lib/builtins/clear_cache.c head/contrib/llvm/include/llvm/Analysis/RegionInfoImpl.h head/contrib/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h head/contrib/llvm/include/llvm/MC/MCCodeView.h head/contrib/llvm/include/llvm/Support/GenericDomTreeConstruction.h head/contrib/llvm/lib/CodeGen/GlobalMerge.cpp head/contrib/llvm/lib/CodeGen/PeepholeOptimizer.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp head/contrib/llvm/lib/CodeGen/TargetLoweringBase.cpp head/contrib/llvm/lib/Linker/IRMover.cpp head/contrib/llvm/lib/MC/MCCodeView.cpp head/contrib/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp head/contrib/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp head/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp head/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.h head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp head/contrib/llvm/lib/Transforms/Scalar/GVNHoist.cpp head/contrib/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp head/contrib/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp head/contrib/llvm/tools/clang/include/clang/Basic/Attr.td head/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td head/contrib/llvm/tools/clang/include/clang/Basic/TokenKinds.def head/contrib/llvm/tools/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h head/contrib/llvm/tools/clang/lib/AST/DeclBase.cpp head/contrib/llvm/tools/clang/lib/AST/ODRHash.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp head/contrib/llvm/tools/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp head/contrib/llvm/tools/clang/lib/Frontend/InitPreprocessor.cpp head/contrib/llvm/tools/clang/lib/Lex/Lexer.cpp head/contrib/llvm/tools/clang/lib/Lex/PPCaching.cpp head/contrib/llvm/tools/clang/lib/Lex/PPLexerChange.cpp head/contrib/llvm/tools/clang/lib/Sema/Scope.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaTemplateDeduction.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp head/contrib/llvm/tools/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp head/contrib/llvm/tools/clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp head/contrib/llvm/tools/lld/COFF/Driver.cpp head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp head/contrib/llvm/tools/llvm-readobj/MachODumper.cpp head/lib/clang/include/clang/Basic/Version.inc head/lib/clang/include/lld/Common/Version.inc head/lib/clang/include/llvm/Support/VCSRevision.h Directory Properties: head/contrib/compiler-rt/ (props changed) head/contrib/libc++/ (props changed) head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) head/contrib/llvm/tools/lld/ (props changed) head/contrib/llvm/tools/lldb/ (props changed) Modified: head/contrib/compiler-rt/lib/builtins/clear_cache.c ============================================================================== --- head/contrib/compiler-rt/lib/builtins/clear_cache.c Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/compiler-rt/lib/builtins/clear_cache.c Wed Jan 24 22:35:00 2018 (r328381) @@ -33,6 +33,11 @@ uintptr_t GetCurrentProcess(void); #include #endif +#if defined(__OpenBSD__) && defined(__mips__) + #include + #include +#endif + #if defined(__linux__) && defined(__mips__) #include #include @@ -142,6 +147,8 @@ void __clear_cache(void *start, void *end) { #else syscall(__NR_cacheflush, start, (end_int - start_int), BCACHE); #endif +#elif defined(__mips__) && defined(__OpenBSD__) + cacheflush(start, (uintptr_t)end - (uintptr_t)start, BCACHE); #elif defined(__aarch64__) && !defined(__APPLE__) uint64_t xstart = (uint64_t)(uintptr_t) start; uint64_t xend = (uint64_t)(uintptr_t) end; @@ -156,12 +163,14 @@ void __clear_cache(void *start, void *end) { * uintptr_t in case this runs in an IPL32 environment. */ const size_t dcache_line_size = 4 << ((ctr_el0 >> 16) & 15); - for (addr = xstart; addr < xend; addr += dcache_line_size) + for (addr = xstart & ~(dcache_line_size - 1); addr < xend; + addr += dcache_line_size) __asm __volatile("dc cvau, %0" :: "r"(addr)); __asm __volatile("dsb ish"); const size_t icache_line_size = 4 << ((ctr_el0 >> 0) & 15); - for (addr = xstart; addr < xend; addr += icache_line_size) + for (addr = xstart & ~(icache_line_size - 1); addr < xend; + addr += icache_line_size) __asm __volatile("ic ivau, %0" :: "r"(addr)); __asm __volatile("isb sy"); #elif defined (__powerpc64__) Modified: head/contrib/llvm/include/llvm/Analysis/RegionInfoImpl.h ============================================================================== --- head/contrib/llvm/include/llvm/Analysis/RegionInfoImpl.h Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/include/llvm/Analysis/RegionInfoImpl.h Wed Jan 24 22:35:00 2018 (r328381) @@ -254,23 +254,23 @@ std::string RegionBase::getNameStr() const { template void RegionBase::verifyBBInRegion(BlockT *BB) const { if (!contains(BB)) - llvm_unreachable("Broken region found: enumerated BB not in region!"); + report_fatal_error("Broken region found: enumerated BB not in region!"); BlockT *entry = getEntry(), *exit = getExit(); for (BlockT *Succ : make_range(BlockTraits::child_begin(BB), BlockTraits::child_end(BB))) { if (!contains(Succ) && exit != Succ) - llvm_unreachable("Broken region found: edges leaving the region must go " - "to the exit node!"); + report_fatal_error("Broken region found: edges leaving the region must go " + "to the exit node!"); } if (entry != BB) { for (BlockT *Pred : make_range(InvBlockTraits::child_begin(BB), InvBlockTraits::child_end(BB))) { if (!contains(Pred)) - llvm_unreachable("Broken region found: edges entering the region must " - "go to the entry node!"); + report_fatal_error("Broken region found: edges entering the region must " + "go to the entry node!"); } } } @@ -557,7 +557,7 @@ void RegionInfoBase::verifyBBMap(const RegionT *R) } else { BlockT *BB = Element->template getNodeAs(); if (getRegionFor(BB) != R) - llvm_unreachable("BB map does not match region nesting"); + report_fatal_error("BB map does not match region nesting"); } } } Modified: head/contrib/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h Wed Jan 24 22:35:00 2018 (r328381) @@ -56,7 +56,7 @@ class BaseIndexOffset { (public) int64_t &Off); /// Parses tree in Ptr for base, index, offset addresses. - static BaseIndexOffset match(SDValue Ptr, const SelectionDAG &DAG); + static BaseIndexOffset match(LSBaseSDNode *N, const SelectionDAG &DAG); }; } // end namespace llvm Modified: head/contrib/llvm/include/llvm/MC/MCCodeView.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCCodeView.h Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/include/llvm/MC/MCCodeView.h Wed Jan 24 22:35:00 2018 (r328381) @@ -177,13 +177,7 @@ class CodeViewContext { (public) unsigned IACol); /// Retreive the function info if this is a valid function id, or nullptr. - MCCVFunctionInfo *getCVFunctionInfo(unsigned FuncId) { - if (FuncId >= Functions.size()) - return nullptr; - if (Functions[FuncId].isUnallocatedFunctionInfo()) - return nullptr; - return &Functions[FuncId]; - } + MCCVFunctionInfo *getCVFunctionInfo(unsigned FuncId); /// Saves the information from the currently parsed .cv_loc directive /// and sets CVLocSeen. When the next instruction is assembled an entry @@ -199,50 +193,22 @@ class CodeViewContext { (public) CurrentCVLoc.setIsStmt(IsStmt); CVLocSeen = true; } - void clearCVLocSeen() { CVLocSeen = false; } bool getCVLocSeen() { return CVLocSeen; } + void clearCVLocSeen() { CVLocSeen = false; } + const MCCVLoc &getCurrentCVLoc() { return CurrentCVLoc; } bool isValidCVFileNumber(unsigned FileNumber); /// \brief Add a line entry. - void addLineEntry(const MCCVLineEntry &LineEntry) { - size_t Offset = MCCVLines.size(); - auto I = MCCVLineStartStop.insert( - {LineEntry.getFunctionId(), {Offset, Offset + 1}}); - if (!I.second) - I.first->second.second = Offset + 1; - MCCVLines.push_back(LineEntry); - } + void addLineEntry(const MCCVLineEntry &LineEntry); - std::vector getFunctionLineEntries(unsigned FuncId) { - std::vector FilteredLines; + std::vector getFunctionLineEntries(unsigned FuncId); - auto I = MCCVLineStartStop.find(FuncId); - if (I != MCCVLineStartStop.end()) - for (size_t Idx = I->second.first, End = I->second.second; Idx != End; - ++Idx) - if (MCCVLines[Idx].getFunctionId() == FuncId) - FilteredLines.push_back(MCCVLines[Idx]); - return FilteredLines; - } + std::pair getLineExtent(unsigned FuncId); - std::pair getLineExtent(unsigned FuncId) { - auto I = MCCVLineStartStop.find(FuncId); - // Return an empty extent if there are no cv_locs for this function id. - if (I == MCCVLineStartStop.end()) - return {~0ULL, 0}; - return I->second; - } - - ArrayRef getLinesForExtent(size_t L, size_t R) { - if (R <= L) - return None; - if (L >= MCCVLines.size()) - return None; - return makeArrayRef(&MCCVLines[L], R - L); - } + ArrayRef getLinesForExtent(size_t L, size_t R); /// Emits a line table substream. void emitLineTableForFunction(MCObjectStreamer &OS, unsigned FuncId, Modified: head/contrib/llvm/include/llvm/Support/GenericDomTreeConstruction.h ============================================================================== --- head/contrib/llvm/include/llvm/Support/GenericDomTreeConstruction.h Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/include/llvm/Support/GenericDomTreeConstruction.h Wed Jan 24 22:35:00 2018 (r328381) @@ -628,7 +628,7 @@ struct SemiNCAInfo { DecreasingLevel> Bucket; // Queue of tree nodes sorted by level in descending order. SmallDenseSet Affected; - SmallDenseSet Visited; + SmallDenseMap Visited; SmallVector AffectedQueue; SmallVector VisitedNotAffectedQueue; }; @@ -706,7 +706,7 @@ struct SemiNCAInfo { // algorithm does not really know or use the set of roots and can make a // different (implicit) decision about which nodes within an infinite loop // becomes a root. - if (DT.isVirtualRoot(TN->getIDom())) { + if (TN && !DT.isVirtualRoot(TN->getIDom())) { DEBUG(dbgs() << "Root " << BlockNamePrinter(R) << " is not virtual root's child\n" << "The entire tree needs to be rebuilt\n"); @@ -753,14 +753,16 @@ struct SemiNCAInfo { while (!II.Bucket.empty()) { const TreeNodePtr CurrentNode = II.Bucket.top().second; + const unsigned CurrentLevel = CurrentNode->getLevel(); II.Bucket.pop(); DEBUG(dbgs() << "\tAdding to Visited and AffectedQueue: " << BlockNamePrinter(CurrentNode) << "\n"); - II.Visited.insert(CurrentNode); + + II.Visited.insert({CurrentNode, CurrentLevel}); II.AffectedQueue.push_back(CurrentNode); // Discover and collect affected successors of the current node. - VisitInsertion(DT, BUI, CurrentNode, CurrentNode->getLevel(), NCD, II); + VisitInsertion(DT, BUI, CurrentNode, CurrentLevel, NCD, II); } // Finish by updating immediate dominators and levels. @@ -772,13 +774,17 @@ struct SemiNCAInfo { const TreeNodePtr TN, const unsigned RootLevel, const TreeNodePtr NCD, InsertionInfo &II) { const unsigned NCDLevel = NCD->getLevel(); - DEBUG(dbgs() << "Visiting " << BlockNamePrinter(TN) << "\n"); + DEBUG(dbgs() << "Visiting " << BlockNamePrinter(TN) << ", RootLevel " + << RootLevel << "\n"); SmallVector Stack = {TN}; assert(TN->getBlock() && II.Visited.count(TN) && "Preconditions!"); + SmallPtrSet Processed; + do { TreeNodePtr Next = Stack.pop_back_val(); + DEBUG(dbgs() << " Next: " << BlockNamePrinter(Next) << "\n"); for (const NodePtr Succ : ChildrenGetter::Get(Next->getBlock(), BUI)) { @@ -786,19 +792,31 @@ struct SemiNCAInfo { assert(SuccTN && "Unreachable successor found at reachable insertion"); const unsigned SuccLevel = SuccTN->getLevel(); - DEBUG(dbgs() << "\tSuccessor " << BlockNamePrinter(Succ) - << ", level = " << SuccLevel << "\n"); + DEBUG(dbgs() << "\tSuccessor " << BlockNamePrinter(Succ) << ", level = " + << SuccLevel << "\n"); + // Do not process the same node multiple times. + if (Processed.count(Next) > 0) + continue; + // Succ dominated by subtree From -- not affected. // (Based on the lemma 2.5 from the second paper.) if (SuccLevel > RootLevel) { DEBUG(dbgs() << "\t\tDominated by subtree From\n"); - if (II.Visited.count(SuccTN) != 0) - continue; + if (II.Visited.count(SuccTN) != 0) { + DEBUG(dbgs() << "\t\t\talready visited at level " + << II.Visited[SuccTN] << "\n\t\t\tcurrent level " + << RootLevel << ")\n"); + // A node can be necessary to visit again if we see it again at + // a lower level than before. + if (II.Visited[SuccTN] >= RootLevel) + continue; + } + DEBUG(dbgs() << "\t\tMarking visited not affected " << BlockNamePrinter(Succ) << "\n"); - II.Visited.insert(SuccTN); + II.Visited.insert({SuccTN, RootLevel}); II.VisitedNotAffectedQueue.push_back(SuccTN); Stack.push_back(SuccTN); } else if ((SuccLevel > NCDLevel + 1) && @@ -809,6 +827,8 @@ struct SemiNCAInfo { II.Bucket.push({SuccLevel, SuccTN}); } } + + Processed.insert(Next); } while (!Stack.empty()); } @@ -920,21 +940,21 @@ struct SemiNCAInfo { const NodePtr NCDBlock = DT.findNearestCommonDominator(From, To); const TreeNodePtr NCD = DT.getNode(NCDBlock); - // To dominates From -- nothing to do. - if (ToTN == NCD) return; + // If To dominates From -- nothing to do. + if (ToTN != NCD) { + DT.DFSInfoValid = false; - DT.DFSInfoValid = false; + const TreeNodePtr ToIDom = ToTN->getIDom(); + DEBUG(dbgs() << "\tNCD " << BlockNamePrinter(NCD) << ", ToIDom " + << BlockNamePrinter(ToIDom) << "\n"); - const TreeNodePtr ToIDom = ToTN->getIDom(); - DEBUG(dbgs() << "\tNCD " << BlockNamePrinter(NCD) << ", ToIDom " - << BlockNamePrinter(ToIDom) << "\n"); - - // To remains reachable after deletion. - // (Based on the caption under Figure 4. from the second paper.) - if (FromTN != ToIDom || HasProperSupport(DT, BUI, ToTN)) - DeleteReachable(DT, BUI, FromTN, ToTN); - else - DeleteUnreachable(DT, BUI, ToTN); + // To remains reachable after deletion. + // (Based on the caption under Figure 4. from the second paper.) + if (FromTN != ToIDom || HasProperSupport(DT, BUI, ToTN)) + DeleteReachable(DT, BUI, FromTN, ToTN); + else + DeleteUnreachable(DT, BUI, ToTN); + } if (IsPostDom) UpdateRootsAfterUpdate(DT, BUI); } Modified: head/contrib/llvm/lib/CodeGen/GlobalMerge.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/GlobalMerge.cpp Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/CodeGen/GlobalMerge.cpp Wed Jan 24 22:35:00 2018 (r328381) @@ -577,7 +577,8 @@ bool GlobalMerge::doInitialization(Module &M) { for (auto &GV : M.globals()) { // Merge is safe for "normal" internal or external globals only if (GV.isDeclaration() || GV.isThreadLocal() || - GV.hasSection() || GV.hasImplicitSection()) + GV.hasSection() || GV.hasImplicitSection() || + GV.hasDLLExportStorageClass()) continue; // It's not safe to merge globals that may be preempted Modified: head/contrib/llvm/lib/CodeGen/PeepholeOptimizer.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/PeepholeOptimizer.cpp Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/CodeGen/PeepholeOptimizer.cpp Wed Jan 24 22:35:00 2018 (r328381) @@ -719,15 +719,14 @@ bool PeepholeOptimizer::findNextSource(unsigned Reg, u CurSrcPair = Pair; ValueTracker ValTracker(CurSrcPair.Reg, CurSrcPair.SubReg, *MRI, !DisableAdvCopyOpt, TII); - ValueTrackerResult Res; - bool ShouldRewrite = false; - do { - // Follow the chain of copies until we reach the top of the use-def chain - // or find a more suitable source. - Res = ValTracker.getNextSource(); + // Follow the chain of copies until we find a more suitable source, a phi + // or have to abort. + while (true) { + ValueTrackerResult Res = ValTracker.getNextSource(); + // Abort at the end of a chain (without finding a suitable source). if (!Res.isValid()) - break; + return false; // Insert the Def -> Use entry for the recently found source. ValueTrackerResult CurSrcRes = RewriteMap.lookup(CurSrcPair); @@ -763,26 +762,21 @@ bool PeepholeOptimizer::findNextSource(unsigned Reg, u if (TargetRegisterInfo::isPhysicalRegister(CurSrcPair.Reg)) return false; + // Keep following the chain if the value isn't any better yet. const TargetRegisterClass *SrcRC = MRI->getRegClass(CurSrcPair.Reg); - ShouldRewrite = TRI->shouldRewriteCopySrc(DefRC, SubReg, SrcRC, - CurSrcPair.SubReg); - } while (!ShouldRewrite); + if (!TRI->shouldRewriteCopySrc(DefRC, SubReg, SrcRC, CurSrcPair.SubReg)) + continue; - // Continue looking for new sources... - if (Res.isValid()) - continue; + // We currently cannot deal with subreg operands on PHI instructions + // (see insertPHI()). + if (PHICount > 0 && CurSrcPair.SubReg != 0) + continue; - // Do not continue searching for a new source if the there's at least - // one use-def which cannot be rewritten. - if (!ShouldRewrite) - return false; + // We found a suitable source, and are done with this chain. + break; + } } - if (PHICount >= RewritePHILimit) { - DEBUG(dbgs() << "findNextSource: PHI limit reached\n"); - return false; - } - // If we did not find a more suitable source, there is nothing to optimize. return CurSrcPair.Reg != Reg; } @@ -799,6 +793,9 @@ insertPHI(MachineRegisterInfo *MRI, const TargetInstrI assert(!SrcRegs.empty() && "No sources to create a PHI instruction?"); const TargetRegisterClass *NewRC = MRI->getRegClass(SrcRegs[0].Reg); + // NewRC is only correct if no subregisters are involved. findNextSource() + // should have rejected those cases already. + assert(SrcRegs[0].SubReg == 0 && "should not have subreg operand"); unsigned NewVR = MRI->createVirtualRegister(NewRC); MachineBasicBlock *MBB = OrigPHI->getParent(); MachineInstrBuilder MIB = BuildMI(*MBB, OrigPHI, OrigPHI->getDebugLoc(), Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Jan 24 22:35:00 2018 (r328381) @@ -3842,9 +3842,16 @@ bool DAGCombiner::SearchForAndLoads(SDNode *N, EVT ExtVT; if (isAndLoadExtLoad(Mask, Load, Load->getValueType(0), ExtVT) && isLegalNarrowLoad(Load, ISD::ZEXTLOAD, ExtVT)) { - // Only add this load if we can make it more narrow. - if (ExtVT.bitsLT(Load->getMemoryVT())) + + // ZEXTLOAD is already small enough. + if (Load->getExtensionType() == ISD::ZEXTLOAD && + ExtVT.bitsGE(Load->getMemoryVT())) + continue; + + // Use LE to convert equal sized loads to zext. + if (ExtVT.bitsLE(Load->getMemoryVT())) Loads.insert(Load); + continue; } return false; @@ -3899,11 +3906,13 @@ bool DAGCombiner::BackwardsPropagateMask(SDNode *N, Se if (Loads.size() == 0) return false; + DEBUG(dbgs() << "Backwards propagate AND: "; N->dump()); SDValue MaskOp = N->getOperand(1); // If it exists, fixup the single node we allow in the tree that needs // masking. if (FixupNode) { + DEBUG(dbgs() << "First, need to fix up: "; FixupNode->dump()); SDValue And = DAG.getNode(ISD::AND, SDLoc(FixupNode), FixupNode->getValueType(0), SDValue(FixupNode, 0), MaskOp); @@ -3914,14 +3923,21 @@ bool DAGCombiner::BackwardsPropagateMask(SDNode *N, Se // Narrow any constants that need it. for (auto *LogicN : NodesWithConsts) { - auto *C = cast(LogicN->getOperand(1)); - SDValue And = DAG.getNode(ISD::AND, SDLoc(C), C->getValueType(0), - SDValue(C, 0), MaskOp); - DAG.UpdateNodeOperands(LogicN, LogicN->getOperand(0), And); + SDValue Op0 = LogicN->getOperand(0); + SDValue Op1 = LogicN->getOperand(1); + + if (isa(Op0)) + std::swap(Op0, Op1); + + SDValue And = DAG.getNode(ISD::AND, SDLoc(Op1), Op1.getValueType(), + Op1, MaskOp); + + DAG.UpdateNodeOperands(LogicN, Op0, And); } // Create narrow loads. for (auto *Load : Loads) { + DEBUG(dbgs() << "Propagate AND back to: "; Load->dump()); SDValue And = DAG.getNode(ISD::AND, SDLoc(Load), Load->getValueType(0), SDValue(Load, 0), MaskOp); DAG.ReplaceAllUsesOfValueWith(SDValue(Load, 0), And); @@ -5209,7 +5225,7 @@ SDValue DAGCombiner::MatchLoadCombine(SDNode *N) { return SDValue(); // Loads must share the same base address - BaseIndexOffset Ptr = BaseIndexOffset::match(L->getBasePtr(), DAG); + BaseIndexOffset Ptr = BaseIndexOffset::match(L, DAG); int64_t ByteOffsetFromBase = 0; if (!Base) Base = Ptr; @@ -12928,7 +12944,7 @@ void DAGCombiner::getStoreMergeCandidates( StoreSDNode *St, SmallVectorImpl &StoreNodes) { // This holds the base pointer, index, and the offset in bytes from the base // pointer. - BaseIndexOffset BasePtr = BaseIndexOffset::match(St->getBasePtr(), DAG); + BaseIndexOffset BasePtr = BaseIndexOffset::match(St, DAG); EVT MemVT = St->getMemoryVT(); SDValue Val = peekThroughBitcast(St->getValue()); @@ -12949,7 +12965,7 @@ void DAGCombiner::getStoreMergeCandidates( EVT LoadVT; if (IsLoadSrc) { auto *Ld = cast(Val); - LBasePtr = BaseIndexOffset::match(Ld->getBasePtr(), DAG); + LBasePtr = BaseIndexOffset::match(Ld, DAG); LoadVT = Ld->getMemoryVT(); // Load and store should be the same type. if (MemVT != LoadVT) @@ -12968,7 +12984,7 @@ void DAGCombiner::getStoreMergeCandidates( return false; // The Load's Base Ptr must also match if (LoadSDNode *OtherLd = dyn_cast(Val)) { - auto LPtr = BaseIndexOffset::match(OtherLd->getBasePtr(), DAG); + auto LPtr = BaseIndexOffset::match(OtherLd, DAG); if (LoadVT != OtherLd->getMemoryVT()) return false; if (!(LBasePtr.equalBaseIndex(LPtr, DAG))) @@ -12992,7 +13008,7 @@ void DAGCombiner::getStoreMergeCandidates( Val.getOpcode() != ISD::EXTRACT_SUBVECTOR) return false; } - Ptr = BaseIndexOffset::match(Other->getBasePtr(), DAG); + Ptr = BaseIndexOffset::match(Other, DAG); return (BasePtr.equalBaseIndex(Ptr, DAG, Offset)); }; @@ -13365,7 +13381,7 @@ bool DAGCombiner::MergeConsecutiveStores(StoreSDNode * if (Ld->getMemoryVT() != MemVT) break; - BaseIndexOffset LdPtr = BaseIndexOffset::match(Ld->getBasePtr(), DAG); + BaseIndexOffset LdPtr = BaseIndexOffset::match(Ld, DAG); // If this is not the first ptr that we check. int64_t LdOffset = 0; if (LdBasePtr.getBase().getNode()) { @@ -17432,44 +17448,46 @@ bool DAGCombiner::isAlias(LSBaseSDNode *Op0, LSBaseSDN unsigned NumBytes1 = Op1->getMemoryVT().getStoreSize(); // Check for BaseIndexOffset matching. - BaseIndexOffset BasePtr0 = BaseIndexOffset::match(Op0->getBasePtr(), DAG); - BaseIndexOffset BasePtr1 = BaseIndexOffset::match(Op1->getBasePtr(), DAG); + BaseIndexOffset BasePtr0 = BaseIndexOffset::match(Op0, DAG); + BaseIndexOffset BasePtr1 = BaseIndexOffset::match(Op1, DAG); int64_t PtrDiff; - if (BasePtr0.equalBaseIndex(BasePtr1, DAG, PtrDiff)) - return !((NumBytes0 <= PtrDiff) || (PtrDiff + NumBytes1 <= 0)); + if (BasePtr0.getBase().getNode() && BasePtr1.getBase().getNode()) { + if (BasePtr0.equalBaseIndex(BasePtr1, DAG, PtrDiff)) + return !((NumBytes0 <= PtrDiff) || (PtrDiff + NumBytes1 <= 0)); - // If both BasePtr0 and BasePtr1 are FrameIndexes, we will not be - // able to calculate their relative offset if at least one arises - // from an alloca. However, these allocas cannot overlap and we - // can infer there is no alias. - if (auto *A = dyn_cast(BasePtr0.getBase())) - if (auto *B = dyn_cast(BasePtr1.getBase())) { - MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo(); - // If the base are the same frame index but the we couldn't find a - // constant offset, (indices are different) be conservative. - if (A != B && (!MFI.isFixedObjectIndex(A->getIndex()) || - !MFI.isFixedObjectIndex(B->getIndex()))) - return false; - } + // If both BasePtr0 and BasePtr1 are FrameIndexes, we will not be + // able to calculate their relative offset if at least one arises + // from an alloca. However, these allocas cannot overlap and we + // can infer there is no alias. + if (auto *A = dyn_cast(BasePtr0.getBase())) + if (auto *B = dyn_cast(BasePtr1.getBase())) { + MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo(); + // If the base are the same frame index but the we couldn't find a + // constant offset, (indices are different) be conservative. + if (A != B && (!MFI.isFixedObjectIndex(A->getIndex()) || + !MFI.isFixedObjectIndex(B->getIndex()))) + return false; + } - bool IsFI0 = isa(BasePtr0.getBase()); - bool IsFI1 = isa(BasePtr1.getBase()); - bool IsGV0 = isa(BasePtr0.getBase()); - bool IsGV1 = isa(BasePtr1.getBase()); - bool IsCV0 = isa(BasePtr0.getBase()); - bool IsCV1 = isa(BasePtr1.getBase()); + bool IsFI0 = isa(BasePtr0.getBase()); + bool IsFI1 = isa(BasePtr1.getBase()); + bool IsGV0 = isa(BasePtr0.getBase()); + bool IsGV1 = isa(BasePtr1.getBase()); + bool IsCV0 = isa(BasePtr0.getBase()); + bool IsCV1 = isa(BasePtr1.getBase()); - // If of mismatched base types or checkable indices we can check - // they do not alias. - if ((BasePtr0.getIndex() == BasePtr1.getIndex() || (IsFI0 != IsFI1) || - (IsGV0 != IsGV1) || (IsCV0 != IsCV1)) && - (IsFI0 || IsGV0 || IsCV0) && (IsFI1 || IsGV1 || IsCV1)) - return false; + // If of mismatched base types or checkable indices we can check + // they do not alias. + if ((BasePtr0.getIndex() == BasePtr1.getIndex() || (IsFI0 != IsFI1) || + (IsGV0 != IsGV1) || (IsCV0 != IsCV1)) && + (IsFI0 || IsGV0 || IsCV0) && (IsFI1 || IsGV1 || IsCV1)) + return false; + } - // If we know required SrcValue1 and SrcValue2 have relatively large alignment - // compared to the size and offset of the access, we may be able to prove they - // do not alias. This check is conservative for now to catch cases created by - // splitting vector types. + // If we know required SrcValue1 and SrcValue2 have relatively large + // alignment compared to the size and offset of the access, we may be able + // to prove they do not alias. This check is conservative for now to catch + // cases created by splitting vector types. int64_t SrcValOffset0 = Op0->getSrcValueOffset(); int64_t SrcValOffset1 = Op1->getSrcValueOffset(); unsigned OrigAlignment0 = Op0->getOriginalAlignment(); @@ -17479,8 +17497,8 @@ bool DAGCombiner::isAlias(LSBaseSDNode *Op0, LSBaseSDN int64_t OffAlign0 = SrcValOffset0 % OrigAlignment0; int64_t OffAlign1 = SrcValOffset1 % OrigAlignment1; - // There is no overlap between these relatively aligned accesses of similar - // size. Return no alias. + // There is no overlap between these relatively aligned accesses of + // similar size. Return no alias. if ((OffAlign0 + NumBytes0) <= OffAlign1 || (OffAlign1 + NumBytes1) <= OffAlign0) return false; @@ -17643,7 +17661,7 @@ bool DAGCombiner::findBetterNeighborChains(StoreSDNode // This holds the base pointer, index, and the offset in bytes from the base // pointer. - BaseIndexOffset BasePtr = BaseIndexOffset::match(St->getBasePtr(), DAG); + BaseIndexOffset BasePtr = BaseIndexOffset::match(St, DAG); // We must have a base and an offset. if (!BasePtr.getBase().getNode()) @@ -17669,7 +17687,7 @@ bool DAGCombiner::findBetterNeighborChains(StoreSDNode break; // Find the base pointer and offset for this memory node. - BaseIndexOffset Ptr = BaseIndexOffset::match(Index->getBasePtr(), DAG); + BaseIndexOffset Ptr = BaseIndexOffset::match(Index, DAG); // Check that the base pointer is the same as the original one. if (!BasePtr.equalBaseIndex(Ptr, DAG)) Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jan 24 22:35:00 2018 (r328381) @@ -2965,12 +2965,12 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) { case ISD::ZERO_EXTEND: LHS = DAG.getNode(ISD::AssertZext, dl, OuterType, Res, DAG.getValueType(AtomicType)); - RHS = DAG.getNode(ISD::ZERO_EXTEND, dl, OuterType, Node->getOperand(2)); + RHS = DAG.getZeroExtendInReg(Node->getOperand(2), dl, AtomicType); ExtRes = LHS; break; case ISD::ANY_EXTEND: LHS = DAG.getZeroExtendInReg(Res, dl, AtomicType); - RHS = DAG.getNode(ISD::ZERO_EXTEND, dl, OuterType, Node->getOperand(2)); + RHS = DAG.getZeroExtendInReg(Node->getOperand(2), dl, AtomicType); break; default: llvm_unreachable("Invalid atomic op extension"); Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jan 24 22:35:00 2018 (r328381) @@ -7947,11 +7947,8 @@ bool SelectionDAG::areNonVolatileConsecutiveLoads(Load if (VT.getSizeInBits() / 8 != Bytes) return false; - SDValue Loc = LD->getOperand(1); - SDValue BaseLoc = Base->getOperand(1); - - auto BaseLocDecomp = BaseIndexOffset::match(BaseLoc, *this); - auto LocDecomp = BaseIndexOffset::match(Loc, *this); + auto BaseLocDecomp = BaseIndexOffset::match(Base, *this); + auto LocDecomp = BaseIndexOffset::match(LD, *this); int64_t Offset = 0; if (BaseLocDecomp.equalBaseIndex(LocDecomp, *this, Offset)) Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp Wed Jan 24 22:35:00 2018 (r328381) @@ -21,6 +21,9 @@ using namespace llvm; bool BaseIndexOffset::equalBaseIndex(BaseIndexOffset &Other, const SelectionDAG &DAG, int64_t &Off) { + // Conservatively fail if we a match failed.. + if (!Base.getNode() || !Other.Base.getNode()) + return false; // Initial Offset difference. Off = Other.Offset - Offset; @@ -72,12 +75,28 @@ bool BaseIndexOffset::equalBaseIndex(BaseIndexOffset & } /// Parses tree in Ptr for base, index, offset addresses. -BaseIndexOffset BaseIndexOffset::match(SDValue Ptr, const SelectionDAG &DAG) { +BaseIndexOffset BaseIndexOffset::match(LSBaseSDNode *N, + const SelectionDAG &DAG) { + SDValue Ptr = N->getBasePtr(); + // (((B + I*M) + c)) + c ... SDValue Base = DAG.getTargetLoweringInfo().unwrapAddress(Ptr); SDValue Index = SDValue(); int64_t Offset = 0; bool IsIndexSignExt = false; + + // pre-inc/pre-dec ops are components of EA. + if (N->getAddressingMode() == ISD::PRE_INC) { + if (auto *C = dyn_cast(N->getOffset())) + Offset += C->getSExtValue(); + else // If unknown, give up now. + return BaseIndexOffset(SDValue(), SDValue(), 0, false); + } else if (N->getAddressingMode() == ISD::PRE_DEC) { + if (auto *C = dyn_cast(N->getOffset())) + Offset -= C->getSExtValue(); + else // If unknown, give up now. + return BaseIndexOffset(SDValue(), SDValue(), 0, false); + } // Consume constant adds & ors with appropriate masking. while (Base->getOpcode() == ISD::ADD || Base->getOpcode() == ISD::OR) { Modified: head/contrib/llvm/lib/CodeGen/TargetLoweringBase.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/TargetLoweringBase.cpp Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/CodeGen/TargetLoweringBase.cpp Wed Jan 24 22:35:00 2018 (r328381) @@ -132,9 +132,18 @@ void TargetLoweringBase::InitLibcalls(const Triple &TT setLibcallName(RTLIB::FPEXT_F16_F32, "__extendhfsf2"); setLibcallName(RTLIB::FPROUND_F32_F16, "__truncsfhf2"); - // Darwin 10 and higher has an optimized __bzero. - if (!TT.isMacOSX() || !TT.isMacOSXVersionLT(10, 6) || TT.isArch64Bit()) { - setLibcallName(RTLIB::BZERO, TT.isAArch64() ? "bzero" : "__bzero"); + // Some darwins have an optimized __bzero/bzero function. + switch (TT.getArch()) { + case Triple::x86: + case Triple::x86_64: + if (TT.isMacOSX() && !TT.isMacOSXVersionLT(10, 6)) + setLibcallName(RTLIB::BZERO, "__bzero"); + break; + case Triple::aarch64: + setLibcallName(RTLIB::BZERO, "bzero"); + break; + default: + break; } if (darwinHasSinCos(TT)) { Modified: head/contrib/llvm/lib/Linker/IRMover.cpp ============================================================================== --- head/contrib/llvm/lib/Linker/IRMover.cpp Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/Linker/IRMover.cpp Wed Jan 24 22:35:00 2018 (r328381) @@ -954,7 +954,12 @@ Expected IRLinker::linkGlobalValueProto(Gl NewGV->setLinkage(GlobalValue::InternalLinkage); Constant *C = NewGV; - if (DGV) + // Only create a bitcast if necessary. In particular, with + // DebugTypeODRUniquing we may reach metadata in the destination module + // containing a GV from the source module, in which case SGV will be + // the same as DGV and NewGV, and TypeMap.get() will assert since it + // assumes it is being invoked on a type in the source module. + if (DGV && NewGV != SGV) C = ConstantExpr::getBitCast(NewGV, TypeMap.get(SGV->getType())); if (DGV && NewGV != DGV) { Modified: head/contrib/llvm/lib/MC/MCCodeView.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCCodeView.cpp Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/MC/MCCodeView.cpp Wed Jan 24 22:35:00 2018 (r328381) @@ -76,6 +76,14 @@ bool CodeViewContext::addFile(MCStreamer &OS, unsigned return true; } +MCCVFunctionInfo *CodeViewContext::getCVFunctionInfo(unsigned FuncId) { + if (FuncId >= Functions.size()) + return nullptr; + if (Functions[FuncId].isUnallocatedFunctionInfo()) + return nullptr; + return &Functions[FuncId]; +} + bool CodeViewContext::recordFunctionId(unsigned FuncId) { if (FuncId >= Functions.size()) Functions.resize(FuncId + 1); @@ -245,6 +253,67 @@ void CodeViewContext::emitFileChecksumOffset(MCObjectS MCSymbolRefExpr::create(Files[Idx].ChecksumTableOffset, OS.getContext()); OS.EmitValueImpl(SRE, 4); +} + +void CodeViewContext::addLineEntry(const MCCVLineEntry &LineEntry) { + size_t Offset = MCCVLines.size(); + auto I = MCCVLineStartStop.insert( + {LineEntry.getFunctionId(), {Offset, Offset + 1}}); + if (!I.second) + I.first->second.second = Offset + 1; + MCCVLines.push_back(LineEntry); +} + +std::vector +CodeViewContext::getFunctionLineEntries(unsigned FuncId) { + std::vector FilteredLines; + auto I = MCCVLineStartStop.find(FuncId); + if (I != MCCVLineStartStop.end()) { + MCCVFunctionInfo *SiteInfo = getCVFunctionInfo(FuncId); + for (size_t Idx = I->second.first, End = I->second.second; Idx != End; + ++Idx) { + unsigned LocationFuncId = MCCVLines[Idx].getFunctionId(); + if (LocationFuncId == FuncId) { + // This was a .cv_loc directly for FuncId, so record it. + FilteredLines.push_back(MCCVLines[Idx]); + } else { + // Check if the current location is inlined in this function. If it is, + // synthesize a statement .cv_loc at the original inlined call site. + auto I = SiteInfo->InlinedAtMap.find(LocationFuncId); + if (I != SiteInfo->InlinedAtMap.end()) { + MCCVFunctionInfo::LineInfo &IA = I->second; + // Only add the location if it differs from the previous location. + // Large inlined calls will have many .cv_loc entries and we only need + // one line table entry in the parent function. + if (FilteredLines.empty() || + FilteredLines.back().getFileNum() != IA.File || + FilteredLines.back().getLine() != IA.Line || + FilteredLines.back().getColumn() != IA.Col) { + FilteredLines.push_back(MCCVLineEntry( + MCCVLines[Idx].getLabel(), + MCCVLoc(FuncId, IA.File, IA.Line, IA.Col, false, false))); + } + } + } + } + } + return FilteredLines; +} + +std::pair CodeViewContext::getLineExtent(unsigned FuncId) { + auto I = MCCVLineStartStop.find(FuncId); + // Return an empty extent if there are no cv_locs for this function id. + if (I == MCCVLineStartStop.end()) + return {~0ULL, 0}; + return I->second; +} + +ArrayRef CodeViewContext::getLinesForExtent(size_t L, size_t R) { + if (R <= L) + return None; + if (L >= MCCVLines.size()) + return None; + return makeArrayRef(&MCCVLines[L], R - L); } void CodeViewContext::emitLineTableForFunction(MCObjectStreamer &OS, Modified: head/contrib/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp Wed Jan 24 22:35:00 2018 (r328381) @@ -868,6 +868,40 @@ bool AArch64InstructionSelector::select(MachineInstr & if (OpFlags & AArch64II::MO_GOT) { I.setDesc(TII.get(AArch64::LOADgot)); I.getOperand(1).setTargetFlags(OpFlags); + } else if (TM.getCodeModel() == CodeModel::Large) { + // Materialize the global using movz/movk instructions. + unsigned MovZDstReg = MRI.createVirtualRegister(&AArch64::GPR64RegClass); + auto InsertPt = std::next(I.getIterator()); + auto MovZ = + BuildMI(MBB, InsertPt, I.getDebugLoc(), TII.get(AArch64::MOVZXi)) + .addDef(MovZDstReg); + MovZ->addOperand(MF, I.getOperand(1)); + MovZ->getOperand(1).setTargetFlags(OpFlags | AArch64II::MO_G0 | + AArch64II::MO_NC); + MovZ->addOperand(MF, MachineOperand::CreateImm(0)); + constrainSelectedInstRegOperands(*MovZ, TII, TRI, RBI); + + auto BuildMovK = [&](unsigned SrcReg, unsigned char Flags, + unsigned Offset, unsigned ForceDstReg) { + unsigned DstReg = + ForceDstReg ? ForceDstReg + : MRI.createVirtualRegister(&AArch64::GPR64RegClass); + auto MovI = BuildMI(MBB, InsertPt, MovZ->getDebugLoc(), + TII.get(AArch64::MOVKXi)) + .addDef(DstReg) + .addReg(SrcReg); + MovI->addOperand(MF, MachineOperand::CreateGA( + GV, MovZ->getOperand(1).getOffset(), Flags)); + MovI->addOperand(MF, MachineOperand::CreateImm(Offset)); + constrainSelectedInstRegOperands(*MovI, TII, TRI, RBI); + return DstReg; + }; + unsigned DstReg = BuildMovK(MovZ->getOperand(0).getReg(), + AArch64II::MO_G1 | AArch64II::MO_NC, 16, 0); + DstReg = BuildMovK(DstReg, AArch64II::MO_G2 | AArch64II::MO_NC, 32, 0); + BuildMovK(DstReg, AArch64II::MO_G3, 48, I.getOperand(0).getReg()); + I.eraseFromParent(); + return true; } else { I.setDesc(TII.get(AArch64::MOVaddr)); I.getOperand(1).setTargetFlags(OpFlags | AArch64II::MO_PAGE); Modified: head/contrib/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp ============================================================================== --- head/contrib/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp Wed Jan 24 22:35:00 2018 (r328381) @@ -821,7 +821,6 @@ namespace llvm { MutableArrayRef NewMask, unsigned Options = None); OpRef packp(ShuffleMask SM, OpRef Va, OpRef Vb, ResultStack &Results, MutableArrayRef NewMask); - OpRef zerous(ShuffleMask SM, OpRef Va, ResultStack &Results); OpRef vmuxs(ArrayRef Bytes, OpRef Va, OpRef Vb, ResultStack &Results); OpRef vmuxp(ArrayRef Bytes, OpRef Va, OpRef Vb, @@ -1137,25 +1136,6 @@ OpRef HvxSelector::packp(ShuffleMask SM, OpRef Va, OpR } return concat(Out[0], Out[1], Results); -} - -OpRef HvxSelector::zerous(ShuffleMask SM, OpRef Va, ResultStack &Results) { - DEBUG_WITH_TYPE("isel", {dbgs() << __func__ << '\n';}); - - int VecLen = SM.Mask.size(); - SmallVector UsedBytes(VecLen); - bool HasUnused = false; - for (int I = 0; I != VecLen; ++I) { - if (SM.Mask[I] != -1) - UsedBytes[I] = 0xFF; - else - HasUnused = true; - } - if (!HasUnused) - return Va; - SDValue B = getVectorConstant(UsedBytes, SDLoc(Results.InpNode)); - Results.push(Hexagon::V6_vand, getSingleVT(MVT::i8), {Va, OpRef(B)}); - return OpRef::res(Results.top()); } OpRef HvxSelector::vmuxs(ArrayRef Bytes, OpRef Va, OpRef Vb, Modified: head/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Wed Jan 24 22:35:00 2018 (r328381) @@ -142,6 +142,9 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMa setOperationAction(ISD::BITREVERSE, MVT::i32, Legal); setOperationAction(ISD::BITREVERSE, MVT::i64, Legal); + // Sub-word ATOMIC_CMP_SWAP need to ensure that the input is zero-extended. + setOperationAction(ISD::ATOMIC_CMP_SWAP, MVT::i32, Custom); + // PowerPC has an i16 but no i8 (or i1) SEXTLOAD. for (MVT VT : MVT::integer_valuetypes()) { setLoadExtAction(ISD::SEXTLOAD, VT, MVT::i1, Promote); @@ -1154,6 +1157,8 @@ const char *PPCTargetLowering::getTargetNodeName(unsig case PPCISD::Hi: return "PPCISD::Hi"; case PPCISD::Lo: return "PPCISD::Lo"; case PPCISD::TOC_ENTRY: return "PPCISD::TOC_ENTRY"; + case PPCISD::ATOMIC_CMP_SWAP_8: return "PPCISD::ATOMIC_CMP_SWAP_8"; + case PPCISD::ATOMIC_CMP_SWAP_16: return "PPCISD::ATOMIC_CMP_SWAP_16"; case PPCISD::DYNALLOC: return "PPCISD::DYNALLOC"; case PPCISD::DYNAREAOFFSET: return "PPCISD::DYNAREAOFFSET"; case PPCISD::GlobalBaseReg: return "PPCISD::GlobalBaseReg"; @@ -8834,6 +8839,42 @@ SDValue PPCTargetLowering::LowerBSWAP(SDValue Op, Sele return Op; } +// ATOMIC_CMP_SWAP for i8/i16 needs to zero-extend its input since it will be +// compared to a value that is atomically loaded (atomic loads zero-extend). +SDValue PPCTargetLowering::LowerATOMIC_CMP_SWAP(SDValue Op, + SelectionDAG &DAG) const { + assert(Op.getOpcode() == ISD::ATOMIC_CMP_SWAP && + "Expecting an atomic compare-and-swap here."); + SDLoc dl(Op); + auto *AtomicNode = cast(Op.getNode()); + EVT MemVT = AtomicNode->getMemoryVT(); + if (MemVT.getSizeInBits() >= 32) + return Op; + + SDValue CmpOp = Op.getOperand(2); + // If this is already correctly zero-extended, leave it alone. + auto HighBits = APInt::getHighBitsSet(32, 32 - MemVT.getSizeInBits()); + if (DAG.MaskedValueIsZero(CmpOp, HighBits)) + return Op; + + // Clear the high bits of the compare operand. + unsigned MaskVal = (1 << MemVT.getSizeInBits()) - 1; + SDValue NewCmpOp = + DAG.getNode(ISD::AND, dl, MVT::i32, CmpOp, + DAG.getConstant(MaskVal, dl, MVT::i32)); + + // Replace the existing compare operand with the properly zero-extended one. + SmallVector Ops; + for (int i = 0, e = AtomicNode->getNumOperands(); i < e; i++) + Ops.push_back(AtomicNode->getOperand(i)); + Ops[2] = NewCmpOp; + MachineMemOperand *MMO = AtomicNode->getMemOperand(); + SDVTList Tys = DAG.getVTList(MVT::i32, MVT::Other); + auto NodeTy = + (MemVT == MVT::i8) ? PPCISD::ATOMIC_CMP_SWAP_8 : PPCISD::ATOMIC_CMP_SWAP_16; + return DAG.getMemIntrinsicNode(NodeTy, dl, Tys, Ops, MemVT, MMO); +} + SDValue PPCTargetLowering::LowerSIGN_EXTEND_INREG(SDValue Op, SelectionDAG &DAG) const { SDLoc dl(Op); @@ -9325,6 +9366,8 @@ SDValue PPCTargetLowering::LowerOperation(SDValue Op, return LowerREM(Op, DAG); case ISD::BSWAP: return LowerBSWAP(Op, DAG); + case ISD::ATOMIC_CMP_SWAP: + return LowerATOMIC_CMP_SWAP(Op, DAG); } } Modified: head/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.h ============================================================================== --- head/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.h Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.h Wed Jan 24 22:35:00 2018 (r328381) @@ -430,6 +430,11 @@ namespace llvm { /// The 4xf32 load used for v4i1 constants. QVLFSb, + /// ATOMIC_CMP_SWAP - the exact same as the target-independent nodes + /// except they ensure that the compare input is zero-extended for + /// sub-word versions because the atomic loads zero-extend. + ATOMIC_CMP_SWAP_8, ATOMIC_CMP_SWAP_16, + /// GPRC = TOC_ENTRY GA, TOC /// Loads the entry for GA from the TOC, where the TOC base is given by /// the last operand. @@ -955,6 +960,7 @@ namespace llvm { SDValue LowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const; SDValue LowerREM(SDValue Op, SelectionDAG &DAG) const; SDValue LowerBSWAP(SDValue Op, SelectionDAG &DAG) const; + SDValue LowerATOMIC_CMP_SWAP(SDValue Op, SelectionDAG &DAG) const; SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const; SDValue LowerSIGN_EXTEND_INREG(SDValue Op, SelectionDAG &DAG) const; SDValue LowerMUL(SDValue Op, SelectionDAG &DAG) const; Modified: head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td Wed Jan 24 22:04:16 2018 (r328380) +++ head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td Wed Jan 24 22:35:00 2018 (r328381) @@ -257,6 +257,13 @@ def PPCvcmp_o : SDNode<"PPCISD::VCMPo", SDT_PPCvcm def PPCcondbranch : SDNode<"PPCISD::COND_BRANCH", SDT_PPCcondbr, [SDNPHasChain, SDNPOptInGlue]>; +// PPC-specific atomic operations. +def PPCatomicCmpSwap_8 : + SDNode<"PPCISD::ATOMIC_CMP_SWAP_8", SDTAtomic3, + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; +def PPCatomicCmpSwap_16 : + SDNode<"PPCISD::ATOMIC_CMP_SWAP_16", SDTAtomic3, + [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; def PPClbrx : SDNode<"PPCISD::LBRX", SDT_PPClbrx, [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Jan 24 22:36:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB090ECA50B; Wed, 24 Jan 2018 22:36:21 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7BDE57BFBE; Wed, 24 Jan 2018 22:36:21 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 764B523CBE; Wed, 24 Jan 2018 22:36:21 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OMaLWk008276; Wed, 24 Jan 2018 22:36:21 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OMaLkl008275; Wed, 24 Jan 2018 22:36:21 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201801242236.w0OMaLkl008275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 24 Jan 2018 22:36:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328382 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 328382 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 22:36:22 -0000 Author: mckusick Date: Wed Jan 24 22:36:21 2018 New Revision: 328382 URL: https://svnweb.freebsd.org/changeset/base/328382 Log: Update .Dd missed in -r328304. Reported by: Bjoern Zeeb (bz) MFC with: 328304 Modified: head/lib/libc/sys/setgroups.2 Modified: head/lib/libc/sys/setgroups.2 ============================================================================== --- head/lib/libc/sys/setgroups.2 Wed Jan 24 22:35:00 2018 (r328381) +++ head/lib/libc/sys/setgroups.2 Wed Jan 24 22:36:21 2018 (r328382) @@ -28,7 +28,7 @@ .\" @(#)setgroups.2 8.2 (Berkeley) 4/16/94 .\" $FreeBSD$ .\" -.Dd April 16, 1994 +.Dd January 19, 2018 .Dt SETGROUPS 2 .Os .Sh NAME From owner-svn-src-all@freebsd.org Wed Jan 24 23:57:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43833ECDC01; Wed, 24 Jan 2018 23:57:41 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E96CB7E4EA; Wed, 24 Jan 2018 23:57:40 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E011B24995; Wed, 24 Jan 2018 23:57:40 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0ONvehu047571; Wed, 24 Jan 2018 23:57:40 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0ONve5P047566; Wed, 24 Jan 2018 23:57:40 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201801242357.w0ONve5P047566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 24 Jan 2018 23:57:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328383 - head/sbin/fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sbin/fsck_ffs X-SVN-Commit-Revision: 328383 X-SVN-Commit-Repository: base 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.25 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, 24 Jan 2018 23:57:41 -0000 Author: mckusick Date: Wed Jan 24 23:57:40 2018 New Revision: 328383 URL: https://svnweb.freebsd.org/changeset/base/328383 Log: More throughly integrate libufs into fsck_ffs by using its cgput() routine to write out the cylinder groups rather than recreating the calculation of the cylinder-group check hash in fsck_ffs. No functional change intended. Modified: head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/fsutil.c head/sbin/fsck_ffs/gjournal.c head/sbin/fsck_ffs/setup.c head/sbin/fsck_ffs/suj.c Modified: head/sbin/fsck_ffs/fsck.h ============================================================================== --- head/sbin/fsck_ffs/fsck.h Wed Jan 24 22:36:21 2018 (r328382) +++ head/sbin/fsck_ffs/fsck.h Wed Jan 24 23:57:40 2018 (r328383) @@ -327,6 +327,7 @@ extern char skipclean; /* skip clean file systems if extern int fsmodified; /* 1 => write done to file system */ extern int fsreadfd; /* file descriptor for reading file system */ extern int fswritefd; /* file descriptor for writing file system */ +extern struct uufsd disk; /* libufs user-ufs disk structure */ extern int surrender; /* Give up if reads fail */ extern int wantrestart; /* Restart fsck on early termination */ Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Wed Jan 24 22:36:21 2018 (r328382) +++ head/sbin/fsck_ffs/fsutil.c Wed Jan 24 23:57:40 2018 (r328383) @@ -352,20 +352,6 @@ flush(int fd, struct bufarea *bp) if (!bp->b_dirty) return; - /* - * Calculate any needed check hashes. - */ - switch (bp->b_type) { - case BT_CYLGRP: - if ((sblock.fs_metackhash & CK_CYLGRP) == 0) - break; - bp->b_un.b_cg->cg_ckhash = 0; - bp->b_un.b_cg->cg_ckhash = - calculate_crc32c(~0L, bp->b_un.b_buf, bp->b_size); - break; - default: - break; - } bp->b_dirty = 0; if (fswritefd < 0) { pfatal("WRITING IN READ_ONLY MODE.\n"); @@ -376,13 +362,30 @@ flush(int fd, struct bufarea *bp) (bp->b_errs == bp->b_size / dev_bsize) ? "" : "PARTIALLY ", (long long)bp->b_bno); bp->b_errs = 0; - blwrite(fd, bp->b_un.b_buf, bp->b_bno, bp->b_size); - if (bp != &sblk) - return; - for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, j++) { - blwrite(fswritefd, (char *)sblock.fs_csp + i, - fsbtodb(&sblock, sblock.fs_csaddr + j * sblock.fs_frag), - MIN(sblock.fs_cssize - i, sblock.fs_bsize)); + /* + * Write using the appropriate function. + */ + switch (bp->b_type) { + case BT_SUPERBLK: + if (bp != &sblk) + pfatal("BUFFER 0x%x DOES NOT MATCH SBLK 0x%x\n", + (u_int)bp, (u_int)&sblk); + blwrite(fd, bp->b_un.b_buf, bp->b_bno, bp->b_size); + for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, + j++) { + blwrite(fswritefd, (char *)sblock.fs_csp + i, + fsbtodb(&sblock, + sblock.fs_csaddr + j * sblock.fs_frag), + MIN(sblock.fs_cssize - i, sblock.fs_bsize)); + } + break; + case BT_CYLGRP: + if (cgput(&disk, (struct cg *)bp->b_un.b_buf) == 0) + fsmodified = 1; + break; + default: + blwrite(fd, bp->b_un.b_buf, bp->b_bno, bp->b_size); + break; } } Modified: head/sbin/fsck_ffs/gjournal.c ============================================================================== --- head/sbin/fsck_ffs/gjournal.c Wed Jan 24 22:36:21 2018 (r328382) +++ head/sbin/fsck_ffs/gjournal.c Wed Jan 24 23:57:40 2018 (r328383) @@ -91,7 +91,7 @@ static unsigned ncgs = 0; static LIST_HEAD(, cgchain) cglist = LIST_HEAD_INITIALIZER(cglist); static const char *devnam; -static struct uufsd *disk = NULL; +static struct uufsd *diskp = NULL; static struct fs *fs = NULL; struct ufs2_dinode ufs2_zino; @@ -107,7 +107,7 @@ getcg(int cg) { struct cgchain *cgc; - assert(disk != NULL && fs != NULL); + assert(diskp != NULL && fs != NULL); LIST_FOREACH(cgc, &cglist, cgc_next) { if (cgc->cgc_cg.cg_cgx == cg) { //printf("%s: Found cg=%d\n", __func__, cg); @@ -134,7 +134,7 @@ getcg(int cg) if (cgc == NULL) err(1, "malloc(%zu)", sizeof(*cgc)); } - if (cgget(disk, cg, &cgc->cgc_cg) == -1) + if (cgget(diskp, cg, &cgc->cgc_cg) == -1) err(1, "cgget(%d)", cg); cgc->cgc_busy = 0; cgc->cgc_dirty = 0; @@ -183,14 +183,14 @@ putcgs(void) { struct cgchain *cgc, *cgc2; - assert(disk != NULL && fs != NULL); + assert(diskp != NULL && fs != NULL); LIST_FOREACH_SAFE(cgc, &cglist, cgc_next, cgc2) { if (cgc->cgc_busy) continue; LIST_REMOVE(cgc, cgc_next); ncgs--; if (cgc->cgc_dirty) { - if (cgput(disk, &cgc->cgc_cg) == -1) + if (cgput(diskp, &cgc->cgc_cg) == -1) err(1, "cgput(%d)", cgc->cgc_cg.cg_cgx); //printf("%s: Wrote cg=%d\n", __func__, // cgc->cgc_cg.cg_cgx); @@ -208,7 +208,7 @@ cancelcgs(void) { struct cgchain *cgc; - assert(disk != NULL && fs != NULL); + assert(diskp != NULL && fs != NULL); while ((cgc = LIST_FIRST(&cglist)) != NULL) { if (cgc->cgc_busy) continue; @@ -225,16 +225,14 @@ cancelcgs(void) static void opendisk(void) { - if (disk != NULL) + if (diskp != NULL) return; - disk = malloc(sizeof(*disk)); - if (disk == NULL) - err(1, "malloc(%zu)", sizeof(*disk)); - if (ufs_disk_fillout(disk, devnam) == -1) { + diskp = &disk; + if (ufs_disk_fillout(diskp, devnam) == -1) { err(1, "ufs_disk_fillout(%s) failed: %s", devnam, - disk->d_error); + diskp->d_error); } - fs = &disk->d_fs; + fs = &diskp->d_fs; } /* @@ -245,12 +243,12 @@ closedisk(void) { fs->fs_clean = 1; - if (sbwrite(disk, 0) == -1) + if (sbwrite(diskp, 0) == -1) err(1, "sbwrite(%s)", devnam); - if (ufs_disk_close(disk) == -1) + if (ufs_disk_close(diskp) == -1) err(1, "ufs_disk_close(%s)", devnam); - free(disk); - disk = NULL; + free(diskp); + diskp = NULL; fs = NULL; } @@ -328,8 +326,8 @@ freeindir(ufs2_daddr_t blk, int level) ufs2_daddr_t *blks; int i; - if (bread(disk, fsbtodb(fs, blk), (void *)&sblks, (size_t)fs->fs_bsize) == -1) - err(1, "bread: %s", disk->d_error); + if (bread(diskp, fsbtodb(fs, blk), (void *)&sblks, (size_t)fs->fs_bsize) == -1) + err(1, "bread: %s", diskp->d_error); blks = (ufs2_daddr_t *)&sblks; for (i = 0; i < NINDIR(fs); i++) { if (blks[i] == 0) @@ -446,7 +444,7 @@ gjournal_check(const char *filesys) /* Unallocated? Skip it. */ if (isclr(inosused, cino)) continue; - if (getino(disk, &p, ino, &mode) == -1) + if (getino(diskp, &p, ino, &mode) == -1) err(1, "getino(cg=%d ino=%ju)", cg, (uintmax_t)ino); dino = p; @@ -479,7 +477,7 @@ gjournal_check(const char *filesys) /* Zero-fill the inode. */ *dino = ufs2_zino; /* Write the inode back. */ - if (putino(disk) == -1) + if (putino(diskp) == -1) err(1, "putino(cg=%d ino=%ju)", cg, (uintmax_t)ino); if (cgp->cg_unrefs == 0) { Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Wed Jan 24 22:36:21 2018 (r328382) +++ head/sbin/fsck_ffs/setup.c Wed Jan 24 23:57:40 2018 (r328383) @@ -54,9 +54,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "fsck.h" +struct uufsd disk; struct bufarea asblk; #define altsblock (*asblk.b_un.b_fs) #define POWEROF2(num) (((num) & ((num) - 1)) == 0) @@ -124,7 +126,8 @@ setup(char *dev) } } } - if ((fsreadfd = open(dev, O_RDONLY)) < 0) { + if ((fsreadfd = open(dev, O_RDONLY)) < 0 || + ufs_disk_fillout(&disk, dev) < 0) { if (bkgrdflag) { unlink(snapname); bkgrdflag = 0; @@ -168,7 +171,8 @@ setup(char *dev) if (preen == 0) printf("** %s", dev); if (bkgrdflag == 0 && - (nflag || (fswritefd = open(dev, O_WRONLY)) < 0)) { + (nflag || ufs_disk_write(&disk) < 0 || + (fswritefd = dup(disk.d_fd)) < 0)) { fswritefd = -1; if (preen) pfatal("NO WRITE ACCESS"); Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Wed Jan 24 22:36:21 2018 (r328382) +++ head/sbin/fsck_ffs/suj.c Wed Jan 24 23:57:40 2018 (r328383) @@ -134,7 +134,6 @@ static struct data_blk *lastblk; static TAILQ_HEAD(seghd, suj_seg) allsegs; static uint64_t oldseq; -static struct uufsd *disk = NULL; static struct fs *fs = NULL; static ino_t sujino; @@ -190,29 +189,6 @@ err_suj(const char * restrict fmt, ...) } /* - * Open the given provider, load superblock. - */ -static void -opendisk(const char *devnam) -{ - if (disk != NULL) - return; - disk = Malloc(sizeof(*disk)); - if (disk == NULL) - err(EX_OSERR, "malloc(%zu)", sizeof(*disk)); - if (ufs_disk_fillout(disk, devnam) == -1) { - err(EX_OSERR, "ufs_disk_fillout(%s) failed: %s", devnam, - disk->d_error); - } - fs = &disk->d_fs; - if (real_dev_bsize == 0 && ioctl(disk->d_fd, DIOCGSECTORSIZE, - &real_dev_bsize) == -1) - real_dev_bsize = secsize; - if (debug) - printf("dev_bsize %u\n", real_dev_bsize); -} - -/* * Mark file system as clean, write the super-block back, close the disk. */ static void @@ -237,12 +213,10 @@ closedisk(const char *devnam) fs->fs_clean = 1; fs->fs_time = time(NULL); fs->fs_mtime = time(NULL); - if (sbwrite(disk, 0) == -1) + if (sbwrite(&disk, 0) == -1) err(EX_OSERR, "sbwrite(%s)", devnam); - if (ufs_disk_close(disk) == -1) + if (ufs_disk_close(&disk) == -1) err(EX_OSERR, "ufs_disk_close(%s)", devnam); - free(disk); - disk = NULL; fs = NULL; } @@ -272,7 +246,11 @@ cg_lookup(int cgx) sc->sc_cgp = (struct cg *)sc->sc_cgbuf; sc->sc_cgx = cgx; LIST_INSERT_HEAD(hd, sc, sc_next); - if (bread(disk, fsbtodb(fs, cgtod(fs, sc->sc_cgx)), sc->sc_cgbuf, + /* + * Use bread() here rather than cgget() because the cylinder group + * may be corrupted but we want it anyway so we can fix it. + */ + if (bread(&disk, fsbtodb(fs, cgtod(fs, sc->sc_cgx)), sc->sc_cgbuf, fs->fs_bsize) == -1) err_suj("Unable to read cylinder group %d\n", sc->sc_cgx); @@ -376,7 +354,7 @@ dblk_read(ufs2_daddr_t blk, int size) free(dblk->db_buf); dblk->db_buf = errmalloc(size); dblk->db_size = size; - if (bread(disk, fsbtodb(fs, blk), dblk->db_buf, size) == -1) + if (bread(&disk, fsbtodb(fs, blk), dblk->db_buf, size) == -1) err_suj("Failed to read data block %jd\n", blk); } return (dblk->db_buf); @@ -401,7 +379,7 @@ dblk_write(void) LIST_FOREACH(dblk, &dbhash[i], db_next) { if (dblk->db_dirty == 0 || dblk->db_size == 0) continue; - if (bwrite(disk, fsbtodb(fs, dblk->db_blk), + if (bwrite(&disk, fsbtodb(fs, dblk->db_blk), dblk->db_buf, dblk->db_size) == -1) err_suj("Unable to write block %jd\n", dblk->db_blk); @@ -435,7 +413,7 @@ ino_read(ino_t ino) iblk->ib_buf = errmalloc(fs->fs_bsize); iblk->ib_blk = blk; LIST_INSERT_HEAD(hd, iblk, ib_next); - if (bread(disk, fsbtodb(fs, blk), iblk->ib_buf, fs->fs_bsize) == -1) + if (bread(&disk, fsbtodb(fs, blk), iblk->ib_buf, fs->fs_bsize) == -1) err_suj("Failed to read inode block %jd\n", blk); found: sc->sc_lastiblk = iblk; @@ -478,7 +456,7 @@ iblk_write(struct ino_blk *iblk) if (iblk->ib_dirty == 0) return; - if (bwrite(disk, fsbtodb(fs, iblk->ib_blk), iblk->ib_buf, + if (bwrite(&disk, fsbtodb(fs, iblk->ib_blk), iblk->ib_buf, fs->fs_bsize) == -1) err_suj("Failed to write inode block %jd\n", iblk->ib_blk); } @@ -1892,7 +1870,7 @@ cg_write(struct suj_cg *sc) * before writing the block. */ fs->fs_cs(fs, sc->sc_cgx) = cgp->cg_cs; - if (cgput(disk, cgp) == -1) + if (cgput(&disk, cgp) == -1) err_suj("Unable to write cylinder group %d\n", sc->sc_cgx); } @@ -2457,7 +2435,7 @@ jblocks_next(struct jblocks *jblocks, int bytes, int * int freecnt; int blocks; - blocks = bytes / disk->d_bsize; + blocks = bytes / disk.d_bsize; jext = &jblocks->jb_extent[jblocks->jb_head]; freecnt = jext->je_blocks - jblocks->jb_off; if (freecnt == 0) { @@ -2469,7 +2447,7 @@ jblocks_next(struct jblocks *jblocks, int bytes, int * } if (freecnt > blocks) freecnt = blocks; - *actual = freecnt * disk->d_bsize; + *actual = freecnt * disk.d_bsize; daddr = jext->je_daddr + jblocks->jb_off; return (daddr); @@ -2483,7 +2461,7 @@ static void jblocks_advance(struct jblocks *jblocks, int bytes) { - jblocks->jb_off += bytes / disk->d_bsize; + jblocks->jb_off += bytes / disk.d_bsize; } static void @@ -2574,7 +2552,7 @@ restart: /* * Read 1MB at a time and scan for records within this block. */ - if (bread(disk, blk, &block, size) == -1) { + if (bread(&disk, blk, &block, size) == -1) { err_suj("Error reading journal block %jd\n", (intmax_t)blk); } @@ -2655,7 +2633,7 @@ suj_find(ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t blk, i if (sujino) return; bytes = lfragtosize(fs, frags); - if (bread(disk, fsbtodb(fs, blk), block, bytes) <= 0) + if (bread(&disk, fsbtodb(fs, blk), block, bytes) <= 0) err_suj("Failed to read UFS_ROOTINO directory block %jd\n", blk); for (off = 0; off < bytes; off += dp->d_reclen) { @@ -2687,7 +2665,12 @@ suj_check(const char *filesys) struct suj_seg *segn; initsuj(); - opendisk(filesys); + fs = &sblock; + if (real_dev_bsize == 0 && ioctl(disk.d_fd, DIOCGSECTORSIZE, + &real_dev_bsize) == -1) + real_dev_bsize = secsize; + if (debug) + printf("dev_bsize %u\n", real_dev_bsize); /* * Set an exit point when SUJ check failed @@ -2790,7 +2773,6 @@ initsuj(void) lastblk = NULL; TAILQ_INIT(&allsegs); oldseq = 0; - disk = NULL; fs = NULL; sujino = 0; freefrags = 0; From owner-svn-src-all@freebsd.org Thu Jan 25 00:08:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BCACECE566; Thu, 25 Jan 2018 00:08:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2FAAF7EB2A; Thu, 25 Jan 2018 00:08:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A9ED24B29; Thu, 25 Jan 2018 00:08:14 +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 w0P08Eve052637; Thu, 25 Jan 2018 00:08:14 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P08E9c052636; Thu, 25 Jan 2018 00:08:14 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801250008.w0P08E9c052636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 25 Jan 2018 00:08: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: r328384 - stable/10/tests/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/10/tests/sys/kern X-SVN-Commit-Revision: 328384 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 00:08:14 -0000 Author: jhb Date: Thu Jan 25 00:08:13 2018 New Revision: 328384 URL: https://svnweb.freebsd.org/changeset/base/328384 Log: MFC 287600,287602: Fixes for fork following tests. 287600: Properly size the children[] arrays in the follow fork tests. 287602: Use _exit() instead of exit() in child processes created during tests. Modified: stable/10/tests/sys/kern/ptrace_test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/10/tests/sys/kern/ptrace_test.c Wed Jan 24 23:57:40 2018 (r328383) +++ stable/10/tests/sys/kern/ptrace_test.c Thu Jan 25 00:08:13 2018 (r328384) @@ -143,7 +143,7 @@ ATF_TC_BODY(ptrace__parent_wait_after_trace_me, tc) /* Child process. */ trace_me(); - exit(1); + _exit(1); } /* Parent process. */ @@ -189,7 +189,7 @@ ATF_TC_BODY(ptrace__parent_wait_after_attach, tc) /* Wait for the parent to attach. */ CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == 0); - exit(1); + _exit(1); } close(cpipe[1]); @@ -237,7 +237,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debug /* Wait for parent to be ready. */ CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c)); - exit(1); + _exit(1); } close(cpipe[1]); @@ -268,7 +268,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debug CHILD_REQUIRE(WIFEXITED(status)); CHILD_REQUIRE(WEXITSTATUS(status) == 1); - exit(0); + _exit(0); } close(dpipe[1]); @@ -331,7 +331,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_d /* Wait for parent to be ready. */ CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c)); - exit(1); + _exit(1); } close(cpipe[1]); @@ -347,7 +347,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_d */ CHILD_REQUIRE((fpid = fork()) != -1); if (fpid != 0) - exit(2); + _exit(2); /* Debugger process. */ close(dpipe[0]); @@ -372,7 +372,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_d CHILD_REQUIRE(WIFEXITED(status)); CHILD_REQUIRE(WEXITSTATUS(status) == 1); - exit(0); + _exit(0); } close(dpipe[1]); @@ -437,14 +437,14 @@ follow_fork_parent(bool use_vfork) if (fpid == 0) /* Child */ - exit(2); + _exit(2); wpid = waitpid(fpid, &status, 0); CHILD_REQUIRE(wpid == fpid); CHILD_REQUIRE(WIFEXITED(status)); CHILD_REQUIRE(WEXITSTATUS(status) == 2); - exit(1); + _exit(1); } /* @@ -516,7 +516,7 @@ handle_fork_events(pid_t parent, struct ptrace_lwpinfo ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_both_attached); ATF_TC_BODY(ptrace__follow_fork_both_attached, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int status; ATF_REQUIRE((fpid = fork()) != -1); @@ -572,7 +572,7 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached, tc) ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_child_detached); ATF_TC_BODY(ptrace__follow_fork_child_detached, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int status; ATF_REQUIRE((fpid = fork()) != -1); @@ -623,7 +623,7 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached, tc) ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_parent_detached); ATF_TC_BODY(ptrace__follow_fork_parent_detached, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int status; ATF_REQUIRE((fpid = fork()) != -1); @@ -685,7 +685,7 @@ attach_fork_parent(int cpipe[2]) /* Double-fork to disassociate from the debugger. */ CHILD_REQUIRE((fpid = fork()) != -1); if (fpid != 0) - exit(3); + _exit(3); /* Send the pid of the disassociated child to the debugger. */ fpid = getpid(); @@ -704,7 +704,7 @@ attach_fork_parent(int cpipe[2]) ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_both_attached_unrelated_debugger); ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelated_debugger, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int cpipe[2], status; ATF_REQUIRE(pipe(cpipe) == 0); @@ -772,7 +772,7 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelate ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_child_detached_unrelated_debugger); ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelated_debugger, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int cpipe[2], status; ATF_REQUIRE(pipe(cpipe) == 0); @@ -835,7 +835,7 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelat ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_parent_detached_unrelated_debugger); ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrelated_debugger, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int cpipe[2], status; ATF_REQUIRE(pipe(cpipe) == 0); From owner-svn-src-all@freebsd.org Thu Jan 25 00:09:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C5FFECE648; Thu, 25 Jan 2018 00:09:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E1D137EC80; Thu, 25 Jan 2018 00:09:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCA9524B2A; Thu, 25 Jan 2018 00:09:44 +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 w0P09iEp052733; Thu, 25 Jan 2018 00:09:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P09iZg052732; Thu, 25 Jan 2018 00:09:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801250009.w0P09iZg052732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 25 Jan 2018 00:09: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: r328385 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328385 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 00:09:45 -0000 Author: jhb Date: Thu Jan 25 00:09:44 2018 New Revision: 328385 URL: https://svnweb.freebsd.org/changeset/base/328385 Log: MFC 312534: ANSYfy kern_ktrace.c and remove archaic register keyword Modified: stable/11/sys/kern/kern_ktrace.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_ktrace.c ============================================================================== --- stable/11/sys/kern/kern_ktrace.c Thu Jan 25 00:08:13 2018 (r328384) +++ stable/11/sys/kern/kern_ktrace.c Thu Jan 25 00:09:44 2018 (r328385) @@ -437,9 +437,7 @@ ktr_freeproc(struct proc *p, struct ucred **uc, struct } void -ktrsyscall(code, narg, args) - int code, narg; - register_t args[]; +ktrsyscall(int code, int narg, register_t args[]) { struct ktr_request *req; struct ktr_syscall *ktp; @@ -468,9 +466,7 @@ ktrsyscall(code, narg, args) } void -ktrsysret(code, error, retval) - int code, error; - register_t retval; +ktrsysret(int code, int error, register_t retval) { struct ktr_request *req; struct ktr_sysret *ktp; @@ -637,9 +633,7 @@ ktrnamei(path) } void -ktrsysctl(name, namelen) - int *name; - u_int namelen; +ktrsysctl(int *name, u_int namelen) { struct ktr_request *req; u_int mib[CTL_MAXNAME + 2]; @@ -671,11 +665,7 @@ ktrsysctl(name, namelen) } void -ktrgenio(fd, rw, uio, error) - int fd; - enum uio_rw rw; - struct uio *uio; - int error; +ktrgenio(int fd, enum uio_rw rw, struct uio *uio, int error) { struct ktr_request *req; struct ktr_genio *ktg; @@ -710,11 +700,7 @@ ktrgenio(fd, rw, uio, error) } void -ktrpsig(sig, action, mask, code) - int sig; - sig_t action; - sigset_t *mask; - int code; +ktrpsig(int sig, sig_t action, sigset_t *mask, int code) { struct thread *td = curthread; struct ktr_request *req; @@ -733,9 +719,7 @@ ktrpsig(sig, action, mask, code) } void -ktrcsw(out, user, wmesg) - int out, user; - const char *wmesg; +ktrcsw(int out, int user, const char *wmesg) { struct thread *td = curthread; struct ktr_request *req; @@ -756,10 +740,7 @@ ktrcsw(out, user, wmesg) } void -ktrstruct(name, data, datalen) - const char *name; - void *data; - size_t datalen; +ktrstruct(const char *name, void *data, size_t datalen) { struct ktr_request *req; char *buf; @@ -782,10 +763,8 @@ ktrstruct(name, data, datalen) } void -ktrcapfail(type, needed, held) - enum ktr_cap_fail_type type; - const cap_rights_t *needed; - const cap_rights_t *held; +ktrcapfail(enum ktr_cap_fail_type type, const cap_rights_t *needed, + const cap_rights_t *held) { struct thread *td = curthread; struct ktr_request *req; @@ -809,9 +788,7 @@ ktrcapfail(type, needed, held) } void -ktrfault(vaddr, type) - vm_offset_t vaddr; - int type; +ktrfault(vm_offset_t vaddr, int type) { struct thread *td = curthread; struct ktr_request *req; @@ -828,8 +805,7 @@ ktrfault(vaddr, type) } void -ktrfaultend(result) - int result; +ktrfaultend(int result) { struct thread *td = curthread; struct ktr_request *req; @@ -857,13 +833,11 @@ struct ktrace_args { #endif /* ARGSUSED */ int -sys_ktrace(td, uap) - struct thread *td; - register struct ktrace_args *uap; +sys_ktrace(struct thread *td, struct ktrace_args *uap) { #ifdef KTRACE - register struct vnode *vp = NULL; - register struct proc *p; + struct vnode *vp = NULL; + struct proc *p; struct pgrp *pg; int facs = uap->facs & ~KTRFAC_ROOT; int ops = KTROP(uap->ops); @@ -1002,9 +976,7 @@ done: /* ARGSUSED */ int -sys_utrace(td, uap) - struct thread *td; - register struct utrace_args *uap; +sys_utrace(struct thread *td, struct utrace_args *uap) { #ifdef KTRACE @@ -1038,11 +1010,7 @@ sys_utrace(td, uap) #ifdef KTRACE static int -ktrops(td, p, ops, facs, vp) - struct thread *td; - struct proc *p; - int ops, facs; - struct vnode *vp; +ktrops(struct thread *td, struct proc *p, int ops, int facs, struct vnode *vp) { struct vnode *tracevp = NULL; struct ucred *tracecred = NULL; @@ -1093,14 +1061,11 @@ ktrops(td, p, ops, facs, vp) } static int -ktrsetchildren(td, top, ops, facs, vp) - struct thread *td; - struct proc *top; - int ops, facs; - struct vnode *vp; +ktrsetchildren(struct thread *td, struct proc *top, int ops, int facs, + struct vnode *vp) { - register struct proc *p; - register int ret = 0; + struct proc *p; + int ret = 0; p = top; PROC_LOCK_ASSERT(p, MA_OWNED); @@ -1260,9 +1225,7 @@ ktr_writerequest(struct thread *td, struct ktr_request * so, only root may further change it. */ static int -ktrcanset(td, targetp) - struct thread *td; - struct proc *targetp; +ktrcanset(struct thread *td, struct proc *targetp) { PROC_LOCK_ASSERT(targetp, MA_OWNED); From owner-svn-src-all@freebsd.org Thu Jan 25 00:13:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13427ECEA12; Thu, 25 Jan 2018 00:13:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 97A177F0A9; Thu, 25 Jan 2018 00:13:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id w0P0DA1j076041 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 24 Jan 2018 16:13:10 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id w0P0DA8I076040; Wed, 24 Jan 2018 16:13:10 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 24 Jan 2018 16:13:10 -0800 From: Gleb Smirnoff To: Kristof Provost Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328313 - head/sys/netpfil/pf Message-ID: <20180125001310.GJ8113@FreeBSD.org> References: <201801240429.w0O4THIl059440@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201801240429.w0O4THIl059440@repo.freebsd.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 00:13:18 -0000 Hi Kristof, On Wed, Jan 24, 2018 at 04:29:17AM +0000, Kristof Provost wrote: K> Author: kp K> Date: Wed Jan 24 04:29:16 2018 K> New Revision: 328313 K> URL: https://svnweb.freebsd.org/changeset/base/328313 K> K> Log: K> pf: States have at least two references K> K> pf_unlink_state() releases a reference to the state without checking if K> this is the last reference. It can't be, because pf_state_insert() K> initialises it to two. KASSERT() that this is always the case. K> K> CID: 1347140 K> K> Modified: K> head/sys/netpfil/pf/pf.c K> K> Modified: head/sys/netpfil/pf/pf.c K> ============================================================================== K> --- head/sys/netpfil/pf/pf.c Wed Jan 24 03:09:56 2018 (r328312) K> +++ head/sys/netpfil/pf/pf.c Wed Jan 24 04:29:16 2018 (r328313) K> @@ -1613,6 +1613,7 @@ int K> pf_unlink_state(struct pf_state *s, u_int flags) K> { K> struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; K> + int last; K> K> if ((flags & PF_ENTER_LOCKED) == 0) K> PF_HASHROW_LOCK(ih); K> @@ -1653,7 +1654,8 @@ pf_unlink_state(struct pf_state *s, u_int flags) K> PF_HASHROW_UNLOCK(ih); K> K> pf_detach_state(s); K> - refcount_release(&s->refs); K> + last = refcount_release(&s->refs); K> + KASSERT(last == 0, ("Incorrect state reference count")); K> K> return (pf_release_state(s)); K> } IMHO, we shouldn't emit extra code to please Coverity. We can mark it as a false positive in the interface. It may make sense to add a comment for a human to explain why return isn't checked here. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Thu Jan 25 00:16:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80935ECEBC5; Thu, 25 Jan 2018 00:16:32 +0000 (UTC) (envelope-from srs0=ghjn=eu=freebsd.org=kp@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F52D7F269; Thu, 25 Jan 2018 00:16:31 +0000 (UTC) (envelope-from srs0=ghjn=eu=freebsd.org=kp@codepro.be) Received: from [192.168.228.1] (unknown [138.44.250.147]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 24399BC69; Thu, 25 Jan 2018 01:16:27 +0100 (CET) From: "Kristof Provost" To: "Gleb Smirnoff" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328313 - head/sys/netpfil/pf Date: Thu, 25 Jan 2018 11:16:23 +1100 X-Mailer: MailMate (2.0BETAr6103) Message-ID: In-Reply-To: <20180125001310.GJ8113@FreeBSD.org> References: <201801240429.w0O4THIl059440@repo.freebsd.org> <20180125001310.GJ8113@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; markup=markdown X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 00:16:32 -0000 On 25 Jan 2018, at 11:13, Gleb Smirnoff wrote: > On Wed, Jan 24, 2018 at 04:29:17AM +0000, Kristof Provost wrote: > K> Author: kp > K> Date: Wed Jan 24 04:29:16 2018 > K> New Revision: 328313 > K> URL: https://svnweb.freebsd.org/changeset/base/328313 > K> > K> Log: > K> pf: States have at least two references > K> > K> pf_unlink_state() releases a reference to the state without > checking if > K> this is the last reference. It can't be, because > pf_state_insert() > K> initialises it to two. KASSERT() that this is always the case. > K> > K> CID: 1347140 > K> > K> + last = refcount_release(&s->refs); > K> + KASSERT(last == 0, ("Incorrect state reference count")); > K> > K> return (pf_release_state(s)); > K> } > > IMHO, we shouldn't emit extra code to please Coverity. We can mark it > as a false positive in the interface. It may make sense to add a > comment > for a human to explain why return isn't checked here. > I find the KASSERT() to be a good way of verifying that this assumption is in fact correct. You do have a good point about the comment. Regards, Kristof From owner-svn-src-all@freebsd.org Thu Jan 25 00:20:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72CE4ECEF33; Thu, 25 Jan 2018 00:20:42 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 080F37F48C; Thu, 25 Jan 2018 00:20:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id w0P0Kebs076091 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 24 Jan 2018 16:20:40 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id w0P0Kew2076090; Wed, 24 Jan 2018 16:20:40 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 24 Jan 2018 16:20:40 -0800 From: Gleb Smirnoff To: Michael Zhilin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328377 - in head/sys/dev/etherswitch: arswitch e6000sw infineon ip17x micrel mtkswitch rtl8366 ukswitch Message-ID: <20180125002040.GK8113@FreeBSD.org> References: <201801242133.w0OLXIOe078281@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201801242133.w0OLXIOe078281@repo.freebsd.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 00:20:42 -0000 Hi Michael, I already replied to Dmitry that this patch isn't correct. The if_alloc() shall never fail. All checks like that needs to be removed. Inside the if_alloc() the check for L2COM allocation should also be removed. Everything happens with M_WAITOK in this path. On Wed, Jan 24, 2018 at 09:33:18PM +0000, Michael Zhilin wrote: M> Author: mizhka M> Date: Wed Jan 24 21:33:18 2018 M> New Revision: 328377 M> URL: https://svnweb.freebsd.org/changeset/base/328377 M> M> Log: M> [etherswitch] check if_alloc returns NULL M> M> This patch is cosmetic. It checks if allocation of ifnet structure failed. M> It's better to have this check rather than assume positive scenario. M> M> Submitted by: Dmitry Luhtionov M> Reported by: Dmitry Luhtionov M> M> Modified: M> head/sys/dev/etherswitch/arswitch/arswitch.c M> head/sys/dev/etherswitch/e6000sw/e6060sw.c M> head/sys/dev/etherswitch/infineon/adm6996fc.c M> head/sys/dev/etherswitch/ip17x/ip17x.c M> head/sys/dev/etherswitch/micrel/ksz8995ma.c M> head/sys/dev/etherswitch/mtkswitch/mtkswitch.c M> head/sys/dev/etherswitch/rtl8366/rtl8366rb.c M> head/sys/dev/etherswitch/ukswitch/ukswitch.c M> M> Modified: head/sys/dev/etherswitch/arswitch/arswitch.c M> ============================================================================== M> --- head/sys/dev/etherswitch/arswitch/arswitch.c Wed Jan 24 21:26:01 2018 (r328376) M> +++ head/sys/dev/etherswitch/arswitch/arswitch.c Wed Jan 24 21:33:18 2018 (r328377) M> @@ -177,6 +177,12 @@ arswitch_attach_phys(struct arswitch_softc *sc) M> snprintf(name, IFNAMSIZ, "%sport", device_get_nameunit(sc->sc_dev)); M> for (phy = 0; phy < sc->numphys; phy++) { M> sc->ifp[phy] = if_alloc(IFT_ETHER); M> + if (sc->ifp[phy] == NULL) { M> + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); M> + err = ENOMEM; M> + break; M> + } M> + M> sc->ifp[phy]->if_softc = sc; M> sc->ifp[phy]->if_flags |= IFF_UP | IFF_BROADCAST | M> IFF_DRV_RUNNING | IFF_SIMPLEX; M> M> Modified: head/sys/dev/etherswitch/e6000sw/e6060sw.c M> ============================================================================== M> --- head/sys/dev/etherswitch/e6000sw/e6060sw.c Wed Jan 24 21:26:01 2018 (r328376) M> +++ head/sys/dev/etherswitch/e6000sw/e6060sw.c Wed Jan 24 21:33:18 2018 (r328377) M> @@ -218,6 +218,12 @@ e6060sw_attach_phys(struct e6060sw_softc *sc) M> sc->ifpport[phy] = port; M> sc->portphy[port] = phy; M> sc->ifp[port] = if_alloc(IFT_ETHER); M> + if (sc->ifp[port] == NULL) { M> + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); M> + err = ENOMEM; M> + break; M> + } M> + M> sc->ifp[port]->if_softc = sc; M> sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | M> IFF_DRV_RUNNING | IFF_SIMPLEX; M> M> Modified: head/sys/dev/etherswitch/infineon/adm6996fc.c M> ============================================================================== M> --- head/sys/dev/etherswitch/infineon/adm6996fc.c Wed Jan 24 21:26:01 2018 (r328376) M> +++ head/sys/dev/etherswitch/infineon/adm6996fc.c Wed Jan 24 21:33:18 2018 (r328377) M> @@ -175,6 +175,12 @@ adm6996fc_attach_phys(struct adm6996fc_softc *sc) M> sc->ifpport[phy] = port; M> sc->portphy[port] = phy; M> sc->ifp[port] = if_alloc(IFT_ETHER); M> + if (sc->ifp[port] == NULL) { M> + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); M> + err = ENOMEM; M> + break; M> + } M> + M> sc->ifp[port]->if_softc = sc; M> sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | M> IFF_DRV_RUNNING | IFF_SIMPLEX; M> M> Modified: head/sys/dev/etherswitch/ip17x/ip17x.c M> ============================================================================== M> --- head/sys/dev/etherswitch/ip17x/ip17x.c Wed Jan 24 21:26:01 2018 (r328376) M> +++ head/sys/dev/etherswitch/ip17x/ip17x.c Wed Jan 24 21:33:18 2018 (r328377) M> @@ -174,6 +174,12 @@ ip17x_attach_phys(struct ip17x_softc *sc) M> sc->phyport[phy] = port; M> sc->portphy[port] = phy; M> sc->ifp[port] = if_alloc(IFT_ETHER); M> + if (sc->ifp[port] == NULL) { M> + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); M> + err = ENOMEM; M> + break; M> + } M> + M> sc->ifp[port]->if_softc = sc; M> sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | M> IFF_DRV_RUNNING | IFF_SIMPLEX; M> M> Modified: head/sys/dev/etherswitch/micrel/ksz8995ma.c M> ============================================================================== M> --- head/sys/dev/etherswitch/micrel/ksz8995ma.c Wed Jan 24 21:26:01 2018 (r328376) M> +++ head/sys/dev/etherswitch/micrel/ksz8995ma.c Wed Jan 24 21:33:18 2018 (r328377) M> @@ -221,6 +221,12 @@ ksz8995ma_attach_phys(struct ksz8995ma_softc *sc) M> sc->ifpport[phy] = port; M> sc->portphy[port] = phy; M> sc->ifp[port] = if_alloc(IFT_ETHER); M> + if (sc->ifp[port] == NULL) { M> + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); M> + err = ENOMEM; M> + break; M> + } M> + M> sc->ifp[port]->if_softc = sc; M> sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | M> IFF_DRV_RUNNING | IFF_SIMPLEX; M> M> Modified: head/sys/dev/etherswitch/mtkswitch/mtkswitch.c M> ============================================================================== M> --- head/sys/dev/etherswitch/mtkswitch/mtkswitch.c Wed Jan 24 21:26:01 2018 (r328376) M> +++ head/sys/dev/etherswitch/mtkswitch/mtkswitch.c Wed Jan 24 21:33:18 2018 (r328377) M> @@ -122,6 +122,12 @@ mtkswitch_attach_phys(struct mtkswitch_softc *sc) M> continue; M> } M> sc->ifp[phy] = if_alloc(IFT_ETHER); M> + if (sc->ifp[phy] == NULL) { M> + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); M> + err = ENOMEM; M> + break; M> + } M> + M> sc->ifp[phy]->if_softc = sc; M> sc->ifp[phy]->if_flags |= IFF_UP | IFF_BROADCAST | M> IFF_DRV_RUNNING | IFF_SIMPLEX; M> M> Modified: head/sys/dev/etherswitch/rtl8366/rtl8366rb.c M> ============================================================================== M> --- head/sys/dev/etherswitch/rtl8366/rtl8366rb.c Wed Jan 24 21:26:01 2018 (r328376) M> +++ head/sys/dev/etherswitch/rtl8366/rtl8366rb.c Wed Jan 24 21:33:18 2018 (r328377) M> @@ -239,6 +239,12 @@ rtl8366rb_attach(device_t dev) M> /* PHYs need an interface, so we generate a dummy one */ M> for (i = 0; i < sc->numphys; i++) { M> sc->ifp[i] = if_alloc(IFT_ETHER); M> + if (sc->ifp[i] == NULL) { M> + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); M> + err = ENOMEM; M> + break; M> + } M> + M> sc->ifp[i]->if_softc = sc; M> sc->ifp[i]->if_flags |= IFF_UP | IFF_BROADCAST | IFF_DRV_RUNNING M> | IFF_SIMPLEX; M> M> Modified: head/sys/dev/etherswitch/ukswitch/ukswitch.c M> ============================================================================== M> --- head/sys/dev/etherswitch/ukswitch/ukswitch.c Wed Jan 24 21:26:01 2018 (r328376) M> +++ head/sys/dev/etherswitch/ukswitch/ukswitch.c Wed Jan 24 21:33:18 2018 (r328377) M> @@ -126,6 +126,12 @@ ukswitch_attach_phys(struct ukswitch_softc *sc) M> sc->ifpport[phy] = port; M> sc->portphy[port] = phy; M> sc->ifp[port] = if_alloc(IFT_ETHER); M> + if (sc->ifp[port] == NULL) { M> + device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); M> + err = ENOMEM; M> + break; M> + } M> + M> sc->ifp[port]->if_softc = sc; M> sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | M> IFF_DRV_RUNNING | IFF_SIMPLEX; M> -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Thu Jan 25 00:22:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02F39ECF26A; Thu, 25 Jan 2018 00:22:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 809B27F86C; Thu, 25 Jan 2018 00:22:35 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id w0P0MXdO076117 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 24 Jan 2018 16:22:33 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id w0P0MXdG076116; Wed, 24 Jan 2018 16:22:33 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 24 Jan 2018 16:22:33 -0800 From: Gleb Smirnoff To: Kristof Provost Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328313 - head/sys/netpfil/pf Message-ID: <20180125002233.GL8113@FreeBSD.org> References: <201801240429.w0O4THIl059440@repo.freebsd.org> <20180125001310.GJ8113@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 00:22:36 -0000 On Thu, Jan 25, 2018 at 11:16:23AM +1100, Kristof Provost wrote: K> On 25 Jan 2018, at 11:13, Gleb Smirnoff wrote: K> > On Wed, Jan 24, 2018 at 04:29:17AM +0000, Kristof Provost wrote: K> > K> Author: kp K> > K> Date: Wed Jan 24 04:29:16 2018 K> > K> New Revision: 328313 K> > K> URL: https://svnweb.freebsd.org/changeset/base/328313 K> > K> K> > K> Log: K> > K> pf: States have at least two references K> > K> K> > K> pf_unlink_state() releases a reference to the state without K> > checking if K> > K> this is the last reference. It can't be, because K> > pf_state_insert() K> > K> initialises it to two. KASSERT() that this is always the case. K> > K> K> > K> CID: 1347140 K> > K> K> K> > K> + last = refcount_release(&s->refs); K> > K> + KASSERT(last == 0, ("Incorrect state reference count")); K> > K> K> > K> return (pf_release_state(s)); K> > K> } K> > K> > IMHO, we shouldn't emit extra code to please Coverity. We can mark it K> > as a false positive in the interface. It may make sense to add a K> > comment K> > for a human to explain why return isn't checked here. K> > K> I find the KASSERT() to be a good way of verifying that this assumption K> is in fact correct. K> You do have a good point about the comment. Now Coverity will report you about a write-only variable, if Coverity has a run with INVARIANTS undefined. There should be a better way for doing that. I don't see it right now though :) -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Thu Jan 25 00:35:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B6F3ECFA64 for ; Thu, 25 Jan 2018 00:35:08 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (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 808AA7FDD1 for ; Thu, 25 Jan 2018 00:35:07 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 927e8969-0167-11e8-91c6-33ffc249f3e8 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.eu.mailhop.org (Halon) with ESMTPSA id 927e8969-0167-11e8-91c6-33ffc249f3e8; Thu, 25 Jan 2018 00:34:59 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w0P0YwZ8009896; Wed, 24 Jan 2018 17:34:58 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1516840498.42536.213.camel@freebsd.org> Subject: Re: svn commit: r328313 - head/sys/netpfil/pf From: Ian Lepore To: Gleb Smirnoff , Kristof Provost Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Wed, 24 Jan 2018 17:34:58 -0700 In-Reply-To: <20180125001310.GJ8113@FreeBSD.org> References: <201801240429.w0O4THIl059440@repo.freebsd.org> <20180125001310.GJ8113@FreeBSD.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 00:35:08 -0000 On Wed, 2018-01-24 at 16:13 -0800, Gleb Smirnoff wrote: > Hi Kristof, > > On Wed, Jan 24, 2018 at 04:29:17AM +0000, Kristof Provost wrote: > K> Author: kp > K> Date: Wed Jan 24 04:29:16 2018 > K> New Revision: 328313 > K> URL: https://svnweb.freebsd.org/changeset/base/328313 > K> > K> Log: > K>pf: States have at least two references > K> > K>pf_unlink_state() releases a reference to the state without > checking if > K>this is the last reference. It can't be, because > pf_state_insert() > K>initialises it to two. KASSERT() that this is always the case. > K> > K>CID: 1347140 > K> > K> Modified: > K>head/sys/netpfil/pf/pf.c > K> > K> Modified: head/sys/netpfil/pf/pf.c > K> > ===================================================================== > ========= > K> --- head/sys/netpfil/pf/pf.c Wed Jan 24 03:09:56 2018 > (r328312) > K> +++ head/sys/netpfil/pf/pf.c Wed Jan 24 04:29:16 2018 > (r328313) > K> @@ -1613,6 +1613,7 @@ int > K>pf_unlink_state(struct pf_state *s, u_int flags) > K>{ > K> struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; > K> + int last; > K> > K> if ((flags & PF_ENTER_LOCKED) == 0) > K> PF_HASHROW_LOCK(ih); > K> @@ -1653,7 +1654,8 @@ pf_unlink_state(struct pf_state *s, u_int > flags) > K> PF_HASHROW_UNLOCK(ih); > K> > K> pf_detach_state(s); > K> - refcount_release(&s->refs); > K> + last = refcount_release(&s->refs); > K> + KASSERT(last == 0, ("Incorrect state reference count")); > K> > K> return (pf_release_state(s)); > K>} > > IMHO, we shouldn't emit extra code to please Coverity. We can mark it > as a false positive in the interface. It may make sense to add a > comment > for a human to explain why return isn't checked here. > Not to mention that when KASSERT compiles to nothing, what you're left with is a "defined but not used" warning for 'last'. -- Ian From owner-svn-src-all@freebsd.org Thu Jan 25 01:08:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CFE0ED15C4; Thu, 25 Jan 2018 01:08:24 +0000 (UTC) (envelope-from srs0=ghjn=eu=freebsd.org=kp@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4CDE814D8; Thu, 25 Jan 2018 01:08:23 +0000 (UTC) (envelope-from srs0=ghjn=eu=freebsd.org=kp@codepro.be) Received: from [192.168.228.1] (unknown [138.44.250.147]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 205DCBD35; Thu, 25 Jan 2018 02:08:20 +0100 (CET) From: "Kristof Provost" To: "Ian Lepore" Cc: "Gleb Smirnoff" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328313 - head/sys/netpfil/pf Date: Thu, 25 Jan 2018 12:08:17 +1100 X-Mailer: MailMate (2.0BETAr6103) Message-ID: <8FA39DD7-FD83-49D5-B7FC-3637B42129BE@FreeBSD.org> In-Reply-To: <1516840498.42536.213.camel@freebsd.org> References: <201801240429.w0O4THIl059440@repo.freebsd.org> <20180125001310.GJ8113@FreeBSD.org> <1516840498.42536.213.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 01:08:24 -0000 On 25 Jan 2018, at 11:34, Ian Lepore wrote: > On Wed, 2018-01-24 at 16:13 -0800, Gleb Smirnoff wrote: >> (r328313) >> K> @@ -1613,6 +1613,7 @@ int >> K>  pf_unlink_state(struct pf_state *s, u_int flags) >> K>  { >> K>   struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; >> K> + int last; >> K>   >> K>   if ((flags & PF_ENTER_LOCKED) == 0) >> K>   PF_HASHROW_LOCK(ih); >> K> @@ -1653,7 +1654,8 @@ pf_unlink_state(struct pf_state *s, u_int >> flags) >> K>   PF_HASHROW_UNLOCK(ih); >> K>   >> K>   pf_detach_state(s); >> K> - refcount_release(&s->refs); >> K> + last = refcount_release(&s->refs); >> K> + KASSERT(last == 0, ("Incorrect state reference count")); >> K>   >> K>   return (pf_release_state(s)); >> K>  } >> >> IMHO, we shouldn't emit extra code to please Coverity. We can mark it >> as a false positive in the interface. It may make sense to add a >> comment >> for a human to explain why return isn't checked here. >> > > Not to mention that when KASSERT compiles to nothing, what you're left > with is a "defined but not used" warning for 'last'. > I’d really like to keep the KASSERT(), because this is the sort of thing that could go wrong, and the assertion would be helpful. I suppose I could wrap last in #ifdef INVARIANTS, but that’s rather ugly too. Asserting that the refcount is at least 1 when entering pf_release_state() would express the same, but that’s also problematic. Of course, errors should trigger the KASSERT() in refcount_release(), so I think I may have convinced myself that the KASSERT() can in fact be removed and replaced with (void)refcount_release() and a comment explaining why this refcount_release() can never return 1. Regards, Kristof From owner-svn-src-all@freebsd.org Thu Jan 25 01:33:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 588B0ED34A4 for ; Thu, 25 Jan 2018 01:33:37 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (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 C0B2B8270E for ; Thu, 25 Jan 2018 01:33:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x243.google.com with SMTP id g1so11761875wmg.2 for ; Wed, 24 Jan 2018 17:33:36 -0800 (PST) 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=JGuHLx58nfsu+cqGB471zrcSReSDsGJa3bQSNEszkYI=; b=yPYyL46NQbizq36EA9u0Vkiv2I/LjGEngJHbaUItVbCmGROzpuqjNuTqs7nA9GA68W 6OvAtsB/WTUzJRb3k9JVY8gohHaud9AwOLh++aUK+Kftx/3R+zOwGOzF6hKsD2Gq/Umo e+ZcQ+/jwkj0MVefKcfwzab7ERcC8M6PyIQvc0ztpvq48XsT3dcGDf33gCoc10WmeusU CKeuiShTBJS3GOROsXUo6+Eqjv4hClHjHy6EG/zCMSAyOlJKhsSAqvJl98qKfRAQTl7U STUFIAeyrcWhdm+KSnpS9dLX4EpDbF5Go8Gkjoo9wkgsNmbIwE5a0N2jKuK01FVYIKcD qcRQ== 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=JGuHLx58nfsu+cqGB471zrcSReSDsGJa3bQSNEszkYI=; b=kq1EdMz2aYLU/5Bo8OzcDRA+iQ2d/2MOJaEUXE0xmY/sKAmWrK1ZHgzxBCKUFZ3yQF m9TO9fFDLCDcN9HjPEg0gMNFLsZo8CZIKa4LAtT8FXIWHrYZ/UEu4z4KjfaIQcBExAc8 /Pcz/W6EXL32autbu31W/5Rg6cXB6UTmsdx/0dJlbkYvcziQ6nE6O+g65t3aAjRkPtEk pL6TwIB1F91j7RjoS4ltxS2Bo8vlDJ7rkJKsGWR6rBk/m/qxFA9RbSvbESYr/nIDvq+T PiwIoVJR0EZONfHP2iJzhC+rsJyE8rvvbyTwVqIfz8znnBxbGS3o7hcSzomssuk4ng1q OpvQ== X-Gm-Message-State: AKwxytfy6eBwfbyYLlQlads2EwtWNpU4xTzEFEHBXrDlJ9I9HgkasFBc RtKNE+QHadrzkGDhVcyVydSvaxePuHPSpBN3IvodUQ== X-Google-Smtp-Source: AH8x227WaouMqF6H+uAUhS8DB0qT/7wgO50zxMZfwk1WEsY21MDgdgj5JavyA6q6RJttDcfh0gUhCAkxrDVZhmO5XL8= X-Received: by 10.80.171.165 with SMTP id u34mr26583363edc.167.1516844015695; Wed, 24 Jan 2018 17:33:35 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.133.195 with HTTP; Wed, 24 Jan 2018 17:33:35 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:e53c:ea1d:7f1f:f74b] Received: by 10.80.133.195 with HTTP; Wed, 24 Jan 2018 17:33:35 -0800 (PST) In-Reply-To: <8FA39DD7-FD83-49D5-B7FC-3637B42129BE@FreeBSD.org> References: <201801240429.w0O4THIl059440@repo.freebsd.org> <20180125001310.GJ8113@FreeBSD.org> <1516840498.42536.213.camel@freebsd.org> <8FA39DD7-FD83-49D5-B7FC-3637B42129BE@FreeBSD.org> From: Warner Losh Date: Wed, 24 Jan 2018 18:33:35 -0700 X-Google-Sender-Auth: fRdZbTjsTCVrx7oksrdbSxvkcAg Message-ID: Subject: Re: svn commit: r328313 - head/sys/netpfil/pf To: Kristof Provost Cc: Ian Lepore , Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 01:33:37 -0000 On Jan 24, 2018 6:08 PM, "Kristof Provost" wrote: On 25 Jan 2018, at 11:34, Ian Lepore wrote: > On Wed, 2018-01-24 at 16:13 -0800, Gleb Smirnoff wrote: > >> (r328313) >> K> @@ -1613,6 +1613,7 @@ int >> K> pf_unlink_state(struct pf_state *s, u_int flags) >> K> { >> K> struct pf_idhash *ih =3D &V_pf_idhash[PF_IDHASH(s)]; >> K> + int last; >> K> >> K> if ((flags & PF_ENTER_LOCKED) =3D=3D 0) >> K> PF_HASHROW_LOCK(ih); >> K> @@ -1653,7 +1654,8 @@ pf_unlink_state(struct pf_state *s, u_int >> flags) >> K> PF_HASHROW_UNLOCK(ih); >> K> >> K> pf_detach_state(s); >> K> - refcount_release(&s->refs); >> K> + last =3D refcount_release(&s->refs); >> K> + KASSERT(last =3D=3D 0, ("Incorrect state reference count")); >> K> >> K> return (pf_release_state(s)); >> K> } >> >> IMHO, we shouldn't emit extra code to please Coverity. We can mark it >> as a false positive in the interface. It may make sense to add a >> comment >> for a human to explain why return isn't checked here. >> >> > Not to mention that when KASSERT compiles to nothing, what you're left > with is a "defined but not used" warning for 'last'. > > I=E2=80=99d really like to keep the KASSERT(), because this is the sort o= f thing that could go wrong, and the assertion would be helpful. I suppose I could wrap last in #ifdef INVARIANTS, but that=E2=80=99s rather= ugly too. Asserting that the refcount is at least 1 when entering pf_release_state() would express the same, but that=E2=80=99s also problematic. Of course, errors should trigger the KASSERT() in refcount_release(), so I think I may have convinced myself that the KASSERT() can in fact be removed and replaced with (void)refcount_release() and a comment explaining why this refcount_release() can never return 1. It would be good to have a Coverty cheer sheet so we know how to annotate this stuff correctly in the source. I've started fumbling my way through for the boot loader and devmatch changes... Warner From owner-svn-src-all@freebsd.org Thu Jan 25 02:45:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3ECB1ED7AB0; Thu, 25 Jan 2018 02:45:24 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE4E0857F3; Thu, 25 Jan 2018 02:45:23 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7EA52675D; Thu, 25 Jan 2018 02:45:23 +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 w0P2jNkL032685; Thu, 25 Jan 2018 02:45:23 GMT (envelope-from pkelsey@FreeBSD.org) Received: (from pkelsey@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P2jL0O032660; Thu, 25 Jan 2018 02:45:21 GMT (envelope-from pkelsey@FreeBSD.org) Message-Id: <201801250245.w0P2jL0O032660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pkelsey set sender to pkelsey@FreeBSD.org using -f From: Patrick Kelsey Date: Thu, 25 Jan 2018 02: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: r328386 - in stable/11/sys: amd64/amd64 amd64/include arm/arm arm/include arm64/include cddl/dev/dtrace/aarch64 cddl/dev/dtrace/amd64 cddl/dev/dtrace/arm cddl/dev/dtrace/i386 cddl/dev/d... X-SVN-Group: stable-11 X-SVN-Commit-Author: pkelsey X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 amd64/include arm/arm arm/include arm64/include cddl/dev/dtrace/aarch64 cddl/dev/dtrace/amd64 cddl/dev/dtrace/arm cddl/dev/dtrace/i386 cddl/dev/dtrace/mips cddl/dev/dtrac... X-SVN-Commit-Revision: 328386 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 02:45:24 -0000 Author: pkelsey Date: Thu Jan 25 02:45:21 2018 New Revision: 328386 URL: https://svnweb.freebsd.org/changeset/base/328386 Log: MFC r316648: Corrected misspelled versions of rendezvous. The MFC maintains smp_no_rendevous_barrier() as a symbol alias of smp_no_rendezvous_barrier(). __FreeBSD_version bumped to indicate presence of the new name smp_no_rendezvous_barrier(). Reviewed by: gnn, jhb (email), kib Differential Revision: https://reviews.freebsd.org/D10313 Modified: stable/11/sys/amd64/amd64/pmap.c stable/11/sys/amd64/include/counter.h stable/11/sys/arm/arm/pmap-v6.c stable/11/sys/arm/include/counter.h stable/11/sys/arm64/include/counter.h stable/11/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c stable/11/sys/cddl/dev/dtrace/amd64/dtrace_subr.c stable/11/sys/cddl/dev/dtrace/arm/dtrace_subr.c stable/11/sys/cddl/dev/dtrace/i386/dtrace_subr.c stable/11/sys/cddl/dev/dtrace/mips/dtrace_subr.c stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c stable/11/sys/cddl/dev/dtrace/riscv/dtrace_subr.c stable/11/sys/dev/acpica/acpi_cpu.c stable/11/sys/i386/i386/pmap.c stable/11/sys/i386/include/counter.h stable/11/sys/kern/kern_rmlock.c stable/11/sys/kern/subr_smp.c stable/11/sys/mips/include/counter.h stable/11/sys/powerpc/include/counter.h stable/11/sys/powerpc/ofw/ofw_machdep.c stable/11/sys/riscv/include/counter.h stable/11/sys/sparc64/include/counter.h stable/11/sys/sys/param.h stable/11/sys/sys/smp.h stable/11/sys/x86/x86/tsc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/amd64/amd64/pmap.c Thu Jan 25 02:45:21 2018 (r328386) @@ -1753,7 +1753,7 @@ pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_ act.newpde = newpde; CPU_SET(cpuid, &active); smp_rendezvous_cpus(active, - smp_no_rendevous_barrier, pmap_update_pde_action, + smp_no_rendezvous_barrier, pmap_update_pde_action, pmap_update_pde_teardown, &act); } else { pmap_update_pde_store(pmap, pde, newpde); Modified: stable/11/sys/amd64/include/counter.h ============================================================================== --- stable/11/sys/amd64/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/amd64/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -69,8 +69,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/arm/arm/pmap-v6.c ============================================================================== --- stable/11/sys/arm/arm/pmap-v6.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/arm/arm/pmap-v6.c Thu Jan 25 02:45:21 2018 (r328386) @@ -3367,7 +3367,7 @@ pmap_change_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_o act.va = va; act.npte1 = npte1; act.update = PCPU_GET(cpuid); - smp_rendezvous_cpus(all_cpus, smp_no_rendevous_barrier, + smp_rendezvous_cpus(all_cpus, smp_no_rendezvous_barrier, pmap_update_pte1_action, NULL, &act); sched_unpin(); } else { Modified: stable/11/sys/arm/include/counter.h ============================================================================== --- stable/11/sys/arm/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/arm/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -70,8 +70,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/arm64/include/counter.h ============================================================================== --- stable/11/sys/arm64/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/arm64/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -68,8 +68,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -134,8 +134,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void Modified: stable/11/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -125,8 +125,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void @@ -331,7 +331,7 @@ dtrace_gethrtime_init(void *arg) smp_rendezvous_cpus(map, NULL, dtrace_gethrtime_init_cpu, - smp_no_rendevous_barrier, (void *)(uintptr_t) i); + smp_no_rendezvous_barrier, (void *)(uintptr_t) i); tsc_skew[i] = tgt_cpu_tsc - hst_cpu_tsc; } Modified: stable/11/sys/cddl/dev/dtrace/arm/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/arm/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/arm/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -136,8 +136,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void Modified: stable/11/sys/cddl/dev/dtrace/i386/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/i386/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/i386/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -127,8 +127,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void @@ -333,7 +333,7 @@ dtrace_gethrtime_init(void *arg) smp_rendezvous_cpus(map, NULL, dtrace_gethrtime_init_cpu, - smp_no_rendevous_barrier, (void *)(uintptr_t) i); + smp_no_rendezvous_barrier, (void *)(uintptr_t) i); tsc_skew[i] = tgt_cpu_tsc - hst_cpu_tsc; } Modified: stable/11/sys/cddl/dev/dtrace/mips/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/mips/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/mips/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -131,8 +131,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void Modified: stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -133,8 +133,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void @@ -212,7 +212,7 @@ dtrace_gethrtime_init(void *arg) smp_rendezvous_cpus(map, NULL, dtrace_gethrtime_init_cpu, - smp_no_rendevous_barrier, (void *)(uintptr_t) i); + smp_no_rendezvous_barrier, (void *)(uintptr_t) i); timebase_skew[i] = tgt_cpu_tsc - hst_cpu_tsc; } Modified: stable/11/sys/cddl/dev/dtrace/riscv/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -137,8 +137,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void Modified: stable/11/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/11/sys/dev/acpica/acpi_cpu.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/dev/acpica/acpi_cpu.c Thu Jan 25 02:45:21 2018 (r328386) @@ -466,8 +466,8 @@ disable_idle(struct acpi_cpu_softc *sc) * is called and executed in such a context with interrupts being re-enabled * right before return. */ - smp_rendezvous_cpus(cpuset, smp_no_rendevous_barrier, NULL, - smp_no_rendevous_barrier, NULL); + smp_rendezvous_cpus(cpuset, smp_no_rendezvous_barrier, NULL, + smp_no_rendezvous_barrier, NULL); } static void Modified: stable/11/sys/i386/i386/pmap.c ============================================================================== --- stable/11/sys/i386/i386/pmap.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/i386/i386/pmap.c Thu Jan 25 02:45:21 2018 (r328386) @@ -1200,7 +1200,7 @@ pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_ act.newpde = newpde; CPU_SET(cpuid, &active); smp_rendezvous_cpus(active, - smp_no_rendevous_barrier, pmap == kernel_pmap ? + smp_no_rendezvous_barrier, pmap == kernel_pmap ? pmap_update_pde_kernel : pmap_update_pde_user, pmap_update_pde_teardown, &act); } else { Modified: stable/11/sys/i386/include/counter.h ============================================================================== --- stable/11/sys/i386/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/i386/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -148,8 +148,8 @@ counter_u64_zero_inline(counter_u64_t c) *(uint64_t *)((char *)c + sizeof(struct pcpu) * i) = 0; critical_exit(); } else { - smp_rendezvous(smp_no_rendevous_barrier, - counter_u64_zero_one_cpu, smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, + counter_u64_zero_one_cpu, smp_no_rendezvous_barrier, c); } } #endif Modified: stable/11/sys/kern/kern_rmlock.c ============================================================================== --- stable/11/sys/kern/kern_rmlock.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/kern/kern_rmlock.c Thu Jan 25 02:45:21 2018 (r328386) @@ -549,9 +549,9 @@ _rm_wlock(struct rmlock *rm) */ #ifdef SMP smp_rendezvous_cpus(readcpus, - smp_no_rendevous_barrier, + smp_no_rendezvous_barrier, rm_cleanIPI, - smp_no_rendevous_barrier, + smp_no_rendezvous_barrier, rm); #else Modified: stable/11/sys/kern/subr_smp.c ============================================================================== --- stable/11/sys/kern/subr_smp.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/kern/subr_smp.c Thu Jan 25 02:45:21 2018 (r328386) @@ -451,7 +451,7 @@ smp_rendezvous_action(void) * function. Ensure all CPUs have completed the setup * function before moving on to the action function. */ - if (local_setup_func != smp_no_rendevous_barrier) { + if (local_setup_func != smp_no_rendezvous_barrier) { if (smp_rv_setup_func != NULL) smp_rv_setup_func(smp_rv_func_arg); atomic_add_int(&smp_rv_waiters[1], 1); @@ -462,7 +462,7 @@ smp_rendezvous_action(void) if (local_action_func != NULL) local_action_func(local_func_arg); - if (local_teardown_func != smp_no_rendevous_barrier) { + if (local_teardown_func != smp_no_rendezvous_barrier) { /* * Signal that the main action has been completed. If a * full exit rendezvous is requested, then all CPUs will @@ -821,11 +821,18 @@ SYSINIT(cpu_mp_setvariables, SI_SUB_TUNABLES, SI_ORDER mp_setvariables_for_up, NULL); #endif /* SMP */ +/* + * smp_no_rendevous_barrier was renamed to smp_no_rendezvous_barrier + * in __FreeBSD_version 1101508, with the old name remaining in 11.x + * as an alias for compatibility. The old name will be gone in 12.0 + * (__FreeBSD_version >= 1200028). + */ +__strong_reference(smp_no_rendezvous_barrier, smp_no_rendevous_barrier); void -smp_no_rendevous_barrier(void *dummy) +smp_no_rendezvous_barrier(void *dummy) { #ifdef SMP - KASSERT((!smp_started),("smp_no_rendevous called and smp is started")); + KASSERT((!smp_started),("smp_no_rendezvous called and smp is started")); #endif } Modified: stable/11/sys/mips/include/counter.h ============================================================================== --- stable/11/sys/mips/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/mips/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -72,8 +72,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/powerpc/include/counter.h ============================================================================== --- stable/11/sys/powerpc/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/powerpc/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -72,8 +72,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif @@ -138,8 +138,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- stable/11/sys/powerpc/ofw/ofw_machdep.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/powerpc/ofw/ofw_machdep.c Thu Jan 25 02:45:21 2018 (r328386) @@ -528,8 +528,8 @@ openfirmware(void *args) #ifdef SMP rv_args.args = args; rv_args.in_progress = 1; - smp_rendezvous(smp_no_rendevous_barrier, ofw_rendezvous_dispatch, - smp_no_rendevous_barrier, &rv_args); + smp_rendezvous(smp_no_rendezvous_barrier, ofw_rendezvous_dispatch, + smp_no_rendezvous_barrier, &rv_args); result = rv_args.retval; #else result = openfirmware_core(args); Modified: stable/11/sys/riscv/include/counter.h ============================================================================== --- stable/11/sys/riscv/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/riscv/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -71,8 +71,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/sparc64/include/counter.h ============================================================================== --- stable/11/sys/sparc64/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/sparc64/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -71,8 +71,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/sys/param.h Thu Jan 25 02:45:21 2018 (r328386) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1101507 /* Master, propagated to newvers */ +#define __FreeBSD_version 1101508 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: stable/11/sys/sys/smp.h ============================================================================== --- stable/11/sys/sys/smp.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/sys/smp.h Thu Jan 25 02:45:21 2018 (r328386) @@ -240,7 +240,14 @@ extern struct mtx smp_ipi_mtx; int quiesce_all_cpus(const char *, int); int quiesce_cpus(cpuset_t, const char *, int); +/* + * smp_no_rendevous_barrier was renamed to smp_no_rendezvous_barrier + * in __FreeBSD_version 1101508, with the old name remaining in 11.x + * as an alias for compatibility. The old name will be gone in 12.0 + * (__FreeBSD_version >= 1200028). + */ void smp_no_rendevous_barrier(void *); +void smp_no_rendezvous_barrier(void *); void smp_rendezvous(void (*)(void *), void (*)(void *), void (*)(void *), Modified: stable/11/sys/x86/x86/tsc.c ============================================================================== --- stable/11/sys/x86/x86/tsc.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/x86/x86/tsc.c Thu Jan 25 02:45:21 2018 (r328386) @@ -443,12 +443,12 @@ retry: for (i = 0, tsc = data; i < N; i++, tsc += size) smp_rendezvous(tsc_read_0, tsc_read_1, tsc_read_2, tsc); smp_tsc = 1; /* XXX */ - smp_rendezvous(smp_no_rendevous_barrier, comp_smp_tsc, - smp_no_rendevous_barrier, data); + smp_rendezvous(smp_no_rendezvous_barrier, comp_smp_tsc, + smp_no_rendezvous_barrier, data); if (!smp_tsc && adj < smp_tsc_adjust) { adj++; - smp_rendezvous(smp_no_rendevous_barrier, adj_smp_tsc, - smp_no_rendevous_barrier, data); + smp_rendezvous(smp_no_rendezvous_barrier, adj_smp_tsc, + smp_no_rendezvous_barrier, data); goto retry; } free(data, M_TEMP); From owner-svn-src-all@freebsd.org Thu Jan 25 02:52:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86FCEED7E46; Thu, 25 Jan 2018 02:52:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D0DC85C4A; Thu, 25 Jan 2018 02:52:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25ED026911; Thu, 25 Jan 2018 02:52:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0P2qj9x037500; Thu, 25 Jan 2018 02:52:45 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P2qj2U037499; Thu, 25 Jan 2018 02:52:45 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801250252.w0P2qj2U037499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 25 Jan 2018 02:52:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328387 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 328387 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 02:52:45 -0000 Author: imp Date: Thu Jan 25 02:52:44 2018 New Revision: 328387 URL: https://svnweb.freebsd.org/changeset/base/328387 Log: Minor whitespace cleanup to remove leading space before tab. No functional changes. Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Thu Jan 25 02:45:21 2018 (r328386) +++ head/sys/cam/scsi/scsi_da.c Thu Jan 25 02:52:44 2018 (r328387) @@ -152,7 +152,7 @@ typedef enum { DA_CCB_BUFFER_IO = 0x07, DA_CCB_DUMP = 0x0A, DA_CCB_DELETE = 0x0B, - DA_CCB_TUR = 0x0C, + DA_CCB_TUR = 0x0C, DA_CCB_PROBE_ZONE = 0x0D, DA_CCB_PROBE_ATA_LOGDIR = 0x0E, DA_CCB_PROBE_ATA_IDDIR = 0x0F, @@ -303,7 +303,7 @@ struct da_softc { int error_inject; int trim_max_ranges; int delete_available; /* Delete methods possibly available */ - da_zone_mode zone_mode; + da_zone_mode zone_mode; da_zone_interface zone_interface; da_zone_flags zone_flags; struct ata_gp_log_dir ata_logdir; @@ -313,7 +313,7 @@ struct da_softc { uint64_t optimal_seq_zones; uint64_t optimal_nonseq_zones; uint64_t max_seq_zones; - u_int maxio; + u_int maxio; uint32_t unmap_max_ranges; uint32_t unmap_max_lba; /* Max LBAs in UNMAP req */ uint32_t unmap_gran; @@ -502,16 +502,16 @@ static struct da_quirk_entry da_quirk_table[] = {T_DIRECT, SIP_MEDIA_REMOVABLE, "Generic*", "USB Flash Disk*", "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE }, - { - /* - * Creative Nomad MUVO mp3 player (USB) - * PR: kern/53094 - */ - {T_DIRECT, SIP_MEDIA_REMOVABLE, "CREATIVE", "NOMAD_MUVO", "*"}, - /*quirks*/ DA_Q_NO_SYNC_CACHE|DA_Q_NO_PREVENT - }, { /* + * Creative Nomad MUVO mp3 player (USB) + * PR: kern/53094 + */ + {T_DIRECT, SIP_MEDIA_REMOVABLE, "CREATIVE", "NOMAD_MUVO", "*"}, + /*quirks*/ DA_Q_NO_SYNC_CACHE|DA_Q_NO_PREVENT + }, + { + /* * Jungsoft NEXDISK USB flash key * PR: kern/54737 */ @@ -557,7 +557,7 @@ static struct da_quirk_entry da_quirk_table[] = */ {T_DIRECT, SIP_MEDIA_REMOVABLE, "iRiver", "iFP*", "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE - }, + }, { /* * Frontier Labs NEX IA+ Digital Audio Player, rev 1.10/0.01 @@ -3947,7 +3947,7 @@ cmd6workaround(union ccb *ccb) xpt_print(ccb->ccb_h.path, "READ(6)/WRITE(6) not supported, " "increasing minimum_cmd_size to 10.\n"); - softc->minimum_cmd_size = 10; + softc->minimum_cmd_size = 10; bcopy(cdb, &cmd6, sizeof(struct scsi_rw_6)); cmd10 = (struct scsi_rw_10 *)cdb; @@ -3961,7 +3961,7 @@ cmd6workaround(union ccb *ccb) /* Requeue request, unfreezing queue if necessary */ frozen = (ccb->ccb_h.status & CAM_DEV_QFRZN) != 0; - ccb->ccb_h.status = CAM_REQUEUE_REQ; + ccb->ccb_h.status = CAM_REQUEUE_REQ; xpt_action(ccb); if (frozen) { cam_release_devq(ccb->ccb_h.path, @@ -5436,17 +5436,17 @@ daerror(union ccb *ccb, u_int32_t cam_flags, u_int32_t periph = xpt_path_periph(ccb->ccb_h.path); softc = (struct da_softc *)periph->softc; - /* + /* * Automatically detect devices that do not support - * READ(6)/WRITE(6) and upgrade to using 10 byte cdbs. - */ + * READ(6)/WRITE(6) and upgrade to using 10 byte cdbs. + */ error = 0; if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID) { error = cmd6workaround(ccb); } else if (scsi_extract_sense_ccb(ccb, &error_code, &sense_key, &asc, &ascq)) { if (sense_key == SSD_KEY_ILLEGAL_REQUEST) - error = cmd6workaround(ccb); + error = cmd6workaround(ccb); /* * If the target replied with CAPACITY DATA HAS CHANGED UA, * query the capacity and notify upper layers. From owner-svn-src-all@freebsd.org Thu Jan 25 03:46:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1EF4EDA4C9; Thu, 25 Jan 2018 03:46:24 +0000 (UTC) (envelope-from srs0=ghjn=eu=freebsd.org=kp@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6881A87DB4; Thu, 25 Jan 2018 03:46:24 +0000 (UTC) (envelope-from srs0=ghjn=eu=freebsd.org=kp@codepro.be) Received: from [192.168.228.1] (unknown [138.44.250.147]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 242D713555; Thu, 25 Jan 2018 04:46:18 +0100 (CET) From: "Kristof Provost" To: "Ian Lepore" Cc: "Gleb Smirnoff" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328313 - head/sys/netpfil/pf Date: Thu, 25 Jan 2018 14:46:14 +1100 X-Mailer: MailMate (2.0BETAr6103) Message-ID: <14734657-ABC2-437B-9830-724901066342@FreeBSD.org> In-Reply-To: <8FA39DD7-FD83-49D5-B7FC-3637B42129BE@FreeBSD.org> References: <201801240429.w0O4THIl059440@repo.freebsd.org> <20180125001310.GJ8113@FreeBSD.org> <1516840498.42536.213.camel@freebsd.org> <8FA39DD7-FD83-49D5-B7FC-3637B42129BE@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; markup=markdown Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 03:46:25 -0000 On 25 Jan 2018, at 12:08, Kristof Provost wrote: > On 25 Jan 2018, at 11:34, Ian Lepore wrote: >> On Wed, 2018-01-24 at 16:13 -0800, Gleb Smirnoff wrote: >>> (r328313) >>> K> @@ -1613,6 +1613,7 @@ int >>> K>  pf_unlink_state(struct pf_state *s, u_int flags) >>> K>  { >>> K>   struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; >>> K> + int last; >>> K>   >>> K>   if ((flags & PF_ENTER_LOCKED) == 0) >>> K>   PF_HASHROW_LOCK(ih); >>> K> @@ -1653,7 +1654,8 @@ pf_unlink_state(struct pf_state *s, u_int >>> flags) >>> K>   PF_HASHROW_UNLOCK(ih); >>> K>   >>> K>   pf_detach_state(s); >>> K> - refcount_release(&s->refs); >>> K> + last = refcount_release(&s->refs); >>> K> + KASSERT(last == 0, ("Incorrect state reference count")); >>> K>   >>> K>   return (pf_release_state(s)); >>> K>  } >>> >>> IMHO, we shouldn't emit extra code to please Coverity. We can mark >>> it >>> as a false positive in the interface. It may make sense to add a >>> comment >>> for a human to explain why return isn't checked here. >>> >> >> Not to mention that when KASSERT compiles to nothing, what you're >> left >> with is a "defined but not used" warning for 'last'. >> > I’d really like to keep the KASSERT(), because this is the sort of > thing that could go wrong, and the assertion would be helpful. > > I suppose I could wrap last in #ifdef INVARIANTS, but that’s rather > ugly too. > > Asserting that the refcount is at least 1 when entering > pf_release_state() would express the same, but that’s also > problematic. > Of course, errors should trigger the KASSERT() in refcount_release(), > so I think I may have convinced myself that the KASSERT() can in fact > be removed and replaced with (void)refcount_release() and a comment > explaining why this refcount_release() can never return 1. > So this: diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 55ae1145835..0dbf1fe7f66 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1623,7 +1623,6 @@ int pf_unlink_state(struct pf_state *s, u_int flags) { struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; - int last; if ((flags & PF_ENTER_LOCKED) == 0) PF_HASHROW_LOCK(ih); @@ -1664,8 +1663,9 @@ pf_unlink_state(struct pf_state *s, u_int flags) PF_HASHROW_UNLOCK(ih); pf_detach_state(s); - last = refcount_release(&s->refs); - KASSERT(last == 0, ("Incorrect state reference count")); + /* pf_state_insert() initialises refs to 2, so we can never release the + * last reference here, only in pf_release_state(). */ + (void)refcount_release(&s->refs); return (pf_release_state(s)); } I do assume that (void) will tell Coverity I’m deliberately ignoring the return value. It’s a fairly common idiom, so I’d expect it to understand. Regards, Kristof From owner-svn-src-all@freebsd.org Thu Jan 25 05:15:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 404E7EBDDE8; Thu, 25 Jan 2018 05:15:45 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD6D96B1A5; Thu, 25 Jan 2018 05:15:44 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4CE6167; Thu, 25 Jan 2018 05:15:44 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0P5Fioo008096; Thu, 25 Jan 2018 05:15:44 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P5FiLk008095; Thu, 25 Jan 2018 05:15:44 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201801250515.w0P5FiLk008095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 25 Jan 2018 05:15:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328388 - head/share/man/man8 X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/share/man/man8 X-SVN-Commit-Revision: 328388 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 05:15:45 -0000 Author: lwhsu (ports committer) Date: Thu Jan 25 05:15:44 2018 New Revision: 328388 URL: https://svnweb.freebsd.org/changeset/base/328388 Log: Fix manual page install on non-amd64 Reviewed by: emaste, imp Differential Revision: https://reviews.freebsd.org/D14038 Modified: head/share/man/man8/Makefile Modified: head/share/man/man8/Makefile ============================================================================== --- head/share/man/man8/Makefile Thu Jan 25 02:52:44 2018 (r328387) +++ head/share/man/man8/Makefile Thu Jan 25 05:15:44 2018 (r328388) @@ -29,14 +29,15 @@ MLINKS= \ .if ${MK_NIS} != "no" MAN+= yp.8 -MLINKS+=uefi.8 efi.8 \ - yp.8 NIS.8 \ +MLINKS+=yp.8 NIS.8 \ yp.8 nis.8 \ yp.8 YP.8 .endif .if ${MACHINE_CPUARCH} == "amd64" _uefi.8= uefi.8 + +MLINKS+=uefi.8 efi.8 .endif .include From owner-svn-src-all@freebsd.org Thu Jan 25 05:48:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA1B2EC0249; Thu, 25 Jan 2018 05:48:42 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8AF156C34F; Thu, 25 Jan 2018 05:48:42 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8036B694; Thu, 25 Jan 2018 05:48:42 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0P5mgCQ022824; Thu, 25 Jan 2018 05:48:42 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P5mgHj022823; Thu, 25 Jan 2018 05:48:42 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201801250548.w0P5mgHj022823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Thu, 25 Jan 2018 05:48:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328389 - head/sys/dev/etherswitch/rtl8366 X-SVN-Group: head X-SVN-Commit-Author: mizhka X-SVN-Commit-Paths: head/sys/dev/etherswitch/rtl8366 X-SVN-Commit-Revision: 328389 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 05:48:43 -0000 Author: mizhka Date: Thu Jan 25 05:48:42 2018 New Revision: 328389 URL: https://svnweb.freebsd.org/changeset/base/328389 Log: [etherswitch] fix LINT build for rtl8366rb Build with rtl8366rb has been broken due to incorrect retrieval of pointer to device_t. Reported by: lwhsu Differential Revision: https://reviews.freebsd.org/D14044 Modified: head/sys/dev/etherswitch/rtl8366/rtl8366rb.c Modified: head/sys/dev/etherswitch/rtl8366/rtl8366rb.c ============================================================================== --- head/sys/dev/etherswitch/rtl8366/rtl8366rb.c Thu Jan 25 05:15:44 2018 (r328388) +++ head/sys/dev/etherswitch/rtl8366/rtl8366rb.c Thu Jan 25 05:48:42 2018 (r328389) @@ -240,7 +240,7 @@ rtl8366rb_attach(device_t dev) for (i = 0; i < sc->numphys; i++) { sc->ifp[i] = if_alloc(IFT_ETHER); if (sc->ifp[i] == NULL) { - device_printf(sc->sc_dev, "couldn't allocate ifnet structure\n"); + device_printf(dev, "couldn't allocate ifnet structure\n"); err = ENOMEM; break; } From owner-svn-src-all@freebsd.org Thu Jan 25 06:37:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 416BDEC3290; Thu, 25 Jan 2018 06:37:15 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E907B6E045; Thu, 25 Jan 2018 06:37:14 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3913F0C; Thu, 25 Jan 2018 06:37:14 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0P6bEZD047526; Thu, 25 Jan 2018 06:37:14 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P6bEEK047525; Thu, 25 Jan 2018 06:37:14 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201801250637.w0P6bEEK047525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 25 Jan 2018 06:37:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328390 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 328390 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 06:37:15 -0000 Author: lwhsu (ports committer) Date: Thu Jan 25 06:37:14 2018 New Revision: 328390 URL: https://svnweb.freebsd.org/changeset/base/328390 Log: Fix build for architectures where size_t is not unsigned long Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D14045 Modified: head/sys/kern/kern_malloc.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Thu Jan 25 05:48:42 2018 (r328389) +++ head/sys/kern/kern_malloc.c Thu Jan 25 06:37:14 2018 (r328390) @@ -453,7 +453,7 @@ contigfree(void *addr, unsigned long size, struct mall #ifdef MALLOC_DEBUG static int -malloc_dbg(caddr_t *vap, unsigned long *sizep, struct malloc_type *mtp, +malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_type *mtp, int flags) { #ifdef INVARIANTS From owner-svn-src-all@freebsd.org Thu Jan 25 07:19:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D27DEC5799; Thu, 25 Jan 2018 07:19:08 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D6A496F619; Thu, 25 Jan 2018 07:19:07 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA77D15C8; Thu, 25 Jan 2018 07:19:07 +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 w0P7J7QD067551; Thu, 25 Jan 2018 07:19:07 GMT (envelope-from pkelsey@FreeBSD.org) Received: (from pkelsey@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P7J73I067547; Thu, 25 Jan 2018 07:19:07 GMT (envelope-from pkelsey@FreeBSD.org) Message-Id: <201801250719.w0P7J73I067547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pkelsey set sender to pkelsey@FreeBSD.org using -f From: Patrick Kelsey Date: Thu, 25 Jan 2018 07:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328391 - in stable/11/sys: net sys X-SVN-Group: stable-11 X-SVN-Commit-Author: pkelsey X-SVN-Commit-Paths: in stable/11/sys: net sys X-SVN-Commit-Revision: 328391 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 07:19:08 -0000 Author: pkelsey Date: Thu Jan 25 07:19:07 2018 New Revision: 328391 URL: https://svnweb.freebsd.org/changeset/base/328391 Log: MFC of r316630, r316631, r316632, r316633, r316634 Fixed various typos. Modified: stable/11/sys/net/if_epair.c stable/11/sys/net/rtsock.c stable/11/sys/sys/event.h stable/11/sys/sys/mbuf.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_epair.c ============================================================================== --- stable/11/sys/net/if_epair.c Thu Jan 25 06:37:14 2018 (r328390) +++ stable/11/sys/net/if_epair.c Thu Jan 25 07:19:07 2018 (r328391) @@ -402,8 +402,8 @@ epair_start_locked(struct ifnet *ifp) return; /* - * We get patckets here from ether_output via if_handoff() - * and ned to put them into the input queue of the oifp + * We get packets here from ether_output via if_handoff() + * and need to put them into the input queue of the oifp * and call oifp->if_input() via netisr/epair_sintr(). */ oifp = sc->oifp; Modified: stable/11/sys/net/rtsock.c ============================================================================== --- stable/11/sys/net/rtsock.c Thu Jan 25 06:37:14 2018 (r328390) +++ stable/11/sys/net/rtsock.c Thu Jan 25 07:19:07 2018 (r328391) @@ -728,7 +728,7 @@ route_output(struct mbuf *m, struct socket *so, ...) if (info.rti_info[RTAX_NETMASK] == NULL && rtm->rtm_type == RTM_GET) { /* - * Provide logest prefix match for + * Provide longest prefix match for * address lookup (no mask). * 'route -n get addr' */ Modified: stable/11/sys/sys/event.h ============================================================================== --- stable/11/sys/sys/event.h Thu Jan 25 06:37:14 2018 (r328390) +++ stable/11/sys/sys/event.h Thu Jan 25 07:19:07 2018 (r328391) @@ -171,7 +171,7 @@ struct knlist { #define KNF_LISTLOCKED 0x0001 /* knlist is locked */ #define KNF_NOKQLOCK 0x0002 /* do not keep KQ_LOCK */ -#define KNOTE(list, hist, flags) knote(list, hist, flags) +#define KNOTE(list, hint, flags) knote(list, hint, flags) #define KNOTE_LOCKED(list, hint) knote(list, hint, KNF_LISTLOCKED) #define KNOTE_UNLOCKED(list, hint) knote(list, hint, 0) Modified: stable/11/sys/sys/mbuf.h ============================================================================== --- stable/11/sys/sys/mbuf.h Thu Jan 25 06:37:14 2018 (r328390) +++ stable/11/sys/sys/mbuf.h Thu Jan 25 07:19:07 2018 (r328391) @@ -472,7 +472,7 @@ void sf_ext_free_nocache(void *, void *); #define CSUM_L4_VALID 0x08000000 /* checksum is correct */ #define CSUM_L5_CALC 0x10000000 /* calculated layer 5 csum */ #define CSUM_L5_VALID 0x20000000 /* checksum is correct */ -#define CSUM_COALESED 0x40000000 /* contains merged segments */ +#define CSUM_COALESCED 0x40000000 /* contains merged segments */ /* * CSUM flag description for use with printf(9) %b identifier. @@ -483,7 +483,7 @@ void sf_ext_free_nocache(void *, void *); "\12CSUM_IP6_UDP\13CSUM_IP6_TCP\14CSUM_IP6_SCTP\15CSUM_IP6_TSO" \ "\16CSUM_IP6_ISCSI" \ "\31CSUM_L3_CALC\32CSUM_L3_VALID\33CSUM_L4_CALC\34CSUM_L4_VALID" \ - "\35CSUM_L5_CALC\36CSUM_L5_VALID\37CSUM_COALESED" + "\35CSUM_L5_CALC\36CSUM_L5_VALID\37CSUM_COALESCED" /* CSUM flags compatibility mappings. */ #define CSUM_IP_CHECKED CSUM_L3_CALC From owner-svn-src-all@freebsd.org Thu Jan 25 07:27:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09984EC5E0A; Thu, 25 Jan 2018 07:27:04 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B02766FAAC; Thu, 25 Jan 2018 07:27:03 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5A891755; Thu, 25 Jan 2018 07:27:03 +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 w0P7R3bu072231; Thu, 25 Jan 2018 07:27:03 GMT (envelope-from pkelsey@FreeBSD.org) Received: (from pkelsey@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P7R36D072230; Thu, 25 Jan 2018 07:27:03 GMT (envelope-from pkelsey@FreeBSD.org) Message-Id: <201801250727.w0P7R36D072230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pkelsey set sender to pkelsey@FreeBSD.org using -f From: Patrick Kelsey Date: Thu, 25 Jan 2018 07:27:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328392 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: pkelsey X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328392 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 07:27:04 -0000 Author: pkelsey Date: Thu Jan 25 07:27:03 2018 New Revision: 328392 URL: https://svnweb.freebsd.org/changeset/base/328392 Log: MFC of r305169: _taskqueue_start_threads() now fails if it doesn't actually start any threads. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D7701 Modified: stable/11/sys/kern/subr_taskqueue.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_taskqueue.c ============================================================================== --- stable/11/sys/kern/subr_taskqueue.c Thu Jan 25 07:19:07 2018 (r328391) +++ stable/11/sys/kern/subr_taskqueue.c Thu Jan 25 07:27:03 2018 (r328392) @@ -672,6 +672,11 @@ _taskqueue_start_threads(struct taskqueue **tqp, int c } else tq->tq_tcount++; } + if (tq->tq_tcount == 0) { + free(tq->tq_threads, M_TASKQUEUE); + tq->tq_threads = NULL; + return (ENOMEM); + } for (i = 0; i < count; i++) { if (tq->tq_threads[i] == NULL) continue; From owner-svn-src-all@freebsd.org Thu Jan 25 08:36:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C3A8EC9A7C; Thu, 25 Jan 2018 08:36:20 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C47B471E85; Thu, 25 Jan 2018 08:36:19 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF7C222F0; Thu, 25 Jan 2018 08:36:19 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0P8aJZj006909; Thu, 25 Jan 2018 08:36:19 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P8aJFu006908; Thu, 25 Jan 2018 08:36:19 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201801250836.w0P8aJFu006908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 25 Jan 2018 08:36:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328393 - head/sbin/fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sbin/fsck_ffs X-SVN-Commit-Revision: 328393 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 08:36:20 -0000 Author: lwhsu (ports committer) Date: Thu Jan 25 08:36:19 2018 New Revision: 328393 URL: https://svnweb.freebsd.org/changeset/base/328393 Log: Fix architectures where pointer and u_int have different sizes Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D14049 Modified: head/sbin/fsck_ffs/fsutil.c Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Thu Jan 25 07:27:03 2018 (r328392) +++ head/sbin/fsck_ffs/fsutil.c Thu Jan 25 08:36:19 2018 (r328393) @@ -368,8 +368,8 @@ flush(int fd, struct bufarea *bp) switch (bp->b_type) { case BT_SUPERBLK: if (bp != &sblk) - pfatal("BUFFER 0x%x DOES NOT MATCH SBLK 0x%x\n", - (u_int)bp, (u_int)&sblk); + pfatal("BUFFER %p DOES NOT MATCH SBLK %p\n", + bp, &sblk); blwrite(fd, bp->b_un.b_buf, bp->b_bno, bp->b_size); for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, j++) { From owner-svn-src-all@freebsd.org Thu Jan 25 12:13:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BBB4ED40E4; Thu, 25 Jan 2018 12:13:42 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A17D791DF; Thu, 25 Jan 2018 12:13:42 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 350144B99; Thu, 25 Jan 2018 12:13:42 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PCDg6j016307; Thu, 25 Jan 2018 12:13:42 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PCDgxg016306; Thu, 25 Jan 2018 12:13:42 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801251213.w0PCDgxg016306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Thu, 25 Jan 2018 12:13:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328394 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 328394 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 12:13:42 -0000 Author: wma Date: Thu Jan 25 12:13:41 2018 New Revision: 328394 URL: https://svnweb.freebsd.org/changeset/base/328394 Log: BPF: Switch to 32 bit compatible mode only when thread is 32 bit Sometimes 32 bit and 64 bit ioctls are represented by the same number. It causes unnecessary switch to 32 bit commpatible mode. This patch prevents switching when we are dealing with 64 bit executable. It fixes issue mentioned here Authored by: Patryk Duda Submitted by: Wojciech Macek Reviewed by: andrew, wma Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D14023 Modified: head/sys/net/bpf.c Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Thu Jan 25 08:36:19 2018 (r328393) +++ head/sys/net/bpf.c Thu Jan 25 12:13:41 2018 (r328394) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1321,9 +1322,11 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, i case BIOCGDLTLIST32: case BIOCGRTIMEOUT32: case BIOCSRTIMEOUT32: - BPFD_LOCK(d); - d->bd_compat32 = 1; - BPFD_UNLOCK(d); + if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) { + BPFD_LOCK(d); + d->bd_compat32 = 1; + BPFD_UNLOCK(d); + } } #endif From owner-svn-src-all@freebsd.org Thu Jan 25 13:40:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40916ED84FE; Thu, 25 Jan 2018 13:40:19 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 802167CBDF; Thu, 25 Jan 2018 13:40:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 16F981075AA; Fri, 26 Jan 2018 00:40:07 +1100 (AEDT) Date: Fri, 26 Jan 2018 00:40:06 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Conrad Meyer cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... In-Reply-To: Message-ID: <20180125220711.D1474@besplex.bde.org> References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=LKgWeNe9 c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=7Qk2ozbKAAAA:8 a=qPgHHyWhIoQxbf3nuOQA:9 a=O6sq6pYNmZX8X9nM:21 a=Q1ZkWQaXjLHd3DbK:21 a=CjuIK1q_8ugA:10 a=1lyxoWkJIXJV6VJUPhuM:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 13:40:19 -0000 On Wed, 24 Jan 2018, Conrad Meyer wrote: > On Wed, Jan 24, 2018 at 10:05 AM, Warner Losh wrote: > ... >> Let's start with his point about u_long vs size_t causing problems: >> >> void *malloc(unsigned long size, struct malloc_type *type, int flags) >> vs >> void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, >> >> Since size_t is long long on i386, for example, > > It is? Since when? __size_t is uint32_t on !__LP64__. I already correctly gave this detail and many more. size_t is indeed the same as u_long on __LP64__. This tends to prevent the compiler from noticing that the types are are logically different, but I notice. (clang's error messages for other errors indicate that it knows that a type typedefed as u_long is logically different from u_long, but it would be unreasonable for it to warn about mixing them.) size_t is not the same as u_long on __LP32__, but it has the same representation. Since it has higher rank, compilers can reasonably complain about mixing them, like at least gcc does for printing size_t with %lu format. This helps prevent writing code that will break (perhaps without the problem being detected at compile time) on arches where size_t and u_long don't have the same respresentation. I gave many more details about why the type mismatch doesn't break anything on any supported arches and what it might break on future arches. >> this can result in >> undetected overflows. Such inattention to detail makes me extremely uneasy >> about the rest of the code. > > A similar snarky comment can be made here about inattention to detail > when making criticisms. If __LP64__ is true, long long is the same > size as long anyway. I gave full attention to detail. > (malloc() should also use size_t.) That would be just churn. The newer UMA doesn't even use u_long. It uses plain int for sizes and counts in all its documented APIs. These are just "int size" and even "int align" for uma_zcreate() and "int nitems" for uma_zone_set_max(). UMA is fundamentally array-like, with zones consisting of an array of fairly small items. Since it is a kernel API, it doesn't have to be consistent with the C design error of using (unsigned) size_t for sizes and even non-sizes (counts) in malloc() and calloc(). All allocations are known to be tiny relative to INT32_MAX, at least for individual elements. (It is almost reasonable to have a single full zone of size much larger than INT32_MAX on arches with a 64-bit address space. But UMA depends on callers not asking for this, else it it has many overflows. Large item sizes are unlikely to occur, and insane nitems for uma_zone_set_max() is almost self-limiting: - uma_zone_set_max(zone, -1) calculates a negative page count, then overflows to large-unsigned on assignment. The result is not much different from starting with a large positive nitimes - uma_zone_set_max(zone, large) overflows to a smaller page and item count than requested. The nitems limit is mostly advisory (for future allocations), so this might not do anything worse than preventing future allocations. >> It's an important function, but it's so poorly implement we should try >> again. It is not safe nor wise to use it blindly, which was bde's larger >> point. > > Citation needed? Blind use is always unwise. Non-blind use involves looking at the caller to see if it needs to be more careful. This is only easy for callers that already have bounds checking. >> #define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 8 / 2)) >> static inline bool >> WOULD_OVERFLOW(size_t nmemb, size_t size) >> { >> >> return ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && >> nmemb > 0 && __SIZE_T_MAX / nmemb < size); >> } >> >> So if I pass in 1GB and 10, this will tell me it won't overflow because of >> size_t can handle 10GB, but u_long can't. > > This whole argument hinges upon incorrect assumption that size_t is > larger than u_long. That wasn't my argument. I said that the correctness of the code depends on the assumption that size_t has the same representation as u_long and more, and implicitly that it is too hard to show correctness even if you assume this and shows inattention to detail if you don't show correctness. Why not just write code that doesn't make assumptions? Well, this is not so easy with everything typedefed. It is easier with u_long only. Even u_long is MD. I forget if I pointed out the problem with converting the args before checking them. This is more serious than I relaized before. It gives the same security hole as blind truncation of the product: suppose that the args struct *uap has nmemb in an typedefed type that you shouldn't know. Bad code does: int *p; p = mallocarrary(uap->nmemb, sizeof(*p), ..., M_WAITOK); if (uap->nmemb > 1) p[uap->nmemb] = 1; If size_t is uint32_t and typeof(uap->nmemb) is uint64_t, then uap->nmemb can be 0x100000001 and the bad mallocarray() API truncates this to 1 before checking for overflow; then the allocation "succeeds" and allocates only 1 element; then the array access is beyond the end of the array even though the caller appears to check that it is within the array. malloc(3) and malloc(9)'s API have the same problem -- that they require the caller to pass the correct args -- but this is not bad since their reason for existence isn't just to be a wrapper that adds checking. Bruce From owner-svn-src-all@freebsd.org Thu Jan 25 13:51:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACAF9ED8E40; Thu, 25 Jan 2018 13:51:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A8BA7D420; Thu, 25 Jan 2018 13:51:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 557435A78; Thu, 25 Jan 2018 13:51:20 +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 w0PDpKGq065360; Thu, 25 Jan 2018 13:51:20 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PDpK3g065359; Thu, 25 Jan 2018 13:51:20 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801251351.w0PDpK3g065359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 25 Jan 2018 13:51:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328395 - head/share/man/man8 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man8 X-SVN-Commit-Revision: 328395 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 13:51:20 -0000 Author: emaste Date: Thu Jan 25 13:51:20 2018 New Revision: 328395 URL: https://svnweb.freebsd.org/changeset/base/328395 Log: Install uefi.8 also on arm64 Our standard boot method for arm64 is via UEFI, so install the man page that describes the boot process. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/share/man/man8/Makefile Modified: head/share/man/man8/Makefile ============================================================================== --- head/share/man/man8/Makefile Thu Jan 25 12:13:41 2018 (r328394) +++ head/share/man/man8/Makefile Thu Jan 25 13:51:20 2018 (r328395) @@ -34,7 +34,7 @@ MLINKS+=yp.8 NIS.8 \ yp.8 YP.8 .endif -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" _uefi.8= uefi.8 MLINKS+=uefi.8 efi.8 From owner-svn-src-all@freebsd.org Thu Jan 25 14:36:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C1DCEDBA19; Thu, 25 Jan 2018 14:36:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D41CD7F80C; Thu, 25 Jan 2018 14:36:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA8316260; Thu, 25 Jan 2018 14:36:47 +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 w0PEal3e088690; Thu, 25 Jan 2018 14:36:47 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PEaloU088689; Thu, 25 Jan 2018 14:36:47 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801251436.w0PEaloU088689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 25 Jan 2018 14:36:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328396 - head/share/man/man8 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man8 X-SVN-Commit-Revision: 328396 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 14:36:48 -0000 Author: emaste Date: Thu Jan 25 14:36:47 2018 New Revision: 328396 URL: https://svnweb.freebsd.org/changeset/base/328396 Log: uefi.8: describe architecture-specific default path Sponsored by: The FreeBSD Foundation Modified: head/share/man/man8/uefi.8 Modified: head/share/man/man8/uefi.8 ============================================================================== --- head/share/man/man8/uefi.8 Thu Jan 25 13:51:20 2018 (r328395) +++ head/share/man/man8/uefi.8 Thu Jan 25 14:36:47 2018 (r328396) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 24, 2018 +.Dd January 25, 2018 .Dt UEFI 8 .Os .Sh NAME @@ -65,16 +65,20 @@ boot process proceeds as follows: firmware runs at power up and searches for an OS loader in the EFI system partition. The path to the loader may be set by an EFI environment variable. -If not set, the default is -.Pa /EFI/BOOT/BOOTX64.EFI . +If not set, an architecture-specific default is used. +.Bl -column -offset indent "Architecture" "Default Path" +.It Sy Architecture Ta Sy Default Path +.It amd64 Ta Pa /EFI/BOOT/BOOTX64.EFI +.It arm64 Ta Pa /EFI/BOOT/BOOTAA64.EFI +.El +.Pp The default .Nm boot configuration for .Fx installs .Pa boot1.efi -as -.Pa /EFI/BOOT/BOOTX64.EFI . +in the default path. .It .Pa boot1.efi reads boot configuration from From owner-svn-src-all@freebsd.org Thu Jan 25 14:42:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17693EDC03B; Thu, 25 Jan 2018 14:42:53 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 86F1D7FE4C; Thu, 25 Jan 2018 14:42:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 762F0107648; Fri, 26 Jan 2018 01:42:46 +1100 (AEDT) Date: Fri, 26 Jan 2018 01:42:45 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Pedro F. Giffuni" cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328340 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs In-Reply-To: <201801241644.w0OGivto028334@repo.freebsd.org> Message-ID: <20180126010213.X1950@besplex.bde.org> References: <201801241644.w0OGivto028334@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=YbvN30Zf c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=3RMtp7UOCSDtmHLZNVwA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 14:42:53 -0000 On Wed, 24 Jan 2018, Pedro F. Giffuni wrote: > Log: > Revert r327781, r328093, r328056: > ufs|ext2fs: Revert uses of mallocarray(9). > > These aren't really useful: drop them. > Variable unsigning will be brought again later. Variable "unsigning" (that is, adding unsign extension bugs) is even more negatively useful than mallocarray(), so should not be brought back. Unsigning variables used _only_ for array sizes and element counts doesn't cause any new problems (and fixes warnings about converting from signed to unsigned when calling malloc*()), but it is a lot of work to check that they aren't used for other things where their signedness matters (perhaps differences or loops that count down to -1 instead of 0). Unsigned variables also break checking for overflow in expressions by compiling with -ftrapv. Bruce From owner-svn-src-all@freebsd.org Thu Jan 25 15:17:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7BC8EB4B91 for ; Thu, 25 Jan 2018 15:17:03 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic301-17.consmr.mail.bf2.yahoo.com (sonic301-17.consmr.mail.bf2.yahoo.com [74.6.129.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A03681578 for ; Thu, 25 Jan 2018 15:17:03 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1516893422; bh=A7msxxBQ2Pdp0CdENSufyNux3KTser5j51aAsjiYJAc=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=PqptV+0KsmWFn86FVtQ2/INGTKPXifpXoQAWD0imC31qkdLU6QCh9ujdToeFu99rIxa4UHFT5ENiwKPXIUd97UbBGRwyVKat6Je+lwB6Af4ztF+kMJ8J8OFz4/PmUGC9sGrqdZ9llct/XAjg4J6og9xe0ZjSVQdQtwXH8rvluzFMixn5ZP6aHKociecPhxokz6cQuQ1pxc6CTmIrL/EVumLWKG42DrST6DfC5vFLeRkaIVVYX+XhkgNGUijayRE6tydaTbtB+u6InZFjvQNbFjTMrgf7T5OrGkZNqg/6Zo5rIPbxI8xzsX4BrDPi0xUzAp+GckFKnM9vXFPyBrV4HQ== X-YMail-OSG: Ghb060UVM1lnI8aWioYj9QqXSMifMLQzLKFlYdXgPy.CK05Odh328bZZ78PE1Yq ffK2zE_fv0QRWfj0.i93lVsuq87iubgSablgnYMo0AckV10yjr8QV0.D5iVw2iBjFZxeLD7Czn88 .4mJWO4mtWGj.zS6ptcn1ZmzXFCswGsavZui4NAf4eP.iijWSIKRdAWqoVAprKJcsp4GYvk5INeV 6szTkoZDwVpGkjBcwyYP6COCMCPyEWwthFOlJd6J9uE7nUVR6drLtjh23u4.d8FVR9IEZD8oT7AL rESG2uc02Eg1rCXXol8fNdoQs1YeerJCnZnoaAAXYzrC6DDCuoVC_LFr7gS7i4lTanFPpsrrPGmw c3KmpBWzwHP9RbGuPShflnahI4bx5_yRu2MCTQNyU_xkwpcI7n8qxSj83DvNsE0nkw.DaZGX2ZIK lDpqKwJk.re2kAccGxvOZ0VBGkf0m35pUR3coDWTG58dcLiqo4qjWJhbN8H7ILVjN7gX3Q5ofa4M bl4z31Q9Ruw-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.bf2.yahoo.com with HTTP; Thu, 25 Jan 2018 15:17:02 +0000 Received: from smtpgate102.mail.bf1.yahoo.com (EHLO [192.168.0.8]) ([72.30.28.113]) by smtp401.mail.bf1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 40b9a20514444a8784246301e1b57aff; Thu, 25 Jan 2018 15:06:52 +0000 (UTC) Subject: Re: svn commit: r328340 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801241644.w0OGivto028334@repo.freebsd.org> <20180126010213.X1950@besplex.bde.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <71173c5c-4f3f-2228-7157-2d657ae46eea@FreeBSD.org> Date: Thu, 25 Jan 2018 10:06:52 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180126010213.X1950@besplex.bde.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 15:17:03 -0000 On 25/01/2018 09:42, Bruce Evans wrote: > On Wed, 24 Jan 2018, Pedro F. Giffuni wrote: > >> Log: >>  Revert r327781,  r328093, r328056: >>  ufs|ext2fs: Revert uses of mallocarray(9). >> >>  These aren't really useful: drop them. >>  Variable unsigning will be brought again later. > > Variable "unsigning" (that is, adding unsign extension bugs) is even more > negatively useful than mallocarray(), so should not be brought back. > Any specific case? I already brought those back in r328346. > Unsigning variables used _only_ for array sizes and element counts > doesn't > cause any new problems (and fixes warnings about converting from > signed to > unsigned when calling malloc*()), but it is a lot of work to check that > they aren't used for other things where their signedness matters (perhaps > differences or loops that count down to -1 instead of 0). > I did check and had mckusick crosscheck before, but as you say it is usually a lot of work and my have missed something. Pedro. From owner-svn-src-all@freebsd.org Thu Jan 25 15:28:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78D0DEB5A74; Thu, 25 Jan 2018 15:28:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E37C82118; Thu, 25 Jan 2018 15:28:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4936E6AB1; Thu, 25 Jan 2018 15:28:44 +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 w0PFSipQ013931; Thu, 25 Jan 2018 15:28:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PFSixU013929; Thu, 25 Jan 2018 15:28:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801251528.w0PFSixU013929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 25 Jan 2018 15:28: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: r328397 - in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 328397 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 15:28:44 -0000 Author: kib Date: Thu Jan 25 15:28:43 2018 New Revision: 328397 URL: https://svnweb.freebsd.org/changeset/base/328397 Log: MFC r327820: Remove redundand CLD instructions. Modified: stable/11/sys/amd64/amd64/support.S stable/11/sys/i386/i386/support.s Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/support.S ============================================================================== --- stable/11/sys/amd64/amd64/support.S Thu Jan 25 14:36:47 2018 (r328396) +++ stable/11/sys/amd64/amd64/support.S Thu Jan 25 15:28:43 2018 (r328397) @@ -50,7 +50,6 @@ ENTRY(bzero) movq %rsi,%rcx xorl %eax,%eax shrq $3,%rcx - cld rep stosq movq %rsi,%rcx @@ -76,7 +75,6 @@ ENTRY(bcmp) PUSH_FRAME_POINTER movq %rdx,%rcx shrq $3,%rcx - cld /* compare forwards */ repe cmpsq jne 1f @@ -108,7 +106,6 @@ ENTRY(bcopy) jb 1f shrq $3,%rcx /* copy by 64-bit words */ - cld /* nope, copy forwards */ rep movsq movq %rdx,%rcx @@ -147,7 +144,6 @@ ENTRY(memcpy) movq %rdi,%rax movq %rdx,%rcx shrq $3,%rcx /* copy by 64-bit words */ - cld /* copy forwards */ rep movsq movq %rdx,%rcx @@ -194,7 +190,6 @@ ENTRY(fillw) movq %rdi,%rax movq %rsi,%rdi movq %rdx,%rcx - cld rep stosw POP_FRAME_POINTER @@ -251,7 +246,6 @@ ENTRY(copyout) movq %rdx,%rcx shrq $3,%rcx - cld rep movsq movb %dl,%cl @@ -300,7 +294,6 @@ ENTRY(copyin) movq %rdx,%rcx movb %cl,%al shrq $3,%rcx /* copy longword-wise */ - cld rep movsq movb %al,%cl @@ -597,7 +590,6 @@ ENTRY(copyinstr) movq %rax,%r8 1: incq %rdx - cld 2: decq %rdx @@ -648,7 +640,6 @@ ENTRY(copystr) xchgq %rdi,%rsi incq %rdx - cld 1: decq %rdx jz 4f Modified: stable/11/sys/i386/i386/support.s ============================================================================== --- stable/11/sys/i386/i386/support.s Thu Jan 25 14:36:47 2018 (r328396) +++ stable/11/sys/i386/i386/support.s Thu Jan 25 15:28:43 2018 (r328397) @@ -50,7 +50,6 @@ ENTRY(bzero) movl 12(%esp),%ecx xorl %eax,%eax shrl $2,%ecx - cld rep stosl movl 12(%esp),%ecx @@ -83,7 +82,6 @@ ENTRY(i686_pagezero) movl 12(%esp),%edi movl $1024,%ecx - cld ALIGN_TEXT 1: @@ -134,7 +132,6 @@ ENTRY(fillw) movl 8(%esp),%eax movl 12(%esp),%edi movl 16(%esp),%ecx - cld rep stosw popl %edi @@ -151,7 +148,6 @@ ENTRY(bcopyb) subl %esi,%eax cmpl %ecx,%eax /* overlapping && src < dst? */ jb 1f - cld /* nope, copy forwards */ rep movsb popl %edi @@ -192,7 +188,6 @@ ENTRY(bcopy) jb 1f shrl $2,%ecx /* copy by 32-bit words */ - cld /* nope, copy forwards */ rep movsl movl 16(%ebp),%ecx @@ -238,7 +233,6 @@ ENTRY(memcpy) movl 20(%esp),%ecx movl %edi,%eax shrl $2,%ecx /* copy by 32-bit words */ - cld /* nope, copy forwards */ rep movsl movl 20(%esp),%ecx @@ -308,7 +302,6 @@ ENTRY(copyout) movl %ebx,%ecx shrl $2,%ecx - cld rep movsl movb %bl,%cl @@ -359,7 +352,6 @@ ENTRY(copyin) movb %cl,%al shrl $2,%ecx /* copy longword-wise */ - cld rep movsl movb %al,%cl @@ -576,7 +568,6 @@ ENTRY(copyinstr) movl %eax,20(%esp) 1: incl %edx - cld 2: decl %edx @@ -629,7 +620,6 @@ ENTRY(copystr) movl 16(%esp),%edi /* %edi = to */ movl 20(%esp),%edx /* %edx = maxlen */ incl %edx - cld 1: decl %edx jz 4f @@ -669,7 +659,6 @@ ENTRY(bcmp) movl %edx,%ecx shrl $2,%ecx - cld /* compare forwards */ repe cmpsl jne 1f From owner-svn-src-all@freebsd.org Thu Jan 25 15:31:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 069DDEB5EFE; Thu, 25 Jan 2018 15:31:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AFCD58248F; Thu, 25 Jan 2018 15:31:56 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AABC36B20; Thu, 25 Jan 2018 15:31:56 +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 w0PFVuqK014113; Thu, 25 Jan 2018 15:31:56 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PFVu8f014112; Thu, 25 Jan 2018 15:31:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801251531.w0PFVu8f014112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 25 Jan 2018 15:31:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328398 - head/cddl/lib/libdtrace X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/lib/libdtrace X-SVN-Commit-Revision: 328398 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 15:31:57 -0000 Author: markj Date: Thu Jan 25 15:31:56 2018 New Revision: 328398 URL: https://svnweb.freebsd.org/changeset/base/328398 Log: Remove uneeded parentheses. MFC after: 1 week Modified: head/cddl/lib/libdtrace/tcp.d Modified: head/cddl/lib/libdtrace/tcp.d ============================================================================== --- head/cddl/lib/libdtrace/tcp.d Thu Jan 25 15:28:43 2018 (r328397) +++ head/cddl/lib/libdtrace/tcp.d Thu Jan 25 15:31:56 2018 (r328398) @@ -260,7 +260,7 @@ translator tcpinfoh_t < struct tcphdr *p > { tcp_ack = p == NULL ? -1 : p->th_ack; tcp_offset = p == NULL ? -1 : (p->th_off >> 2); tcp_flags = p == NULL ? 0 : p->th_flags; - tcp_window = p == NULL ? 0 : (p->th_win); + tcp_window = p == NULL ? 0 : p->th_win; tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum); tcp_urgent = p == NULL ? 0 : p->th_urp; tcp_hdr = (struct tcphdr *)p; From owner-svn-src-all@freebsd.org Thu Jan 25 15:35:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0A45EB61EA; Thu, 25 Jan 2018 15:35:34 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 75C3C82844; Thu, 25 Jan 2018 15:35:34 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B1796C42; Thu, 25 Jan 2018 15:35:34 +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 w0PFZYVl018816; Thu, 25 Jan 2018 15:35:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PFZYsm018815; Thu, 25 Jan 2018 15:35:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801251535.w0PFZYsm018815@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 25 Jan 2018 15:35:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328399 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 328399 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 15:35:35 -0000 Author: markj Date: Thu Jan 25 15:35:34 2018 New Revision: 328399 URL: https://svnweb.freebsd.org/changeset/base/328399 Log: Use tcpinfoh_t for TCP headers in the tcp:::debug-{drop,input} probes. The header passed to these probes has some fields converted to host order by tcp_fields_to_host(), so the tcpinfo_t translator doesn't do what we want. Submitted by: Hannes Mehnert MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D12647 Modified: head/sys/netinet/in_kdtrace.c Modified: head/sys/netinet/in_kdtrace.c ============================================================================== --- head/sys/netinet/in_kdtrace.c Thu Jan 25 15:31:56 2018 (r328398) +++ head/sys/netinet/in_kdtrace.c Thu Jan 25 15:35:34 2018 (r328399) @@ -109,7 +109,7 @@ SDT_PROBE_DEFINE1_XLATE(tcp, , , siftr, SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__input, "struct tcpcb *", "tcpsinfo_t *" , - "struct tcphdr *", "tcpinfo_t *", + "struct tcphdr *", "tcpinfoh_t *", "uint8_t *", "ipinfo_t *"); SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__output, @@ -123,7 +123,7 @@ SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__user, SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__drop, "struct tcpcb *", "tcpsinfo_t *" , - "struct tcphdr *", "tcpinfo_t *", + "struct tcphdr *", "tcpinfoh_t *", "struct mbuf *", "ipinfo_t *"); SDT_PROBE_DEFINE6_XLATE(tcp, , , state__change, From owner-svn-src-all@freebsd.org Thu Jan 25 15:42:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D44DEB687F; Thu, 25 Jan 2018 15:42:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B34A082F16; Thu, 25 Jan 2018 15:42:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE5796DD4; Thu, 25 Jan 2018 15:42:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PFgLCT022751; Thu, 25 Jan 2018 15:42:21 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PFgLio022750; Thu, 25 Jan 2018 15:42:21 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801251542.w0PFgLio022750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 25 Jan 2018 15:42:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328400 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 328400 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 15:42:22 -0000 Author: imp Date: Thu Jan 25 15:42:21 2018 New Revision: 328400 URL: https://svnweb.freebsd.org/changeset/base/328400 Log: Add info about c99 designationed initializers. Differential Revision: https://reviews.freebsd.org/D13975 Modified: head/share/man/man9/style.9 Modified: head/share/man/man9/style.9 ============================================================================== --- head/share/man/man9/style.9 Thu Jan 25 15:35:34 2018 (r328399) +++ head/share/man/man9/style.9 Thu Jan 25 15:42:21 2018 (r328400) @@ -324,6 +324,10 @@ Userspace code should include while kernel code should include .In sys/types.h . .Pp +Likewise, the project is moving to using the +.St -isoC-99 +designated initializers when it makes sense to do so. +.Pp Enumeration values are all uppercase. .Bd -literal enum enumtype { ONE, TWO } et; From owner-svn-src-all@freebsd.org Thu Jan 25 15:55:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3610EEB798B; Thu, 25 Jan 2018 15:55:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A9B483C63; Thu, 25 Jan 2018 15:55:58 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74FD06FB2; Thu, 25 Jan 2018 15:55:58 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PFtwgg028858; Thu, 25 Jan 2018 15:55:58 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PFtwmA028857; Thu, 25 Jan 2018 15:55:58 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801251555.w0PFtwmA028857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 25 Jan 2018 15:55:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328401 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 328401 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 15:55:59 -0000 Author: imp Date: Thu Jan 25 15:55:58 2018 New Revision: 328401 URL: https://svnweb.freebsd.org/changeset/base/328401 Log: Bump .Dd date for c99 change Modified: head/share/man/man9/style.9 Modified: head/share/man/man9/style.9 ============================================================================== --- head/share/man/man9/style.9 Thu Jan 25 15:42:21 2018 (r328400) +++ head/share/man/man9/style.9 Thu Jan 25 15:55:58 2018 (r328401) @@ -26,7 +26,7 @@ .\" From: @(#)style 1.14 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd January 18, 2018 +.Dd January 25, 2018 .Dt STYLE 9 .Os .Sh NAME From owner-svn-src-all@freebsd.org Thu Jan 25 16:28:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD323EBD55F; Thu, 25 Jan 2018 16:28:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 1B7A48503B; Thu, 25 Jan 2018 16:28:30 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id A400FD4D196; Fri, 26 Jan 2018 03:28:22 +1100 (AEDT) Date: Fri, 26 Jan 2018 03:28:22 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Pedro F. Giffuni" cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs In-Reply-To: <201801241758.w0OHwm26063524@repo.freebsd.org> Message-ID: <20180126020540.B2181@besplex.bde.org> References: <201801241758.w0OHwm26063524@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=DIX/22Fb c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=rN32wYyCiFP0na-g1XEA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 16:28:32 -0000 On Wed, 24 Jan 2018, Pedro F. Giffuni wrote: > Log: > ext2fs|ufs:Unsign some values related to allocation. > > When allocating memory through malloc(9), we always expect the amount of > memory requested to be unsigned as a negative value would either stand for > an error or an overflow. > Unsign some values, found when considering the use of mallocarray(9), to > avoid unnecessary casting. Also consider that indexes should be of > at least the same size/type as the upper limit they pretend to index. This might not break much, but it adds many more type errors and bogus (implicit) casts than it fixes. It actually changes the brokenness of the first variable touched: > Modified: head/sys/fs/ext2fs/ext2_lookup.c > ============================================================================== > --- head/sys/fs/ext2fs/ext2_lookup.c Wed Jan 24 17:52:06 2018 (r328345) > +++ head/sys/fs/ext2fs/ext2_lookup.c Wed Jan 24 17:58:48 2018 (r328346) > @@ -145,9 +145,9 @@ ext2_readdir(struct vop_readdir_args *ap) > off_t offset, startoffset; > size_t readcnt, skipcnt; > ssize_t startresid; > - int ncookies; > int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; > int error; > + u_int ncookies; The first bug is only a style bug (unsorting the u_int after the ints even when its variable was accidentally already before the ints. > > if (uio->uio_offset < 0) > return (EINVAL); That is the only change in this file. No comment on other changes. ncookies is mostly used in contexts other than for multiplying by it before calling malloc(), and its type is now inconsistent with most other places. The other places are: X ncookies = uio->uio_resid; This has a more serious type error and consequent overflow bugs. uio_resid used to have type int, and cookies had to have type int to match that, else there overflow occurs before the bounds checks. Now uio_resid has type ssize_t, which is excessively large on 64-bit arches (64 bits then), so the assignment overflowed when ncookies had type int and uio_resid > INT_MAX. Now it overflows differently when uio_resid > UINT_MAX, and unsign extension causes overflow when uio_resid < 0. There might be a sanity check on uio_resid at higher levels, but I can only find a check related to EOF in vfs_read_dirent(). Next, we do some bounds checking which seems to be correct modulo previous overflows, and show the care needed for unsigned variables (i_size is unsigned and must be compared with uio_offset which is signed). Next, we assign ncookies, to ap_ncookies which still has the correct type (plain signed int). If ncookies were actually large enough to need a u_int, or worse a 64-bit ssize_t, then this would overflow. Later, we KASSERT() that ncookies > 0. This might cause a compiler warning "unsigned comparison with 0" now that ncookies is unsigned. We count down ncookies, but the loop termination condition is complicated and we don't get any benefits from the possible micro-optimization of using ncookies as a loop counter that counts down to 0. To fix the problem that mallocarray() wanted a size_t arg, ncookies could be cast to size_t, but that would be silly. The prototype does the same cast automatically even for cases with sign mismatches. Now malloc() wants a type of size_t (after further breakage to change malloc()s arg type). Many conversions are still involved, and casting would at most limit compiler warnings: the code is now: X malloc(ncookies * sizeof(*cookies), ...) First, ncookies and sizeof(...) are promoted to a common type. When ncookies was int, usually it was promoted to size_t and sizeof(...) was not promoted. But on exotic arches with size_t smaller than int, sizeof(...) is promoted to int and ncookies is not promoted. Next, the type of the result of the multiplication is the common type. Finally, the prototype used to convert to u_long, but now converts to size_t. When the common type is size_t, then the conversion is now null. When the common type was int, the conversion was promotion to u_long, but it is now demotion to size_t. All this only obviously works in practice because all the variables and the product are small, so they are smaller than all of INT_MAX, SIZE_MAX and ULONG_MAX on all supported and unsupported arches. However, it is hard to write bounds checks that obviously handle all cases, except by using simple small bounds on the variables. It is now obvious that the bounds checking is broken for general use. There is no obvious limit on the malloc() except the file size. However, I think cookies are only used by nfs, so this is not a user-serving bug. nfs just has to limit its cookie size. It seems to use a limit of something like NFS_SRVMAXIO (128K). This also makes the overflow from the ssize_t type error unreachable. Note that it So all of this actually works very unobviously in practice. The sizes are only small because nfs is the only (?) caller and it never asks for large sizes. ffs has almost the same code, so has the same fragility. This fragility goes back to at least FreeBSD-3, but for ffs it was only in the big-endian case then (this is the case which always had to copy and convert the on-disk layout). This changed relatively recently, because the ffs on-disk layout only matches struct dirent for 32-bit ino_t. Bruce From owner-svn-src-all@freebsd.org Thu Jan 25 16:52:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0E20EBEBC5; Thu, 25 Jan 2018 16:52:02 +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 0EB9986202; Thu, 25 Jan 2018 16:52:01 +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 w0PGprK8000744; Thu, 25 Jan 2018 08:51:53 -0800 (PST) (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 w0PGpqrF000743; Thu, 25 Jan 2018 08:51:52 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801251651.w0PGpqrF000743@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r328388 - head/share/man/man8 In-Reply-To: <201801250515.w0P5FiLk008095@repo.freebsd.org> To: Li-Wen Hsu Date: Thu, 25 Jan 2018 08:51:52 -0800 (PST) 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.25 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: Thu, 25 Jan 2018 16:52:02 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: lwhsu (ports committer) > Date: Thu Jan 25 05:15:44 2018 > New Revision: 328388 > URL: https://svnweb.freebsd.org/changeset/base/328388 > > Log: > Fix manual page install on non-amd64 > > Reviewed by: emaste, imp > Differential Revision: https://reviews.freebsd.org/D14038 Um, small technical nit, *efi is not amd64 only. There is a 32 bit efi spec that can apply to i386, and there is also arm using efi. Let me quote the wiki(sic): Processor compatibility As of version 2.5, processor bindings exist for Itanium, x86, x86-64, ARM (AArch32) and ARM64 (AArch64).[14] Only little-endian processors can be supported.[15] Unofficial UEFI support is under development for POWERPC64 by implementing TianoCore on top of OPAL,[16] the OpenPOWER abstraction layer, running in little-endian mode.[17] Similar projects exist for MIPS[18] and RISC-V.[19]. As of UEFI 2.7, RISC-V processor bindings have been officially established for 32, 64 and 128-bit modes.[20] I had already pointed out on the commit list that Ed's r328378 was in error in that it mangled the NIS/yp links with the *efi links within minutes of the commit happening, kinda confused why this had to go to a differential to fix what was a rather trivial man link error. > Modified: > head/share/man/man8/Makefile > > Modified: head/share/man/man8/Makefile > ============================================================================== > --- head/share/man/man8/Makefile Thu Jan 25 02:52:44 2018 (r328387) > +++ head/share/man/man8/Makefile Thu Jan 25 05:15:44 2018 (r328388) > @@ -29,14 +29,15 @@ MLINKS= \ > .if ${MK_NIS} != "no" > MAN+= yp.8 > > -MLINKS+=uefi.8 efi.8 \ > - yp.8 NIS.8 \ > +MLINKS+=yp.8 NIS.8 \ > yp.8 nis.8 \ > yp.8 YP.8 > .endif > > .if ${MACHINE_CPUARCH} == "amd64" > _uefi.8= uefi.8 > + > +MLINKS+=uefi.8 efi.8 > .endif > > .include > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Thu Jan 25 16:58:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9B56EBF362; Thu, 25 Jan 2018 16:58:23 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9650D86739; Thu, 25 Jan 2018 16:58:23 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90EA979BC; Thu, 25 Jan 2018 16:58:23 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PGwNlp058493; Thu, 25 Jan 2018 16:58:23 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PGwNcq058492; Thu, 25 Jan 2018 16:58:23 GMT (envelope-from br@FreeBSD.org) Message-Id: <201801251658.w0PGwNcq058492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 25 Jan 2018 16:58:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328402 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 328402 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 16:58:24 -0000 Author: br Date: Thu Jan 25 16:58:23 2018 New Revision: 328402 URL: https://svnweb.freebsd.org/changeset/base/328402 Log: Add basic driver for Qualcomm USB 2.0 EHCI controller. This driver relies on system initialization in u-boot. Tested on DragonBoard 410c. Sponsored by: DARPA, AFRL Added: head/sys/dev/usb/controller/ehci_msm.c (contents, props changed) Added: head/sys/dev/usb/controller/ehci_msm.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/controller/ehci_msm.c Thu Jan 25 16:58:23 2018 (r328402) @@ -0,0 +1,231 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_bus.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +struct ehci_msm_softc { + ehci_softc_t base; + struct resource *res[3]; +}; + +static struct resource_spec ehci_msm_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_MEMORY, 1, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { -1, 0 } +}; + +#define EHCI_HC_DEVSTR "Qualcomm USB 2.0 controller" + +static device_attach_t ehci_msm_attach; +static device_detach_t ehci_msm_detach; + +static int +ehci_msm_probe(device_t dev) +{ + + if (!ofw_bus_is_compatible(dev, "qcom,ci-hdrc")) + return (ENXIO); + + device_set_desc(dev, EHCI_HC_DEVSTR); + + return (BUS_PROBE_DEFAULT); +} + +static int +ehci_msm_attach(device_t dev) +{ + struct ehci_msm_softc *esc; + bus_space_handle_t bsh; + ehci_softc_t *sc; + int err; + + esc = device_get_softc(dev); + sc = &esc->base; + sc->sc_bus.parent = dev; + sc->sc_bus.devices = sc->sc_devices; + sc->sc_bus.devices_max = EHCI_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; + + if (bus_alloc_resources(dev, ehci_msm_spec, esc->res)) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + + sc->sc_io_tag = rman_get_bustag(esc->res[0]); + + /* Get all DMA memory */ + if (usb_bus_mem_alloc_all(&sc->sc_bus, + USB_GET_DMA_TAG(dev), &ehci_iterate_hw_softc)) { + return (ENOMEM); + } + + /* EHCI registers */ + sc->sc_io_tag = rman_get_bustag(esc->res[0]); + bsh = rman_get_bushandle(esc->res[0]); + sc->sc_io_size = rman_get_size(esc->res[0]); + + if (bus_space_subregion(sc->sc_io_tag, bsh, 0x100, + sc->sc_io_size, &sc->sc_io_hdl) != 0) + panic("%s: unable to subregion USB host registers", + device_get_name(dev)); + + sc->sc_bus.bdev = device_add_child(dev, "usbus", -1); + if (!sc->sc_bus.bdev) { + device_printf(dev, "Could not add USB device\n"); + goto error; + } + device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus); + device_set_desc(sc->sc_bus.bdev, EHCI_HC_DEVSTR); + + sprintf(sc->sc_vendor, "Qualcomm"); + + err = bus_setup_intr(dev, esc->res[2], INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl); + if (err) { + device_printf(dev, "Could not setup irq, %d\n", err); + sc->sc_intr_hdl = NULL; + goto error; + } + + sc->sc_flags |= EHCI_SCFLG_DONTRESET | EHCI_SCFLG_NORESTERM; + + err = ehci_init(sc); + if (!err) { + sc->sc_flags |= EHCI_SCFLG_DONEINIT; + err = device_probe_and_attach(sc->sc_bus.bdev); + } + + if (err) { + device_printf(dev, "USB init failed err=%d\n", err); + goto error; + } + return (0); + +error: + ehci_msm_detach(dev); + return (ENXIO); +} + +static int +ehci_msm_detach(device_t dev) +{ + ehci_softc_t *sc; + device_t bdev; + int err; + + sc = device_get_softc(dev); + + if (sc->sc_bus.bdev) { + bdev = sc->sc_bus.bdev; + device_detach(bdev); + device_delete_child(dev, bdev); + } + + device_delete_children(dev); + + if (sc->sc_irq_res && sc->sc_intr_hdl) { + /* only call ehci_detach() after ehci_init() */ + ehci_detach(sc); + + err = bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intr_hdl); + if (err) + device_printf(dev, "Could not tear down irq, %d\n", + err); + sc->sc_intr_hdl = NULL; + } + + if (sc->sc_irq_res) { + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); + sc->sc_irq_res = NULL; + } + if (sc->sc_io_res) { + bus_release_resource(dev, SYS_RES_MEMORY, 0, + sc->sc_io_res); + sc->sc_io_res = NULL; + } + + usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc); + + return (0); +} + + +static device_method_t ehci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ehci_msm_probe), + DEVMETHOD(device_attach, ehci_msm_attach), + DEVMETHOD(device_detach, ehci_msm_detach), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD_END +}; + +static driver_t ehci_driver = { + .name = "ehci", + .methods = ehci_methods, + .size = sizeof(ehci_softc_t), +}; + +static devclass_t ehci_devclass; + +DRIVER_MODULE(ehci_msm, simplebus, ehci_driver, ehci_devclass, 0, 0); +MODULE_DEPEND(ehci_msm, usb, 1, 1, 1); From owner-svn-src-all@freebsd.org Thu Jan 25 17:00:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22FFDEBF602; Thu, 25 Jan 2018 17:00:36 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA8DF8697E; Thu, 25 Jan 2018 17:00:35 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C553579C9; Thu, 25 Jan 2018 17:00:35 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PH0ZE8059439; Thu, 25 Jan 2018 17:00:35 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PH0Zvp059438; Thu, 25 Jan 2018 17:00:35 GMT (envelope-from br@FreeBSD.org) Message-Id: <201801251700.w0PH0Zvp059438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 25 Jan 2018 17:00:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328403 - head/sys/dev/sdhci X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/dev/sdhci X-SVN-Commit-Revision: 328403 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 17:00:36 -0000 Author: br Date: Thu Jan 25 17:00:35 2018 New Revision: 328403 URL: https://svnweb.freebsd.org/changeset/base/328403 Log: Add support for SDHCI controller found in Qualcomm Snapdragon 410e. Tested on DragonBoard 410c. Sponsored by: DARPA, AFRL Modified: head/sys/dev/sdhci/sdhci_fdt.c Modified: head/sys/dev/sdhci/sdhci_fdt.c ============================================================================== --- head/sys/dev/sdhci/sdhci_fdt.c Thu Jan 25 16:58:23 2018 (r328402) +++ head/sys/dev/sdhci/sdhci_fdt.c Thu Jan 25 17:00:35 2018 (r328403) @@ -63,10 +63,12 @@ __FBSDID("$FreeBSD$"); #define SDHCI_FDT_ARMADA38X 1 #define SDHCI_FDT_GENERIC 2 #define SDHCI_FDT_XLNX_ZY7 3 +#define SDHCI_FDT_QUALCOMM 4 static struct ofw_compat_data compat_data[] = { { "marvell,armada-380-sdhci", SDHCI_FDT_ARMADA38X }, { "sdhci_generic", SDHCI_FDT_GENERIC }, + { "qcom,sdhci-msm-v4", SDHCI_FDT_QUALCOMM }, { "xlnx,zy7_sdhci", SDHCI_FDT_XLNX_ZY7 }, { NULL, 0 } }; @@ -200,6 +202,10 @@ sdhci_fdt_probe(device_t dev) break; case SDHCI_FDT_GENERIC: device_set_desc(dev, "generic fdt SDHCI controller"); + break; + case SDHCI_FDT_QUALCOMM: + sc->quirks = SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE; + device_set_desc(dev, "Qualcomm FDT SDHCI controller"); break; case SDHCI_FDT_XLNX_ZY7: sc->quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK; From owner-svn-src-all@freebsd.org Thu Jan 25 17:12:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F31EAEC048D; Thu, 25 Jan 2018 17:12:14 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 276D887318; Thu, 25 Jan 2018 17:12:13 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id bd67b106; Thu, 25 Jan 2018 18:12:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=xsV6nb+C+4laqIn0pA/FDtOulbE=; b=dK7BhFM4L99ZrnacT0GMfnU0wSoy AT0Gr0bHOHVbEatrMkk7ckbmjKmATvtUYDaJltchqNmgmSiuTJ5DxZcwVxrQA+Ut n6LwUs9bRQGNsMCtoo6yLacaQiklmqbBqnh1gjLnbE+WbbLeDrkgaB/4v9rXpH+i c0Z3GaPumeZOf4o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=iWuJ1Wot6c8jvvwsHsfNLrlbRSXyXzllYk5TJr0wWCC3+MCZWcxxU+n+ Vpi9ErQv/FwJm8el1CUjcuhDF42lpG8WQwBcNF+Z+sJo5XjZzvAV/gRhDIEaCpBs Uw3SdkLF2QYmzNbZrbLIyJwcXgh/kMzKuKP1zIAYpBa25uzHyzM= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id ee17cc5c TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Thu, 25 Jan 2018 18:12:05 +0100 (CET) Date: Thu, 25 Jan 2018 18:12:04 +0100 From: Emmanuel Vadot To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328402 - head/sys/dev/usb/controller Message-Id: <20180125181204.bb006fbb3a9bcd4acb4236af@bidouilliste.com> In-Reply-To: <201801251658.w0PGwNcq058492@repo.freebsd.org> References: <201801251658.w0PGwNcq058492@repo.freebsd.org> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 17:12:15 -0000 Hi Ruslan, On Thu, 25 Jan 2018 16:58:23 +0000 (UTC) Ruslan Bukin wrote: > Author: br > Date: Thu Jan 25 16:58:23 2018 > New Revision: 328402 > URL: https://svnweb.freebsd.org/changeset/base/328402 > > Log: > Add basic driver for Qualcomm USB 2.0 EHCI controller. > This driver relies on system initialization in u-boot. > > Tested on DragonBoard 410c. > > Sponsored by: DARPA, AFRL > > Added: > head/sys/dev/usb/controller/ehci_msm.c (contents, props changed) > The code looks like the generic-ehci, would it be better to subclass generic-ehci to fdt and add qualcomm quirks if necessary ? Cheers, -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Thu Jan 25 17:16:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C593BEC082A; Thu, 25 Jan 2018 17:16:30 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 776FC875DA; Thu, 25 Jan 2018 17:16:30 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 725997D1F; Thu, 25 Jan 2018 17:16:30 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PHGUEh068395; Thu, 25 Jan 2018 17:16:30 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PHGULh068392; Thu, 25 Jan 2018 17:16:30 GMT (envelope-from br@FreeBSD.org) Message-Id: <201801251716.w0PHGULh068392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 25 Jan 2018 17:16:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328404 - in head/sys: arm/mv/armada38x arm/xilinx conf X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: arm/mv/armada38x arm/xilinx conf X-SVN-Commit-Revision: 328404 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 17:16:31 -0000 Author: br Date: Thu Jan 25 17:16:29 2018 New Revision: 328404 URL: https://svnweb.freebsd.org/changeset/base/328404 Log: o Move sdhci_fdt to the generic files list. o Include Qualcomm EHCI and UART drivers to the build. Sponsored by: DARPA, AFRL Modified: head/sys/arm/mv/armada38x/files.armada38x head/sys/arm/xilinx/files.zynq7 head/sys/conf/files Modified: head/sys/arm/mv/armada38x/files.armada38x ============================================================================== --- head/sys/arm/mv/armada38x/files.armada38x Thu Jan 25 17:00:35 2018 (r328403) +++ head/sys/arm/mv/armada38x/files.armada38x Thu Jan 25 17:16:29 2018 (r328404) @@ -9,4 +9,3 @@ arm/mv/armada38x/armada38x_mp.c optional smp arm/mv/armada38x/pmsu.c standard arm/mv/armada38x/armada38x_rtc.c optional mv_rtc fdt arm/mv/armada38x/armada38x_pl310.c optional pl310 -dev/sdhci/sdhci_fdt.c optional sdhci Modified: head/sys/arm/xilinx/files.zynq7 ============================================================================== --- head/sys/arm/xilinx/files.zynq7 Thu Jan 25 17:00:35 2018 (r328403) +++ head/sys/arm/xilinx/files.zynq7 Thu Jan 25 17:16:29 2018 (r328404) @@ -12,7 +12,6 @@ arm/xilinx/zy7_devcfg.c standard arm/xilinx/zy7_mp.c optional smp dev/cadence/if_cgem.c optional cgem -dev/sdhci/sdhci_fdt.c optional sdhci arm/xilinx/zy7_ehci.c optional ehci arm/xilinx/uart_dev_cdnc.c optional uart arm/xilinx/zy7_gpio.c optional gpio Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Jan 25 17:00:35 2018 (r328403) +++ head/sys/conf/files Thu Jan 25 17:16:29 2018 (r328404) @@ -3013,6 +3013,7 @@ dev/scc/scc_dev_quicc.c optional scc quicc dev/scc/scc_dev_sab82532.c optional scc dev/scc/scc_dev_z8530.c optional scc dev/sdhci/sdhci.c optional sdhci +dev/sdhci/sdhci_fdt.c optional sdhci fdt dev/sdhci/sdhci_fdt_gpio.c optional sdhci fdt gpio dev/sdhci/sdhci_if.m optional sdhci dev/sdhci/sdhci_acpi.c optional sdhci acpi @@ -3182,6 +3183,7 @@ dev/uart/uart_bus_puc.c optional uart puc dev/uart/uart_bus_scc.c optional uart scc dev/uart/uart_core.c optional uart dev/uart/uart_dbg.c optional uart gdb +dev/uart/uart_dev_msm.c optional uart uart_msm fdt dev/uart/uart_dev_mvebu.c optional uart uart_mvebu dev/uart/uart_dev_ns8250.c optional uart uart_ns8250 | uart uart_snps dev/uart/uart_dev_pl011.c optional uart pl011 @@ -3205,6 +3207,7 @@ dev/usb/controller/musb_otg_atmelarm.c optional musb a dev/usb/controller/dwc_otg.c optional dwcotg dev/usb/controller/dwc_otg_fdt.c optional dwcotg fdt dev/usb/controller/ehci.c optional ehci +dev/usb/controller/ehci_msm.c optional ehci_msm fdt dev/usb/controller/ehci_pci.c optional ehci pci dev/usb/controller/ohci.c optional ohci dev/usb/controller/ohci_pci.c optional ohci pci From owner-svn-src-all@freebsd.org Thu Jan 25 17:23:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B1A2EC0EF1; Thu, 25 Jan 2018 17:23:02 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-30.csi.cam.ac.uk (ppsw-30.csi.cam.ac.uk [131.111.8.130]) (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 9E24787B92; Thu, 25 Jan 2018 17:23:01 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:20582) by ppsw-30.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1eelEk-000Tbh-cu (Exim 4.90) (return-path ); Thu, 25 Jan 2018 17:22:54 +0000 Date: Thu, 25 Jan 2018 17:14:52 +0000 From: Ruslan Bukin To: Emmanuel Vadot Cc: Ruslan Bukin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328402 - head/sys/dev/usb/controller Message-ID: <20180125171452.GA61523@bsdpad.com> References: <201801251658.w0PGwNcq058492@repo.freebsd.org> <20180125181204.bb006fbb3a9bcd4acb4236af@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180125181204.bb006fbb3a9bcd4acb4236af@bidouilliste.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 17:23:02 -0000 On Thu, Jan 25, 2018 at 06:12:04PM +0100, Emmanuel Vadot wrote: > > Log: > > Add basic driver for Qualcomm USB 2.0 EHCI controller. > > This driver relies on system initialization in u-boot. > > > > Tested on DragonBoard 410c. > > > > Sponsored by: DARPA, AFRL > > > > Added: > > head/sys/dev/usb/controller/ehci_msm.c (contents, props changed) > > > > The code looks like the generic-ehci, would it be better to subclass > generic-ehci to fdt and add qualcomm quirks if necessary ? > Hi Emmanuel This driver is incomplete currently and requires initialization in u-boot. Both system clocks and EHCI subsystem, also Qualcomm power management device requires full initialization. My goal will be to extend this driver and proceed full initialization required for Qualcomm EHCI. The u-boot option CONFIG_DM_DEVICE_REMOVE=n must be added in order to keep devices initialized before jumping to FreeBSD. We will need to get rid of these by adding some code to this driver I guess. Thanks. Ruslan From owner-svn-src-all@freebsd.org Thu Jan 25 17:43:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E88C2EC2300 for ; Thu, 25 Jan 2018 17:43:24 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22c.google.com (mail-io0-x22c.google.com [IPv6:2607:f8b0:4001:c06::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 7558B68AF6 for ; Thu, 25 Jan 2018 17:43:24 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22c.google.com with SMTP id n7so9494875iob.0 for ; Thu, 25 Jan 2018 09:43:24 -0800 (PST) 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=eop+XiMmBzr1CcG9y0D/CH+D7VugO0pTPGYPr/OyWqw=; b=YQcC7YCOmIfmgnETOokBDTvoKoze9U9r6fuBo0EymHMYMAcuyg3huwvQVJpgx4taeS LE6QPWPVVm8VVCj/uq5GWxw0Gdu9ABNfAV2sPS4cZYw9qo2Th8aFeo0BBKeBBjMrsVKd NeR9MALrkqD74bQT9COyLEyZpep4pYCU1VncOp6gkjG8yjfyVVqInGGRV8yTmulPf1hP 3mN06lJI/fSBIqcRN9fyyASuW9LvAsv/9Zzz6+t1auyz/JYBtVcRFq0fXQqBEOgfiedS kEf9HXCq3lnkEg66yiaAqW/fGYSW5Ypdf+Wo4+9BE6Sx9NxvwM0z47Q4e/uOdIoaBoSE UAKw== 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=eop+XiMmBzr1CcG9y0D/CH+D7VugO0pTPGYPr/OyWqw=; b=lLmdSHaASxuMKnGScELJFy5bbJznWyYA1l7Dfcy71NNdDc1OiANMDeztPVxSV5FeaE ashN3LYBXmKqXzX1aEwFI+sLftxJslMPx32Wy6nugasuYN4vimj3n839dbOXft2AAa3a oEQNIW72KXdxzppl8jJr6rgmkihpIPyeIgx0y7Pyu09v8+d161P0e+HOaV3txRgoHwNe J/tgh+aFq5DmvbM4GbBxNg/E4j3v2rZlFcYySn2C73Vrhk8Cmksg4JzK9R+z9T/xoYfl gqTaU+dTH/XdTl3dYD2m2lQ3ExFv0obxsankfOtwQwLTEAD8nUoXJilvXV88kA55QcSd OquA== X-Gm-Message-State: AKwxyter3EW3aJuDORMo3O/ORXKfcw79Phxhmws6t3Zn4/nHk/U65J+K LQqK85Hdwb+tmCD982Df+CeHShO98nOFKIcADPoJXA== X-Google-Smtp-Source: AH8x226Gpajqj7AB9Csni2qxuTYXqPmZo+hbZcvu42Irf8T1OCHvAe56+eVaUuL46Ih1N4RCHngCoy+VgWxsMN2wHJ4= X-Received: by 10.107.136.76 with SMTP id k73mr13790387iod.301.1516902203691; Thu, 25 Jan 2018 09:43:23 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Thu, 25 Jan 2018 09:43:23 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <201801251651.w0PGpqrF000743@pdx.rh.CN85.dnsmgr.net> References: <201801250515.w0P5FiLk008095@repo.freebsd.org> <201801251651.w0PGpqrF000743@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Thu, 25 Jan 2018 10:43:23 -0700 X-Google-Sender-Auth: qb19vtA38b4dmrqQM0IIPPjOFJw Message-ID: Subject: Re: svn commit: r328388 - head/share/man/man8 To: "Rodney W. Grimes" Cc: Li-Wen Hsu , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 17:43:25 -0000 On Thu, Jan 25, 2018 at 9:51 AM, Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > [ Charset UTF-8 unsupported, converting... ] > > Author: lwhsu (ports committer) > > Date: Thu Jan 25 05:15:44 2018 > > New Revision: 328388 > > URL: https://svnweb.freebsd.org/changeset/base/328388 > > > > Log: > > Fix manual page install on non-amd64 > > > > Reviewed by: emaste, imp > > Differential Revision: https://reviews.freebsd.org/D14038 > > Um, small technical nit, *efi is not amd64 only. There is > a 32 bit efi spec that can apply to i386, and there is also > arm using efi. > We don't support either of those yet (though, we're super close on arm, we're not at all close on i386). Let's not confuse users until we're ready to let people use them. Warner From owner-svn-src-all@freebsd.org Thu Jan 25 17:53:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A605EC2D3A; Thu, 25 Jan 2018 17:53:34 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E1DAB692A0; Thu, 25 Jan 2018 17:53:33 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCD3D103BA; Thu, 25 Jan 2018 17:53:33 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PHrXUn087956; Thu, 25 Jan 2018 17:53:33 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PHrXBq087955; Thu, 25 Jan 2018 17:53:33 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801251753.w0PHrXBq087955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 25 Jan 2018 17:53:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328405 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 328405 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 17:53:34 -0000 Author: ian Date: Thu Jan 25 17:53:33 2018 New Revision: 328405 URL: https://svnweb.freebsd.org/changeset/base/328405 Log: Minor cleanups... Move DRIVER_MODULE() and other boilerplate stuff to the bottom of the file, where it is in most imx5/6 drivers. Switch from an RD2 macro using bus_space_read_2() to an inline function using bus_read_2(); likewise for WR2. Use RESOURCE_SPEC_END to end the resource_spec list. Net effect should be no functional changes. Modified: head/sys/arm/freescale/imx/imx_wdog.c Modified: head/sys/arm/freescale/imx/imx_wdog.c ============================================================================== --- head/sys/arm/freescale/imx/imx_wdog.c Thu Jan 25 17:16:29 2018 (r328404) +++ head/sys/arm/freescale/imx/imx_wdog.c Thu Jan 25 17:53:33 2018 (r328405) @@ -54,8 +54,6 @@ __FBSDID("$FreeBSD$"); struct imx_wdog_softc { struct mtx sc_mtx; device_t sc_dev; - bus_space_tag_t sc_bst; - bus_space_handle_t sc_bsh; struct resource *sc_res[2]; uint32_t sc_timeout; }; @@ -63,9 +61,12 @@ struct imx_wdog_softc { static struct resource_spec imx_wdog_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, - { -1, 0 } + RESOURCE_SPEC_END }; +#define MEMRES 0 +#define IRQRES 1 + static struct ofw_compat_data compat_data[] = { {"fsl,imx6sx-wdt", 1}, {"fsl,imx6sl-wdt", 1}, @@ -80,28 +81,19 @@ static struct ofw_compat_data compat_data[] = { {NULL, 0} }; -static void imx_watchdog(void *, u_int, int *); -static int imx_wdog_probe(device_t); -static int imx_wdog_attach(device_t); +static inline uint16_t +RD2(struct imx_wdog_softc *sc, bus_size_t offs) +{ -static device_method_t imx_wdog_methods[] = { - DEVMETHOD(device_probe, imx_wdog_probe), - DEVMETHOD(device_attach, imx_wdog_attach), - DEVMETHOD_END -}; + return bus_read_2(sc->sc_res[MEMRES], offs); +} -static driver_t imx_wdog_driver = { - "imx_wdog", - imx_wdog_methods, - sizeof(struct imx_wdog_softc), -}; -static devclass_t imx_wdog_devclass; -DRIVER_MODULE(imx_wdog, simplebus, imx_wdog_driver, imx_wdog_devclass, 0, 0); +static inline void +WR2(struct imx_wdog_softc *sc, bus_size_t offs, uint16_t val) +{ -#define RD2(_sc, _r) \ - bus_space_read_2((_sc)->sc_bst, (_sc)->sc_bsh, (_r)) -#define WR2(_sc, _r, _v) \ - bus_space_write_2((_sc)->sc_bst, (_sc)->sc_bsh, (_r), (_v)) + return bus_write_2(sc->sc_res[MEMRES], offs, val); +} static void imx_watchdog(void *arg, u_int cmd, int *error) @@ -165,12 +157,24 @@ imx_wdog_attach(device_t dev) mtx_init(&sc->sc_mtx, device_get_nameunit(dev), "imx_wdt", MTX_DEF); - sc->sc_dev = dev; - sc->sc_bst = rman_get_bustag(sc->sc_res[0]); - sc->sc_bsh = rman_get_bushandle(sc->sc_res[0]); - /* TODO: handle interrupt */ EVENTHANDLER_REGISTER(watchdog_list, imx_watchdog, sc, 0); return (0); } + +static device_method_t imx_wdog_methods[] = { + DEVMETHOD(device_probe, imx_wdog_probe), + DEVMETHOD(device_attach, imx_wdog_attach), + DEVMETHOD_END +}; + +static driver_t imx_wdog_driver = { + "imx_wdog", + imx_wdog_methods, + sizeof(struct imx_wdog_softc), +}; + +static devclass_t imx_wdog_devclass; + +DRIVER_MODULE(imx_wdog, simplebus, imx_wdog_driver, imx_wdog_devclass, 0, 0); From owner-svn-src-all@freebsd.org Thu Jan 25 18:01:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDFE9EC3593; Thu, 25 Jan 2018 18:01:46 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A0CD669811; Thu, 25 Jan 2018 18:01:46 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B9861050E; Thu, 25 Jan 2018 18:01:46 +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 w0PI1kSG091955; Thu, 25 Jan 2018 18:01:46 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PI1k96091954; Thu, 25 Jan 2018 18:01:46 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801251801.w0PI1k96091954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 25 Jan 2018 18:01:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328406 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 328406 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 18:01:47 -0000 Author: pfg Date: Thu Jan 25 18:01:46 2018 New Revision: 328406 URL: https://svnweb.freebsd.org/changeset/base/328406 Log: Minor style issue introduced in r328346. Pointed by: bde Modified: head/sys/fs/ext2fs/ext2_lookup.c Modified: head/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- head/sys/fs/ext2fs/ext2_lookup.c Thu Jan 25 17:53:33 2018 (r328405) +++ head/sys/fs/ext2fs/ext2_lookup.c Thu Jan 25 18:01:46 2018 (r328406) @@ -145,9 +145,9 @@ ext2_readdir(struct vop_readdir_args *ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; + u_int ncookies; int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; - u_int ncookies; if (uio->uio_offset < 0) return (EINVAL); From owner-svn-src-all@freebsd.org Thu Jan 25 18:03:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2E26EC37A2; Thu, 25 Jan 2018 18:03:51 +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 211FD69B99; Thu, 25 Jan 2018 18:03:50 +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 w0PI3k8g001099; Thu, 25 Jan 2018 10:03:46 -0800 (PST) (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 w0PI3ktC001098; Thu, 25 Jan 2018 10:03:46 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801251803.w0PI3ktC001098@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r328388 - head/share/man/man8 In-Reply-To: To: Warner Losh Date: Thu, 25 Jan 2018 10:03:46 -0800 (PST) CC: "Rodney W. Grimes" , Li-Wen Hsu , 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.25 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: Thu, 25 Jan 2018 18:03:51 -0000 [ Charset UTF-8 unsupported, converting... ] > On Thu, Jan 25, 2018 at 9:51 AM, Rodney W. Grimes < > freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > > [ Charset UTF-8 unsupported, converting... ] > > > Author: lwhsu (ports committer) > > > Date: Thu Jan 25 05:15:44 2018 > > > New Revision: 328388 > > > URL: https://svnweb.freebsd.org/changeset/base/328388 > > > > > > Log: > > > Fix manual page install on non-amd64 > > > > > > Reviewed by: emaste, imp > > > Differential Revision: https://reviews.freebsd.org/D14038 > > > > Um, small technical nit, *efi is not amd64 only. There is > > a 32 bit efi spec that can apply to i386, and there is also > > arm using efi. > > > > We don't support either of those yet (though, we're super close on arm, > we're not at all close on i386). Let's not confuse users until we're ready > to let people use them. I wrote this before the correction to add the man pages to arm, which we do support and was a majority of the concern. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Thu Jan 25 18:08:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 110C0EC3B3D; Thu, 25 Jan 2018 18:08:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3B9C69E51; Thu, 25 Jan 2018 18:08:56 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEB7910557; Thu, 25 Jan 2018 18:08:56 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PI8uUU093129; Thu, 25 Jan 2018 18:08:56 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PI8uUx093128; Thu, 25 Jan 2018 18:08:56 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801251808.w0PI8uUx093128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 25 Jan 2018 18:08:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328407 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 328407 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 18:08:57 -0000 Author: ian Date: Thu Jan 25 18:08:56 2018 New Revision: 328407 URL: https://svnweb.freebsd.org/changeset/base/328407 Log: Fix return style in RD2. Remove bogus return value from a void function in WR2 (I have no idea why that didn't result in a compile error). Modified: head/sys/arm/freescale/imx/imx_wdog.c Modified: head/sys/arm/freescale/imx/imx_wdog.c ============================================================================== --- head/sys/arm/freescale/imx/imx_wdog.c Thu Jan 25 18:01:46 2018 (r328406) +++ head/sys/arm/freescale/imx/imx_wdog.c Thu Jan 25 18:08:56 2018 (r328407) @@ -85,14 +85,14 @@ static inline uint16_t RD2(struct imx_wdog_softc *sc, bus_size_t offs) { - return bus_read_2(sc->sc_res[MEMRES], offs); + return (bus_read_2(sc->sc_res[MEMRES], offs)); } static inline void WR2(struct imx_wdog_softc *sc, bus_size_t offs, uint16_t val) { - return bus_write_2(sc->sc_res[MEMRES], offs, val); + bus_write_2(sc->sc_res[MEMRES], offs, val); } static void From owner-svn-src-all@freebsd.org Thu Jan 25 18:09:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF07BEC3BAE; Thu, 25 Jan 2018 18:09:26 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C9E869F94; Thu, 25 Jan 2018 18:09:26 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 679BC10558; Thu, 25 Jan 2018 18:09:26 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PI9QlG093193; Thu, 25 Jan 2018 18:09:26 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PI9QOr093192; Thu, 25 Jan 2018 18:09:26 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201801251809.w0PI9QOr093192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Thu, 25 Jan 2018 18:09:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328408 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 328408 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 18:09:26 -0000 Author: nwhitehorn Date: Thu Jan 25 18:09:26 2018 New Revision: 328408 URL: https://svnweb.freebsd.org/changeset/base/328408 Log: Treat DSE exceptions like DSI exceptions when generating signinfo. Both can generate SIGSEGV, but DSEs would have put the wrong address into the siginfo structure when the signal was delivered. MFC after: 1 week Modified: head/sys/powerpc/powerpc/exec_machdep.c Modified: head/sys/powerpc/powerpc/exec_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/exec_machdep.c Thu Jan 25 18:08:56 2018 (r328407) +++ head/sys/powerpc/powerpc/exec_machdep.c Thu Jan 25 18:09:26 2018 (r328408) @@ -154,7 +154,8 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask * Fill siginfo structure. */ ksi->ksi_info.si_signo = ksi->ksi_signo; - ksi->ksi_info.si_addr = (void *)((tf->exc == EXC_DSI) ? + ksi->ksi_info.si_addr = + (void *)((tf->exc == EXC_DSI || tf->exc == EXC_DSE) ? tf->dar : tf->srr0); #ifdef COMPAT_FREEBSD32 From owner-svn-src-all@freebsd.org Thu Jan 25 18:10:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3FADEC3CF8; Thu, 25 Jan 2018 18:10:34 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 65D106A140; Thu, 25 Jan 2018 18:10:34 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60CB210562; Thu, 25 Jan 2018 18:10:34 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PIAYRd093299; Thu, 25 Jan 2018 18:10:34 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PIAYSj093298; Thu, 25 Jan 2018 18:10:34 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201801251810.w0PIAYSj093298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Thu, 25 Jan 2018 18:10:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328409 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 328409 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 18:10:34 -0000 Author: nwhitehorn Date: Thu Jan 25 18:10:33 2018 New Revision: 328409 URL: https://svnweb.freebsd.org/changeset/base/328409 Log: Avoid all SLB operations in trap handling if the process is not using a software-managed SLB. Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Thu Jan 25 18:09:26 2018 (r328408) +++ head/sys/powerpc/powerpc/trap.c Thu Jan 25 18:10:33 2018 (r328409) @@ -629,8 +629,9 @@ syscall(struct trapframe *frame) * Speculatively restore last user SLB segment, which we know is * invalid already, since we are likely to do copyin()/copyout(). */ - __asm __volatile ("slbmte %0, %1; isync" :: - "r"(td->td_pcb->pcb_cpu.aim.usr_vsid), "r"(USER_SLB_SLBE)); + if (td->td_pcb->pcb_cpu.aim.usr_vsid != 0) + __asm __volatile ("slbmte %0, %1; isync" :: + "r"(td->td_pcb->pcb_cpu.aim.usr_vsid), "r"(USER_SLB_SLBE)); #endif error = syscallenter(td); @@ -690,6 +691,9 @@ handle_user_slb_spill(pmap_t pm, vm_offset_t addr) struct slb *user_entry; uint64_t esid; int i; + + if (pm->pm_slb == NULL) + return (-1); esid = (uintptr_t)addr >> ADDR_SR_SHFT; From owner-svn-src-all@freebsd.org Thu Jan 25 18:13:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F06CAEC42A9 for ; Thu, 25 Jan 2018 18:13:42 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic309-35.consmr.mail.gq1.yahoo.com (sonic309-35.consmr.mail.gq1.yahoo.com [98.137.65.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7AA736A67F for ; Thu, 25 Jan 2018 18:13:42 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1516904015; bh=99rfCN4pOC+Bue0RbBql6hzb7SvNxoRIHwRKjoo3DU8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=ScU+4LBFv6G3m+Pa210vUpZs1pxLP5cCD7GQqqVQ0Qczhptm1FKra5Gf04yilTaUl5ammcRb+u4Md3BujhXWEfPMjfSmSG+2wB1PYqtt6KIaS3vggHsjH5QW0XoURrr/O6F+0ZoO7BXwq5fZhIAFWwD7b6fj5nWKQijMNuRuKgyoYvKaLovZXIs5AF7REHiquv4WJs3LgHlCyI9mlGH9ksgGlsOudl7mLqDH7cKDAh8RXKUR72pr0H2uQANEq9aFRXxgxDh9EjvWujT0h6jIOv3gdj/fPyBHj5Iu/jjMFPQLl4tcjLT/pcH1FLIz/V6m9H6uSe5s3VpmTaIcbi2wyw== X-YMail-OSG: Au5G1kMVM1lMrbf_2t246a09X7qbz7S9waAOiIpcwFZXzo80s4FmT.TrH.uBJEl TwZYjiitzrMJHBlAETVlH6ZMioTO9_46GkPWM6mxgwX_ZrUFGlJXYgUI1x6iFocfJDjpqj3Dio8F hiYPvdvS0_QUdlNOGyJ6EG76eXVkWXnjM9jrBmZ_coAUmHlXk53RUQMqD288TPULOQ7P0Ve8VrJH Tfekg0RTfZK7p67dP8jocl1_Ke54dXzLf6Az5TXn7LyW7TMbaHCqaT05iHv.qcuMJHcFg6qAfZU9 UB0uJu._5Wy_knFbuK7q3y48JADzTOwILMfo2_E16HjqU3DyT5pWXLF1CbIhprCuAJVwacnjQoy8 ELLBC33gLN7J4ekmeoscwqAWF.56CEmoYjN8RJTcNbhl6DjW0nnJ7K.elocq9yTuR7jBizNMtI0s T5sRObcGSOOSLmODCbs.VV_hElVP0.nZny2hIqPHFaQyQ1yECjSSOX.WxMVwz9xWgHnpdKk5QKTY Y.ku_TMxT7A-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.gq1.yahoo.com with HTTP; Thu, 25 Jan 2018 18:13:35 +0000 Received: from smtp104.rhel.mail.gq1.yahoo.com (EHLO [192.168.0.8]) ([216.39.57.214]) by smtp410.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID c694356ccce12c40c41cacc78fbcff2d; Thu, 25 Jan 2018 18:13:32 +0000 (UTC) Subject: Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801241758.w0OHwm26063524@repo.freebsd.org> <20180126020540.B2181@besplex.bde.org> From: Pedro Giffuni Message-ID: <8d5ddd06-14b2-e7e1-14dd-5e9d42f9b33c@FreeBSD.org> Date: Thu, 25 Jan 2018 13:13:32 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180126020540.B2181@besplex.bde.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 18:13:43 -0000 On 01/25/18 11:28, Bruce Evans wrote: > On Wed, 24 Jan 2018, Pedro F. Giffuni wrote: > >> Log: >>  ext2fs|ufs:Unsign some values related to allocation. >> >>  When allocating memory through malloc(9), we always expect the >> amount of >>  memory requested to be unsigned as a negative value would either >> stand for >>  an error or an overflow. >>  Unsign some values, found when considering the use of >> mallocarray(9), to >>  avoid unnecessary casting. Also consider that indexes should be of >>  at least the same size/type as the upper limit they pretend to index. > > This might not break much, but it adds many more type errors and bogus > (implicit) casts than it fixes.  It actually changes the brokenness of > the > first variable touched: > >> Modified: head/sys/fs/ext2fs/ext2_lookup.c >> ============================================================================== >> >> --- head/sys/fs/ext2fs/ext2_lookup.c    Wed Jan 24 17:52:06 2018    >> (r328345) >> +++ head/sys/fs/ext2fs/ext2_lookup.c    Wed Jan 24 17:58:48 2018    >> (r328346) >> @@ -145,9 +145,9 @@ ext2_readdir(struct vop_readdir_args *ap) >>     off_t offset, startoffset; >>     size_t readcnt, skipcnt; >>     ssize_t startresid; >> -    int ncookies; >>     int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; >>     int error; >> +    u_int ncookies; > > The first bug is only a style bug (unsorting the u_int after the ints > even > when its variable was accidentally already before the ints. > Yup, my error. >> >>     if (uio->uio_offset < 0) >>         return (EINVAL); > > That is the only change in this file.  No comment on other changes. > > ncookies is mostly used in contexts other than for multiplying by it > before > calling malloc(), and its type is now inconsistent with most other > places. > > The other places are: > > X     ncookies = uio->uio_resid; > > This has a more serious type error and consequent overflow bugs. > uio_resid > used to have type int, and cookies had to have type int to match that, > else > there overflow occurs before the bounds checks.  Now uio_resid has type > ssize_t, which is excessively large on 64-bit arches (64 bits then), > so the > assignment overflowed when ncookies had type int and uio_resid > INT_MAX. > Now it overflows differently when uio_resid > UINT_MAX, and unsign > extension > causes overflow when uio_resid < 0.  There might be a sanity check on > uio_resid at higher levels, but I can only find a check related to EOF in > vfs_read_dirent(). > I will argue that none of the code in this function is prepared for the eventually of uio->uio_resid < 0 In that case we would have a rather spectacular failure in malloc. Unsigning ncookies is a theoretical, although likely impractical, improvement here. It is not clear to me that using int or u_int makes a difference given it is a local variable and in this scope the signedness of the variable is basically irrelevant. From a logical point of view .. we can't really have a negative number of cookies. > Next, we do some bounds checking which seems to be correct modulo > previous > overflows, and show the care needed for unsigned variables (i_size is > unsigned > and must be compared with uio_offset which is signed). > > Next, we assign ncookies, to ap_ncookies which still has the correct type > (plain signed int).  If ncookies were actually large enough to need a > u_int, > or worse a 64-bit ssize_t, then this would overflow. > > Later, we KASSERT() that ncookies > 0.  This might cause a compiler > warning > "unsigned comparison with 0" now that ncookies is unsigned.  We count > down > ncookies, but the loop termination condition is complicated and we don't > get any benefits from the possible micro-optimization of using > ncookies as > a loop counter that counts down to 0. > > To fix the problem that mallocarray() wanted a size_t arg, ncookies could > be cast to size_t, but that would be silly.  The prototype does the same > cast automatically even for cases with sign mismatches.  Now malloc() > wants a type of size_t (after further breakage to change malloc()s arg > type).  Many conversions are still involved, and casting would at most > limit > compiler warnings:  the code is now: > > X     malloc(ncookies * sizeof(*cookies), ...) > > First, ncookies and sizeof(...) are promoted to a common type. When > ncookies > was int, usually it was promoted to size_t and sizeof(...) was not > promoted. > But on exotic arches with size_t smaller than int, sizeof(...) is > promoted to > int and ncookies is not promoted. > > Next, the type of the result of the multiplication is the common type. > > Finally, the prototype used to convert to u_long, but now converts to > size_t. > When the common type is size_t, then the conversion is now null. When the > common type was int, the conversion was promotion to u_long, but it is > now > demotion to size_t. > > All this only obviously works in practice because all the variables and > the product are small, so they are smaller than all of INT_MAX, SIZE_MAX > and ULONG_MAX on all supported and unsupported arches.  However, it is > hard to write bounds checks that obviously handle all cases, except > by using simple small bounds on the variables. > > It is now obvious that the bounds checking is broken for general use. > There is no obvious limit on the malloc() except the file size. > However, I think cookies are only used by nfs, so this is not a > user-serving bug.  nfs just has to limit its cookie size.  It seems to > use a limit of something like NFS_SRVMAXIO (128K).  This also makes > the overflow from the ssize_t type error unreachable.  Note that it > > So all of this actually works very unobviously in practice.  The sizes > are only small because nfs is the only (?) caller and it never asks for > large sizes. > > ffs has almost the same code, so has the same fragility. > > This fragility goes back to at least FreeBSD-3, but for ffs it was > only in the big-endian case then (this is the case which always had > to copy and convert the on-disk layout).  This changed relatively > recently, because the ffs on-disk layout only matches struct dirent > for 32-bit ino_t. > > Bruce > Pedro. From owner-svn-src-all@freebsd.org Thu Jan 25 19:16:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34891EC7571; Thu, 25 Jan 2018 19:16:48 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id C1D736C987; Thu, 25 Jan 2018 19:16:47 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from [IPv6:2001:630:212:2a8:a1f1:c940:d54d:f50c] (unknown [IPv6:2001:630:212:2a8:a1f1:c940:d54d:f50c]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 914E64ECD4; Thu, 25 Jan 2018 19:16:39 +0000 (UTC) From: Andrew Turner Message-Id: <798D3B3D-2CC2-4DE6-844E-FE6745B8D88E@fubar.geek.nz> Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: svn commit: r328388 - head/share/man/man8 Date: Thu, 25 Jan 2018 19:16:38 +0000 In-Reply-To: Cc: "Rodney W. Grimes" , Li-Wen Hsu , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Warner Losh References: <201801250515.w0P5FiLk008095@repo.freebsd.org> <201801251651.w0PGpqrF000743@pdx.rh.CN85.dnsmgr.net> X-Mailer: Apple Mail (2.3445.5.20) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 19:16:48 -0000 > On 25 Jan 2018, at 17:43, Warner Losh wrote: >=20 >=20 >=20 > On Thu, Jan 25, 2018 at 9:51 AM, Rodney W. Grimes = > = wrote: > [ Charset UTF-8 unsupported, converting... ] > > Author: lwhsu (ports committer) > > Date: Thu Jan 25 05:15:44 2018 > > New Revision: 328388 > > URL: https://svnweb.freebsd.org/changeset/base/328388 = > > > > Log: > > Fix manual page install on non-amd64 > > > > Reviewed by: emaste, imp > > Differential Revision: https://reviews.freebsd.org/D14038 = >=20 > Um, small technical nit, *efi is not amd64 only. There is > a 32 bit efi spec that can apply to i386, and there is also > arm using efi. >=20 > We don't support either of those yet (though, we're super close on = arm, we're not at all close on i386). Let's not confuse users until = we're ready to let people use them. We=E2=80=99ve had working arm support for over 2 years. The issue seems = to be because we normally try to use it with U-Boot. Using the EDK2 base = UEFI under qemu works. Andrew= From owner-svn-src-all@freebsd.org Thu Jan 25 19:24:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAD88EC7E18; Thu, 25 Jan 2018 19:24:45 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id CB42C6D03E; Thu, 25 Jan 2018 19:24:44 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id CC369D4D499; Fri, 26 Jan 2018 06:24:42 +1100 (AEDT) Date: Fri, 26 Jan 2018 06:24:42 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pedro Giffuni cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs In-Reply-To: <8d5ddd06-14b2-e7e1-14dd-5e9d42f9b33c@FreeBSD.org> Message-ID: <20180126053133.R3207@besplex.bde.org> References: <201801241758.w0OHwm26063524@repo.freebsd.org> <20180126020540.B2181@besplex.bde.org> <8d5ddd06-14b2-e7e1-14dd-5e9d42f9b33c@FreeBSD.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=DIX/22Fb c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=nlC_4_pT8q9DhB4Ho9EA:9 a=qP6oLS8uYDIcobi9JHoA:9 a=D7gtUgfzYDhNg8rz:21 a=ScS6avwA4i5X-wbK:21 a=45ClL6m2LaAA:10 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 19:24:45 -0000 On Thu, 25 Jan 2018, Pedro Giffuni wrote: This is almost unreadable due to hard-coded UTF-8 (mostly for tabs corrupte= d to spaces) even in previously-literally quoted C code. > On 01/25/18 11:28, Bruce Evans wrote: >> On Wed, 24 Jan 2018, Pedro F. Giffuni wrote: [... Most unreadable lines deleted] >> X=C2=A0=C2=A0=C2=A0=C2=A0 ncookies =3D uio->uio_resid; >>=20 >> This has a more serious type error and consequent overflow bugs. uio_res= id >> used to have type int, and cookies had to have type int to match that, e= lse >> there overflow occurs before the bounds checks.=C2=A0 Now uio_resid has = type >> ssize_t, which is excessively large on 64-bit arches (64 bits then), so = the >> assignment overflowed when ncookies had type int and uio_resid > INT_MAX= =2E >> Now it overflows differently when uio_resid > UINT_MAX, and unsign=20 >> extension >> causes overflow when uio_resid < 0.=C2=A0 There might be a sanity check = on >> uio_resid at higher levels, but I can only find a check related to EOF i= n >> vfs_read_dirent(). >>=20 > I will argue that none of the code in this function is prepared for the= =20 > eventually of > uio->uio_resid < 0 All of it except the cookies code has to be prepared for that, and seems to handle it OK, since this userland can set uio_resid. The other code is not broken by either the ssize_t expansion or the unsigned bugs, since it mostly doesn't truncate uio_resid by assigning it to a variable of the wrong type (it uses uio->uio_resid in-place, except for copying its initial value to startresid, and startresid is not missing the ssize_t expansion). It mostly does comparisons of the form (uio->uio_resid > 0), where it is 0 in uio_resid means EOF, negative is treated as EOF, and strictly positive means more to do. There is a clear up-front check that uio_offset >=3D 0 (return EINVAL if uio_offset < 0). This is not needed for the trusted nfs caller, but is needed for syscalls and is done for both. > In that case we would have a rather spectacular failure in malloc. > Unsigning ncookies is a theoretical, although likely impractical, improve= ment=20 > here. No, it increases the bug slightly. E.g., if uio_resid is -1, ncookies was -1 / (offsetof(...) + 4) + 1 =3D 0 + 1 after rounding. This might even work (1 cookie at a time, just like if the caller asked for that). Now ncookies is -1U / (offsetof(...) + 4) + 1 =3D a large value. However, if uio_resid was slightly more negative than -2 * (offsetof(...) + 4), then ncookies was -1 and in the multiplication this overflows to -1U =3D a large value and the result is much the same as for earlier overflow on assignment to u_int ncookies. This code only works because (if?) nfs is the only caller and nfs never passes insane values. > It is not clear to me that using int or u_int makes a difference given it= is=20 > a local variable > and in this scope the signedness of the variable is basically irrelevant. It is clear to me that overflow bugs occur with both if untrusted callers a= re allowed. > From a logical point of view .. we can't really have a negative number of= =20 > cookies. Malicious and buggy callers do illogical things to get through holes in your logic. It is also illogical to have a zero number of cookies, but ncookies can be 0 in various ways. First, ncookies is 0 in the EOF case (and cookies are requested). We depend on 0 not being an invalid size for malloc() so that we malloc() nothing and later do more nothings in the main loop. This is a standard use for 0. If you don't like negative numbers, then you also shouldn't like 0. Both exist to make some calculations easier. Later, ncookies is abused as a residual count, so it becomes 0 at the end. This is another standard use for 0. Bruce From owner-svn-src-all@freebsd.org Thu Jan 25 19:57:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47C4DEC98D3; Thu, 25 Jan 2018 19:57:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F00CC6E3E5; Thu, 25 Jan 2018 19:57:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB134117A2; Thu, 25 Jan 2018 19:57:21 +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 w0PJvLhg047878; Thu, 25 Jan 2018 19:57:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PJvLNf047877; Thu, 25 Jan 2018 19:57:21 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801251957.w0PJvLNf047877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 25 Jan 2018 19:57:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328410 - head/usr.sbin/bsdinstall/partedit X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/bsdinstall/partedit X-SVN-Commit-Revision: 328410 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 19:57:22 -0000 Author: emaste Date: Thu Jan 25 19:57:21 2018 New Revision: 328410 URL: https://svnweb.freebsd.org/changeset/base/328410 Log: bsdinstall: enable SUJ by default (revert r327890) fsck should be fixed as of r328092. PR: 225110 Tested by: dumbbell, Arshan Khanifar Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- head/usr.sbin/bsdinstall/partedit/gpart_ops.c Thu Jan 25 18:10:33 2018 (r328409) +++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c Thu Jan 25 19:57:21 2018 (r328410) @@ -91,7 +91,8 @@ newfs_command(const char *fstype, char *command, int u {"SU", "Softupdates", "Enable softupdates (default)", 1 }, {"SUJ", "Softupdates journaling", - "Enable file system journaling", 0 }, + "Enable file system journaling (default - " + "turn off for SSDs)", 1 }, {"TRIM", "Enable SSD TRIM support", "Enable TRIM support, useful on solid-state drives", 0 }, From owner-svn-src-all@freebsd.org Thu Jan 25 20:01:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E11F5EC9E61 for ; Thu, 25 Jan 2018 20:01:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic317-41.consmr.mail.bf2.yahoo.com (sonic317-41.consmr.mail.bf2.yahoo.com [74.6.129.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89EDF6E9FC for ; Thu, 25 Jan 2018 20:01:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1516910478; bh=0DOsI0ZeuDKlfnmWnd5p4S0CsOI4me/K08lwWACkK4c=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=pD4q6g7MuZOvy9RIF6vwRTmHDPxUFdlct6W6pud0LYmfghXMSP+/tT92gZPaSXa7+ys4cLfIQNQm1gvSOhM5VCVKV/IRceB8mwPPF/fb9Z85C5bZU0UQSipq5k2PDWxlD1FNIof6Kzc53bOP1sEJjHZ8McNEj5ADo78K0/YbErsxtdLZGKrwP1miXI2zkn+K1aLcRHa7p047gzC1o/EuDOmyXiZjQEAsZHZ8O5m0t72NZKNWsM1vrlhnHqgl76q+SQwAw3uHTkfjRIrLhGggBwb8+S1g4ppD+Njdks+ePYguNhFQc02OyXxk2fz1BxZudp8nI1nCGVXfNg4w6ArXCA== X-YMail-OSG: TtNLmjsVM1mN.3.p0MVqhkMOx6IYjJT4p1.wEZAJmq9WlqJsWX1773jig.8eLym QN6qNB_fmhINz8Kw2QkcCwuv88BSZhBdIcG9C1q9OQo.kcqV3QwYCDybqeCOxh2yOBb8Gf0jhHNM TBg6kyODChNfTzJ7R8e5aj6lu47dmJVhzukTaLp3QMnEG4.3KFcSxw4XOWeLi99G0WSZYqEHN_vY LRJ8edmW.4UvgBn6q0i1f6_NpF_syBe4sNe8.oZ3WPRCrx2a0Zzwri8SIw3Oy2eOiEKBIQ5LNu49 TcYQeXm.9DJHzHG2dEVDuXdf6BzEfe14Ell2iDoiqzv7C_54b6Lx5wEXIfTQOH3locdeyFa2kYJf Zbe_ZChRbhYKCGJcaZxHSyJue4N7EllwTjllojFlXJrWZOuahcrcmovit0fkyrmNaM4R3wsMR7U1 RVwmSz8iL_a0S5sFA07pDMZU73iWD3Z.lBVVhMZ1XNs1CwZ06z1Vot.jjvnoLtV5WYqJQiyNQkFr n4IgOV1zZcw-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.bf2.yahoo.com with HTTP; Thu, 25 Jan 2018 20:01:18 +0000 Received: from smtp105.rhel.mail.bf1.yahoo.com (EHLO [192.168.0.8]) ([98.139.231.38]) by smtp412.mail.bf1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID a53f401ffab560e1068aa3e11952352a; Thu, 25 Jan 2018 20:01:14 +0000 (UTC) Subject: Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801241758.w0OHwm26063524@repo.freebsd.org> <20180126020540.B2181@besplex.bde.org> <8d5ddd06-14b2-e7e1-14dd-5e9d42f9b33c@FreeBSD.org> <20180126053133.R3207@besplex.bde.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <21b6bdda-65b7-89da-4dd6-bed64978eba8@FreeBSD.org> Date: Thu, 25 Jan 2018 15:01:15 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180126053133.R3207@besplex.bde.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 20:01:25 -0000 On 25/01/2018 14:24, Bruce Evans wrote: > On Thu, 25 Jan 2018, Pedro Giffuni wrote: > > This is almost unreadable due to hard-coded UTF-8 (mostly for tabs > corrupted > to spaces) even in previously-literally quoted C code. > Mailer agents ... they all suck :( >> On 01/25/18 11:28, Bruce Evans wrote: >>> On Wed, 24 Jan 2018, Pedro F. Giffuni wrote: > > [... Most unreadable lines deleted] > >>> X     ncookies = uio->uio_resid; >>> >>> This has a more serious type error and consequent overflow bugs. >>> uio_resid >>> used to have type int, and cookies had to have type int to match >>> that, else >>> there overflow occurs before the bounds checks.  Now uio_resid has type >>> ssize_t, which is excessively large on 64-bit arches (64 bits then), >>> so the >>> assignment overflowed when ncookies had type int and uio_resid > >>> INT_MAX. >>> Now it overflows differently when uio_resid > UINT_MAX, and unsign >>> extension >>> causes overflow when uio_resid < 0.  There might be a sanity check on >>> uio_resid at higher levels, but I can only find a check related to >>> EOF in >>> vfs_read_dirent(). >>> >> I will argue that none of the code in this function is prepared for >> the eventually of >> uio->uio_resid < 0 > > All of it except the cookies code has to be prepared for that, and seems > to handle it OK, since this userland can set uio_resid.  The other code > is not broken by either the ssize_t expansion or the unsigned bugs, since > it mostly doesn't truncate uio_resid by assigning it to a variable of the > wrong type (it uses uio->uio_resid in-place, except for copying its > initial > value to startresid, and startresid is not missing the ssize_t > expansion). > It mostly does comparisons of the form (uio->uio_resid > 0), where it is > 0 in uio_resid means EOF, negative is treated as EOF, and strictly > positive > means more to do. > > There is a clear up-front check that uio_offset >= 0 (return EINVAL if > uio_offset < 0).  This is not needed for the trusted nfs caller, but is > needed for syscalls and is done for both. > >> In that case we would have a rather spectacular failure in malloc. >> Unsigning ncookies is a theoretical, although likely impractical, >> improvement here. > > No, it increases the bug slightly.  E.g., if uio_resid is -1, ncookies > was -1 / (offsetof(...) + 4) + 1 = 0 + 1 after rounding.  This might even > work (1 cookie at a time, just like if the caller asked for that).  Now > ncookies is -1U / (offsetof(...) + 4) + 1 = a large value. However, if > uio_resid was slightly more negative than -2 * (offsetof(...) + 4), then > ncookies was -1 and in the multiplication this overflows to -1U = a large > value and the result is much the same as for earlier overflow on > assignment > to u_int ncookies. > > This code only works because (if?) nfs is the only caller and nfs never > passes insane values. > I am starting to think that we should simply match uio_resid and set it to ssize_t. Returning the value to int is certainly not the solution. >> It is not clear to me that using int or u_int makes a difference >> given it is a local variable >> and in this scope the signedness of the variable is basically >> irrelevant. > > It is clear to me that overflow bugs occur with both if untrusted > callers are > allowed. > >> From a logical point of view .. we can't really have a negative >> number of cookies. > > Malicious and buggy callers do illogical things to get through holes in > your logic. > > It is also illogical to have a zero number of cookies, but ncookies can > be 0 in various ways.  First, ncookies is 0 in the EOF case (and cookies > are requested).  We depend on 0 not being an invalid size for malloc() > so that we malloc() nothing and later do more nothings in the main loop. > This is a standard use for 0.  If you don't like negative numbers, then > you also shouldn't like 0.  Both exist to make some calculations easier. > Later, ncookies is abused as a residual count, so it becomes 0 at the > end. > This is another standard use for 0. > > Bruce From owner-svn-src-all@freebsd.org Thu Jan 25 20:02:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9EB7AECA06A for ; Thu, 25 Jan 2018 20:02:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::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 142026ECB5 for ; Thu, 25 Jan 2018 20:02:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x22c.google.com with SMTP id 143so16848401wma.5 for ; Thu, 25 Jan 2018 12:02:55 -0800 (PST) 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=+YIsiHqnZ6DcUAYKZ/F+hLSW1cfRgl+gJrd9SxpaXjw=; b=kwb4VmXxjisvgLSV9Cc37zltp9kLNLDNnQ80G3FWR7MobsrjM32WcmvBg3mcfnZOVl gfmRopk4Tp96Tn42ckGofebYLT5ucXhuH/xmLs/AlbxleyjGn2dDQqgh3F6GRns9VM43 7Q5/Y7EBqgevbDkO2zbSQ3/kA+jQTl1iKhYXJaQaE/RpkfD7XnNjW+sTi1V+cDcrfsLN KrjE4cTUGiTnRAdgAk07Ro2aUofM56FSY0CJ+faKm4cultx1kHExUnzRwLN7uMKJ0u6z iMQ91fMuWffFZnZ7Vp6XRNH4RHT/UuFBh+Gu40ZLFK7U3uH+T0XtP3+N6IiAWWgJy7AE uP3A== 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=+YIsiHqnZ6DcUAYKZ/F+hLSW1cfRgl+gJrd9SxpaXjw=; b=ecqq3NrU+8jaGCgh2HkXQYh1mcM09FvcyPZ/Zj+7+dmB/4dy7gbhZRZdYZHA9cud26 /XvuMk2BTt56b17/jCGzKN+1IwFc8/7vs5BKFgSpLBbjdSczjAaCI4qMhK2ohFsSgSeV Dr/Km7Teu7CmGPinMXCOv9hSS4QesHRxCRkWUYNzl0pTUupp4aNw9C2tXwOTm75Zi2Br Ru2cJsFVgsCaSeuXApv9PZ6gck4XdhKC+KnnjxIfLCk45sI2WrlPVPFmwmQ1ga9HXt/Q 2flbdl3XMdF6MCGFEaRK5MX2LQrtt9WSVbu9MggM7G7vO6QcqejJX4DKSkNMGUER6l7x sXGQ== X-Gm-Message-State: AKwxytdiI2UMN5SBUWZfpUvUhnD+FEvItA5WnWWA1lMjNYB7Nc/6LK8e Jg2tAJGoiKFviIwEYwbl6OFWtb88GaENAxayljBOtA== X-Google-Smtp-Source: AH8x224nqB2iY1pfpn7Mk+ToRvPqda4AjdP292B4NptnwNa6WlYvCSQwwvWRFghdc1wWc6t3KLoL+r5aC+p1lY8UNAk= X-Received: by 10.80.244.226 with SMTP id v31mr31272135edm.221.1516910573417; Thu, 25 Jan 2018 12:02:53 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.133.195 with HTTP; Thu, 25 Jan 2018 12:02:53 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <798D3B3D-2CC2-4DE6-844E-FE6745B8D88E@fubar.geek.nz> References: <201801250515.w0P5FiLk008095@repo.freebsd.org> <201801251651.w0PGpqrF000743@pdx.rh.CN85.dnsmgr.net> <798D3B3D-2CC2-4DE6-844E-FE6745B8D88E@fubar.geek.nz> From: Warner Losh Date: Thu, 25 Jan 2018 13:02:53 -0700 X-Google-Sender-Auth: _PynZwCgAbBTAeri4ZuQX0PT8jc Message-ID: Subject: Re: svn commit: r328388 - head/share/man/man8 To: Andrew Turner Cc: "Rodney W. Grimes" , Li-Wen Hsu , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 20:02:56 -0000 On Thu, Jan 25, 2018 at 12:16 PM, Andrew Turner wrote: > > On 25 Jan 2018, at 17:43, Warner Losh wrote: > > > > On Thu, Jan 25, 2018 at 9:51 AM, Rodney W. Grimes < > freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > >> [ Charset UTF-8 unsupported, converting... ] >> > Author: lwhsu (ports committer) >> > Date: Thu Jan 25 05:15:44 2018 >> > New Revision: 328388 >> > URL: https://svnweb.freebsd.org/changeset/base/328388 >> > >> > Log: >> > Fix manual page install on non-amd64 >> > >> > Reviewed by: emaste, imp >> > Differential Revision: https://reviews.freebsd.org/D14038 >> >> Um, small technical nit, *efi is not amd64 only. There is >> a 32 bit efi spec that can apply to i386, and there is also >> arm using efi. >> > > We don't support either of those yet (though, we're super close on arm, > we're not at all close on i386). Let's not confuse users until we're read= y > to let people use them. > > > We=E2=80=99ve had working arm support for over 2 years. The issue seems t= o be > because we normally try to use it with U-Boot. Using the EDK2 base UEFI > under qemu works. > Right. armv6/v7 support is kinda there, but most of the 'kinda' comes from external factors, not our code base. Those have mostly been fixed, I think the latest round of u-boot updates will be sufficient that we can recommend using it... Warner From owner-svn-src-all@freebsd.org Thu Jan 25 20:09:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B593ECA4F9; Thu, 25 Jan 2018 20:09:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E6416EF87; Thu, 25 Jan 2018 20:09:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 093CF1194E; Thu, 25 Jan 2018 20:09:52 +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 w0PK9p13052700; Thu, 25 Jan 2018 20:09:51 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PK9pP0052698; Thu, 25 Jan 2018 20:09:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801252009.w0PK9pP0052698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 25 Jan 2018 20:09:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328411 - in head/stand/efi: include loader X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/stand/efi: include loader X-SVN-Commit-Revision: 328411 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 20:09:52 -0000 Author: emaste Date: Thu Jan 25 20:09:51 2018 New Revision: 328411 URL: https://svnweb.freebsd.org/changeset/base/328411 Log: loader.efi: add missing EFI GUIDs These were found during bring-up on a new arm64 platform and in an amd64 VM. Submitted by: Arshan Khanifar Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D14036 Modified: head/stand/efi/include/efiapi.h head/stand/efi/loader/main.c Modified: head/stand/efi/include/efiapi.h ============================================================================== --- head/stand/efi/include/efiapi.h Thu Jan 25 19:57:21 2018 (r328410) +++ head/stand/efi/include/efiapi.h Thu Jan 25 20:09:51 2018 (r328411) @@ -840,6 +840,9 @@ typedef struct { #define SMBIOS_TABLE_GUID \ { 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } +#define SMBIOS3_TABLE_GUID \ + { 0xf2fd1544, 0x9794, 0x4a2c, {0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94} } + #define SAL_SYSTEM_TABLE_GUID \ { 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } @@ -851,6 +854,15 @@ typedef struct { #define HOB_LIST_TABLE_GUID \ { 0x7739f24c, 0x93d7, 0x11d4, {0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } + +#define LZMA_DECOMPRESSION_GUID \ + { 0xee4e5898, 0x3914, 0x4259, {0x9d, 0x6e, 0xdc, 0x7b, 0xd7, 0x94, 0x3, 0xcf} } + +#define ARM_MP_CORE_INFO_TABLE_GUID \ + { 0xa4ee0728, 0xe5d7, 0x4ac5, {0xb2, 0x1e, 0x65, 0x8e, 0xd8, 0x57, 0xe8, 0x34} } + +#define ESRT_TABLE_GUID \ + { 0xb122a263, 0x3661, 0x4f68, {0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80} } #define MEMORY_TYPE_INFORMATION_TABLE_GUID \ { 0x4c19049f, 0x4137, 0x4dd3, {0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa} } Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Thu Jan 25 19:57:21 2018 (r328410) +++ head/stand/efi/loader/main.c Thu Jan 25 20:09:51 2018 (r328411) @@ -65,8 +65,12 @@ EFI_GUID imgid = LOADED_IMAGE_PROTOCOL; EFI_GUID mps = MPS_TABLE_GUID; EFI_GUID netid = EFI_SIMPLE_NETWORK_PROTOCOL; EFI_GUID smbios = SMBIOS_TABLE_GUID; +EFI_GUID smbios3 = SMBIOS3_TABLE_GUID; EFI_GUID dxe = DXE_SERVICES_TABLE_GUID; EFI_GUID hoblist = HOB_LIST_TABLE_GUID; +EFI_GUID lzmadecomp = LZMA_DECOMPRESSION_GUID; +EFI_GUID mpcore = ARM_MP_CORE_INFO_TABLE_GUID; +EFI_GUID esrt = ESRT_TABLE_GUID; EFI_GUID memtype = MEMORY_TYPE_INFORMATION_TABLE_GUID; EFI_GUID debugimg = DEBUG_IMAGE_INFO_TABLE_GUID; EFI_GUID fdtdtb = FDT_TABLE_GUID; @@ -655,10 +659,18 @@ command_configuration(int argc, char *argv[]) else if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) printf("SMBIOS Table %p", ST->ConfigurationTable[i].VendorTable); + else if (!memcmp(guid, &smbios3, sizeof(EFI_GUID))) + printf("SMBIOS3 Table"); else if (!memcmp(guid, &dxe, sizeof(EFI_GUID))) printf("DXE Table"); else if (!memcmp(guid, &hoblist, sizeof(EFI_GUID))) printf("HOB List Table"); + else if (!memcmp(guid, &lzmadecomp, sizeof(EFI_GUID))) + printf("LZMA Compression"); + else if (!memcmp(guid, &mpcore, sizeof(EFI_GUID))) + printf("ARM MpCore Information Table"); + else if (!memcmp(guid, &esrt, sizeof(EFI_GUID))) + printf("ESRT Table"); else if (!memcmp(guid, &memtype, sizeof(EFI_GUID))) printf("Memory Type Information Table"); else if (!memcmp(guid, &debugimg, sizeof(EFI_GUID))) From owner-svn-src-all@freebsd.org Thu Jan 25 21:13:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C00AECDD20; Thu, 25 Jan 2018 21:13:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C32571D16; Thu, 25 Jan 2018 21:13:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4700F124C9; Thu, 25 Jan 2018 21:13:43 +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 w0PLDhml087159; Thu, 25 Jan 2018 21:13:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PLDh3K087158; Thu, 25 Jan 2018 21:13:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801252113.w0PLDh3K087158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 25 Jan 2018 21:13:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328412 - head/share/vt/keymaps X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/vt/keymaps X-SVN-Commit-Revision: 328412 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 21:13:43 -0000 Author: emaste Date: Thu Jan 25 21:13:42 2018 New Revision: 328412 URL: https://svnweb.freebsd.org/changeset/base/328412 Log: vt: add Ctrl+/ key mapping This matches Xorg's handling of Ctrl+/ and may be useful as a tmux escape. PR: 212197 Submitted by: martin at sugioarto.com Tested by: Arshan Khanifar MFC after: 2 weeks Relnotes: Yes Modified: head/share/vt/keymaps/us.kbd Modified: head/share/vt/keymaps/us.kbd ============================================================================== --- head/share/vt/keymaps/us.kbd Thu Jan 25 20:09:51 2018 (r328411) +++ head/share/vt/keymaps/us.kbd Thu Jan 25 21:13:42 2018 (r328412) @@ -56,7 +56,7 @@ 050 'm' 'M' cr cr 'm' 'M' cr cr C 051 ',' '<' nop nop ',' '<' nop nop O 052 '.' '>' nop nop '.' '>' nop nop O - 053 '/' '?' nop nop '/' '?' nop nop O + 053 '/' '?' 0x1f nop '/' '?' nop nop O 054 rshift rshift rshift rshift rshift rshift rshift rshift O 055 '*' '*' '*' '*' '*' '*' '*' '*' O 056 lalt lalt lalt lalt lalt lalt lalt lalt O From owner-svn-src-all@freebsd.org Thu Jan 25 21:36:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49FDBECEE81; Thu, 25 Jan 2018 21:36:27 +0000 (UTC) (envelope-from wosch@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0016E72B36; Thu, 25 Jan 2018 21:36:27 +0000 (UTC) (envelope-from wosch@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4FEA127FB; Thu, 25 Jan 2018 21:36:26 +0000 (UTC) (envelope-from wosch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PLaQ5q098165; Thu, 25 Jan 2018 21:36:26 GMT (envelope-from wosch@FreeBSD.org) Received: (from wosch@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PLaQw0098164; Thu, 25 Jan 2018 21:36:26 GMT (envelope-from wosch@FreeBSD.org) Message-Id: <201801252136.w0PLaQw0098164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wosch set sender to wosch@FreeBSD.org using -f From: Wolfram Schneider Date: Thu, 25 Jan 2018 21:36:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328413 - head X-SVN-Group: head X-SVN-Commit-Author: wosch X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 328413 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 21:36:27 -0000 Author: wosch Date: Thu Jan 25 21:36:26 2018 New Revision: 328413 URL: https://svnweb.freebsd.org/changeset/base/328413 Log: `make installkernel' should display a completed message if done PR: 225159 Reviewed by: bdrewery Approved by: cem (mentor) Differential Revision: https://reviews.freebsd.org/D13940 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Jan 25 21:13:42 2018 (r328412) +++ head/Makefile.inc1 Thu Jan 25 21:36:26 2018 (r328413) @@ -1447,20 +1447,26 @@ reinstallkernel reinstallkernel.debug: _installcheck_k false .endif @echo "--------------------------------------------------------------" - @echo ">>> Installing kernel ${INSTALLKERNEL}" + @echo ">>> Installing kernel ${INSTALLKERNEL} on $$(LC_ALL=C date)" @echo "--------------------------------------------------------------" ${_+_}cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ ${CROSSENV} PATH=${TMPPATH} \ ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} + @echo "--------------------------------------------------------------" + @echo ">>> Installing kernel ${INSTALLKERNEL} completed on $$(LC_ALL=C date)" + @echo "--------------------------------------------------------------" .endif .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" .for _kernel in ${BUILDKERNELS:[2..-1]} @echo "--------------------------------------------------------------" - @echo ">>> Installing kernel ${_kernel}" + @echo ">>> Installing kernel ${_kernel} $$(LC_ALL=C date)" @echo "--------------------------------------------------------------" ${_+_}cd ${KRNLOBJDIR}/${_kernel}; \ ${CROSSENV} PATH=${TMPPATH} \ ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME}.${_kernel} ${.TARGET:S/kernel//} + @echo "--------------------------------------------------------------" + @echo ">>> Installing kernel ${_kernel} completed on $$(LC_ALL=C date)" + @echo "--------------------------------------------------------------" .endfor .endif From owner-svn-src-all@freebsd.org Thu Jan 25 21:38:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92F83ECF113; Thu, 25 Jan 2018 21:38:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F1DF72D46; Thu, 25 Jan 2018 21:38:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29FC612809; Thu, 25 Jan 2018 21:38:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PLcAL1098275; Thu, 25 Jan 2018 21:38:10 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PLcA7t098274; Thu, 25 Jan 2018 21:38:10 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801252138.w0PLcA7t098274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 25 Jan 2018 21:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328414 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 328414 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 21:38:10 -0000 Author: imp Date: Thu Jan 25 21:38:09 2018 New Revision: 328414 URL: https://svnweb.freebsd.org/changeset/base/328414 Log: When devices are invalidated, there's some cases where ccbs for that device still wind up in xpt_done after the path has been invalidated. Since we don't always need sim or devq, add some guard rails to only fail if we have to use them. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D14040 Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Thu Jan 25 21:36:26 2018 (r328413) +++ head/sys/cam/cam_xpt.c Thu Jan 25 21:38:09 2018 (r328414) @@ -5374,8 +5374,8 @@ xpt_path_mtx(struct cam_path *path) static void xpt_done_process(struct ccb_hdr *ccb_h) { - struct cam_sim *sim; - struct cam_devq *devq; + struct cam_sim *sim = NULL; + struct cam_devq *devq = NULL; struct mtx *mtx = NULL; #if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) @@ -5418,9 +5418,15 @@ xpt_done_process(struct ccb_hdr *ccb_h) mtx_unlock(&xsoftc.xpt_highpower_lock); } - sim = ccb_h->path->bus->sim; + /* + * Insulate against a race where the periph is destroyed + * but CCBs are still not all processed. + */ + if (ccb_h->path->bus) + sim = ccb_h->path->bus->sim; if (ccb_h->status & CAM_RELEASE_SIMQ) { + KASSERT(sim, ("sim missing for CAM_RELEASE_SIMQ request")); xpt_release_simq(sim, /*run_queue*/FALSE); ccb_h->status &= ~CAM_RELEASE_SIMQ; } @@ -5431,9 +5437,12 @@ xpt_done_process(struct ccb_hdr *ccb_h) ccb_h->status &= ~CAM_DEV_QFRZN; } - devq = sim->devq; if ((ccb_h->func_code & XPT_FC_USER_CCB) == 0) { struct cam_ed *dev = ccb_h->path->device; + + if (sim) + devq = sim->devq; + KASSERT(devq, ("sim missing for XPT_FC_USER_CCB request")); mtx_lock(&devq->send_mtx); devq->send_active--; From owner-svn-src-all@freebsd.org Thu Jan 25 21:38:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51225ECF16B; Thu, 25 Jan 2018 21:38:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0239772E6C; Thu, 25 Jan 2018 21:38:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F14011280E; Thu, 25 Jan 2018 21:38:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PLcU4c098334; Thu, 25 Jan 2018 21:38:30 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PLcU2v098331; Thu, 25 Jan 2018 21:38:30 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801252138.w0PLcU2v098331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 25 Jan 2018 21:38:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328415 - in head/sys: cam/scsi conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: cam/scsi conf X-SVN-Commit-Revision: 328415 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 21:38:31 -0000 Author: imp Date: Thu Jan 25 21:38:30 2018 New Revision: 328415 URL: https://svnweb.freebsd.org/changeset/base/328415 Log: Track Ref / DeRef and Hold / Unhold that da is doing to track down leaks. We assume each source can be taken / dropped only once and don't recurse. These are only enabled via DA_TRACK_REFS or INVARIANTS. There appreas to be a reference leak under extreme load, and these should help us colaberatively work it out. It also documents better the reference / holding protocol better. Reviewed by: ken@, scottl@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D14040 Modified: head/sys/cam/scsi/scsi_da.c head/sys/conf/options Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Thu Jan 25 21:38:09 2018 (r328414) +++ head/sys/cam/scsi/scsi_da.c Thu Jan 25 21:38:30 2018 (r328415) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef _KERNEL +#include "opt_da.h" #include #include #include @@ -51,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #endif /* _KERNEL */ #ifndef _KERNEL @@ -291,6 +293,18 @@ struct disk_params { #define DA_WORK_TUR (1 << 16) +typedef enum { + DA_REF_OPEN = 1, + DA_REF_OPEN_HOLD, + DA_REF_CLOSE_HOLD, + DA_REF_PROBE_HOLD, + DA_REF_TUR, + DA_REF_GEOM, + DA_REF_SYSCTL, + DA_REF_REPROBE, + DA_REF_MAX /* KEEP LAST */ +} da_ref_token; + struct da_softc { struct cam_iosched_softc *cam_iosched; struct bio_queue_head delete_run_queue; @@ -335,6 +349,7 @@ struct da_softc { uint8_t unmap_buf[UNMAP_BUF_SIZE]; struct scsi_read_capacity_data_long rcaplong; struct callout mediapoll_c; + int ref_flags[DA_REF_MAX]; #ifdef CAM_IO_STATS struct sysctl_ctx_list sysctl_stats_ctx; struct sysctl_oid *sysctl_stats_tree; @@ -1469,6 +1484,143 @@ PERIPHDRIVER_DECLARE(da, dadriver); static MALLOC_DEFINE(M_SCSIDA, "scsi_da", "scsi_da buffers"); +/* + * This driver takes out references / holds in well defined pairs, never + * recursively. These macros / inline functions enforce those rules. They + * are only enabled with DA_TRACK_REFS or INVARIANTS. If DA_TRACK_REFS is + * defined to be 2 or larger, the tracking also includes debug printfs. + */ +#if defined(DA_TRACK_REFS) || defined(INVARIANTS) + +#ifndef DA_TRACK_REFS +#define DA_TRACK_REFS 1 +#endif + +#if DA_TRACK_REFS > 1 +#define CAM_PERIPH_PRINT(p, msg, args...) \ + printf("%s%d:" msg, (periph)->periph_name, (periph)->unit_number, ##args) + +static const char *da_ref_text[] = { + "bogus", + "open", + "open hold", + "close hold", + "reprobe hold", + "Test Unit Ready", + "Geom", + "sysctl", + "reprobe", + "max -- also bogus" +}; + +#else +#define CAM_PERIPH_PRINT(p, msg, args...) +#endif + +static inline void +token_sanity(da_ref_token token) +{ + if ((unsigned)token >= DA_REF_MAX) + panic("Bad token value passed in %d\n", token); +} + +static inline int +da_periph_hold(struct cam_periph *periph, int priority, da_ref_token token) +{ + int err = cam_periph_hold(periph, priority); + + token_sanity(token); + CAM_PERIPH_PRINT(periph, "Holding device %s (%d): %d\n", + da_ref_text[token], token, err); + if (err == 0) { + int cnt; + struct da_softc *softc = periph->softc; + + cnt = atomic_fetchadd_int(&softc->ref_flags[token], 1); + if (cnt != 0) + panic("Re-holding for reason %d, cnt = %d", token, cnt); + } + return (err); +} + +static inline void +da_periph_unhold(struct cam_periph *periph, da_ref_token token) +{ + int cnt; + struct da_softc *softc = periph->softc; + + token_sanity(token); + cam_periph_unhold(periph); + CAM_PERIPH_PRINT(periph, "Unholding device %s (%d)\n", + da_ref_text[token], token); + cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1); + if (cnt != 1) + panic("Unholding %d with cnt = %d", token, cnt); +} + +static inline int +da_periph_acquire(struct cam_periph *periph, da_ref_token token) +{ + int err = cam_periph_acquire(periph); + + token_sanity(token); + CAM_PERIPH_PRINT(periph, "acquiring device %s (%d): %d\n", + da_ref_text[token], token, err); + if (err == CAM_REQ_CMP) { + int cnt; + struct da_softc *softc = periph->softc; + + cnt = atomic_fetchadd_int(&softc->ref_flags[token], 1); + if (cnt != 0) + panic("Re-refing for reason %d, cnt = %d", token, cnt); + } + return (err); +} + +static inline void +da_periph_release(struct cam_periph *periph, da_ref_token token) +{ + int cnt; + struct da_softc *softc = periph->softc; + + token_sanity(token); + cam_periph_release(periph); + CAM_PERIPH_PRINT(periph, "releasing device %s (%d)\n", + da_ref_text[token], token); + cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1); + if (cnt != 1) + panic("Unholding %d with cnt = %d", token, cnt); +} + +static inline void +da_periph_release_locked(struct cam_periph *periph, da_ref_token token) +{ + int cnt; + struct da_softc *softc = periph->softc; + + token_sanity(token); + cam_periph_release_locked(periph); + CAM_PERIPH_PRINT(periph, "releasing device (locked) %s (%d)\n", + da_ref_text[token], token); + cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1); + if (cnt != 1) + panic("Unholding %d with cnt = %d", token, cnt); +} + +#define cam_periph_hold POISON +#define cam_periph_unhold POISON +#define cam_periph_acquire POISON +#define cam_periph_release POISON +#define cam_periph_release_locked POISON + +#else +#define da_periph_hold(periph, prio, token) cam_periph_hold((periph), (prio)) +#define da_periph_unhold(periph, token) cam_periph_unhold((periph)) +#define da_periph_acquire(periph, token) cam_periph_acquire((periph)) +#define da_periph_release(periph, token) cam_periph_release((periph)) +#define da_periph_release_locked(periph, token) cam_periph_release_locked((periph)) +#endif + static int daopen(struct disk *dp) { @@ -1477,14 +1629,14 @@ daopen(struct disk *dp) int error; periph = (struct cam_periph *)dp->d_drv1; - if (cam_periph_acquire(periph) != CAM_REQ_CMP) { + if (da_periph_acquire(periph, DA_REF_OPEN) != CAM_REQ_CMP) { return (ENXIO); } cam_periph_lock(periph); - if ((error = cam_periph_hold(periph, PRIBIO|PCATCH)) != 0) { + if ((error = da_periph_hold(periph, PRIBIO|PCATCH, DA_REF_OPEN_HOLD)) != 0) { cam_periph_unlock(periph); - cam_periph_release(periph); + da_periph_release(periph, DA_REF_OPEN); return (error); } @@ -1512,11 +1664,11 @@ daopen(struct disk *dp) softc->flags |= DA_FLAG_OPEN; } - cam_periph_unhold(periph); + da_periph_unhold(periph, DA_REF_OPEN_HOLD); cam_periph_unlock(periph); if (error != 0) - cam_periph_release(periph); + da_periph_release(periph, DA_REF_OPEN); return (error); } @@ -1534,7 +1686,7 @@ daclose(struct disk *dp) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("daclose\n")); - if (cam_periph_hold(periph, PRIBIO) == 0) { + if (da_periph_hold(periph, PRIBIO, DA_REF_CLOSE_HOLD) == 0) { /* Flush disk cache. */ if ((softc->flags & DA_FLAG_DIRTY) != 0 && @@ -1557,7 +1709,7 @@ daclose(struct disk *dp) (softc->quirks & DA_Q_NO_PREVENT) == 0) daprevent(periph, PR_ALLOW); - cam_periph_unhold(periph); + da_periph_unhold(periph, DA_REF_CLOSE_HOLD); } /* @@ -1572,7 +1724,7 @@ daclose(struct disk *dp) while (softc->refcount != 0) cam_periph_sleep(periph, &softc->refcount, PRIBIO, "daclose", 1); cam_periph_unlock(periph); - cam_periph_release(periph); + da_periph_release(periph, DA_REF_OPEN); return (0); } @@ -1750,7 +1902,7 @@ dadiskgonecb(struct disk *dp) struct cam_periph *periph; periph = (struct cam_periph *)dp->d_drv1; - cam_periph_release(periph); + da_periph_release(periph, DA_REF_GEOM); } static void @@ -1910,7 +2062,7 @@ daasync(void *callback_arg, u_int32_t code, case AC_SCSI_AEN: softc = (struct da_softc *)periph->softc; if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { - if (cam_periph_acquire(periph) == CAM_REQ_CMP) { + if (da_periph_acquire(periph, DA_REF_TUR) == CAM_REQ_CMP) { cam_iosched_set_work_flags(softc->cam_iosched, DA_WORK_TUR); daschedule(periph); } @@ -1955,7 +2107,7 @@ dasysctlinit(void *context, int pending) * periph was held for us when this task was enqueued */ if (periph->flags & CAM_PERIPH_INVALID) { - cam_periph_release(periph); + da_periph_release(periph, DA_REF_SYSCTL); return; } @@ -1970,7 +2122,7 @@ dasysctlinit(void *context, int pending) CTLFLAG_RD, 0, tmpstr, "device_index"); if (softc->sysctl_tree == NULL) { printf("dasysctlinit: unable to allocate sysctl tree\n"); - cam_periph_release(periph); + da_periph_release(periph, DA_REF_SYSCTL); return; } @@ -2052,7 +2204,7 @@ dasysctlinit(void *context, int pending) xpt_action((union ccb *)&cts); cam_periph_unlock(periph); if (cts.ccb_h.status != CAM_REQ_CMP) { - cam_periph_release(periph); + da_periph_release(periph, DA_REF_SYSCTL); return; } if (cts.protocol == PROTO_SCSI && cts.transport == XPORT_FC) { @@ -2103,7 +2255,7 @@ dasysctlinit(void *context, int pending) cam_iosched_sysctl_init(softc->cam_iosched, &softc->sysctl_ctx, softc->sysctl_tree); - cam_periph_release(periph); + da_periph_release(periph, DA_REF_SYSCTL); } static int @@ -2269,9 +2421,9 @@ daprobedone(struct cam_periph *periph, union ccb *ccb) wakeup(&softc->disk->d_mediasize); if ((softc->flags & DA_FLAG_ANNOUNCED) == 0) { softc->flags |= DA_FLAG_ANNOUNCED; - cam_periph_unhold(periph); + da_periph_unhold(periph, DA_REF_PROBE_HOLD); } else - cam_periph_release_locked(periph); + da_periph_release_locked(periph, DA_REF_REPROBE); } static void @@ -2484,8 +2636,10 @@ daregister(struct cam_periph *periph, void *arg) * Take an exclusive refcount on the periph while dastart is called * to finish the probe. The reference will be dropped in dadone at * the end of probe. + * + * XXX if cam_periph_hold returns an error, we don't hold a refcount. */ - (void)cam_periph_hold(periph, PRIBIO); + (void)da_periph_hold(periph, PRIBIO, DA_REF_PROBE_HOLD); /* * Schedule a periodic event to occasionally send an @@ -2579,7 +2733,7 @@ daregister(struct cam_periph *periph, void *arg) * We'll release this reference once GEOM calls us back (via * dadiskgonecb()) telling us that our provider has been freed. */ - if (cam_periph_acquire(periph) != CAM_REQ_CMP) { + if (da_periph_acquire(periph, DA_REF_GEOM) != CAM_REQ_CMP) { xpt_print(periph->path, "%s: lost periph during " "registration!\n", __func__); cam_periph_lock(periph); @@ -2965,7 +3119,7 @@ more: if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); - cam_periph_release_locked(periph); + da_periph_release_locked(periph, DA_REF_TUR); } if ((bp->bio_flags & BIO_ORDERED) != 0 || @@ -4547,7 +4701,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) * we have successfully attached. */ /* increase the refcount */ - if (cam_periph_acquire(periph) == CAM_REQ_CMP) { + if (da_periph_acquire(periph, DA_REF_SYSCTL) == CAM_REQ_CMP) { taskqueue_enqueue(taskqueue_thread, &softc->sysctl_task); @@ -5392,7 +5546,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) /*getcount_only*/0); } xpt_release_ccb(done_ccb); - cam_periph_release_locked(periph); + da_periph_release_locked(periph, DA_REF_TUR); return; } default: @@ -5413,7 +5567,7 @@ dareprobe(struct cam_periph *periph) if (softc->state != DA_STATE_NORMAL) return; - status = cam_periph_acquire(periph); + status = da_periph_acquire(periph, DA_REF_REPROBE); KASSERT(status == CAM_REQ_CMP, ("dareprobe: cam_periph_acquire failed")); @@ -5513,7 +5667,7 @@ damediapoll(void *arg) if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR) && LIST_EMPTY(&softc->pending_ccbs)) { - if (cam_periph_acquire(periph) == CAM_REQ_CMP) { + if (da_periph_acquire(periph, DA_REF_TUR) == CAM_REQ_CMP) { cam_iosched_set_work_flags(softc->cam_iosched, DA_WORK_TUR); daschedule(periph); } Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Jan 25 21:38:09 2018 (r328414) +++ head/sys/conf/options Thu Jan 25 21:38:30 2018 (r328415) @@ -345,6 +345,9 @@ ATA_STATIC_ID opt_ada.h CHANGER_MIN_BUSY_SECONDS opt_cd.h CHANGER_MAX_BUSY_SECONDS opt_cd.h +# Options used only in cam/scsi/scsi_da.c +DA_TRACK_REFS opt_da.h + # Options used only in cam/scsi/scsi_sa.c. SA_IO_TIMEOUT opt_sa.h SA_SPACE_TIMEOUT opt_sa.h From owner-svn-src-all@freebsd.org Thu Jan 25 21:48:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAE58ECFBB8; Thu, 25 Jan 2018 21:48:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C29B73687; Thu, 25 Jan 2018 21:48:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5715B129BE; Thu, 25 Jan 2018 21:48:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PLm7mi003218; Thu, 25 Jan 2018 21:48:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PLm7aB003217; Thu, 25 Jan 2018 21:48:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801252148.w0PLm7aB003217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 25 Jan 2018 21:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328416 - head/sys/modules/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/modules/cam X-SVN-Commit-Revision: 328416 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 21:48:07 -0000 Author: imp Date: Thu Jan 25 21:48:07 2018 New Revision: 328416 URL: https://svnweb.freebsd.org/changeset/base/328416 Log: Add new opt_da.h for stand-alone build. Sponsored by: Netflix Modified: head/sys/modules/cam/Makefile Modified: head/sys/modules/cam/Makefile ============================================================================== --- head/sys/modules/cam/Makefile Thu Jan 25 21:38:30 2018 (r328415) +++ head/sys/modules/cam/Makefile Thu Jan 25 21:48:07 2018 (r328416) @@ -11,6 +11,7 @@ SRCS= opt_cam.h SRCS+= opt_ada.h SRCS+= opt_scsi.h SRCS+= opt_cd.h +SRCS+= opt_da.h SRCS+= opt_pt.h SRCS+= opt_sa.h SRCS+= opt_ses.h From owner-svn-src-all@freebsd.org Thu Jan 25 22:25:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 536FAED1AFF; Thu, 25 Jan 2018 22:25:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F37E074FAF; Thu, 25 Jan 2018 22:25:14 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE48D13051; Thu, 25 Jan 2018 22:25:14 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PMPEqt023058; Thu, 25 Jan 2018 22:25:14 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PMPDVQ023040; Thu, 25 Jan 2018 22:25:13 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801252225.w0PMPDVQ023040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 25 Jan 2018 22:25:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328417 - in head/sys: contrib/ipfilter/netinet fs/nfs fs/nfsclient fs/nfsserver netinet nfsclient sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: contrib/ipfilter/netinet fs/nfs fs/nfsclient fs/nfsserver netinet nfsclient sys X-SVN-Commit-Revision: 328417 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 22:25:15 -0000 Author: cem Date: Thu Jan 25 22:25:13 2018 New Revision: 328417 URL: https://svnweb.freebsd.org/changeset/base/328417 Log: style: Remove remaining deprecated MALLOC/FREE macros Mechanically replace uses of MALLOC/FREE with appropriate invocations of malloc(9) / free(9) (a series of sed expressions). Something like: * MALLOC(a, b, ... -> a = malloc(... * FREE( -> free( * free((caddr_t) -> free( No functional change. For now, punt on modifying contrib ipfilter code, leaving a definition of the macro in its KMALLOC(). Reported by: jhb Reviewed by: cy, imp, markj, rmacklem Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14035 Modified: head/sys/contrib/ipfilter/netinet/ip_compat.h head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfsport.h head/sys/fs/nfsclient/nfs_clcomsubs.c head/sys/fs/nfsclient/nfs_clnode.c head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clrpcops.c head/sys/fs/nfsclient/nfs_clstate.c head/sys/fs/nfsclient/nfs_clsubs.c head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/fs/nfsclient/nfsnode.h head/sys/fs/nfsserver/nfs_nfsdcache.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdserv.c head/sys/fs/nfsserver/nfs_nfsdstate.c head/sys/netinet/ip_mroute.c head/sys/nfsclient/nfsnode.h head/sys/sys/malloc.h Modified: head/sys/contrib/ipfilter/netinet/ip_compat.h ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_compat.h Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/contrib/ipfilter/netinet/ip_compat.h Thu Jan 25 22:25:13 2018 (r328417) @@ -530,16 +530,16 @@ MALLOC_DECLARE(M_IPFILTER); # endif /* M_PFIL */ # endif /* IPFILTER_M_IPFILTER */ # if !defined(KMALLOC) -# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), _M_IPF, M_NOWAIT) +# define KMALLOC(a, b) (a) = (b)malloc(sizeof(*(a)), _M_IPF, M_NOWAIT) # endif # if !defined(KMALLOCS) -# define KMALLOCS(a, b, c) MALLOC((a), b, (c), _M_IPF, M_NOWAIT) +# define KMALLOCS(a, b, c) (a) = (b)malloc((c), _M_IPF, M_NOWAIT) # endif # if !defined(KFREE) -# define KFREE(x) FREE((x), _M_IPF) +# define KFREE(x) free((x), _M_IPF) # endif # if !defined(KFREES) -# define KFREES(x,s) FREE((x), _M_IPF) +# define KFREES(x,s) free((x), _M_IPF) # endif # define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,d) # define SLEEP(id, n) tsleep((id), PPAUSE|PCATCH, n, 0) Modified: head/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- head/sys/fs/nfs/nfs_commonkrpc.c Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfs/nfs_commonkrpc.c Thu Jan 25 22:25:13 2018 (r328417) @@ -676,7 +676,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmo * outstanding RPCs for nfsv4 client requests. */ if ((nd->nd_flag & ND_NFSV4) && procnum == NFSV4PROC_COMPOUND) - MALLOC(rep, struct nfsreq *, sizeof(struct nfsreq), + rep = malloc(sizeof(struct nfsreq), M_NFSDREQ, M_WAITOK); #ifdef KDTRACE_HOOKS if (dtrace_nfscl_nfs234_start_probe != NULL) { @@ -798,7 +798,7 @@ tryagain: if (usegssname == 0) AUTH_DESTROY(auth); if (rep != NULL) - FREE((caddr_t)rep, M_NFSDREQ); + free(rep, M_NFSDREQ); if (set_sigset) newnfs_restore_sigmask(td, &oldset); return (error); @@ -1098,7 +1098,7 @@ tryagain: if (usegssname == 0) AUTH_DESTROY(auth); if (rep != NULL) - FREE((caddr_t)rep, M_NFSDREQ); + free(rep, M_NFSDREQ); if (set_sigset) newnfs_restore_sigmask(td, &oldset); return (0); @@ -1108,7 +1108,7 @@ nfsmout: if (usegssname == 0) AUTH_DESTROY(auth); if (rep != NULL) - FREE((caddr_t)rep, M_NFSDREQ); + free(rep, M_NFSDREQ); if (set_sigset) newnfs_restore_sigmask(td, &oldset); return (error); Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfs/nfs_commonsubs.c Thu Jan 25 22:25:13 2018 (r328417) @@ -677,11 +677,11 @@ nfsm_getfh(struct nfsrv_descript *nd, struct nfsfh **n } } else len = NFSX_V2FH; - MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + len, + nfhp = malloc(sizeof (struct nfsfh) + len, M_NFSFH, M_WAITOK); error = nfsrv_mtostr(nd, nfhp->nfh_fh, len); if (error) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); goto nfsmout; } nfhp->nfh_len = len; @@ -1200,11 +1200,11 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, !NFSRV_CMPFH(tnfhp->nfh_fh, tfhsize, fhp, fhsize)) *retcmpp = NFSERR_NOTSAME; - FREE((caddr_t)tnfhp, M_NFSFH); + free(tnfhp, M_NFSFH); } else if (nfhpp != NULL) { *nfhpp = tnfhp; } else { - FREE((caddr_t)tnfhp, M_NFSFH); + free(tnfhp, M_NFSFH); } attrsum += (NFSX_UNSIGNED + NFSM_RNDUP(tfhsize)); break; @@ -3832,7 +3832,7 @@ nfsrv_getrefstr(struct nfsrv_descript *nd, u_char **fs cp3 += stringlen; *cp3 = '\0'; siz += (lsp->len + stringlen + 2); - free((caddr_t)lsp, M_TEMP); + free(lsp, M_TEMP); } } *fsrootp = cp; Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfs/nfsport.h Thu Jan 25 22:25:13 2018 (r328417) @@ -630,7 +630,7 @@ void nfsrvd_rcv(struct socket *, void *, int); #define NFSSOCKADDR(a, t) ((t)(a)) #define NFSSOCKADDRALLOC(a) \ do { \ - MALLOC((a), struct sockaddr *, sizeof (struct sockaddr), \ + (a) = malloc(sizeof (struct sockaddr), \ M_SONAME, M_WAITOK); \ NFSBZERO((a), sizeof (struct sockaddr)); \ } while (0) @@ -638,7 +638,7 @@ void nfsrvd_rcv(struct socket *, void *, int); #define NFSSOCKADDRFREE(a) \ do { \ if (a) \ - FREE((caddr_t)(a), M_SONAME); \ + free((a), M_SONAME); \ } while (0) /* Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clcomsubs.c Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfsclient/nfs_clcomsubs.c Thu Jan 25 22:25:13 2018 (r328417) @@ -499,7 +499,7 @@ nfscl_getcookie(struct nfsnode *np, off_t off, int add dp = LIST_FIRST(&np->n_cookies); if (!dp) { if (add) { - MALLOC(dp, struct nfsdmap *, sizeof (struct nfsdmap), + dp = malloc(sizeof (struct nfsdmap), M_NFSDIROFF, M_WAITOK); dp->ndm_eocookie = 0; LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list); @@ -514,7 +514,7 @@ nfscl_getcookie(struct nfsnode *np, off_t off, int add return (NULL); dp = LIST_NEXT(dp, ndm_list); } else if (add) { - MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap), + dp2 = malloc(sizeof (struct nfsdmap), M_NFSDIROFF, M_WAITOK); dp2->ndm_eocookie = 0; LIST_INSERT_AFTER(dp, dp2, ndm_list); Modified: head/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clnode.c Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfsclient/nfs_clnode.c Thu Jan 25 22:25:13 2018 (r328417) @@ -111,13 +111,13 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize hash = fnv_32_buf(fhp, fhsize, FNV1_32_INIT); - MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + fhsize, + nfhp = malloc(sizeof (struct nfsfh) + fhsize, M_NFSFH, M_WAITOK); bcopy(fhp, &nfhp->nfh_fh[0], fhsize); nfhp->nfh_len = fhsize; error = vfs_hash_get(mntp, hash, lkflags, td, &nvp, newnfs_vncmpf, nfhp); - FREE(nfhp, M_NFSFH); + free(nfhp, M_NFSFH); if (error) return (error); if (nvp != NULL) { @@ -163,14 +163,14 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize vp->v_vflag |= VV_ROOT; } - MALLOC(np->n_fhp, struct nfsfh *, sizeof (struct nfsfh) + fhsize, + np->n_fhp = malloc(sizeof (struct nfsfh) + fhsize, M_NFSFH, M_WAITOK); bcopy(fhp, np->n_fhp->nfh_fh, fhsize); np->n_fhp->nfh_len = fhsize; error = insmntque(vp, mntp); if (error != 0) { *npp = NULL; - FREE((caddr_t)np->n_fhp, M_NFSFH); + free(np->n_fhp, M_NFSFH); mtx_destroy(&np->n_mtx); lockdestroy(&np->n_excl); uma_zfree(newnfsnode_zone, np); @@ -329,14 +329,14 @@ ncl_reclaim(struct vop_reclaim_args *ap) while (dp) { dp2 = dp; dp = LIST_NEXT(dp, ndm_list); - FREE((caddr_t)dp2, M_NFSDIROFF); + free(dp2, M_NFSDIROFF); } } if (np->n_writecred != NULL) crfree(np->n_writecred); - FREE((caddr_t)np->n_fhp, M_NFSFH); + free(np->n_fhp, M_NFSFH); if (np->n_v4 != NULL) - FREE((caddr_t)np->n_v4, M_NFSV4NODE); + free(np->n_v4, M_NFSV4NODE); mtx_destroy(&np->n_mtx); lockdestroy(&np->n_excl); uma_zfree(newnfsnode_zone, vp->v_data); Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfsclient/nfs_clport.c Thu Jan 25 22:25:13 2018 (r328417) @@ -163,7 +163,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru } } if (error) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); return (error); } if (nvp != NULL) { @@ -181,7 +181,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru dnp->n_fhp->nfh_len != np->n_v4->n4_fhlen || NFSBCMP(dnp->n_fhp->nfh_fh, np->n_v4->n4_data, dnp->n_fhp->nfh_len))) { - MALLOC(newd, struct nfsv4node *, + newd = malloc( sizeof (struct nfsv4node) + dnp->n_fhp->nfh_len + + cnp->cn_namelen - 1, M_NFSV4NODE, M_WAITOK); NFSLOCKNODE(np); @@ -205,11 +205,11 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru NFSUNLOCKNODE(np); } if (newd != NULL) - FREE((caddr_t)newd, M_NFSV4NODE); + free(newd, M_NFSV4NODE); if (oldd != NULL) - FREE((caddr_t)oldd, M_NFSV4NODE); + free(oldd, M_NFSV4NODE); *npp = np; - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); return (0); } np = uma_zalloc(newnfsnode_zone, M_WAITOK | M_ZERO); @@ -217,7 +217,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru error = getnewvnode(nfs_vnode_tag, mntp, &newnfs_vnodeops, &nvp); if (error) { uma_zfree(newnfsnode_zone, np); - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); return (error); } vp = nvp; @@ -252,7 +252,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru * file name, so that Open Ops can be done later. */ if (nmp->nm_flag & NFSMNT_NFSV4) { - MALLOC(np->n_v4, struct nfsv4node *, sizeof (struct nfsv4node) + np->n_v4 = malloc(sizeof (struct nfsv4node) + dnp->n_fhp->nfh_len + cnp->cn_namelen - 1, M_NFSV4NODE, M_WAITOK); np->n_v4->n4_fhlen = dnp->n_fhp->nfh_len; @@ -276,9 +276,9 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru *npp = NULL; mtx_destroy(&np->n_mtx); lockdestroy(&np->n_excl); - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); if (np->n_v4 != NULL) - FREE((caddr_t)np->n_v4, M_NFSV4NODE); + free(np->n_v4, M_NFSV4NODE); uma_zfree(newnfsnode_zone, np); return (error); } @@ -320,7 +320,7 @@ nfscl_ngetreopen(struct mount *mntp, u_int8_t *fhp, in /* For forced dismounts, just return error. */ if (NFSCL_FORCEDISM(mntp)) return (EINTR); - MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + fhsize, + nfhp = malloc(sizeof (struct nfsfh) + fhsize, M_NFSFH, M_WAITOK); bcopy(fhp, &nfhp->nfh_fh[0], fhsize); nfhp->nfh_len = fhsize; @@ -355,7 +355,7 @@ nfscl_ngetreopen(struct mount *mntp, u_int8_t *fhp, in } } } - FREE(nfhp, M_NFSFH); + free(nfhp, M_NFSFH); if (error) return (error); if (nvp != NULL) { Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Thu Jan 25 22:25:13 2018 (r328417) @@ -538,7 +538,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int NFSCLFLAGS_FIRSTDELEG)) op->nfso_own->nfsow_clp->nfsc_flags |= (NFSCLFLAGS_FIRSTDELEG | NFSCLFLAGS_GOTDELEG); - MALLOC(ndp, struct nfscldeleg *, + ndp = malloc( sizeof (struct nfscldeleg) + newfhlen, M_NFSCLDELEG, M_WAITOK); LIST_INIT(&ndp->nfsdl_owner); @@ -634,7 +634,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int } while (ret == NFSERR_DELAY); if (ret) { if (ndp != NULL) { - FREE((caddr_t)ndp, M_NFSCLDELEG); + free(ndp, M_NFSCLDELEG); ndp = NULL; } if (ret == NFSERR_STALECLIENTID || @@ -652,7 +652,7 @@ nfsmout: if (!error) *dpp = ndp; else if (ndp != NULL) - FREE((caddr_t)ndp, M_NFSCLDELEG); + free(ndp, M_NFSCLDELEG); mbuf_freem(nd->nd_mrep); return (error); } @@ -1324,7 +1324,7 @@ nfsrpc_lookup(vnode_t dvp, char *name, int len, struct * Just return the current dir's fh. */ np = VTONFS(dvp); - MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + + nfhp = malloc(sizeof (struct nfsfh) + np->n_fhp->nfh_len, M_NFSFH, M_WAITOK); nfhp->nfh_len = np->n_fhp->nfh_len; NFSBCOPY(np->n_fhp->nfh_fh, nfhp->nfh_fh, nfhp->nfh_len); @@ -1356,7 +1356,7 @@ nfsrpc_lookup(vnode_t dvp, char *name, int len, struct */ if (nd->nd_repstat == NFSERR_NOENT && lookupp) { np = VTONFS(dvp); - MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + + nfhp = malloc(sizeof (struct nfsfh) + np->n_fhp->nfh_len, M_NFSFH, M_WAITOK); nfhp->nfh_len = np->n_fhp->nfh_len; NFSBCOPY(np->n_fhp->nfh_fh, nfhp->nfh_fh, nfhp->nfh_len); @@ -2182,7 +2182,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, int namelen, NFSCLFLAGS_FIRSTDELEG)) owp->nfsow_clp->nfsc_flags |= (NFSCLFLAGS_FIRSTDELEG | NFSCLFLAGS_GOTDELEG); - MALLOC(dp, struct nfscldeleg *, + dp = malloc( sizeof (struct nfscldeleg) + NFSX_V4FHMAX, M_NFSCLDELEG, M_WAITOK); LIST_INIT(&dp->nfsdl_owner); @@ -2296,7 +2296,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, int namelen, } while (ret == NFSERR_DELAY); if (ret) { if (dp != NULL) { - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); dp = NULL; } if (ret == NFSERR_STALECLIENTID || @@ -2316,7 +2316,7 @@ nfsmout: if (!error) *dpp = dp; else if (dp != NULL) - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); mbuf_freem(nd->nd_mrep); return (error); } @@ -3568,7 +3568,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui goto nfsmout; } if (!attrflag && nfhp != NULL) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); nfhp = NULL; } } else { @@ -3616,7 +3616,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui VREF(vp); newvp = vp; unlocknewvp = 0; - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); np = dnp; } else if (isdotdot != 0) { /* @@ -3674,7 +3674,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui } } } else if (nfhp != NULL) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); } NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); more_dirs = fxdr_unsigned(int, *tl); Modified: head/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clstate.c Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfsclient/nfs_clstate.c Thu Jan 25 22:25:13 2018 (r328417) @@ -234,16 +234,16 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_in * Might need one or both of these, so MALLOC them now, to * avoid a tsleep() in MALLOC later. */ - MALLOC(nowp, struct nfsclowner *, sizeof (struct nfsclowner), + nowp = malloc(sizeof (struct nfsclowner), M_NFSCLOWNER, M_WAITOK); if (nfhp != NULL) - MALLOC(nop, struct nfsclopen *, sizeof (struct nfsclopen) + + nop = malloc(sizeof (struct nfsclopen) + fhlen - 1, M_NFSCLOPEN, M_WAITOK); ret = nfscl_getcl(vnode_mount(vp), cred, p, 1, &clp); if (ret != 0) { - FREE((caddr_t)nowp, M_NFSCLOWNER); + free(nowp, M_NFSCLOWNER); if (nop != NULL) - FREE((caddr_t)nop, M_NFSCLOPEN); + free(nop, M_NFSCLOPEN); return (ret); } @@ -331,9 +331,9 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_in } NFSUNLOCKCLSTATE(); if (nowp != NULL) - FREE((caddr_t)nowp, M_NFSCLOWNER); + free(nowp, M_NFSCLOWNER); if (nop != NULL) - FREE((caddr_t)nop, M_NFSCLOPEN); + free(nop, M_NFSCLOPEN); if (owpp != NULL) *owpp = owp; if (opp != NULL) @@ -440,7 +440,7 @@ nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int if (mp != NULL && dp != NULL && !NFSMNT_RDONLY(mp) && (dp->nfsdl_flags & NFSCLDL_READ)) { (void) nfscl_trydelegreturn(dp, cred, VFSTONFS(mp), p); - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); *dpp = NULL; return (0); } @@ -466,7 +466,7 @@ nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int */ if (dp != NULL) { printf("Deleg already exists!\n"); - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); *dpp = NULL; } else { *dpp = tdp; @@ -795,7 +795,7 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSP idlen += sizeof (u_int64_t); else idlen += sizeof (u_int64_t) + 16; /* 16 random bytes */ - MALLOC(newclp, struct nfsclclient *, + newclp = malloc( sizeof (struct nfsclclient) + idlen - 1, M_NFSCLCLIENT, M_WAITOK | M_ZERO); } @@ -1012,11 +1012,11 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t * Might need these, so MALLOC them now, to * avoid a tsleep() in MALLOC later. */ - MALLOC(nlp, struct nfscllockowner *, + nlp = malloc( sizeof (struct nfscllockowner), M_NFSCLLOCKOWNER, M_WAITOK); - MALLOC(otherlop, struct nfscllock *, + otherlop = malloc( sizeof (struct nfscllock), M_NFSCLLOCK, M_WAITOK); - MALLOC(nlop, struct nfscllock *, + nlop = malloc( sizeof (struct nfscllock), M_NFSCLLOCK, M_WAITOK); nlop->nfslo_type = type; nlop->nfslo_first = off; @@ -1035,9 +1035,9 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t error = nfscl_getcl(vnode_mount(vp), cred, p, 1, &clp); } if (error) { - FREE((caddr_t)nlp, M_NFSCLLOCKOWNER); - FREE((caddr_t)otherlop, M_NFSCLLOCK); - FREE((caddr_t)nlop, M_NFSCLLOCK); + free(nlp, M_NFSCLLOCKOWNER); + free(otherlop, M_NFSCLLOCK); + free(nlop, M_NFSCLLOCK); return (error); } @@ -1106,9 +1106,9 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t nfscl_clrelease(clp); NFSUNLOCKCLSTATE(); } - FREE((caddr_t)nlp, M_NFSCLLOCKOWNER); - FREE((caddr_t)otherlop, M_NFSCLLOCK); - FREE((caddr_t)nlop, M_NFSCLLOCK); + free(nlp, M_NFSCLLOCKOWNER); + free(otherlop, M_NFSCLLOCK); + free(nlop, M_NFSCLLOCK); return (error); } @@ -1168,11 +1168,11 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t NFSUNLOCKCLSTATE(); if (nlp) - FREE((caddr_t)nlp, M_NFSCLLOCKOWNER); + free(nlp, M_NFSCLLOCKOWNER); if (nlop) - FREE((caddr_t)nlop, M_NFSCLLOCK); + free(nlop, M_NFSCLLOCK); if (otherlop) - FREE((caddr_t)otherlop, M_NFSCLLOCK); + free(otherlop, M_NFSCLLOCK); *lpp = lp; return (0); @@ -1204,7 +1204,7 @@ nfscl_relbytelock(vnode_t vp, u_int64_t off, u_int64_t * Might need these, so MALLOC them now, to * avoid a tsleep() in MALLOC later. */ - MALLOC(nlop, struct nfscllock *, + nlop = malloc( sizeof (struct nfscllock), M_NFSCLLOCK, M_WAITOK); nlop->nfslo_type = F_UNLCK; nlop->nfslo_first = off; @@ -1213,12 +1213,12 @@ nfscl_relbytelock(vnode_t vp, u_int64_t off, u_int64_t } else { nlop->nfslo_end = off + len; if (nlop->nfslo_end <= nlop->nfslo_first) { - FREE((caddr_t)nlop, M_NFSCLLOCK); + free(nlop, M_NFSCLLOCK); return (NFSERR_INVAL); } } if (callcnt == 0) { - MALLOC(other_lop, struct nfscllock *, + other_lop = malloc( sizeof (struct nfscllock), M_NFSCLLOCK, M_WAITOK); *other_lop = *nlop; } @@ -1284,9 +1284,9 @@ nfscl_relbytelock(vnode_t vp, u_int64_t off, u_int64_t } NFSUNLOCKCLSTATE(); if (nlop) - FREE((caddr_t)nlop, M_NFSCLLOCK); + free(nlop, M_NFSCLLOCK); if (other_lop) - FREE((caddr_t)other_lop, M_NFSCLLOCK); + free(other_lop, M_NFSCLLOCK); return (0); } @@ -1464,7 +1464,7 @@ nfscl_freeopen(struct nfsclopen *op, int local) LIST_REMOVE(op, nfso_list); nfscl_freealllocks(&op->nfso_lock, local); - FREE((caddr_t)op, M_NFSCLOPEN); + free(op, M_NFSCLOPEN); if (local) nfsstatsv1.cllocalopens--; else @@ -1520,7 +1520,7 @@ nfscl_expireopen(struct nfsclclient *clp, struct nfscl if (error) { mustdelete = 1; if (dp != NULL) { - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); dp = NULL; } } @@ -1545,7 +1545,7 @@ nfscl_freeopenowner(struct nfsclowner *owp, int local) { LIST_REMOVE(owp, nfsow_list); - FREE((caddr_t)owp, M_NFSCLOWNER); + free(owp, M_NFSCLOWNER); if (local) nfsstatsv1.cllocalopenowners--; else @@ -1564,7 +1564,7 @@ nfscl_freelockowner(struct nfscllockowner *lp, int loc LIST_FOREACH_SAFE(lop, &lp->nfsl_lock, nfslo_list, nlop) { nfscl_freelock(lop, local); } - FREE((caddr_t)lp, M_NFSCLLOCKOWNER); + free(lp, M_NFSCLLOCKOWNER); if (local) nfsstatsv1.cllocallockowners--; else @@ -1579,7 +1579,7 @@ nfscl_freelock(struct nfscllock *lop, int local) { LIST_REMOVE(lop, nfslo_list); - FREE((caddr_t)lop, M_NFSCLLOCK); + free(lop, M_NFSCLLOCK); if (local) nfsstatsv1.cllocallocks--; else @@ -1616,7 +1616,7 @@ nfscl_freedeleg(struct nfscldeleghead *hdp, struct nfs TAILQ_REMOVE(hdp, dp, nfsdl_list); LIST_REMOVE(dp, nfsdl_hash); - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); nfsstatsv1.cldelegates--; nfscl_delegcnt--; } @@ -2104,7 +2104,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c dp->nfsdl_flags &= ~NFSCLDL_NEEDRECLAIM; if ((ndp->nfsdl_flags & NFSCLDL_RECALL)) dp->nfsdl_flags |= NFSCLDL_RECALL; - FREE((caddr_t)ndp, M_NFSCLDELEG); + free(ndp, M_NFSCLDELEG); ndp = NULL; break; } @@ -2160,7 +2160,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c ndp = TAILQ_NEXT(dp, nfsdl_list); if ((dp->nfsdl_flags & NFSCLDL_NEEDRECLAIM)) { if (nowp == NULL) { - MALLOC(nowp, struct nfsclowner *, + nowp = malloc( sizeof (struct nfsclowner), M_NFSCLOWNER, M_WAITOK); /* * Name must be as long an largest possible @@ -2176,7 +2176,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c } nop = NULL; if (error != NFSERR_NOGRACE && error != NFSERR_BADSESSION) { - MALLOC(nop, struct nfsclopen *, sizeof (struct nfsclopen) + + nop = malloc(sizeof (struct nfsclopen) + dp->nfsdl_fhlen - 1, M_NFSCLOPEN, M_WAITOK); nop->nfso_own = nowp; if ((dp->nfsdl_flags & NFSCLDL_WRITE)) { @@ -2218,7 +2218,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c dp->nfsdl_flags &= ~NFSCLDL_NEEDRECLAIM; if ((tdp->nfsdl_flags & NFSCLDL_RECALL)) dp->nfsdl_flags |= NFSCLDL_RECALL; - FREE((caddr_t)tdp, M_NFSCLDELEG); + free(tdp, M_NFSCLDELEG); } else { TAILQ_INSERT_HEAD(&extra_deleg, tdp, nfsdl_list); } @@ -2226,7 +2226,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c } if (error) { if (nop != NULL) - FREE((caddr_t)nop, M_NFSCLOPEN); + free(nop, M_NFSCLOPEN); /* * Couldn't reclaim it, so throw the state * away. Ouch!! @@ -2251,10 +2251,10 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c (void) nfs_catnap(PZERO, error, "nfsexcls"); } while (error == NFSERR_GRACE); LIST_REMOVE(op, nfso_list); - FREE((caddr_t)op, M_NFSCLOPEN); + free(op, M_NFSCLOPEN); } if (nowp != NULL) - FREE((caddr_t)nowp, M_NFSCLOWNER); + free(nowp, M_NFSCLOWNER); TAILQ_FOREACH_SAFE(dp, &extra_deleg, nfsdl_list, ndp) { do { @@ -2264,7 +2264,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c (void) nfs_catnap(PZERO, error, "nfsexdlg"); } while (error == NFSERR_GRACE); TAILQ_REMOVE(&extra_deleg, dp, nfsdl_list); - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); } /* For NFSv4.1 or later, do a RECLAIM_COMPLETE. */ @@ -2795,7 +2795,7 @@ tryagain2: newnfs_copycred(&dp->nfsdl_cred, cred); (void) nfscl_trydelegreturn(dp, cred, clp->nfsc_nmp, p); TAILQ_REMOVE(&dh, dp, nfsdl_list); - FREE((caddr_t)dp, M_NFSCLDELEG); + free(dp, M_NFSCLDELEG); } SLIST_INIT(&lfh); @@ -3369,7 +3369,7 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) if (mp != NULL) vfs_unbusy(mp); if (nfhp != NULL) - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); if (!error) (void) nfsv4_fillattr(nd, NULL, NULL, NULL, &va, NULL, 0, &rattrbits, NULL, p, 0, 0, 0, 0, @@ -3409,7 +3409,7 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) NFSUNLOCKCLSTATE(); } if (nfhp != NULL) - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); break; case NFSV4OP_CBLAYOUTRECALL: NFSCL_DEBUG(4, "cblayrec\n"); @@ -3977,7 +3977,7 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsm * for it. */ if (owp == NULL) { - MALLOC(nowp, struct nfsclowner *, + nowp = malloc( sizeof (struct nfsclowner), M_NFSCLOWNER, M_WAITOK); nfscl_newopen(clp, NULL, &owp, &nowp, &op, @@ -4060,7 +4060,7 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, st /* No appropriate open, so we have to do one against the server. */ np = VTONFS(vp); - MALLOC(nop, struct nfsclopen *, sizeof (struct nfsclopen) + + nop = malloc(sizeof (struct nfsclopen) + lop->nfso_fhlen - 1, M_NFSCLOPEN, M_WAITOK); newone = 0; nfscl_newopen(clp, NULL, &owp, NULL, &op, &nop, owp->nfsow_owner, @@ -4078,7 +4078,7 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, st nfscl_freeopen(lop, 1); } if (nop != NULL) - FREE((caddr_t)nop, M_NFSCLOPEN); + free(nop, M_NFSCLOPEN); if (ndp != NULL) { /* * What should I do with the returned delegation, since the @@ -4086,7 +4086,7 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, st * through it away. */ printf("Moveopen returned deleg\n"); - FREE((caddr_t)ndp, M_NFSCLDELEG); + free(ndp, M_NFSCLDELEG); } return (error); } Modified: head/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clsubs.c Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfsclient/nfs_clsubs.c Thu Jan 25 22:25:13 2018 (r328417) @@ -278,7 +278,7 @@ ncl_getcookie(struct nfsnode *np, off_t off, int add) dp = LIST_FIRST(&np->n_cookies); if (!dp) { if (add) { - MALLOC(dp, struct nfsdmap *, sizeof (struct nfsdmap), + dp = malloc(sizeof (struct nfsdmap), M_NFSDIROFF, M_WAITOK); dp->ndm_eocookie = 0; LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list); @@ -293,7 +293,7 @@ ncl_getcookie(struct nfsnode *np, off_t off, int add) goto out; dp = LIST_NEXT(dp, ndm_list); } else if (add) { - MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap), + dp2 = malloc(sizeof (struct nfsdmap), M_NFSDIROFF, M_WAITOK); dp2->ndm_eocookie = 0; LIST_INSERT_AFTER(dp, dp2, ndm_list); Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Thu Jan 25 22:25:13 2018 (r328417) @@ -1392,10 +1392,10 @@ mountnfs(struct nfs_args *argp, struct mount *mp, stru if (mp->mnt_flag & MNT_UPDATE) { nmp = VFSTONFS(mp); printf("%s: MNT_UPDATE is no longer handled here\n", __func__); - FREE(nam, M_SONAME); + free(nam, M_SONAME); return (0); } else { - MALLOC(nmp, struct nfsmount *, sizeof (struct nfsmount) + + nmp = malloc(sizeof (struct nfsmount) + krbnamelen + dirlen + srvkrbnamelen + 2, M_NEWNFSMNT, M_WAITOK | M_ZERO); TAILQ_INIT(&nmp->nm_bufq); @@ -1651,8 +1651,8 @@ bad: newnfs_disconnect(dsp->nfsclds_sockp); nfscl_freenfsclds(dsp); } - FREE(nmp, M_NEWNFSMNT); - FREE(nam, M_SONAME); + free(nmp, M_NEWNFSMNT); + free(nam, M_SONAME); return (error); } @@ -1728,7 +1728,7 @@ nfs_unmount(struct mount *mp, int mntflags) newnfs_disconnect(&nmp->nm_sockreq); crfree(nmp->nm_sockreq.nr_cred); - FREE(nmp->nm_nam, M_SONAME); + free(nmp->nm_nam, M_SONAME); if (nmp->nm_sockreq.nr_auth != NULL) AUTH_DESTROY(nmp->nm_sockreq.nr_auth); mtx_destroy(&nmp->nm_sockreq.nr_mtx); @@ -1739,7 +1739,7 @@ nfs_unmount(struct mount *mp, int mntflags) newnfs_disconnect(dsp->nfsclds_sockp); nfscl_freenfsclds(dsp); } - FREE(nmp, M_NEWNFSMNT); + free(nmp, M_NEWNFSMNT); out: return (error); } Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfsclient/nfs_clvnops.c Thu Jan 25 22:25:13 2018 (r328417) @@ -1193,7 +1193,7 @@ nfs_lookup(struct vop_lookup_args *ap) */ if (cnp->cn_nameiop == RENAME && (flags & ISLASTCN)) { if (NFS_CMPFH(np, nfhp->nfh_fh, nfhp->nfh_len)) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); return (EISDIR); } error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL, @@ -1248,7 +1248,7 @@ nfs_lookup(struct vop_lookup_args *ap) (void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL, 0, 1); } else if (NFS_CMPFH(np, nfhp->nfh_fh, nfhp->nfh_len)) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); VREF(dvp); newvp = dvp; if (attrflag) @@ -1817,7 +1817,7 @@ nfs_rename(struct vop_rename_args *ap) * For NFSv4, check to see if it is the same name and * replace the name, if it is different. */ - MALLOC(newv4, struct nfsv4node *, + newv4 = malloc( sizeof (struct nfsv4node) + tdnp->n_fhp->nfh_len + tcnp->cn_namelen - 1, M_NFSV4NODE, M_WAITOK); @@ -1838,7 +1838,7 @@ nnn[nnnl] = '\0'; printf("ren replace=%s\n",nnn); } #endif - FREE((caddr_t)fnp->n_v4, M_NFSV4NODE); + free(fnp->n_v4, M_NFSV4NODE); fnp->n_v4 = newv4; newv4 = NULL; fnp->n_v4->n4_fhlen = tdnp->n_fhp->nfh_len; @@ -1851,7 +1851,7 @@ printf("ren replace=%s\n",nnn); mtx_unlock(&tdnp->n_mtx); mtx_unlock(&fnp->n_mtx); if (newv4 != NULL) - FREE((caddr_t)newv4, M_NFSV4NODE); + free(newv4, M_NFSV4NODE); } if (fvp->v_type == VDIR) { @@ -2389,7 +2389,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, s cache_purge(dvp); np = VTONFS(vp); KASSERT(vp->v_type != VDIR, ("nfs: sillyrename dir")); - MALLOC(sp, struct sillyrename *, sizeof (struct sillyrename), + sp = malloc(sizeof (struct sillyrename), M_NEWNFSREQ, M_WAITOK); sp->s_cred = crhold(cnp->cn_cred); sp->s_dvp = dvp; @@ -2423,7 +2423,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, s bad: vrele(sp->s_dvp); crfree(sp->s_cred); - free((caddr_t)sp, M_NEWNFSREQ); + free(sp, M_NEWNFSREQ); return (error); } @@ -2473,8 +2473,8 @@ nnn[nnnl] = '\0'; printf("replace=%s\n",nnn); } #endif - FREE((caddr_t)np->n_v4, M_NFSV4NODE); - MALLOC(np->n_v4, struct nfsv4node *, + free(np->n_v4, M_NFSV4NODE); + np->n_v4 = malloc( sizeof (struct nfsv4node) + dnp->n_fhp->nfh_len + len - 1, M_NFSV4NODE, M_WAITOK); @@ -2493,10 +2493,10 @@ printf("replace=%s\n",nnn); vfs_hash_rehash(vp, hash); np->n_fhp = nfhp; if (onfhp != NULL) - FREE((caddr_t)onfhp, M_NFSFH); + free(onfhp, M_NFSFH); newvp = NFSTOV(np); } else if (NFS_CMPFH(dnp, nfhp->nfh_fh, nfhp->nfh_len)) { - FREE((caddr_t)nfhp, M_NFSFH); + free(nfhp, M_NFSFH); VREF(dvp); newvp = dvp; } else { Modified: head/sys/fs/nfsclient/nfsnode.h ============================================================================== --- head/sys/fs/nfsclient/nfsnode.h Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfsclient/nfsnode.h Thu Jan 25 22:25:13 2018 (r328417) @@ -87,7 +87,7 @@ struct nfs_accesscache { * An nfsnode is 'named' by its file handle. (nget/nfs_node.c) * If this structure exceeds 256 bytes (it is currently 256 using 4.4BSD-Lite * type definitions), file handles of > 32 bytes should probably be split out - * into a separate MALLOC()'d data structure. (Reduce the size of nfsfh_t by + * into a separate malloc()'d data structure. (Reduce the size of nfsfh_t by * changing the definition in nfsproto.h of NFS_SMALLFH.) * NB: Hopefully the current order of the fields is such that everything will * be well aligned and, therefore, tightly packed. Modified: head/sys/fs/nfsserver/nfs_nfsdcache.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdcache.c Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfsserver/nfs_nfsdcache.c Thu Jan 25 22:25:13 2018 (r328417) @@ -336,7 +336,7 @@ nfsrvd_getcache(struct nfsrv_descript *nd) if (nd->nd_procnum == NFSPROC_NULL) panic("nfsd cache null"); - MALLOC(newrp, struct nfsrvcache *, sizeof (struct nfsrvcache), + newrp = malloc(sizeof (struct nfsrvcache), M_NFSRVCACHE, M_WAITOK); NFSBZERO((caddr_t)newrp, sizeof (struct nfsrvcache)); if (nd->nd_flag & ND_NFSV4) @@ -423,7 +423,7 @@ loop: panic("nfs udp cache1"); } nfsrc_unlock(rp); - free((caddr_t)newrp, M_NFSRVCACHE); + free(newrp, M_NFSRVCACHE); goto out; } } @@ -710,7 +710,7 @@ tryagain: panic("nfs tcp cache1"); } nfsrc_unlock(rp); - free((caddr_t)newrp, M_NFSRVCACHE); + free(newrp, M_NFSRVCACHE); goto out; } nfsstatsv1.srvcache_misses++; @@ -802,7 +802,7 @@ nfsrc_freecache(struct nfsrvcache *rp) if (!(rp->rc_flag & RC_UDP)) atomic_add_int(&nfsrc_tcpsavedreplies, -1); } - FREE((caddr_t)rp, M_NFSRVCACHE); + free(rp, M_NFSRVCACHE); atomic_add_int(&nfsstatsv1.srvcache_size, -1); } Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Thu Jan 25 21:48:07 2018 (r328416) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Thu Jan 25 22:25:13 2018 (r328417) @@ -659,7 +659,7 @@ nfsvno_read(struct vnode *vp, off_t off, int cnt, stru m3 = m; m2 = m; } - MALLOC(iv, struct iovec *, i * sizeof (struct iovec), + iv = malloc(i * sizeof (struct iovec), M_TEMP, M_WAITOK); uiop->uio_iov = iv2 = iv; m = m3; @@ -690,7 +690,7 @@ nfsvno_read(struct vnode *vp, off_t off, int cnt, stru /* XXX KDM make this more systematic? */ nfsstatsv1.srvbytes[NFSV4OP_READ] += uiop->uio_resid; error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred); - FREE((caddr_t)iv2, M_TEMP); + free(iv2, M_TEMP); if (error) { m_freem(m3); *mpp = NULL; @@ -727,7 +727,7 @@ nfsvno_write(struct vnode *vp, off_t off, int retlen, struct uio io, *uiop = &io; struct nfsheur *nh; - MALLOC(ivp, struct iovec *, cnt * sizeof (struct iovec), M_TEMP, + ivp = malloc(cnt * sizeof (struct iovec), M_TEMP, M_WAITOK); uiop->uio_iov = iv = ivp; uiop->uio_iovcnt = cnt; @@ -766,7 +766,7 @@ nfsvno_write(struct vnode *vp, off_t off, int retlen, error = VOP_WRITE(vp, uiop, ioflags, cred); if (error == 0) nh->nh_nextoff = uiop->uio_offset; - FREE((caddr_t)iv, M_TEMP); + free(iv, M_TEMP); NFSEXITCODE(error); return (error); @@ -1004,7 +1004,7 @@ out: /* * Parse symbolic link arguments. - * This function has an ugly side effect. It will MALLOC() an area for + * This function has an ugly side effect. It will malloc() an area for * the symlink and set iov_base to point to it, only if it succeeds. * So, if it returns with uiop->uio_iov->iov_base != NULL, that must * be FREE'd later. @@ -1029,7 +1029,7 @@ nfsvno_getsymlink(struct nfsrv_descript *nd, struct nf error = EBADRPC; goto nfsmout; } - MALLOC(pathcp, caddr_t, len + 1, M_TEMP, M_WAITOK); + pathcp = malloc(len + 1, M_TEMP, M_WAITOK); error = nfsrv_mtostr(nd, pathcp, len); if (error) goto nfsmout; @@ -1634,11 +1634,11 @@ nfsrvd_readdir(struct nfsrv_descript *nd, int isdgram, goto out; } is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0; - MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); + rbuf = malloc(siz, M_TEMP, M_WAITOK); again: eofflag = 0; if (cookies) { - free((caddr_t)cookies, M_TEMP); + free(cookies, M_TEMP); cookies = NULL; } @@ -1670,9 +1670,9 @@ again: */ if (nd->nd_repstat) { vput(vp); - free((caddr_t)rbuf, M_TEMP); + free(rbuf, M_TEMP); if (cookies) - free((caddr_t)cookies, M_TEMP); + free(cookies, M_TEMP); if (nd->nd_flag & ND_NFSV3) nfsrv_postopattr(nd, getret, &at); goto out; @@ -1693,8 +1693,8 @@ again: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Jan 25 22:38:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A483ED25D6; Thu, 25 Jan 2018 22:38:40 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 482B3758A4; Thu, 25 Jan 2018 22:38:40 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A5CC13204; Thu, 25 Jan 2018 22:38:40 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PMcePe028221; Thu, 25 Jan 2018 22:38:40 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PMcd2e028217; Thu, 25 Jan 2018 22:38:39 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801252238.w0PMcd2e028217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 25 Jan 2018 22:38:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328418 - in head/sys/fs: nfs nfsserver X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys/fs: nfs nfsserver X-SVN-Commit-Revision: 328418 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 22:38:40 -0000 Author: cem Date: Thu Jan 25 22:38:39 2018 New Revision: 328418 URL: https://svnweb.freebsd.org/changeset/base/328418 Log: nfs: Remove NFSSOCKADDRALLOC, NFSSOCKADDRFREE macros They were just thin wrappers over malloc(9) w/ M_ZERO and free(9). Discussed with: rmacklem, markj Sponsored by: Dell EMC Isilon Modified: head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfsport.h head/sys/fs/nfsserver/nfs_nfsdserv.c head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Thu Jan 25 22:25:13 2018 (r328417) +++ head/sys/fs/nfs/nfs_commonsubs.c Thu Jan 25 22:38:39 2018 (r328418) @@ -3067,7 +3067,7 @@ nfsrv_nfsuserdport(struct sockaddr *sad, u_short port, if (nfsrv_nfsuserd) { NFSUNLOCKNAMEID(); error = EPERM; - NFSSOCKADDRFREE(sad); + free(sad, M_SONAME); goto out; } nfsrv_nfsuserd = 1; @@ -3088,7 +3088,8 @@ nfsrv_nfsuserdport(struct sockaddr *sad, u_short port, /* Use the port# for a UDP socket (old nfsuserd). */ rp->nr_sotype = SOCK_DGRAM; rp->nr_soproto = IPPROTO_UDP; - NFSSOCKADDRALLOC(rp->nr_nam); + rp->nr_nam = malloc(sizeof(*rp->nr_nam), M_SONAME, M_WAITOK | + M_ZERO); NFSSOCKADDRSIZE(rp->nr_nam, sizeof (struct sockaddr_in)); ad = NFSSOCKADDR(rp->nr_nam, struct sockaddr_in *); ad->sin_family = AF_INET; @@ -3099,7 +3100,7 @@ nfsrv_nfsuserdport(struct sockaddr *sad, u_short port, rp->nr_vers = RPCNFSUSERD_VERS; error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0); if (error) { - NFSSOCKADDRFREE(rp->nr_nam); + free(rp->nr_nam, M_SONAME); nfsrv_nfsuserd = 0; } out: @@ -3122,7 +3123,7 @@ nfsrv_nfsuserddelport(void) nfsrv_nfsuserd = 0; NFSUNLOCKNAMEID(); newnfs_disconnect(&nfsrv_nfsuserdsock); - NFSSOCKADDRFREE(nfsrv_nfsuserdsock.nr_nam); + free(nfsrv_nfsuserdsock.nr_nam, M_SONAME); } /* Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Thu Jan 25 22:25:13 2018 (r328417) +++ head/sys/fs/nfs/nfsport.h Thu Jan 25 22:38:39 2018 (r328418) @@ -628,18 +628,7 @@ void nfsrvd_rcv(struct socket *, void *, int); * mbufs any more.) */ #define NFSSOCKADDR(a, t) ((t)(a)) -#define NFSSOCKADDRALLOC(a) \ - do { \ - (a) = malloc(sizeof (struct sockaddr), \ - M_SONAME, M_WAITOK); \ - NFSBZERO((a), sizeof (struct sockaddr)); \ - } while (0) #define NFSSOCKADDRSIZE(a, s) ((a)->sa_len = (s)) -#define NFSSOCKADDRFREE(a) \ - do { \ - if (a) \ - free((a), M_SONAME); \ - } while (0) /* * These should be defined as a process or thread structure, as required Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdserv.c Thu Jan 25 22:25:13 2018 (r328417) +++ head/sys/fs/nfsserver/nfs_nfsdserv.c Thu Jan 25 22:38:39 2018 (r328418) @@ -3477,7 +3477,8 @@ nfsrvd_setclientid(struct nfsrv_descript *nd, __unused clp->lc_stateid = malloc(sizeof(struct nfsstatehead) * nfsrv_statehashsize, M_NFSDCLIENT, M_WAITOK); NFSINITSOCKMUTEX(&clp->lc_req.nr_mtx); - NFSSOCKADDRALLOC(clp->lc_req.nr_nam); + clp->lc_req.nr_nam = malloc(sizeof(*clp->lc_req.nr_nam), M_SONAME, + M_WAITOK | M_ZERO); NFSSOCKADDRSIZE(clp->lc_req.nr_nam, sizeof (struct sockaddr_in)); clp->lc_req.nr_cred = NULL; NFSBCOPY(verf, clp->lc_verf, NFSX_VERF); @@ -3533,7 +3534,7 @@ nfsrvd_setclientid(struct nfsrv_descript *nd, __unused (void) nfsm_strtom(nd, addrbuf, strlen(addrbuf)); } if (clp) { - NFSSOCKADDRFREE(clp->lc_req.nr_nam); + free(clp->lc_req.nr_nam, M_SONAME); NFSFREEMUTEX(&clp->lc_req.nr_mtx); free(clp->lc_stateid, M_NFSDCLIENT); free(clp, M_NFSDCLIENT); @@ -3551,7 +3552,7 @@ out: return (0); nfsmout: if (clp) { - NFSSOCKADDRFREE(clp->lc_req.nr_nam); + free(clp->lc_req.nr_nam, M_SONAME); NFSFREEMUTEX(&clp->lc_req.nr_mtx); free(clp->lc_stateid, M_NFSDCLIENT); free(clp, M_NFSDCLIENT); @@ -3753,7 +3754,8 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused clp->lc_stateid = malloc(sizeof(struct nfsstatehead) * nfsrv_statehashsize, M_NFSDCLIENT, M_WAITOK); NFSINITSOCKMUTEX(&clp->lc_req.nr_mtx); - NFSSOCKADDRALLOC(clp->lc_req.nr_nam); + clp->lc_req.nr_nam = malloc(sizeof(*clp->lc_req.nr_nam), M_SONAME, + M_WAITOK | M_ZERO); NFSSOCKADDRSIZE(clp->lc_req.nr_nam, sizeof (struct sockaddr_in)); sad = NFSSOCKADDR(nd->nd_nam, struct sockaddr_in *); rad = NFSSOCKADDR(clp->lc_req.nr_nam, struct sockaddr_in *); @@ -3813,7 +3815,7 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused */ nd->nd_repstat = nfsrv_setclient(nd, &clp, &clientid, &confirm, p); if (clp != NULL) { - NFSSOCKADDRFREE(clp->lc_req.nr_nam); + free(clp->lc_req.nr_nam, M_SONAME); NFSFREEMUTEX(&clp->lc_req.nr_mtx); free(clp->lc_stateid, M_NFSDCLIENT); free(clp, M_NFSDCLIENT); @@ -3846,7 +3848,7 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused return (0); nfsmout: if (clp != NULL) { - NFSSOCKADDRFREE(clp->lc_req.nr_nam); + free(clp->lc_req.nr_nam, M_SONAME); NFSFREEMUTEX(&clp->lc_req.nr_mtx); free(clp->lc_stateid, M_NFSDCLIENT); free(clp, M_NFSDCLIENT); Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Thu Jan 25 22:25:13 2018 (r328417) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Thu Jan 25 22:38:39 2018 (r328418) @@ -1226,7 +1226,7 @@ nfsrv_zapclient(struct nfsclient *clp, NFSPROC_T *p) } #endif newnfs_disconnect(&clp->lc_req); - NFSSOCKADDRFREE(clp->lc_req.nr_nam); + free(clp->lc_req.nr_nam, M_SONAME); NFSFREEMUTEX(&clp->lc_req.nr_mtx); free(clp->lc_stateid, M_NFSDCLIENT); free(clp, M_NFSDCLIENT); From owner-svn-src-all@freebsd.org Thu Jan 25 23:31:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2277ED5198; Thu, 25 Jan 2018 23:31:05 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47DE877C03; Thu, 25 Jan 2018 23:31:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id w0PNV3jg083027 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 25 Jan 2018 15:31:03 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id w0PNV2ht083026; Thu, 25 Jan 2018 15:31:02 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 25 Jan 2018 15:31:02 -0800 From: Gleb Smirnoff To: Kristof Provost Cc: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328313 - head/sys/netpfil/pf Message-ID: <20180125233102.GN8113@FreeBSD.org> References: <201801240429.w0O4THIl059440@repo.freebsd.org> <20180125001310.GJ8113@FreeBSD.org> <1516840498.42536.213.camel@freebsd.org> <8FA39DD7-FD83-49D5-B7FC-3637B42129BE@FreeBSD.org> <14734657-ABC2-437B-9830-724901066342@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <14734657-ABC2-437B-9830-724901066342@FreeBSD.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 25 Jan 2018 23:31:05 -0000 On Thu, Jan 25, 2018 at 02:46:14PM +1100, Kristof Provost wrote: K> On 25 Jan 2018, at 12:08, Kristof Provost wrote: K> > On 25 Jan 2018, at 11:34, Ian Lepore wrote: K> >> On Wed, 2018-01-24 at 16:13 -0800, Gleb Smirnoff wrote: K> >>> (r328313) K> >>> K> @@ -1613,6 +1613,7 @@ int K> >>> K>  pf_unlink_state(struct pf_state *s, u_int flags) K> >>> K>  { K> >>> K>   struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; K> >>> K> + int last; K> >>> K>   K> >>> K>   if ((flags & PF_ENTER_LOCKED) == 0) K> >>> K>   PF_HASHROW_LOCK(ih); K> >>> K> @@ -1653,7 +1654,8 @@ pf_unlink_state(struct pf_state *s, u_int K> >>> flags) K> >>> K>   PF_HASHROW_UNLOCK(ih); K> >>> K>   K> >>> K>   pf_detach_state(s); K> >>> K> - refcount_release(&s->refs); K> >>> K> + last = refcount_release(&s->refs); K> >>> K> + KASSERT(last == 0, ("Incorrect state reference count")); K> >>> K>   K> >>> K>   return (pf_release_state(s)); K> >>> K>  } K> >>> K> >>> IMHO, we shouldn't emit extra code to please Coverity. We can mark K> >>> it K> >>> as a false positive in the interface. It may make sense to add a K> >>> comment K> >>> for a human to explain why return isn't checked here. K> >>> K> >> K> >> Not to mention that when KASSERT compiles to nothing, what you're K> >> left K> >> with is a "defined but not used" warning for 'last'. K> >> K> > I’d really like to keep the KASSERT(), because this is the sort of K> > thing that could go wrong, and the assertion would be helpful. K> > K> > I suppose I could wrap last in #ifdef INVARIANTS, but that’s rather K> > ugly too. K> > K> > Asserting that the refcount is at least 1 when entering K> > pf_release_state() would express the same, but that’s also K> > problematic. K> > Of course, errors should trigger the KASSERT() in refcount_release(), K> > so I think I may have convinced myself that the KASSERT() can in fact K> > be removed and replaced with (void)refcount_release() and a comment K> > explaining why this refcount_release() can never return 1. K> > K> So this: K> K> diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c K> index 55ae1145835..0dbf1fe7f66 100644 K> --- a/sys/netpfil/pf/pf.c K> +++ b/sys/netpfil/pf/pf.c K> @@ -1623,7 +1623,6 @@ int K> pf_unlink_state(struct pf_state *s, u_int flags) K> { K> struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; K> - int last; K> K> if ((flags & PF_ENTER_LOCKED) == 0) K> PF_HASHROW_LOCK(ih); K> @@ -1664,8 +1663,9 @@ pf_unlink_state(struct pf_state *s, u_int flags) K> PF_HASHROW_UNLOCK(ih); K> K> pf_detach_state(s); K> - last = refcount_release(&s->refs); K> - KASSERT(last == 0, ("Incorrect state reference count")); K> + /* pf_state_insert() initialises refs to 2, so we can never K> release the K> + * last reference here, only in pf_release_state(). */ K> + (void)refcount_release(&s->refs); K> K> return (pf_release_state(s)); K> } K> K> I do assume that (void) will tell Coverity I’m deliberately ignoring K> the return value. It’s a fairly common idiom, so I’d expect it to K> understand. My vote goes for this one. A slightly better then warning when compiling w/o INVARIANTS. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Thu Jan 25 23:38:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 461F0ED5700; Thu, 25 Jan 2018 23:38:06 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ECA39780AF; Thu, 25 Jan 2018 23:38:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7A0213C10; Thu, 25 Jan 2018 23:38:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PNc5lb057769; Thu, 25 Jan 2018 23:38:05 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PNc5Qc057768; Thu, 25 Jan 2018 23:38:05 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201801252338.w0PNc5Qc057768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 25 Jan 2018 23:38:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328419 - head/crypto/openssl/ssl X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: head/crypto/openssl/ssl X-SVN-Commit-Revision: 328419 X-SVN-Commit-Repository: base 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.25 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: Thu, 25 Jan 2018 23:38:06 -0000 Author: jkim Date: Thu Jan 25 23:38:05 2018 New Revision: 328419 URL: https://svnweb.freebsd.org/changeset/base/328419 Log: Add declaration of SSL_get_selected_srtp_profile() for OpenSSL. Because there was an extra declaration in the vendor version, we locally removed the second one in r238405 with 1.0.1c. Later, upstream fixed it in 1.0.2d but they removed the first one. Therefore, both were removed in our version unfortunately. Now we revert to the vendor one to re-add it. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D10525 Modified: head/crypto/openssl/ssl/srtp.h Modified: head/crypto/openssl/ssl/srtp.h ============================================================================== --- head/crypto/openssl/ssl/srtp.h Thu Jan 25 22:38:39 2018 (r328418) +++ head/crypto/openssl/ssl/srtp.h Thu Jan 25 23:38:05 2018 (r328419) @@ -136,6 +136,7 @@ int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const ch int SSL_set_tlsext_use_srtp(SSL *ctx, const char *profiles); STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); +SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); # endif From owner-svn-src-all@freebsd.org Fri Jan 26 00:03:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3C28ED6D10; Fri, 26 Jan 2018 00:03:14 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 94FC278FF2; Fri, 26 Jan 2018 00:03:14 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A29414120; Fri, 26 Jan 2018 00:03:14 +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 w0Q03EoA072419; Fri, 26 Jan 2018 00:03:14 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q03EuN072418; Fri, 26 Jan 2018 00:03:14 GMT (envelope-from np@FreeBSD.org) Message-Id: <201801260003.w0Q03EuN072418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 26 Jan 2018 00:03:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328420 - head/sys/dev/cxgbe/common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/common X-SVN-Commit-Revision: 328420 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 00:03:15 -0000 Author: np Date: Fri Jan 26 00:03:14 2018 New Revision: 328420 URL: https://svnweb.freebsd.org/changeset/base/328420 Log: cxgbe(4): Do not display harmless warning in non-debug builds. MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Thu Jan 25 23:38:05 2018 (r328419) +++ head/sys/dev/cxgbe/common/t4_hw.c Fri Jan 26 00:03:14 2018 (r328420) @@ -3752,8 +3752,10 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int m rcap = aneg | speed | fc | fec; if ((rcap | lc->supported) != lc->supported) { +#ifdef INVARIANTS CH_WARN(adap, "rcap 0x%08x, pcap 0x%08x\n", rcap, lc->supported); +#endif rcap &= lc->supported; } rcap |= mdi; From owner-svn-src-all@freebsd.org Fri Jan 26 00:34:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9829DED8538; Fri, 26 Jan 2018 00:34:34 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 489F87A26E; Fri, 26 Jan 2018 00:34:34 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 427B214633; Fri, 26 Jan 2018 00:34:34 +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 w0Q0YY52087535; Fri, 26 Jan 2018 00:34:34 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q0YYI1087534; Fri, 26 Jan 2018 00:34:34 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201801260034.w0Q0YYI1087534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 26 Jan 2018 00:34: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: r328421 - stable/11/usr.bin/procstat X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/usr.bin/procstat X-SVN-Commit-Revision: 328421 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 00:34:34 -0000 Author: brooks Date: Fri Jan 26 00:34:33 2018 New Revision: 328421 URL: https://svnweb.freebsd.org/changeset/base/328421 Log: MFC r328297: Don't escape '?'s in protocol output. This isn't required by mandoc and is nonfunctional in groff. PR: 224632 Reported by: w.schwarzenfeld@utanet.at Differential Revision: https://reviews.freebsd.org/D13779 Modified: stable/11/usr.bin/procstat/procstat.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/procstat/procstat.1 ============================================================================== --- stable/11/usr.bin/procstat/procstat.1 Fri Jan 26 00:03:14 2018 (r328420) +++ stable/11/usr.bin/procstat/procstat.1 Fri Jan 26 00:34:33 2018 (r328421) @@ -288,7 +288,7 @@ see .Dv IPPROTO_DIVERT ; see .Xr divert 4 . -.It IP\? +.It IP? unknown protocol. .It RAW .Dv IPPROTO_RAW ; @@ -319,12 +319,12 @@ see .Dv IPPROTO_TCP ; see .Xr tcp 4 . -.It UD\? +.It UD? unknown protocol. .El .Pp .Bl -tag -width indent -compact -.It \? +.It ? unknown address family. .El .Ss Signal Disposition Information From owner-svn-src-all@freebsd.org Fri Jan 26 00:35:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2598EED860C; Fri, 26 Jan 2018 00:35:34 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C9DE17A3B5; Fri, 26 Jan 2018 00:35:33 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C489C14637; Fri, 26 Jan 2018 00:35:33 +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 w0Q0ZXu3087644; Fri, 26 Jan 2018 00:35:33 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q0ZXRH087643; Fri, 26 Jan 2018 00:35:33 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201801260035.w0Q0ZXRH087643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 26 Jan 2018 00:35:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328422 - stable/10/usr.bin/procstat X-SVN-Group: stable-10 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/10/usr.bin/procstat X-SVN-Commit-Revision: 328422 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 00:35:34 -0000 Author: brooks Date: Fri Jan 26 00:35:33 2018 New Revision: 328422 URL: https://svnweb.freebsd.org/changeset/base/328422 Log: MFC r328297: Don't escape '?'s in protocol output. This isn't required by mandoc and is nonfunctional in groff. PR: 224632 Reported by: w.schwarzenfeld@utanet.at Differential Revision: https://reviews.freebsd.org/D13779 Modified: stable/10/usr.bin/procstat/procstat.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/procstat/procstat.1 ============================================================================== --- stable/10/usr.bin/procstat/procstat.1 Fri Jan 26 00:34:33 2018 (r328421) +++ stable/10/usr.bin/procstat/procstat.1 Fri Jan 26 00:35:33 2018 (r328422) @@ -276,7 +276,7 @@ see .Dv IPPROTO_DIVERT ; see .Xr divert 4 . -.It IP\? +.It IP? unknown protocol. .It RAW .Dv IPPROTO_RAW ; @@ -307,12 +307,12 @@ see .Dv IPPROTO_TCP ; see .Xr tcp 4 . -.It UD\? +.It UD? unknown protocol. .El .Pp .Bl -tag -width indent -compact -.It \? +.It ? unknown address family. .El .Ss Signal Disposition Information From owner-svn-src-all@freebsd.org Fri Jan 26 00:45:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B1ADED8DF0; Fri, 26 Jan 2018 00:45:41 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EEC0C7A9DE; Fri, 26 Jan 2018 00:45:40 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E336E147D3; Fri, 26 Jan 2018 00:45:40 +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 w0Q0jedK092384; Fri, 26 Jan 2018 00:45:40 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q0jeQR092383; Fri, 26 Jan 2018 00:45:40 GMT (envelope-from np@FreeBSD.org) Message-Id: <201801260045.w0Q0jeQR092383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 26 Jan 2018 00:45:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328423 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 328423 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 00:45:41 -0000 Author: np Date: Fri Jan 26 00:45:40 2018 New Revision: 328423 URL: https://svnweb.freebsd.org/changeset/base/328423 Log: cxgbe(4): Accept old names of a couple of tunables. Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Jan 26 00:35:33 2018 (r328422) +++ head/sys/dev/cxgbe/t4_main.c Fri Jan 26 00:45:40 2018 (r328423) @@ -355,10 +355,12 @@ TUNABLE_INT("hw.cxgbe.nnmrxq_vi", &t4_nnmrxq_vi); #define TMR_IDX 1 int t4_tmr_idx = TMR_IDX; TUNABLE_INT("hw.cxgbe.holdoff_timer_idx", &t4_tmr_idx); +TUNABLE_INT("hw.cxgbe.holdoff_timer_idx_10G", &t4_tmr_idx); /* Old name */ #define PKTC_IDX (-1) int t4_pktc_idx = PKTC_IDX; TUNABLE_INT("hw.cxgbe.holdoff_pktc_idx", &t4_pktc_idx); +TUNABLE_INT("hw.cxgbe.holdoff_pktc_idx_10G", &t4_pktc_idx); /* Old name */ /* * Size (# of entries) of each tx and rx queue. From owner-svn-src-all@freebsd.org Fri Jan 26 00:56:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A32ECED94D5; Fri, 26 Jan 2018 00:56:10 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F08E7B04A; Fri, 26 Jan 2018 00:56:10 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49F14149CA; Fri, 26 Jan 2018 00:56:10 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q0uAc0097524; Fri, 26 Jan 2018 00:56:10 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q0uARW097523; Fri, 26 Jan 2018 00:56:10 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201801260056.w0Q0uARW097523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 26 Jan 2018 00:56:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328424 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 328424 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 00:56:10 -0000 Author: jhibbits Date: Fri Jan 26 00:56:09 2018 New Revision: 328424 URL: https://svnweb.freebsd.org/changeset/base/328424 Log: Minimal change to build linuxkpi on architectures with physical addresses larger than virtual Summary: Some architectures have physical/bus addresses that are much larger than virtual addresses. This change just quiets a warning, as DMAP is not used on those architectures, and on 64-bit platforms uintptr_t is the same size as vm_paddr_t and void *. Reviewed By: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14043 Modified: head/sys/compat/linuxkpi/common/src/linux_page.c Modified: head/sys/compat/linuxkpi/common/src/linux_page.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_page.c Fri Jan 26 00:45:40 2018 (r328423) +++ head/sys/compat/linuxkpi/common/src/linux_page.c Fri Jan 26 00:56:09 2018 (r328424) @@ -69,7 +69,8 @@ linux_page_address(struct page *page) if (page->object != kmem_object && page->object != kernel_object) { return (PMAP_HAS_DMAP ? - ((void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(page))) : NULL); + ((void *)(uintptr_t)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(page))) : + NULL); } return ((void *)(uintptr_t)(VM_MIN_KERNEL_ADDRESS + IDX_TO_OFF(page->pindex))); From owner-svn-src-all@freebsd.org Fri Jan 26 00:58:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46034ED962C; Fri, 26 Jan 2018 00:58:03 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E8D907B1E9; Fri, 26 Jan 2018 00:58:02 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7B76149CF; Fri, 26 Jan 2018 00:58:02 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q0w22Z097633; Fri, 26 Jan 2018 00:58:02 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q0w268097631; Fri, 26 Jan 2018 00:58:02 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201801260058.w0Q0w268097631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 26 Jan 2018 00:58:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328425 - head/sys/cam/ctl X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/cam/ctl X-SVN-Commit-Revision: 328425 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 00:58:03 -0000 Author: jhibbits Date: Fri Jan 26 00:58:02 2018 New Revision: 328425 URL: https://svnweb.freebsd.org/changeset/base/328425 Log: Minimum changes for ctl to build on architectures with non-matching physical and virtual address sizes Summary: Some architectures use physical addresses larger than virtual. This is the minimal changeset needed to get CAM/CTL to build on these targets. No functional changes. More changes would likely be needed for this to be fully functional on said platforms, but they can be made when needed. Reviewed By: mav, chuck Differential Revision: https://reviews.freebsd.org/D14041 Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_cam_sim.c Fri Jan 26 00:56:09 2018 (r328424) +++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Fri Jan 26 00:58:02 2018 (r328425) @@ -354,7 +354,7 @@ cfcs_datamove(union ctl_io *io) case CAM_DATA_VADDR: cam_sglist = &cam_sg_entry; cam_sglist[0].ds_len = ccb->csio.dxfer_len; - cam_sglist[0].ds_addr = (bus_addr_t)ccb->csio.data_ptr; + cam_sglist[0].ds_addr = (bus_addr_t)(uintptr_t)ccb->csio.data_ptr; cam_sg_count = 1; cam_sg_start = 0; cam_sg_offset = io->scsiio.kern_rel_offset; @@ -382,7 +382,7 @@ cfcs_datamove(union ctl_io *io) len_to_copy = MIN(cam_sglist[i].ds_len - cam_watermark, ctl_sglist[j].len - ctl_watermark); - cam_ptr = (uint8_t *)cam_sglist[i].ds_addr; + cam_ptr = (uint8_t *)(uintptr_t)cam_sglist[i].ds_addr; cam_ptr = cam_ptr + cam_watermark; if (io->io_hdr.flags & CTL_FLAG_BUS_ADDR) { /* Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Fri Jan 26 00:56:09 2018 (r328424) +++ head/sys/cam/ctl/scsi_ctl.c Fri Jan 26 00:58:02 2018 (r328425) @@ -728,7 +728,7 @@ ctlfedata(struct ctlfe_lun_softc *softc, union ctl_io cam_sglist = cmd_info->cam_sglist; *dxfer_len = 0; for (i = 0; i < io->scsiio.kern_sg_entries - idx; i++) { - cam_sglist[i].ds_addr = (bus_addr_t)ctl_sglist[i + idx].addr + off; + cam_sglist[i].ds_addr = (bus_addr_t)(uintptr_t)ctl_sglist[i + idx].addr + off; if (ctl_sglist[i + idx].len - off <= bus_softc->maxio - *dxfer_len) { cam_sglist[i].ds_len = ctl_sglist[idx + i].len - off; *dxfer_len += cam_sglist[i].ds_len; From owner-svn-src-all@freebsd.org Fri Jan 26 00:58:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEABBED9682; Fri, 26 Jan 2018 00:58:34 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B7927B32B; Fri, 26 Jan 2018 00:58:34 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86423149D3; Fri, 26 Jan 2018 00:58:34 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q0wY8I097712; Fri, 26 Jan 2018 00:58:34 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q0wXXP097695; Fri, 26 Jan 2018 00:58:33 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201801260058.w0Q0wXXP097695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 26 Jan 2018 00:58:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328426 - in head: lib/libufs sbin/clri sbin/dump sbin/fsck_ffs sbin/fsirand sbin/growfs sbin/newfs sbin/quotacheck stand/libsa sys/geom sys/geom/journal sys/geom/label sys/ufs/ffs usr.... X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in head: lib/libufs sbin/clri sbin/dump sbin/fsck_ffs sbin/fsirand sbin/growfs sbin/newfs sbin/quotacheck stand/libsa sys/geom sys/geom/journal sys/geom/label sys/ufs/ffs usr.sbin/fstyp usr.sbin/quot X-SVN-Commit-Revision: 328426 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 00:58:35 -0000 Author: mckusick Date: Fri Jan 26 00:58:32 2018 New Revision: 328426 URL: https://svnweb.freebsd.org/changeset/base/328426 Log: Refactoring of reading and writing of the UFS/FFS superblock. Specifically reading is done if ffs_sbget() and writing is done in ffs_sbput(). These functions are exported to libufs via the sbget() and sbput() functions which then used in the various filesystem utilities. This work is in preparation for adding subperblock check hashes. No functional change intended. Reviewed by: kib Modified: head/lib/libufs/Makefile head/lib/libufs/libufs.h head/lib/libufs/sblock.c head/lib/libufs/sbread.3 head/sbin/clri/Makefile head/sbin/clri/clri.c head/sbin/dump/Makefile head/sbin/dump/dump.h head/sbin/dump/main.c head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/fsutil.c head/sbin/fsck_ffs/globs.c head/sbin/fsck_ffs/setup.c head/sbin/fsirand/Makefile head/sbin/fsirand/fsirand.c head/sbin/growfs/growfs.c head/sbin/newfs/mkfs.c head/sbin/quotacheck/Makefile head/sbin/quotacheck/quotacheck.c head/stand/libsa/Makefile head/stand/libsa/ufs.c head/sys/geom/geom.h head/sys/geom/geom_io.c head/sys/geom/journal/g_journal_ufs.c head/sys/geom/label/g_label_ufs.c head/sys/ufs/ffs/ffs_extern.h head/sys/ufs/ffs/ffs_subr.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ffs/fs.h head/usr.sbin/fstyp/Makefile head/usr.sbin/fstyp/ufs.c head/usr.sbin/quot/Makefile head/usr.sbin/quot/quot.c Modified: head/lib/libufs/Makefile ============================================================================== --- head/lib/libufs/Makefile Fri Jan 26 00:58:02 2018 (r328425) +++ head/lib/libufs/Makefile Fri Jan 26 00:58:32 2018 (r328426) @@ -17,6 +17,8 @@ MLINKS+= cgread.3 cgwrite.3 MLINKS+= cgread.3 cgwrite1.3 MLINKS+= cgread.3 cgput.3 MLINKS+= sbread.3 sbwrite.3 +MLINKS+= sbread.3 sbget.3 +MLINKS+= sbread.3 sbput.3 MLINKS+= ufs_disk_close.3 ufs_disk_fillout.3 MLINKS+= ufs_disk_close.3 ufs_disk_fillout_blank.3 MLINKS+= ufs_disk_close.3 ufs_disk_write.3 Modified: head/lib/libufs/libufs.h ============================================================================== --- head/lib/libufs/libufs.h Fri Jan 26 00:58:02 2018 (r328425) +++ head/lib/libufs/libufs.h Fri Jan 26 00:58:32 2018 (r328426) @@ -99,6 +99,20 @@ __BEGIN_DECLS */ /* + * ffs_subr.c + */ +void ffs_clrblock(struct fs *, u_char *, ufs1_daddr_t); +void ffs_clusteracct(struct fs *, struct cg *, ufs1_daddr_t, int); +void ffs_fragacct(struct fs *, int, int32_t [], int); +int ffs_isblock(struct fs *, u_char *, ufs1_daddr_t); +int ffs_isfreeblock(struct fs *, u_char *, ufs1_daddr_t); +void ffs_setblock(struct fs *, u_char *, ufs1_daddr_t); +int ffs_sbget(void *, struct fs **, off_t, char *, + int (*)(void *, off_t, void **, int)); +int ffs_sbput(void *, struct fs *, off_t, + int (*)(void *, off_t, void *, int)); + +/* * block.c */ ssize_t bread(struct uufsd *, ufs2_daddr_t, void *, size_t); @@ -129,6 +143,9 @@ int putino(struct uufsd *); */ int sbread(struct uufsd *); int sbwrite(struct uufsd *, int); +/* low level superblock read/write functions */ +int sbget(int, struct fs **, off_t); +int sbput(int, struct fs *, int); /* * type.c @@ -137,16 +154,6 @@ int ufs_disk_close(struct uufsd *); int ufs_disk_fillout(struct uufsd *, const char *); int ufs_disk_fillout_blank(struct uufsd *, const char *); int ufs_disk_write(struct uufsd *); - -/* - * ffs_subr.c - */ -void ffs_clrblock(struct fs *, u_char *, ufs1_daddr_t); -void ffs_clusteracct(struct fs *, struct cg *, ufs1_daddr_t, int); -void ffs_fragacct(struct fs *, int, int32_t [], int); -int ffs_isblock(struct fs *, u_char *, ufs1_daddr_t); -int ffs_isfreeblock(struct fs *, u_char *, ufs1_daddr_t); -void ffs_setblock(struct fs *, u_char *, ufs1_daddr_t); /* * crc32c.c Modified: head/lib/libufs/sblock.c ============================================================================== --- head/lib/libufs/sblock.c Fri Jan 26 00:58:02 2018 (r328425) +++ head/lib/libufs/sblock.c Fri Jan 26 00:58:32 2018 (r328426) @@ -47,79 +47,48 @@ __FBSDID("$FreeBSD$"); #include -static int superblocks[] = SBLOCKSEARCH; - int sbread(struct uufsd *disk) { - uint8_t block[MAXBSIZE]; struct fs *fs; - int sb, superblock; - int i, size, blks; - uint8_t *space; ERROR(disk, NULL); - fs = &disk->d_fs; - superblock = superblocks[0]; - - for (sb = 0; (superblock = superblocks[sb]) != -1; sb++) { - if (bread(disk, superblock, disk->d_sb, SBLOCKSIZE) == -1) { + if ((errno = sbget(disk->d_fd, &fs, -1)) != 0) { + switch (errno) { + case EIO: ERROR(disk, "non-existent or truncated superblock"); - return (-1); + break; + case ENOENT: + ERROR(disk, "no usable known superblock found"); + break; + case ENOSPC: + ERROR(disk, "failed to allocate space for superblock " + "information"); + break; + case EINVAL: + ERROR(disk, "The previous newfs operation on this " + "volume did not complete.\nYou must complete " + "newfs before using this volume."); + break; + default: + ERROR(disk, "unknown superblock read error"); + errno = EIO; + break; } - if (fs->fs_magic == FS_UFS1_MAGIC) - disk->d_ufs = 1; - if (fs->fs_magic == FS_UFS2_MAGIC && - fs->fs_sblockloc == superblock) - disk->d_ufs = 2; - if (fs->fs_bsize <= MAXBSIZE && - (size_t)fs->fs_bsize >= sizeof(*fs)) { - if (disk->d_ufs) - break; - } disk->d_ufs = 0; - } - if (superblock == -1 || disk->d_ufs == 0) { - /* - * Other error cases will result in errno being set, here we - * must set it to indicate no superblock could be found with - * which to associate this disk/filesystem. - */ - ERROR(disk, "no usable known superblock found"); - errno = ENOENT; return (-1); } + memcpy(&disk->d_fs, fs, fs->fs_sbsize); + free(fs); + fs = &disk->d_fs; + if (fs->fs_magic == FS_UFS1_MAGIC) + disk->d_ufs = 1; + if (fs->fs_magic == FS_UFS2_MAGIC) + disk->d_ufs = 2; disk->d_bsize = fs->fs_fsize / fsbtodb(fs, 1); - disk->d_sblock = superblock / disk->d_bsize; - /* - * Read in the superblock summary information. - */ - size = fs->fs_cssize; - blks = howmany(size, fs->fs_fsize); - size += fs->fs_ncg * sizeof(int32_t); - space = malloc(size); - if (space == NULL) { - ERROR(disk, "failed to allocate space for summary information"); - return (-1); - } - fs->fs_csp = (struct csum *)space; - for (i = 0; i < blks; i += fs->fs_frag) { - size = fs->fs_bsize; - if (i + fs->fs_frag > blks) - size = (blks - i) * fs->fs_fsize; - if (bread(disk, fsbtodb(fs, fs->fs_csaddr + i), block, size) - == -1) { - ERROR(disk, "Failed to read sb summary information"); - free(fs->fs_csp); - return (-1); - } - bcopy(block, space, size); - space += size; - } - fs->fs_maxcluster = (uint32_t *)space; + disk->d_sblock = fs->fs_sblockloc / disk->d_bsize; disk->d_sbcsum = fs->fs_csp; - return (0); } @@ -127,45 +96,107 @@ int sbwrite(struct uufsd *disk, int all) { struct fs *fs; - int blks, size; - uint8_t *space; - unsigned i; ERROR(disk, NULL); fs = &disk->d_fs; - - if (!disk->d_sblock) { - disk->d_sblock = disk->d_fs.fs_sblockloc / disk->d_bsize; - } - - if (bwrite(disk, disk->d_sblock, fs, SBLOCKSIZE) == -1) { - ERROR(disk, "failed to write superblock"); + if ((errno = sbput(disk->d_fd, fs, all ? fs->fs_ncg : 0)) != 0) { + switch (errno) { + case EIO: + ERROR(disk, "failed to write superblock"); + break; + default: + ERROR(disk, "unknown superblock write error"); + errno = EIO; + break; + } return (-1); } - /* - * Write superblock summary information. - */ - blks = howmany(fs->fs_cssize, fs->fs_fsize); - space = (uint8_t *)disk->d_sbcsum; - for (i = 0; i < blks; i += fs->fs_frag) { - size = fs->fs_bsize; - if (i + fs->fs_frag > blks) - size = (blks - i) * fs->fs_fsize; - if (bwrite(disk, fsbtodb(fs, fs->fs_csaddr + i), space, size) - == -1) { - ERROR(disk, "Failed to write sb summary information"); + return (0); +} + +/* + * These are the low-level functions that actually read and write + * the superblock and its associated data. The actual work is done by + * the functions ffs_sbget and ffs_sbput in /sys/ufs/ffs/ffs_subr.c. + */ +static int use_pread(void *devfd, off_t loc, void **bufp, int size); +static int use_pwrite(void *devfd, off_t loc, void *buf, int size); + +/* + * Read a superblock from the devfd device allocating memory returned + * in fsp. Also read the superblock summary information. + */ +int +sbget(int devfd, struct fs **fsp, off_t sblockloc) +{ + + return (ffs_sbget(&devfd, fsp, sblockloc, "user", use_pread)); +} + +/* + * A read function for use by user-level programs using libufs. + */ +static int +use_pread(void *devfd, off_t loc, void **bufp, int size) +{ + int fd; + + fd = *(int *)devfd; + if ((*bufp = malloc(size)) == NULL) + return (ENOSPC); + if (pread(fd, *bufp, size, loc) != size) + return (EIO); + return (0); +} + +/* + * Write a superblock to the devfd device from the memory pointed to by fs. + * Also write out the superblock summary information but do not free the + * summary information memory. + * + * Additionally write out numaltwrite of the alternate superblocks. Use + * fs->fs_ncg to write out all of the alternate superblocks. + */ +int +sbput(int devfd, struct fs *fs, int numaltwrite) +{ + struct csum *savedcsp; + off_t savedactualloc; + int i, error; + + if ((error = ffs_sbput(&devfd, fs, fs->fs_sblockactualloc, + use_pwrite)) != 0) + return (error); + if (numaltwrite == 0) + return (0); + savedactualloc = fs->fs_sblockactualloc; + savedcsp = fs->fs_csp; + fs->fs_csp = NULL; + for (i = 0; i < numaltwrite; i++) { + fs->fs_sblockactualloc = dbtob(fsbtodb(fs, cgsblock(fs, i))); + if ((error = ffs_sbput(&devfd, fs, fs->fs_sblockactualloc, + use_pwrite)) != 0) { + fs->fs_sblockactualloc = savedactualloc; + fs->fs_csp = savedcsp; return (-1); } - space += size; } - if (all) { - for (i = 0; i < fs->fs_ncg; i++) - if (bwrite(disk, fsbtodb(fs, cgsblock(fs, i)), - fs, SBLOCKSIZE) == -1) { - ERROR(disk, "failed to update a superblock"); - return (-1); - } - } + fs->fs_sblockactualloc = savedactualloc; + fs->fs_csp = savedcsp; + return (0); +} + +/* + * A write function for use by user-level programs using sbput in libufs. + */ +static int +use_pwrite(void *devfd, off_t loc, void *buf, int size) +{ + int fd; + + fd = *(int *)devfd; + if (pwrite(fd, buf, size, loc) != size) + return (EIO); return (0); } Modified: head/lib/libufs/sbread.3 ============================================================================== --- head/lib/libufs/sbread.3 Fri Jan 26 00:58:02 2018 (r328425) +++ head/lib/libufs/sbread.3 Fri Jan 26 00:58:32 2018 (r328426) @@ -2,6 +2,8 @@ .\" Date: June 04, 2003 .\" Description: .\" Manual page for libufs functions: +.\" sbget(3) +.\" sbput(3) .\" sbread(3) .\" sbwrite(3) .\" @@ -9,11 +11,11 @@ .\" .\" $FreeBSD$ .\" -.Dd June 4, 2003 +.Dd January 19, 2018 .Dt SBREAD 3 .Os .Sh NAME -.Nm sbread , sbwrite +.Nm sbget , sbput , sbread , sbwrite .Nd read and write superblocks of a UFS file system .Sh LIBRARY .Lb libufs @@ -25,35 +27,95 @@ .In ufs/ffs/fs.h .In libufs.h .Ft int +.Fn sbget "int devfd" "struct fs **fsp" "off_t sblockloc" +.Ft int +.Fn sbput "int devfd" "struct fs *fs" "int numaltwrite" +.Ft int .Fn sbread "struct uufsd *disk" .Ft int .Fn sbwrite "struct uufsd *disk" "int all" .Sh DESCRIPTION The +.Fn sbget +and .Fn sbread +functions provide superblock reads for +.Xr libufs 3 +consumers. +The +.Fn sbput and .Fn sbwrite -functions provide superblock reads and writes for +functions provide superblock writes for .Xr libufs 3 consumers. +.Pp The +.Fn sbget +function first allocates a buffer to hold the superblock. +Using the +.Va devfd +file descriptor that references the filesystem disk, +.Fn sbget +reads the superblock located at the byte offset specified by +.Va sblockloc +into the allocated buffer. +If successful, it returns a pointer to the buffer containing the superblock in +.Va fsp . +The +.Fn sbget +function is safe to use in threaded applications. +.Pp +The +.Fn sbput +function writes the superblock specified by +.Va fs +to the location from which it was read on the disk referenced by the +.Va devfd +file descriptor. +Additionally, the +.Fn sbput +function will update the first +.Va numaltwrite +alternate superblock locations. +To update all the alternate superblocks, +specify a +.Va numaltwrite +value of +.Va fs->fs_ncg . +The +.Fn sbput +function is safe to use in threaded applications. +Note that the +.Fn sbput +function needs to be called only if the superblock has been +modified and the on-disk copy needs to be updated. +.Pp +The .Fn sbread -and +function reads the standard filesystem superblock into the +.Va d_sb , +structure embedded in the given user-land UFS disk structure. +.Pp +The .Fn sbwrite -functions operate on the superblock field, +function writes the superblock from the .Va d_sb , -associated with a given userland UFS disk structure. +structure embedded in the given user-land UFS disk structure +to the location from which it was read. Additionally, the .Fn sbwrite -function will write to all superblock locations if the +function will write to all the alternate superblock locations if the .Fa all value is non-zero. .Sh RETURN VALUES -.Rv -std sbread sbwrite +.Rv -std sbget sbput sbread sbwrite .Sh ERRORS -The function +The +.Fn sbget +and .Fn sbread -may fail and set +functions may fail and set .Va errno for any of the errors specified for the library function .Xr bread 3 . @@ -62,9 +124,11 @@ Additionally, it may follow the error methodologies in situations where no usable superblock could be found. .Pp -The function +The +.Fn sbput +and .Fn sbwrite -may fail and set +functions may fail and set .Va errno for any of the errors specified for the library function .Xr bwrite 3 . Modified: head/sbin/clri/Makefile ============================================================================== --- head/sbin/clri/Makefile Fri Jan 26 00:58:02 2018 (r328425) +++ head/sbin/clri/Makefile Fri Jan 26 00:58:32 2018 (r328426) @@ -4,6 +4,7 @@ PACKAGE=runtime PROG= clri MAN= clri.8 +LIBADD= ufs WARNS?= 2 .include Modified: head/sbin/clri/clri.c ============================================================================== --- head/sbin/clri/clri.c Fri Jan 26 00:58:02 2018 (r328425) +++ head/sbin/clri/clri.c Fri Jan 26 00:58:32 2018 (r328426) @@ -54,17 +54,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include #include #include #include -/* - * Possible superblock locations ordered from most to least likely. - */ -static int sblock_try[] = SBLOCKSEARCH; - static void usage(void) { @@ -75,41 +72,35 @@ usage(void) int main(int argc, char *argv[]) { - struct fs *sbp; + struct fs *fs; struct ufs1_dinode *dp1; struct ufs2_dinode *dp2; char *ibuf[MAXBSIZE]; long generation, bsize; off_t offset; - int i, fd, inonum; - char *fs, sblock[SBLOCKSIZE]; + int fd, ret, inonum; + char *fsname; void *v = ibuf; if (argc < 3) usage(); - fs = *++argv; - sbp = NULL; + fsname = *++argv; /* get the superblock. */ - if ((fd = open(fs, O_RDWR, 0)) < 0) - err(1, "%s", fs); - for (i = 0; sblock_try[i] != -1; i++) { - if (lseek(fd, (off_t)(sblock_try[i]), SEEK_SET) < 0) - err(1, "%s", fs); - if (read(fd, sblock, sizeof(sblock)) != sizeof(sblock)) - errx(1, "%s: can't read superblock", fs); - sbp = (struct fs *)sblock; - if ((sbp->fs_magic == FS_UFS1_MAGIC || - (sbp->fs_magic == FS_UFS2_MAGIC && - sbp->fs_sblockloc == sblock_try[i])) && - sbp->fs_bsize <= MAXBSIZE && - sbp->fs_bsize >= (int)sizeof(struct fs)) - break; + if ((fd = open(fsname, O_RDWR, 0)) < 0) + err(1, "%s", fsname); + if ((ret = sbget(fd, &fs, -1)) != 0) { + switch (ret) { + case ENOENT: + warn("Cannot find file system superblock"); + return (1); + default: + warn("Unable to read file system superblock"); + return (1); + } } - if (sblock_try[i] == -1) - errx(2, "cannot find file system superblock"); - bsize = sbp->fs_bsize; + bsize = fs->fs_bsize; /* remaining arguments are inode numbers. */ while (*++argv) { @@ -119,20 +110,20 @@ main(int argc, char *argv[]) (void)printf("clearing %d\n", inonum); /* read in the appropriate block. */ - offset = ino_to_fsba(sbp, inonum); /* inode to fs blk */ - offset = fsbtodb(sbp, offset); /* fs blk disk blk */ + offset = ino_to_fsba(fs, inonum); /* inode to fs blk */ + offset = fsbtodb(fs, offset); /* fs blk disk blk */ offset *= DEV_BSIZE; /* disk blk to bytes */ /* seek and read the block */ if (lseek(fd, offset, SEEK_SET) < 0) - err(1, "%s", fs); + err(1, "%s", fsname); if (read(fd, ibuf, bsize) != bsize) - err(1, "%s", fs); + err(1, "%s", fsname); - if (sbp->fs_magic == FS_UFS2_MAGIC) { + if (fs->fs_magic == FS_UFS2_MAGIC) { /* get the inode within the block. */ dp2 = &(((struct ufs2_dinode *)v) - [ino_to_fsbo(sbp, inonum)]); + [ino_to_fsbo(fs, inonum)]); /* clear the inode, and bump the generation count. */ generation = dp2->di_gen + 1; @@ -141,7 +132,7 @@ main(int argc, char *argv[]) } else { /* get the inode within the block. */ dp1 = &(((struct ufs1_dinode *)v) - [ino_to_fsbo(sbp, inonum)]); + [ino_to_fsbo(fs, inonum)]); /* clear the inode, and bump the generation count. */ generation = dp1->di_gen + 1; @@ -151,9 +142,9 @@ main(int argc, char *argv[]) /* backup and write the block */ if (lseek(fd, (off_t)-bsize, SEEK_CUR) < 0) - err(1, "%s", fs); + err(1, "%s", fsname); if (write(fd, ibuf, bsize) != bsize) - err(1, "%s", fs); + err(1, "%s", fsname); (void)fsync(fd); } (void)close(fd); Modified: head/sbin/dump/Makefile ============================================================================== --- head/sbin/dump/Makefile Fri Jan 26 00:58:02 2018 (r328425) +++ head/sbin/dump/Makefile Fri Jan 26 00:58:32 2018 (r328426) @@ -19,6 +19,7 @@ LINKS= ${BINDIR}/dump ${BINDIR}/rdump CFLAGS+=-DRDUMP SRCS= itime.c main.c optr.c dumprmt.c tape.c traverse.c unctime.c cache.c MAN= dump.8 +LIBADD= ufs MLINKS= dump.8 rdump.8 WARNS?= 2 Modified: head/sbin/dump/dump.h ============================================================================== --- head/sbin/dump/dump.h Fri Jan 26 00:58:02 2018 (r328425) +++ head/sbin/dump/dump.h Fri Jan 26 00:58:32 2018 (r328426) @@ -86,7 +86,6 @@ time_t tstart_writing; /* when started writing the fir time_t tend_writing; /* after writing the last tape block */ int passno; /* current dump pass number */ struct fs *sblock; /* the file system super block */ -char sblock_buf[MAXBSIZE]; long dev_bsize; /* block size of underlying disk device */ int dev_bshift; /* log2(dev_bsize) */ int tp_bshift; /* log2(TP_BSIZE) */ Modified: head/sbin/dump/main.c ============================================================================== --- head/sbin/dump/main.c Fri Jan 26 00:58:02 2018 (r328425) +++ head/sbin/dump/main.c Fri Jan 26 00:58:32 2018 (r328426) @@ -59,6 +59,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -84,11 +85,6 @@ long dev_bsize = 1; /* recalculated below */ long blocksperfile; /* output blocks per file */ char *host = NULL; /* remote host (if any) */ -/* - * Possible superblock locations ordered from most to least likely. - */ -static int sblock_try[] = SBLOCKSEARCH; - static char *getmntpt(char *, int *); static long numarg(const char *, long, long); static void obsolete(int *, char **[]); @@ -104,7 +100,7 @@ main(int argc, char *argv[]) struct fstab *dt; char *map, *mntpt; int ch, mode, mntflags; - int i, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1; + int i, ret, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1; int just_estimate = 0; ino_t maxino; char *tmsg; @@ -437,19 +433,16 @@ main(int argc, char *argv[]) msgtail("to %s\n", tape); sync(); - sblock = (struct fs *)sblock_buf; - for (i = 0; sblock_try[i] != -1; i++) { - sblock->fs_fsize = SBLOCKSIZE; /* needed in blkread */ - blkread(sblock_try[i]>>dev_bshift, (char *) sblock, SBLOCKSIZE); - if ((sblock->fs_magic == FS_UFS1_MAGIC || - (sblock->fs_magic == FS_UFS2_MAGIC && - sblock->fs_sblockloc == sblock_try[i])) && - sblock->fs_bsize <= MAXBSIZE && - sblock->fs_bsize >= sizeof(struct fs)) - break; + if ((ret = sbget(diskfd, &sblock, -1)) != 0) { + switch (ret) { + case ENOENT: + warn("Cannot find file system superblock"); + return (1); + default: + warn("Unable to read file system superblock"); + return (1); + } } - if (sblock_try[i] == -1) - quit("Cannot find file system superblock\n"); dev_bsize = sblock->fs_fsize / fsbtodb(sblock, 1); dev_bshift = ffs(dev_bsize) - 1; if (dev_bsize != (1 << dev_bshift)) Modified: head/sbin/fsck_ffs/fsck.h ============================================================================== --- head/sbin/fsck_ffs/fsck.h Fri Jan 26 00:58:02 2018 (r328425) +++ head/sbin/fsck_ffs/fsck.h Fri Jan 26 00:58:32 2018 (r328426) @@ -308,7 +308,7 @@ extern u_int real_dev_bsize; /* actual disk sector si extern char nflag; /* assume a no response */ extern char yflag; /* assume a yes response */ extern int bkgrdflag; /* use a snapshot to run on an active system */ -extern ufs2_daddr_t bflag; /* location of alternate super block */ +extern off_t bflag; /* location of alternate super block */ extern int debug; /* output debugging info */ extern int Eflag; /* delete empty data blocks */ extern int Zflag; /* zero empty data blocks */ Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Fri Jan 26 00:58:02 2018 (r328425) +++ head/sbin/fsck_ffs/fsutil.c Fri Jan 26 00:58:32 2018 (r328426) @@ -348,7 +348,6 @@ getblk(struct bufarea *bp, ufs2_daddr_t blk, long size void flush(int fd, struct bufarea *bp) { - int i, j; if (!bp->b_dirty) return; @@ -370,14 +369,8 @@ flush(int fd, struct bufarea *bp) if (bp != &sblk) pfatal("BUFFER %p DOES NOT MATCH SBLK %p\n", bp, &sblk); - blwrite(fd, bp->b_un.b_buf, bp->b_bno, bp->b_size); - for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, - j++) { - blwrite(fswritefd, (char *)sblock.fs_csp + i, - fsbtodb(&sblock, - sblock.fs_csaddr + j * sblock.fs_frag), - MIN(sblock.fs_cssize - i, sblock.fs_bsize)); - } + if (sbput(fd, (struct fs *)bp->b_un.b_buf, 0) == 0) + fsmodified = 1; break; case BT_CYLGRP: if (cgput(&disk, (struct cg *)bp->b_un.b_buf) == 0) @@ -439,6 +432,8 @@ ckfini(int markclean) if (havesb && cursnapshot == 0 && sblock.fs_magic == FS_UFS2_MAGIC && sblk.b_bno != sblock.fs_sblockloc / dev_bsize && !preen && reply("UPDATE STANDARD SUPERBLOCK")) { + /* Change the write destination to standard superblock */ + sblock.fs_sblockactualloc = sblock.fs_sblockloc; sblk.b_bno = sblock.fs_sblockloc / dev_bsize; sbdirty(); flush(fswritefd, &sblk); Modified: head/sbin/fsck_ffs/globs.c ============================================================================== --- head/sbin/fsck_ffs/globs.c Fri Jan 26 00:58:02 2018 (r328425) +++ head/sbin/fsck_ffs/globs.c Fri Jan 26 00:58:32 2018 (r328426) @@ -80,7 +80,7 @@ u_int real_dev_bsize; /* actual disk sector size, not char nflag; /* assume a no response */ char yflag; /* assume a yes response */ int bkgrdflag; /* use a snapshot to run on an active system */ -ufs2_daddr_t bflag; /* location of alternate super block */ +off_t bflag; /* location of alternate super block */ int debug; /* output debugging info */ int Eflag; /* delete empty data blocks */ int Zflag; /* zero empty data blocks */ Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Fri Jan 26 00:58:02 2018 (r328425) +++ head/sbin/fsck_ffs/setup.c Fri Jan 26 00:58:32 2018 (r328426) @@ -311,70 +311,48 @@ badsb: } /* - * Possible superblock locations ordered from most to least likely. - */ -static int sblock_try[] = SBLOCKSEARCH; - -#define BAD_MAGIC_MSG \ -"The previous newfs operation on this volume did not complete.\n" \ -"You must complete newfs before mounting this volume.\n" - -/* * Read in the super block and its summary info. */ int readsb(int listerr) { - ufs2_daddr_t super; - int i, bad; + off_t super; + int bad, ret; + struct fs *fs; - if (bflag) { - super = bflag; - readcnt[sblk.b_type]++; - if ((blread(fsreadfd, (char *)&sblock, super, (long)SBLOCKSIZE))) - return (0); - if (sblock.fs_magic == FS_BAD_MAGIC) { - fprintf(stderr, BAD_MAGIC_MSG); + super = bflag ? bflag * dev_bsize : -1; + readcnt[sblk.b_type]++; + if ((ret = sbget(fsreadfd, &fs, super)) != 0) { + switch (ret) { + case EINVAL: + fprintf(stderr, "The previous newfs operation " + "on this volume did not complete.\nYou must " + "complete newfs before using this volume.\n"); exit(11); - } - if (sblock.fs_magic != FS_UFS1_MAGIC && - sblock.fs_magic != FS_UFS2_MAGIC) { - fprintf(stderr, "%jd is not a file system superblock\n", - bflag); + case ENOENT: + if (bflag) + fprintf(stderr, "%jd is not a file system " + "superblock\n", super / dev_bsize); + else + fprintf(stderr, "Cannot find file system " + "superblock\n"); return (0); - } - } else { - for (i = 0; sblock_try[i] != -1; i++) { - super = sblock_try[i] / dev_bsize; - readcnt[sblk.b_type]++; - if ((blread(fsreadfd, (char *)&sblock, super, - (long)SBLOCKSIZE))) - return (0); - if (sblock.fs_magic == FS_BAD_MAGIC) { - fprintf(stderr, BAD_MAGIC_MSG); - exit(11); - } - if ((sblock.fs_magic == FS_UFS1_MAGIC || - (sblock.fs_magic == FS_UFS2_MAGIC && - sblock.fs_sblockloc == sblock_try[i])) && - sblock.fs_ncg >= 1 && - sblock.fs_bsize >= MINBSIZE && - sblock.fs_sbsize >= roundup(sizeof(struct fs), dev_bsize)) - break; - } - if (sblock_try[i] == -1) { - fprintf(stderr, "Cannot find file system superblock\n"); + case EIO: + default: + fprintf(stderr, "I/O error reading %jd\n", + super / dev_bsize); return (0); } } + memcpy(&sblock, fs, fs->fs_sbsize); + free(fs); /* * Compute block size that the file system is based on, * according to fsbtodb, and adjust superblock block number * so we can tell if this is an alternate later. */ - super *= dev_bsize; dev_bsize = sblock.fs_fsize / fsbtodb(&sblock, 1); - sblk.b_bno = super / dev_bsize; + sblk.b_bno = sblock.fs_sblockactualloc / dev_bsize; sblk.b_size = SBLOCKSIZE; /* * Compare all fields that should not differ in alternate super block. Modified: head/sbin/fsirand/Makefile ============================================================================== --- head/sbin/fsirand/Makefile Fri Jan 26 00:58:02 2018 (r328425) +++ head/sbin/fsirand/Makefile Fri Jan 26 00:58:32 2018 (r328426) @@ -4,6 +4,7 @@ PACKAGE=runtime PROG= fsirand MAN= fsirand.8 +LIBADD= ufs WARNS?= 3 .include Modified: head/sbin/fsirand/fsirand.c ============================================================================== --- head/sbin/fsirand/fsirand.c Fri Jan 26 00:58:02 2018 (r328425) +++ head/sbin/fsirand/fsirand.c Fri Jan 26 00:58:32 2018 (r328426) @@ -46,6 +46,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -56,11 +57,6 @@ static const char rcsid[] = static void usage(void) __dead2; int fsirand(char *); -/* - * Possible superblock locations ordered from most to least likely. - */ -static int sblock_try[] = SBLOCKSEARCH; - static int printonly = 0, force = 0, ignorelabel = 0; int @@ -117,9 +113,8 @@ fsirand(char *device) ssize_t ibufsize; struct fs *sblock; ino_t inumber; - ufs2_daddr_t sblockloc, dblk; - char sbuf[SBLOCKSIZE], sbuftmp[SBLOCKSIZE]; - int i, devfd, n, cg; + ufs2_daddr_t dblk; + int devfd, n, cg, ret; u_int32_t bsize = DEV_BSIZE; if ((devfd = open(device, printonly ? O_RDONLY : O_RDWR)) < 0) { @@ -131,31 +126,16 @@ fsirand(char *device) dp2 = NULL; /* Read in master superblock */ - (void)memset(&sbuf, 0, sizeof(sbuf)); - sblock = (struct fs *)&sbuf; - for (i = 0; sblock_try[i] != -1; i++) { - sblockloc = sblock_try[i]; - if (lseek(devfd, sblockloc, SEEK_SET) == -1) { - warn("can't seek to superblock (%jd) on %s", - (intmax_t)sblockloc, device); + if ((ret = sbget(devfd, &sblock, -1)) != 0) { + switch (ret) { + case ENOENT: + warn("Cannot find file system superblock"); return (1); - } - if ((n = read(devfd, (void *)sblock, SBLOCKSIZE))!=SBLOCKSIZE) { - warnx("can't read superblock on %s: %s", device, - (n < SBLOCKSIZE) ? "short read" : strerror(errno)); + default: + warn("Unable to read file system superblock"); return (1); } - if ((sblock->fs_magic == FS_UFS1_MAGIC || - (sblock->fs_magic == FS_UFS2_MAGIC && - sblock->fs_sblockloc == sblock_try[i])) && - sblock->fs_bsize <= MAXBSIZE && - sblock->fs_bsize >= (ssize_t)sizeof(struct fs)) - break; } - if (sblock_try[i] == -1) { - fprintf(stderr, "Cannot find file system superblock\n"); - return (1); - } if (sblock->fs_magic == FS_UFS1_MAGIC && sblock->fs_old_inodefmt < FS_44INODEFMT) { @@ -167,33 +147,6 @@ fsirand(char *device) return (1); } - /* Make sure backup superblocks are sane. */ - sblock = (struct fs *)&sbuftmp; - for (cg = 0; cg < (int)sblock->fs_ncg; cg++) { - dblk = fsbtodb(sblock, cgsblock(sblock, cg)); - if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) { - warn("can't seek to %jd", (intmax_t)dblk * bsize); - return (1); - } else if ((n = write(devfd, (void *)sblock, SBLOCKSIZE)) != SBLOCKSIZE) { - warn("can't read backup superblock %d on %s: %s", - cg + 1, device, (n < SBLOCKSIZE) ? "short write" - : strerror(errno)); - return (1); - } - if (sblock->fs_magic != FS_UFS1_MAGIC && - sblock->fs_magic != FS_UFS2_MAGIC) { - warnx("bad magic number in backup superblock %d on %s", - cg + 1, device); - return (1); - } - if (sblock->fs_sbsize > SBLOCKSIZE) { - warnx("size of backup superblock %d on %s is preposterous", - cg + 1, device); - return (1); - } - } - sblock = (struct fs *)&sbuf; - /* XXX - should really cap buffer at 512kb or so */ if (sblock->fs_magic == FS_UFS1_MAGIC) ibufsize = sizeof(struct ufs1_dinode) * sblock->fs_ipg; @@ -215,38 +168,14 @@ fsirand(char *device) /* Randomize fs_id and write out new sblock and backups */ sblock->fs_id[0] = (u_int32_t)time(NULL); sblock->fs_id[1] = random(); - - if (lseek(devfd, sblockloc, SEEK_SET) == -1) { - warn("can't seek to superblock (%jd) on %s", - (intmax_t)sblockloc, device); + if (sbput(devfd, sblock, sblock->fs_ncg) != 0) { + warn("could not write updated superblock"); return (1); } - if ((n = write(devfd, (void *)sblock, SBLOCKSIZE)) != - SBLOCKSIZE) { - warn("can't write superblock on %s: %s", device, - (n < SBLOCKSIZE) ? "short write" : strerror(errno)); - return (1); - } } /* For each cylinder group, randomize inodes and update backup sblock */ for (cg = 0, inumber = 0; cg < (int)sblock->fs_ncg; cg++) { - /* Update superblock if appropriate */ - if (!printonly) { - dblk = fsbtodb(sblock, cgsblock(sblock, cg)); - if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) { - warn("can't seek to %jd", - (intmax_t)dblk * bsize); - return (1); - } else if ((n = write(devfd, (void *)sblock, - SBLOCKSIZE)) != SBLOCKSIZE) { - warn("can't write backup superblock %d on %s: %s", - cg + 1, device, (n < SBLOCKSIZE) ? - "short write" : strerror(errno)); - return (1); - } - } - /* Read in inodes, then print or randomize generation nums */ dblk = fsbtodb(sblock, ino_to_fsba(sblock, inumber)); if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) { Modified: head/sbin/growfs/growfs.c ============================================================================== --- head/sbin/growfs/growfs.c Fri Jan 26 00:58:02 2018 (r328425) +++ head/sbin/growfs/growfs.c Fri Jan 26 00:58:32 2018 (r328426) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -95,12 +96,6 @@ static union { #define sblock fsun1.fs /* the new superblock */ #define osblock fsun2.fs /* the old superblock */ -/* - * Possible superblock locations ordered from most to least likely. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Jan 26 03:30:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65630EB72A9; Fri, 26 Jan 2018 03:30:06 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B6397FFA5; Fri, 26 Jan 2018 03:30:06 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1673216366; Fri, 26 Jan 2018 03:30:06 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q3U5FD072735; Fri, 26 Jan 2018 03:30:05 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q3U5t5072734; Fri, 26 Jan 2018 03:30:05 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801260330.w0Q3U5t5072734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Fri, 26 Jan 2018 03:30:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328427 - head/bin/dd X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/bin/dd X-SVN-Commit-Revision: 328427 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 03:30:06 -0000 Author: eadler Date: Fri Jan 26 03:30:05 2018 New Revision: 328427 URL: https://svnweb.freebsd.org/changeset/base/328427 Log: dd(1): Use a local swapbytes() function. swab(3) has restrict qualifiers for src and dst. Avoid relying on undefined overlapping swab behavior. Obtained From: OpenBSD Modified: head/bin/dd/dd.c Modified: head/bin/dd/dd.c ============================================================================== --- head/bin/dd/dd.c Fri Jan 26 00:58:32 2018 (r328426) +++ head/bin/dd/dd.c Fri Jan 26 03:30:05 2018 (r328427) @@ -339,6 +339,21 @@ speed_limit(void) } static void +swapbytes(void *v, size_t len) +{ + unsigned char *p = v; + unsigned char t; + + while (len > 1) { + t = p[0]; + p[0] = p[1]; + p[1] = t; + p += 2; + len -= 2; + } +} + +static void dd_in(void) { ssize_t n; @@ -438,7 +453,7 @@ dd_in(void) ++st.swab; --n; } - swab(in.dbp, in.dbp, (size_t)n); + swapbytes(in.dbp, (size_t)n); } in.dbp += in.dbrcnt; From owner-svn-src-all@freebsd.org Fri Jan 26 04:24:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 087C4EBDA87; Fri, 26 Jan 2018 04:24:40 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D4CB81A2B; Fri, 26 Jan 2018 04:24:39 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9285116D0E; Fri, 26 Jan 2018 04:24:39 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q4OdDN002670; Fri, 26 Jan 2018 04:24:39 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q4OdcK002668; Fri, 26 Jan 2018 04:24:39 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801260424.w0Q4OdcK002668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Fri, 26 Jan 2018 04:24:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328428 - head/share/examples/kld/cdev/module X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/share/examples/kld/cdev/module X-SVN-Commit-Revision: 328428 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 04:24:40 -0000 Author: eadler Date: Fri Jan 26 04:24:39 2018 New Revision: 328428 URL: https://svnweb.freebsd.org/changeset/base/328428 Log: example cdev: use make_dev_s Make use of make_dev_s in the example cdev. While here, fix warnings. Reviewed by: rpokala Modified: head/share/examples/kld/cdev/module/cdev.c head/share/examples/kld/cdev/module/cdevmod.c Modified: head/share/examples/kld/cdev/module/cdev.c ============================================================================== --- head/share/examples/kld/cdev/module/cdev.c Fri Jan 26 03:30:05 2018 (r328427) +++ head/share/examples/kld/cdev/module/cdev.c Fri Jan 26 04:24:39 2018 (r328428) @@ -104,7 +104,7 @@ mydev_open(struct cdev *dev, int flag, int otyp, struc { struct proc *procp = td->td_proc; - printf("mydev_open: dev_t=%d, flag=%x, otyp=%x, procp=%p\n", + printf("mydev_open: dev_t=%lu, flag=%x, otyp=%x, procp=%p\n", dev2udev(dev), flag, otyp, procp); memset(&buf, '\0', 513); len = 0; @@ -116,7 +116,7 @@ mydev_close(struct cdev *dev, int flag, int otyp, stru { struct proc *procp = td->td_proc; - printf("mydev_close: dev_t=%d, flag=%x, otyp=%x, procp=%p\n", + printf("mydev_close: dev_t=%lu, flag=%x, otyp=%x, procp=%p\n", dev2udev(dev), flag, otyp, procp); return (0); } @@ -128,7 +128,7 @@ mydev_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int error = 0; struct proc *procp = td->td_proc; - printf("mydev_ioctl: dev_t=%d, cmd=%lx, arg=%p, mode=%x procp=%p\n", + printf("mydev_ioctl: dev_t=%lu, cmd=%lx, arg=%p, mode=%x procp=%p\n", dev2udev(dev), cmd, arg, mode, procp); switch(cmd) { @@ -152,7 +152,7 @@ mydev_write(struct cdev *dev, struct uio *uio, int iof { int err = 0; - printf("mydev_write: dev_t=%d, uio=%p, ioflag=%d\n", + printf("mydev_write: dev_t=%lu, uio=%p, ioflag=%d\n", dev2udev(dev), uio, ioflag); err = copyinstr(uio->uio_iov->iov_base, &buf, 512, &len); @@ -172,7 +172,7 @@ mydev_read(struct cdev *dev, struct uio *uio, int iofl { int err = 0; - printf("mydev_read: dev_t=%d, uio=%p, ioflag=%d\n", + printf("mydev_read: dev_t=%lu, uio=%p, ioflag=%d\n", dev2udev(dev), uio, ioflag); if (len <= 0) { Modified: head/share/examples/kld/cdev/module/cdevmod.c ============================================================================== --- head/share/examples/kld/cdev/module/cdevmod.c Fri Jan 26 03:30:05 2018 (r328427) +++ head/share/examples/kld/cdev/module/cdevmod.c Fri Jan 26 04:24:39 2018 (r328428) @@ -109,6 +109,7 @@ static int cdev_load(module_t mod, int cmd, void *arg) { int err = 0; + struct make_dev_args mda; switch (cmd) { case MOD_LOAD: @@ -120,8 +121,14 @@ cdev_load(module_t mod, int cmd, void *arg) printf("Copyright (c) 1998\n"); printf("Rajesh Vaidheeswarran\n"); printf("All rights reserved\n"); - sdev = make_dev(&my_devsw, 0, UID_ROOT, GID_WHEEL, 0600, "cdev"); - break; /* Success*/ + + make_dev_args_init(&mda); + mda.mda_devsw = &my_devsw; + mda.mda_uid = UID_ROOT; + mda.mda_gid = GID_WHEEL; + mda.mda_mode = 0600; + err = make_dev_s(&mda, &sdev, "cdev"); + break; case MOD_UNLOAD: printf("Unloaded kld character device driver\n"); From owner-svn-src-all@freebsd.org Fri Jan 26 04:32:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B6DDEBE0ED; Fri, 26 Jan 2018 04:32:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1EE8981ECB; Fri, 26 Jan 2018 04:32:32 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19C7B16EB0; Fri, 26 Jan 2018 04:32:32 +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 w0Q4WVOK007737; Fri, 26 Jan 2018 04:32:31 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q4WVho007736; Fri, 26 Jan 2018 04:32:31 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201801260432.w0Q4WVho007736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 26 Jan 2018 04:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328429 - in stable: 10/release 11/release X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release 11/release X-SVN-Commit-Revision: 328429 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 04:32:32 -0000 Author: gjb Date: Fri Jan 26 04:32:31 2018 New Revision: 328429 URL: https://svnweb.freebsd.org/changeset/base/328429 Log: MFC r328283, r328284: r328283: When CHROOTBUILD_SKIP is set, evaluate the existence of /bin/sh within the CHROOTDIR. If it does not exist, unset CHROOTBUILD_SKIP to prevent build failures. r328284: Bump Copyright year. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/release.sh Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/release/release.sh Directory Properties: stable/11/ (props changed) Modified: stable/10/release/release.sh ============================================================================== --- stable/10/release/release.sh Fri Jan 26 04:24:39 2018 (r328428) +++ stable/10/release/release.sh Fri Jan 26 04:32:31 2018 (r328429) @@ -1,6 +1,6 @@ #!/bin/sh #- -# Copyright (c) 2013-2017 The FreeBSD Foundation +# Copyright (c) 2013-2018 The FreeBSD Foundation # Copyright (c) 2013 Glen Barber # Copyright (c) 2011 Nathan Whitehorn # All rights reserved. @@ -195,6 +195,11 @@ env_check() { if [ $(id -u) -ne 0 ]; then echo "Needs to be run as root." exit 1 + fi + + # Unset CHROOTBUILD_SKIP if the chroot(8) does not appear to exist. + if [ ! -z "${CHROOTBUILD_SKIP}" -a ! -e ${CHROOTDIR}/bin/sh ]; then + CHROOTBUILD_SKIP= fi CHROOT_MAKEENV="${CHROOT_MAKEENV} \ From owner-svn-src-all@freebsd.org Fri Jan 26 04:32:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2B2FEBE0F1; Fri, 26 Jan 2018 04:32:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54DB781ECD; Fri, 26 Jan 2018 04:32:32 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F71D16EB1; Fri, 26 Jan 2018 04:32:32 +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 w0Q4WWw9007743; Fri, 26 Jan 2018 04:32:32 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q4WW0e007742; Fri, 26 Jan 2018 04:32:32 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201801260432.w0Q4WW0e007742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 26 Jan 2018 04:32:32 +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: r328429 - in stable: 10/release 11/release X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release 11/release X-SVN-Commit-Revision: 328429 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 04:32:32 -0000 Author: gjb Date: Fri Jan 26 04:32:31 2018 New Revision: 328429 URL: https://svnweb.freebsd.org/changeset/base/328429 Log: MFC r328283, r328284: r328283: When CHROOTBUILD_SKIP is set, evaluate the existence of /bin/sh within the CHROOTDIR. If it does not exist, unset CHROOTBUILD_SKIP to prevent build failures. r328284: Bump Copyright year. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/release.sh Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/release/release.sh Directory Properties: stable/10/ (props changed) Modified: stable/11/release/release.sh ============================================================================== --- stable/11/release/release.sh Fri Jan 26 04:24:39 2018 (r328428) +++ stable/11/release/release.sh Fri Jan 26 04:32:31 2018 (r328429) @@ -1,6 +1,6 @@ #!/bin/sh #- -# Copyright (c) 2013-2017 The FreeBSD Foundation +# Copyright (c) 2013-2018 The FreeBSD Foundation # Copyright (c) 2013 Glen Barber # Copyright (c) 2011 Nathan Whitehorn # All rights reserved. @@ -201,6 +201,11 @@ env_check() { if [ $(id -u) -ne 0 ]; then echo "Needs to be run as root." exit 1 + fi + + # Unset CHROOTBUILD_SKIP if the chroot(8) does not appear to exist. + if [ ! -z "${CHROOTBUILD_SKIP}" -a ! -e ${CHROOTDIR}/bin/sh ]; then + CHROOTBUILD_SKIP= fi CHROOT_MAKEENV="${CHROOT_MAKEENV} \ From owner-svn-src-all@freebsd.org Fri Jan 26 04:40:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B831EBE5E8; Fri, 26 Jan 2018 04:40:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD8AB82241; Fri, 26 Jan 2018 04:40:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C85C216EC8; Fri, 26 Jan 2018 04:40:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q4ef8N008107; Fri, 26 Jan 2018 04:40:41 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q4efhg008105; Fri, 26 Jan 2018 04:40:41 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801260440.w0Q4efhg008105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Fri, 26 Jan 2018 04:40:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328430 - head/sbin/devd X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/sbin/devd X-SVN-Commit-Revision: 328430 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 04:40:42 -0000 Author: eadler Date: Fri Jan 26 04:40:41 2018 New Revision: 328430 URL: https://svnweb.freebsd.org/changeset/base/328430 Log: devd: minor nits - mark usage as noreturn - config does not need a virtual destructor Modified: head/sbin/devd/devd.cc head/sbin/devd/devd.hh Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Fri Jan 26 04:32:31 2018 (r328429) +++ head/sbin/devd/devd.cc Fri Jan 26 04:40:41 2018 (r328430) @@ -161,7 +161,7 @@ static const char *configfile = CF; static void devdlog(int priority, const char* message, ...) __printflike(2, 3); static void event_loop(void); -static void usage(void); +static void usage(void) __dead2; template void delete_and_clear(vector &v) Modified: head/sbin/devd/devd.hh ============================================================================== --- head/sbin/devd/devd.hh Fri Jan 26 04:32:31 2018 (r328429) +++ head/sbin/devd/devd.hh Fri Jan 26 04:40:41 2018 (r328430) @@ -147,7 +147,7 @@ class config { public: config() { push_var_table(); } - virtual ~config() { reset(); } + ~config() { reset(); } void add_attach(int, event_proc *); void add_detach(int, event_proc *); void add_directory(const char *); From owner-svn-src-all@freebsd.org Fri Jan 26 04:52:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D216EEC01CC for ; Fri, 26 Jan 2018 04:52:20 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com [IPv6:2a00:1450:400c:c09::22f]) (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 3E5F182BA8 for ; Fri, 26 Jan 2018 04:52:20 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x22f.google.com with SMTP id f71so18567473wmf.0 for ; Thu, 25 Jan 2018 20:52:19 -0800 (PST) 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=JcoqqCfawUSJ6wbcyMxRX/0aLNWjeF5eUt0+80rSeiE=; b=O1glz+kXDEWgsQ/JJSNlUPgv2pRlnGBlCtiQWN0Ep+SXJF/jFJMuJjDp2yIwlHMhkY KmCQHoq6qxloWLeXBu0UTfPKPwAkiDlQ8J9RiPlHf5rpcELYGVnn/eUREu9zD+lrrjsx PyiwQ3FCVaS/4k9ocztSyXIiFmS801/fPc5rdeSNBoluh4txmSAYqr0OjzZD+l5hLZrC /ewBNBe+l52nic4dLDvaK3+uo32fXiiB2BFj5A43fC15kAYvf9F1k0DAUEXOyJZxu7tt IppFK7RZlI9LEAUA2AeDwIEs+C09ofgOO9SjQnoZOD/y4PIpLHH1QvlN17lGnph3i4xH DctQ== 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=JcoqqCfawUSJ6wbcyMxRX/0aLNWjeF5eUt0+80rSeiE=; b=ChUE75sKgrQOpNnrN9uudlYx651iKiEqJ7SEbnbKSGAv6FtSI9WrHQAGsb2cw+qb8+ sbWQJctYjqcaoYOW2NDZt29dG1fLPrmedZS9Ci5jqPtzAlcQ/4SXtfw2XV0MD97bj6J3 XpwGgCTaGypaXnLzySVrB0vQgvG5HUy/HGfauO7Jl1thbWuZzkFBH1ddx27WQ91Yzoxg a3dpKvaMvwswfokZmaCCOJIPDTYK5n+N/7Wvrcbv2sEK9vjBWgYQdKOXvmoUMmx/1jLV AXLGxIua6a5m8j9wB+zALzGjmGjvHvHOc+74GpOyDAZaQ4Si98kRelqNVi+CSpxFZtAR ZBew== X-Gm-Message-State: AKwxytf7eOuq+qK3D5um/5KlVCfEo+YVjgV2h1CYpUzM1u7L0WNwpPWq XjFdT5hNbGKzoY1EV1BRzjKT3Cttn8K/QLqnLWiIUA== X-Google-Smtp-Source: AH8x227/KGjrSAWL1CQQ+LAANZFJP9IDA41XPgI/ZnRhaaLTnVmqbNT376IASMmyIOrAKWNPmnKyfPRTRRvZNmuIarM= X-Received: by 10.80.170.24 with SMTP id o24mr32260411edc.258.1516942338297; Thu, 25 Jan 2018 20:52:18 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.165.93 with HTTP; Thu, 25 Jan 2018 20:52:09 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:18a2:a4f7:170:8dd9] In-Reply-To: <201801260440.w0Q4efhg008105@repo.freebsd.org> References: <201801260440.w0Q4efhg008105@repo.freebsd.org> From: Warner Losh Date: Thu, 25 Jan 2018 21:52:09 -0700 X-Google-Sender-Auth: ZnOEj3Y8iYf-WVFJEbhpK_5Sycc Message-ID: Subject: Re: svn commit: r328430 - head/sbin/devd To: Eitan Adler Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 26 Jan 2018 04:52:21 -0000 On Thu, Jan 25, 2018 at 9:40 PM, Eitan Adler wrote: > Author: eadler > Date: Fri Jan 26 04:40:41 2018 > New Revision: 328430 > URL: https://svnweb.freebsd.org/changeset/base/328430 > > Log: > devd: minor nits > > - mark usage as noreturn > - config does not need a virtual destructor > Everything needs a virtual destructor... Please back that part of this out... Warner > Modified: > head/sbin/devd/devd.cc > head/sbin/devd/devd.hh > > Modified: head/sbin/devd/devd.cc > ============================================================ > ================== > --- head/sbin/devd/devd.cc Fri Jan 26 04:32:31 2018 (r328429) > +++ head/sbin/devd/devd.cc Fri Jan 26 04:40:41 2018 (r328430) > @@ -161,7 +161,7 @@ static const char *configfile = CF; > static void devdlog(int priority, const char* message, ...) > __printflike(2, 3); > static void event_loop(void); > -static void usage(void); > +static void usage(void) __dead2; > > template void > delete_and_clear(vector &v) > > Modified: head/sbin/devd/devd.hh > ============================================================ > ================== > --- head/sbin/devd/devd.hh Fri Jan 26 04:32:31 2018 (r328429) > +++ head/sbin/devd/devd.hh Fri Jan 26 04:40:41 2018 (r328430) > @@ -147,7 +147,7 @@ class config > { > public: > config() { push_var_table(); } > - virtual ~config() { reset(); } > + ~config() { reset(); } > void add_attach(int, event_proc *); > void add_detach(int, event_proc *); > void add_directory(const char *); > > From owner-svn-src-all@freebsd.org Fri Jan 26 05:02:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 452B0EC09C9; Fri, 26 Jan 2018 05:02:53 +0000 (UTC) (envelope-from matt.joras@gmail.com) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::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 AD0D68314D; Fri, 26 Jan 2018 05:02:52 +0000 (UTC) (envelope-from matt.joras@gmail.com) Received: by mail-wm0-x22c.google.com with SMTP id g1so18589304wmg.2; Thu, 25 Jan 2018 21:02:52 -0800 (PST) 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=Y+CzTJPY77E7TEExA5GTcfWziuyUv0PPi5c3Ncr7aAw=; b=B4WkODkYgQ7VBxQhrxS+yfKwT+PUqeiYrvMir0m6qAb1xfJUzRZM27RxFByxee3wQ3 UtvMP6ZgoIe/P0KyEBJZ3GGwsMTfGjW5BZdvRdomy6tlyGGjsd+xRKLzMOzzjEA0BYU+ cwa6B+eMl8K7V/JsMlxU6O8PRuBPwFuxT1J7zJVsmMDrYmLr++Ov2XU5BVc8XSs2edz1 IIevN6I7zJpV0XhWKKa9Ycq4m6GN3Wo7l96RYjXCfNqaJHGoHRnCOPK94+w7l9b3ada2 pASyN8MdnceBWWLyh4E9ESgbyQgQOfxGyvVOJTZygFO9uz4k/XlRfi7WsseT26HIs/oP QRqw== 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=Y+CzTJPY77E7TEExA5GTcfWziuyUv0PPi5c3Ncr7aAw=; b=R6YlC12E+aZjU9S7ROGcxH7Kgc91AUARaqjvEJ//R2Mt0oz613UMmTwZ/e1P+Ndw8w qKqnLjHkBXy+GePr5QupgosU/VVjmr0r4GWA0wDiEW5klspUzjuXSCIfZ15DTCqTrlr+ ReRp+PWZqWummvSuc7KlblSbR+h/W7ebd9aHWBYdO3f/TJ4hm+45WLbxdyp0cKdeQXA3 SV+6WGZ3NTErv5tUUHASni3qi809WqPTsSQDXdPxlivGAA5EjAu/O/OWaDfEhj31r5c0 AL7XGmiK7VXEOdzG6RYauMdUAI0x5scuZPKfYYgerMDO/V6a6qEKeDxs+b1YP+brzcqB BSOA== X-Gm-Message-State: AKwxytcZW5ZIZI4OKGz6QAnaQCx5nif2bEu0DqOqdg82Kca+x0zUks0O /83YjCsm9dN9sS1UhTdHF6OawwZdsguF+W7PfvyTgQ== X-Google-Smtp-Source: AH8x227rfenIF0zt482KyIuRIV3g2SvLFmpQkAlrO/NbgCglwyq9RI0nf3DpcGIRVAdk1QPrcw8c19SRz1CnuuGjq0I= X-Received: by 10.28.144.197 with SMTP id s188mr10113737wmd.51.1516942971499; Thu, 25 Jan 2018 21:02:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.170.69 with HTTP; Thu, 25 Jan 2018 21:02:51 -0800 (PST) In-Reply-To: References: <201801260440.w0Q4efhg008105@repo.freebsd.org> From: Matt Joras Date: Thu, 25 Jan 2018 21:02:51 -0800 Message-ID: Subject: Re: svn commit: r328430 - head/sbin/devd To: Warner Losh Cc: Eitan Adler , 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.25 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: Fri, 26 Jan 2018 05:02:53 -0000 On Thu, Jan 25, 2018 at 8:52 PM, Warner Losh wrote: > > > On Thu, Jan 25, 2018 at 9:40 PM, Eitan Adler wrote: >> >> Author: eadler >> Date: Fri Jan 26 04:40:41 2018 >> New Revision: 328430 >> URL: https://svnweb.freebsd.org/changeset/base/328430 >> >> Log: >> devd: minor nits >> >> - mark usage as noreturn >> - config does not need a virtual destructor > > > Everything needs a virtual destructor... Please back that part of this > out... > > Warner Needs? If there's not inheritance there's no _need_ to do it, and it's arguably superfluous. That being said it's also an arguably superfluous change to remove it. Matt From owner-svn-src-all@freebsd.org Fri Jan 26 05:03:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5956DEC0AB1; Fri, 26 Jan 2018 05:03:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 036F3832A6; Fri, 26 Jan 2018 05:03:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F288017368; Fri, 26 Jan 2018 05:03:37 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q53bD2022265; Fri, 26 Jan 2018 05:03:37 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q53b3u022264; Fri, 26 Jan 2018 05:03:37 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801260503.w0Q53b3u022264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Fri, 26 Jan 2018 05:03:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328431 - head/sbin/devd X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/sbin/devd X-SVN-Commit-Revision: 328431 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 05:03:38 -0000 Author: eadler Date: Fri Jan 26 05:03:37 2018 New Revision: 328431 URL: https://svnweb.freebsd.org/changeset/base/328431 Log: devd: readd virtual - my C++ knowledge is old and rusty. re-add virtual Modified: head/sbin/devd/devd.hh Modified: head/sbin/devd/devd.hh ============================================================================== --- head/sbin/devd/devd.hh Fri Jan 26 04:40:41 2018 (r328430) +++ head/sbin/devd/devd.hh Fri Jan 26 05:03:37 2018 (r328431) @@ -147,7 +147,7 @@ class config { public: config() { push_var_table(); } - ~config() { reset(); } + virtual ~config() { reset(); } void add_attach(int, event_proc *); void add_detach(int, event_proc *); void add_directory(const char *); From owner-svn-src-all@freebsd.org Fri Jan 26 05:05:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EECA7EC0C71 for ; Fri, 26 Jan 2018 05:05:26 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-yw0-x231.google.com (mail-yw0-x231.google.com [IPv6:2607:f8b0:4002:c05::231]) (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 3B75B83451 for ; Fri, 26 Jan 2018 05:05:26 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: by mail-yw0-x231.google.com with SMTP id x62so3844994ywg.11 for ; Thu, 25 Jan 2018 21:05:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=1C9Nw7EhL0S0azdJIJxDVjGKWIsIat1J8V+httszYyM=; b=IbI2u+/aL/J8qPFsXKOn6jgHl/fMt9oprb5zFPtm4hj7KTxmbzUsFzkDx52+m+Z8dX Fx7dxAXXPa9gB9unNp3dOlmKT7KQHFNMb/6r4IFUxiVfkRF0sARxLwsjwCK7YbQKupP2 J28iotxeeYL2N1VLhhUkV8z3fuvznmjrYDn6g= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=1C9Nw7EhL0S0azdJIJxDVjGKWIsIat1J8V+httszYyM=; b=wv12uHYpETKgkc/aEuUkiMuoZPCCUzeNXLnACfZdzDwM9LolA1gY0y7KuylhnwEiTh R2Ii0Q2JHnGO30gjS+eWKpTY0hvE1vJE4VJGJE0ZCF7KX39CukzfsIlcD2Kq36qACHTP 98KWImQDJTsnDP8Fzbwt0ZBQizDCy0oNkWertGYpNf2OUOVCQd5U3UiCLFzU682gJVNH aCOllCMUEyx1k9GzWEFd2H5leVWyKxuZ4OmGA9hcGlDWjZA5THuyh3GCnxQ1IVHxOxZl 1qWMoyC2ChZSE/ZfPc2zYjKzHa/LYfpmTZnN++a6sTa17WA7Vcl2Rr/27Rws428FaqtJ ef8A== 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=1C9Nw7EhL0S0azdJIJxDVjGKWIsIat1J8V+httszYyM=; b=s/06bEbt05qIMpx8aV4aPN2PWlEdnF0YI+N8X0en2Qu6DfsEVdSS22VhH+b/BesB40 njw0FEN/i7/i49myAmiTZaNmbZKC9XOHjpLqVhTc6vxBuGjmJdDyK7WRhJDrjXLM/RS6 AxILXVXkg+GqCW5ILo4n8xXAQgojWPaYsymfup6+wOLRHkfpbFst+7TXaxyFjz0HIeeS WsIh6sQLetrLSpQP3B3hv/5dlHDEMGIpA99bwmEkdFIOO+TV8wiukq9JfAtTpYK31mk0 xk01Qq67N4qGKQdof6WRSjo09yw6ghho9sNCY+Oxl3sTnL/xBj7C+EFKMKOOXpJzKMKM FHHg== X-Gm-Message-State: AKwxyteX3vCZr5jTuOLJejvisGk8n6tqXptmsznH7eJzTpOQ4bP91jiu FMYte9frM5APkLS1cpdWWr9TTI5k+axPRYLUs60Kyg== X-Google-Smtp-Source: AH8x227XssUva6Oq24l+fYC0/iQJ8zb37yg9YQZE9rp7iglJShJFoQreuzhKENZgsPC5GwovUlZZs+Dut367Fp0eXtU= X-Received: by 10.13.228.1 with SMTP id n1mr512540ywe.6.1516943125539; Thu, 25 Jan 2018 21:05:25 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.37.223.203 with HTTP; Thu, 25 Jan 2018 21:04:54 -0800 (PST) In-Reply-To: References: <201801260440.w0Q4efhg008105@repo.freebsd.org> From: Eitan Adler Date: Thu, 25 Jan 2018 21:04:54 -0800 X-Google-Sender-Auth: oiP6ineIZrlH9ESmt5JBB8056y0 Message-ID: Subject: Re: svn commit: r328430 - head/sbin/devd To: Matt Joras Cc: Warner Losh , 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.25 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: Fri, 26 Jan 2018 05:05:27 -0000 On 25 January 2018 at 21:02, Matt Joras wrote: > On Thu, Jan 25, 2018 at 8:52 PM, Warner Losh wrote: >> >> >> On Thu, Jan 25, 2018 at 9:40 PM, Eitan Adler wrote: >>> >>> Author: eadler >>> Date: Fri Jan 26 04:40:41 2018 >>> New Revision: 328430 >>> URL: https://svnweb.freebsd.org/changeset/base/328430 >>> >>> Log: >>> devd: minor nits >>> >>> - mark usage as noreturn >>> - config does not need a virtual destructor >> >> >> Everything needs a virtual destructor... Please back that part of this >> out... >> >> Warner > Needs? If there's not inheritance there's no _need_ to do it, and it's > arguably superfluous. That being said it's also an arguably > superfluous change to remove it. Yeah, I don't think this needs it. That said, readded in 328431. I removed it originally since it was the only virtual function in config and it seemed out of place. At the least, I went looking for what inherited from it. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-all@freebsd.org Fri Jan 26 05:59:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3E9FEC318F for ; Fri, 26 Jan 2018 05:59:21 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (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 1B7E184A18 for ; Fri, 26 Jan 2018 05:59:21 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x232.google.com with SMTP id 143so18709277wma.5 for ; Thu, 25 Jan 2018 21:59:21 -0800 (PST) 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=LSVDUy81WptxnjQ2TI35iE+ycRTDDSbDQ7gtuPapuwQ=; b=bngr5OhTzCnO98s0yg2yg5/1YhDSPHhciQ3wX4lPeyHc6hXlZIlPzOiC+eX0CLMq/i pI76gYbKym3HdgsNwz25X7e0ptKXHmnY4zJ/6qnQyUD4YYgZEJpT1KwEOXNtQrhQ/DFP dxbyXYs7FK2ypKppM4C8DFXutBGIG0TJ5ZWRYoA1RNrS7bNBncptoE6M37/6mnTSYFQJ 6DFI7bY3sqk/fD8uXf0CuLkfeo0kTu/1hZbnpCxpcQAfPu/o4KppqDobAqjb/kzIwPoK SjsFngpEMEIHZooopcBCsOngj0azhoeBy7OHgMBWRwLs9hEI6JSOoMq+2Cuato5uY7xw CaKg== 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=LSVDUy81WptxnjQ2TI35iE+ycRTDDSbDQ7gtuPapuwQ=; b=KLOBMtqyDBGWS+xXhlrXB3sGDzAcEla2gB4RpyMPKgRwe5ugtn1kgB6xcjoEM+2xWO k354tookvqVQW1ABiE6BEv07pdWyPbG42TXvb6IQBfM3YCtEiDFeGMp2gaBEYKx18Nby oOUwG6zZHcBwESTVG1N0SHN8odOpE79E2D9yCJ3N9WCAHX3IUAWXjpTJY1OX5NCnq7sG ft5+6oefP7wtrhE8gCHtfzay4Oaz/5O/8mhFkM1bgxdCruNY/WWChjAREVlxg2R6euvp IfHyvPoFOkkD4ZWscA6MYNjOINMSXMt+kkh4s9pyeZZ08xBy9lHNLpbrjABC6lhLlXFj g0dw== X-Gm-Message-State: AKwxytfvX3IPCpxZkcWK5cPyniuM70z350nASpnSA8LxFGZqEsul2lMy b/6e2uL7PzBA6FzYnONIFrFB4QcOIstMarBS29JgKw== X-Google-Smtp-Source: AH8x224kMbAt9R5fXFgrUYw2hHRwXS/+1/23xZ+83Yj0C6Z9SMoJUJP4oQernFb4EVx4oXtxq0jKoK7BcTa4AvARc/w= X-Received: by 10.80.130.2 with SMTP id 2mr33217288edf.7.1516946359281; Thu, 25 Jan 2018 21:59:19 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.133.195 with HTTP; Thu, 25 Jan 2018 21:59:18 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201801260440.w0Q4efhg008105@repo.freebsd.org> From: Warner Losh Date: Thu, 25 Jan 2018 22:59:18 -0700 X-Google-Sender-Auth: XFyX97u5N5zR2ARZ4OpRqYLtgsE Message-ID: Subject: Re: svn commit: r328430 - head/sbin/devd To: Matt Joras Cc: Eitan Adler , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 26 Jan 2018 05:59:22 -0000 On Thu, Jan 25, 2018 at 10:02 PM, Matt Joras wrote: > On Thu, Jan 25, 2018 at 8:52 PM, Warner Losh wrote: > > > > > > On Thu, Jan 25, 2018 at 9:40 PM, Eitan Adler wrote: > >> > >> Author: eadler > >> Date: Fri Jan 26 04:40:41 2018 > >> New Revision: 328430 > >> URL: https://svnweb.freebsd.org/changeset/base/328430 > >> > >> Log: > >> devd: minor nits > >> > >> - mark usage as noreturn > >> - config does not need a virtual destructor > > > > > > Everything needs a virtual destructor... Please back that part of this > > out... > > > > Warner > Needs? If there's not inheritance there's no _need_ to do it, and it's > arguably superfluous. That being said it's also an arguably > superfluous change to remove it. > OK. Needs might not be the proper word. It's a stylistic thing in all the C++ code I write. It keeps me from having to go back later and add it back when it really does need it after subclasses are derived from it. It's an important detail that often gets overlooked. The cost is minimal. And this isn't one of the rare cases where it's harmful to have it. Warner From owner-svn-src-all@freebsd.org Fri Jan 26 06:02:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCC15EC34B3 for ; Fri, 26 Jan 2018 06:02:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (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 3015A84E47 for ; Fri, 26 Jan 2018 06:02:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x234.google.com with SMTP id f71so18743561wmf.0 for ; Thu, 25 Jan 2018 22:02:03 -0800 (PST) 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=lIUuXEvwVNVGQexm2hQAXZfQD6t3JWJ7QvbIsiWlPF4=; b=GaikJqohQriPdn7tsP3jyE0Dr2RShbNWhiTBOTphF8YmxMC5yHOeKusye3HzbdqUP7 +8PGBpq5S5Mts46eB8qg5Xxif0h0NVWqnTWj3/VUuf7aPuYG5d54O3oUvEr9JDbx3xSO Qum5PyB/q42/rydU2tLN2b2oBC6UZ5LFDf2JsncB5+OFOeFsaDx05QCyT8yC3X4aojpR jMsVHcU/Ucdd8Az4d3gzra5Nx4h/rRKZROj1Qk/JqhhN/2sMAGdO2WAtMxDAah1WL7nP ol2eiqgmlZSlMXciGQdFNUp2cuOTACNZZgbZT1SqIyB4IhblSCdosHuSS383oSK85hF0 +0aw== 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=lIUuXEvwVNVGQexm2hQAXZfQD6t3JWJ7QvbIsiWlPF4=; b=JQyLK8hQpvmD52/91xomAcaBRnxN0cy3VmyJ6ZwxocwHEti4hugdFrhSUUk3A1lLX7 xyrABJLJ5kEkwxH/1qiDj+iJUiyf+ek4d6VFpI9H2BNf5pn7OAQicB3qqqIXP8ZqOuLz JARznwLiNazfHGGJzck2UjCOF/ZpAPJiqeB4h8X21Z5gHOX81G9pc4twqMGIxQ5v57VQ 5NHnSL/AaaAKfTjeFN8PAKtc9JAsWXW0rUF8NH1RYCH8VCA/QGmxTS2wXrkZKPy8agYc 0nKU9x8eVMFIXwqRvIrTA9q0lmTgeI1ay2ceg9RYTM321Js2ISv6OkmTF+X/azeDtrXb 1XWw== X-Gm-Message-State: AKwxytc6zPdjPjHKiP+9t0JI9rfZKfyND+alCj7FHQmh1cDCYJurMkgn 0P49YR596DFrQn/6A3EaRCmU0ap/1q+76umFd7hxjA== X-Google-Smtp-Source: AH8x225tF012qhFXUFtdrEPai9/5hIpWFHiVeupSjXcy1D+2OdPOWli2wS2JPrW9G+yjyFVcQ0z/XJCgtlQEHISYmoc= X-Received: by 10.80.170.24 with SMTP id o24mr32467561edc.258.1516946522062; Thu, 25 Jan 2018 22:02:02 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.133.195 with HTTP; Thu, 25 Jan 2018 22:02:01 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201801260440.w0Q4efhg008105@repo.freebsd.org> From: Warner Losh Date: Thu, 25 Jan 2018 23:02:01 -0700 X-Google-Sender-Auth: KeoayirUaVwf3xCf9OYTpxjvc3A Message-ID: Subject: Re: svn commit: r328430 - head/sbin/devd To: Eitan Adler Cc: Matt Joras , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 26 Jan 2018 06:02:04 -0000 On Thu, Jan 25, 2018 at 10:04 PM, Eitan Adler wrote: > On 25 January 2018 at 21:02, Matt Joras wrote: > > On Thu, Jan 25, 2018 at 8:52 PM, Warner Losh wrote: > >> > >> > >> On Thu, Jan 25, 2018 at 9:40 PM, Eitan Adler > wrote: > >>> > >>> Author: eadler > >>> Date: Fri Jan 26 04:40:41 2018 > >>> New Revision: 328430 > >>> URL: https://svnweb.freebsd.org/changeset/base/328430 > >>> > >>> Log: > >>> devd: minor nits > >>> > >>> - mark usage as noreturn > >>> - config does not need a virtual destructor > >> > >> > >> Everything needs a virtual destructor... Please back that part of this > >> out... > >> > >> Warner > > Needs? If there's not inheritance there's no _need_ to do it, and it's > > arguably superfluous. That being said it's also an arguably > > superfluous change to remove it. > > Yeah, I don't think this needs it. That said, readded in 328431. I > removed it originally since it was the only virtual function in config > and it seemed out of place. At the least, I went looking for what > inherited from it. > It's a flaw in C++ that you have a choice here. All dtors should be virtual because you never know when you'll have new derived classes and have to hunt down a hard-to-find bug because you didn't go back and make it virtual. Of course, this flaw is there because of other flaws in the language. This isn't one of the cases where having it is harmful, so stylistically I always have them unless there's a good reason not to because were I to create derived classes, I might forget to make it virtual. It's an old habit, I'll admit. Warner From owner-svn-src-all@freebsd.org Fri Jan 26 06:21:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23249EC4234; Fri, 26 Jan 2018 06:21:25 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C6CE28589F; Fri, 26 Jan 2018 06:21:24 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1C2817EC7; Fri, 26 Jan 2018 06:21:24 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q6LO0n058375; Fri, 26 Jan 2018 06:21:24 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q6LOoe058374; Fri, 26 Jan 2018 06:21:24 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201801260621.w0Q6LOoe058374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Fri, 26 Jan 2018 06:21:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328432 - head/sys/modules/geom/geom_label X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/modules/geom/geom_label X-SVN-Commit-Revision: 328432 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 06:21:25 -0000 Author: lwhsu (ports committer) Date: Fri Jan 26 06:21:24 2018 New Revision: 328432 URL: https://svnweb.freebsd.org/changeset/base/328432 Log: Fix LINT build. Approved by: delphij Modified: head/sys/modules/geom/geom_label/Makefile Modified: head/sys/modules/geom/geom_label/Makefile ============================================================================== --- head/sys/modules/geom/geom_label/Makefile Fri Jan 26 05:03:37 2018 (r328431) +++ head/sys/modules/geom/geom_label/Makefile Fri Jan 26 06:21:24 2018 (r328432) @@ -13,6 +13,7 @@ SRCS+= g_label_ntfs.c SRCS+= g_label_reiserfs.c SRCS+= g_label_ufs.c SRCS+= opt_geom.h +SRCS+= vnode_if.h opt_geom.h: echo "#define GEOM_LABEL 1" > ${.TARGET} From owner-svn-src-all@freebsd.org Fri Jan 26 07:02:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59DC8EC5D56 for ; Fri, 26 Jan 2018 07:02:38 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-lf0-x231.google.com (mail-lf0-x231.google.com [IPv6:2a00:1450:4010:c07::231]) (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 BFB7C86A57 for ; Fri, 26 Jan 2018 07:02:37 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-lf0-x231.google.com with SMTP id 63so6608978lfv.4 for ; Thu, 25 Jan 2018 23:02:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pdQJY1tNpkZcon4wO9T7iThiAK0dSB46XrWohdcKO5w=; b=lkR18B4TCn2/wJUUlOsyEEV8hLjE8qU4SqmH2nzAyY4B4B1P0at4x27+eQljRjvAAa N1NPDQRKORjh86eVAZfwCdsii9iDkOc90zSSuAzkEgr35J6K2jRVrxTTsdcIfCwP6juj DNB+Kg0Oh0VpLxL4pGiRCJXgXgro38HxuD1Fj8aSRfnw85WkOhq2NK7ztuHT7ncF+Jhw n1m5rK7toBzZcezLJEruHPO6ZrP+Jao/la5i6fvGLVylFXMg5NTlEtGjAk6DRMxo3b5l cTTgvIjJ3DouSHaV5G+VoLYJVrYURT/Q5pwKwwOiFOeN2hcvWXe+CEv3ZsEnjJptUROe E2dg== 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=pdQJY1tNpkZcon4wO9T7iThiAK0dSB46XrWohdcKO5w=; b=Ii7bMUCi8gFnthcJVr921j/6wpX36ZAqxnO1ZF8pqM78sx19VWgjzJvggnP2SABl3N TF20uys4vdCep9aU+sylxH8ZcI3hOg7JVkg3ttSIr/DO2NVq7VaWiIuaOVliaerC/xzf rU4emaLEefJH7IdpNaQGXMZe2n1I7nwFQ6O0UvqdVPhtM3av16xkCSPHfPS8pVm2ySSE bN3CWxjSStnqvF1ZQ9GcKn3sGgZFlGpl/taAeeFFSYX4szjd9xogemh0YoUQY0OEz64E WnxyTK1YiVMXWZ93k97NODl5oh8VIRKeYGVCZoWR/cRMrmCk3J6Hp0cbOmz5KDRJ4pll 6aiQ== X-Gm-Message-State: AKwxyteJecV0Rxrm1/zcl8u/GiOemK5OSslMHEynshYmkmojIGEioJ8A TCp7DCGMY7YRKkmOIB6MMC9kY8zYT8Qrihw2d9g9FQ== X-Google-Smtp-Source: AH8x226VHbQEUzWRqNulMh75RmR0RYcuPsJOXWuBs6TJc4H54/gRuutmUeOj4on+j12pCb7bZ0UHkWq62gMfarsoJ18= X-Received: by 10.46.115.22 with SMTP id o22mr7873793ljc.89.1516950155022; Thu, 25 Jan 2018 23:02:35 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.216.206 with HTTP; Thu, 25 Jan 2018 23:02:04 -0800 (PST) In-Reply-To: References: <201801260440.w0Q4efhg008105@repo.freebsd.org> From: Ed Schouten Date: Fri, 26 Jan 2018 08:02:04 +0100 Message-ID: Subject: Re: svn commit: r328430 - head/sbin/devd To: Warner Losh Cc: Eitan Adler , 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.25 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: Fri, 26 Jan 2018 07:02:38 -0000 2018-01-26 5:52 GMT+01:00 Warner Losh : > Everything needs a virtual destructor... Please back that part of this > out... If you're concerned about inheritance, what about adding the 'final' keyword to the class? http://en.cppreference.com/w/cpp/language/final Eitan: static void usage(void) __dead2; This should be spelled: [[noreturn]] static void usage(); -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands From owner-svn-src-all@freebsd.org Fri Jan 26 08:38:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 528F9EC9D00; Fri, 26 Jan 2018 08:38:27 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0462269408; Fri, 26 Jan 2018 08:38:27 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3817194AA; Fri, 26 Jan 2018 08:38:26 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q8cQTB025068; Fri, 26 Jan 2018 08:38:26 GMT (envelope-from maxim@FreeBSD.org) Received: (from maxim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q8cQlm025067; Fri, 26 Jan 2018 08:38:26 GMT (envelope-from maxim@FreeBSD.org) Message-Id: <201801260838.w0Q8cQlm025067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: maxim set sender to maxim@FreeBSD.org using -f From: Maxim Konovalov Date: Fri, 26 Jan 2018 08:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328433 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: maxim X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 328433 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 08:38:27 -0000 Author: maxim Date: Fri Jan 26 08:38:26 2018 New Revision: 328433 URL: https://svnweb.freebsd.org/changeset/base/328433 Log: o EMFILE errno documented. PR: 219209 Submitted by: yuri (with minor adjustment) Reviewed by: brooks Modified: head/lib/libc/sys/shmat.2 Modified: head/lib/libc/sys/shmat.2 ============================================================================== --- head/lib/libc/sys/shmat.2 Fri Jan 26 06:21:24 2018 (r328432) +++ head/lib/libc/sys/shmat.2 Fri Jan 26 08:38:26 2018 (r328433) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 2, 1995 +.Dd January 25, 2018 .Dt SHMAT 2 .Os .Sh NAME @@ -104,6 +104,11 @@ The .Fa addr argument was not an acceptable address. +.It Bq Er EMFILE +Failed to attach the shared memory segment because the per-process +.Va kern.ipc.shmseg +.Xr sysctl 3 +limit was reached. .El .Pp The From owner-svn-src-all@freebsd.org Fri Jan 26 08:52:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03DBEECA97A; Fri, 26 Jan 2018 08:52:29 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A7CBD69E60; Fri, 26 Jan 2018 08:52:28 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2517197DA; Fri, 26 Jan 2018 08:52:28 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q8qSf1034675; Fri, 26 Jan 2018 08:52:28 GMT (envelope-from maxim@FreeBSD.org) Received: (from maxim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q8qSWJ034674; Fri, 26 Jan 2018 08:52:28 GMT (envelope-from maxim@FreeBSD.org) Message-Id: <201801260852.w0Q8qSWJ034674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: maxim set sender to maxim@FreeBSD.org using -f From: Maxim Konovalov Date: Fri, 26 Jan 2018 08:52:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328434 - head/usr.sbin/daemon X-SVN-Group: head X-SVN-Commit-Author: maxim X-SVN-Commit-Paths: head/usr.sbin/daemon X-SVN-Commit-Revision: 328434 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 08:52:29 -0000 Author: maxim Date: Fri Jan 26 08:52:28 2018 New Revision: 328434 URL: https://svnweb.freebsd.org/changeset/base/328434 Log: o A command line flag for the syslog_facility fixed in the SYNOPSIS. PR: 225441 Modified: head/usr.sbin/daemon/daemon.8 Modified: head/usr.sbin/daemon/daemon.8 ============================================================================== --- head/usr.sbin/daemon/daemon.8 Fri Jan 26 08:38:26 2018 (r328433) +++ head/usr.sbin/daemon/daemon.8 Fri Jan 26 08:52:28 2018 (r328434) @@ -43,7 +43,7 @@ .Op Fl o Ar output_file .Op Fl s Ar syslog_priority .Op Fl T Ar syslog_tag -.Op Fl s Ar syslog_facility +.Op Fl l Ar syslog_facility .Ar command arguments ... .Sh DESCRIPTION The From owner-svn-src-all@freebsd.org Fri Jan 26 09:38:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C17DECC60D; Fri, 26 Jan 2018 09:38:41 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F2916B512; Fri, 26 Jan 2018 09:38:41 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BD2519E31; Fri, 26 Jan 2018 09:38:41 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q9ceDN054854; Fri, 26 Jan 2018 09:38:40 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q9cebW054853; Fri, 26 Jan 2018 09:38:40 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201801260938.w0Q9cebW054853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Fri, 26 Jan 2018 09:38:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328435 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: wma X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 328435 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 09:38:41 -0000 Author: wma Date: Fri Jan 26 09:38:40 2018 New Revision: 328435 URL: https://svnweb.freebsd.org/changeset/base/328435 Log: PPC: Add place for NULL chars in intrnames In a corner case we could fall into OOB error. Authored by: Patryk Duda Submitted by: Wojciech Macek Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Modified: head/sys/powerpc/powerpc/intr_machdep.c Modified: head/sys/powerpc/powerpc/intr_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/intr_machdep.c Fri Jan 26 08:52:28 2018 (r328434) +++ head/sys/powerpc/powerpc/intr_machdep.c Fri Jan 26 09:38:40 2018 (r328435) @@ -130,7 +130,7 @@ static u_int nirqs = 0; /* Allocated IRQs. */ static u_int stray_count; u_long intrcnt[INTR_VECTORS]; -char intrnames[INTR_VECTORS * MAXCOMLEN]; +char intrnames[INTR_VECTORS * (MAXCOMLEN + 1)]; size_t sintrcnt = sizeof(intrcnt); size_t sintrnames = sizeof(intrnames); From owner-svn-src-all@freebsd.org Fri Jan 26 10:14:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2933AECDCCE; Fri, 26 Jan 2018 10:14:20 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 45D7E6C8EB; Fri, 26 Jan 2018 10:14:18 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 6f1b35c4; Fri, 26 Jan 2018 11:14:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=954JvhhrlE4gJsNgQsRE8fdsTsw=; b=j0h2pE+YohIwkT/gLEg1/2ZjrLum 1gG8MJkibdYzu1/Fpn3yto4chgEddk9rFNwRW+eX/QZITmNy8F+tpqPZoYB5Lm1F oqUOS6e6LV1V6Ige+scXf3SyKiktCL8AKt4nINN6lvvr/lCvU2eWz6HxpE7gMWEZ 8sDplMAu3ZWgHwY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=EF5rJhglMLwlPihWY3IADyQZmu7YjnqwLBap0nOEVPQLP9V+43ComKj7 LrMqzshqDibdsnSR9NmOVDpjXX7DL5FFRDJKhZzWFLZVEydtY3OuIf03gQrKsUGC EA8tUfIhol9NOIQ5OEXQktcnLuijrcYspo3186uXNZpIGLyqVQw= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 33995fbd TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Fri, 26 Jan 2018 11:14:16 +0100 (CET) Date: Fri, 26 Jan 2018 11:14:16 +0100 From: Emmanuel Vadot To: Ruslan Bukin Cc: Ruslan Bukin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328402 - head/sys/dev/usb/controller Message-Id: <20180126111416.21d99403b0ff40c06d610990@bidouilliste.com> In-Reply-To: <20180125171452.GA61523@bsdpad.com> References: <201801251658.w0PGwNcq058492@repo.freebsd.org> <20180125181204.bb006fbb3a9bcd4acb4236af@bidouilliste.com> <20180125171452.GA61523@bsdpad.com> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 26 Jan 2018 10:14:20 -0000 On Thu, 25 Jan 2018 17:14:52 +0000 Ruslan Bukin wrote: > On Thu, Jan 25, 2018 at 06:12:04PM +0100, Emmanuel Vadot wrote: > > > Log: > > > Add basic driver for Qualcomm USB 2.0 EHCI controller. > > > This driver relies on system initialization in u-boot. > > > > > > Tested on DragonBoard 410c. > > > > > > Sponsored by: DARPA, AFRL > > > > > > Added: > > > head/sys/dev/usb/controller/ehci_msm.c (contents, props changed) > > > > > > > The code looks like the generic-ehci, would it be better to subclass > > generic-ehci to fdt and add qualcomm quirks if necessary ? > > > > Hi Emmanuel > > This driver is incomplete currently and requires initialization in u-boot. > > Both system clocks and EHCI subsystem, also Qualcomm power management device requires full initialization. > My goal will be to extend this driver and proceed full initialization required for Qualcomm EHCI. Yes I can see that all the clock/reset/phy management is not yet done. But the generic-ehci driver should be subclassed so you can re-use the ehdi generic code in your driver. Then you will just need the attach function to deal the clock/reset/phy. > The u-boot option CONFIG_DM_DEVICE_REMOVE=n must be added in order to keep devices initialized before jumping to FreeBSD. We will need to get rid of these by adding some code to this driver I guess. > > Thanks. > > Ruslan -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Fri Jan 26 10:28:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA134ECE5B0; Fri, 26 Jan 2018 10:28:18 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 99D006D02F; Fri, 26 Jan 2018 10:28:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 5393842DD45; Fri, 26 Jan 2018 21:28:07 +1100 (AEDT) Date: Fri, 26 Jan 2018 21:28:05 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: Eitan Adler , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328430 - head/sbin/devd In-Reply-To: Message-ID: <20180126205058.X1040@besplex.bde.org> References: <201801260440.w0Q4efhg008105@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=DIX/22Fb c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=nZUZjZyyJAfB1BKuvp8A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 26 Jan 2018 10:28:19 -0000 On Thu, 25 Jan 2018, Warner Losh wrote: > On Thu, Jan 25, 2018 at 9:40 PM, Eitan Adler wrote: > >> Author: eadler >> Date: Fri Jan 26 04:40:41 2018 >> New Revision: 328430 >> URL: https://svnweb.freebsd.org/changeset/base/328430 >> >> Log: >> devd: minor nits >> >> - mark usage as noreturn >> - config does not need a virtual destructor >> > > Everything needs a virtual destructor... Please back that part of this > out... Everything here should be backed out. usage() is static, so it doesn't need any magic declarations even for lint. Compilers shouldn't warn about it if they do even less checking that lint. In practice gcc-4 and later compilers default to using -funit-at-a-time which gives the full file-scope scope analysis needed to obfuscate functions like usage() by inlining them especially when you intentionally kept them separate. Noticing that usage() doesn't return is a trivial part of the preparation for possibly inlining it. (The obfuscations from auto-inlining mainly affect debugging including things like running nm and objdump. It can be reduced or avoided using -fno-inline or -fno-inline-functions-called-once or the __noinline attribute, but -fno-inline is too global, -fno-inline-functions-called-onces is broken for clang, and adding __noinline to most static functions is painful.) style(9) even gives usage() as an example, and of course this is missing the style bug of declaring it as __dead2. However, style(9) is not completly trustworthy for usage. It still uses a K&R or C++ definition for usage() (missing 'void'). The bug is this definition, not the correct prototype. >> Modified: head/sbin/devd/devd.cc >> ============================================================ >> ================== >> --- head/sbin/devd/devd.cc Fri Jan 26 04:32:31 2018 (r328429) >> +++ head/sbin/devd/devd.cc Fri Jan 26 04:40:41 2018 (r328430) >> @@ -161,7 +161,7 @@ static const char *configfile = CF; >> static void devdlog(int priority, const char* message, ...) >> __printflike(2, 3); >> static void event_loop(void); >> -static void usage(void); >> +static void usage(void) __dead2; Since this is C++, it is arguably also a style bug to not be missing 'void'. It is unarguably a style bug not be missing 'void' in the prototype but to be missing it in the definition (the combination is the same style bug as in style(9), made worse since style(9) was correct for K&R but the difference is just gratuitous for C++). The style for 'void' is random in this program: - all prototypes in devd.cc use (void) (not all static functions have forward prototypes) - 4 function definitions in devd.cc use (void) - 12 function definitions in devd.cc use () - 2 (yacc) prototypes in devd.h use (void). There are no 'extern "C"' declarations in the program so I don't know how yacc can work. - 0 prototypes in devd.hh use (void) - many prototypes in devd.hh use (). These mostly match the 12 functions in devd.cc. Bruce From owner-svn-src-all@freebsd.org Fri Jan 26 10:49:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC28CECF5B3; Fri, 26 Jan 2018 10:49:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F8556DCB8; Fri, 26 Jan 2018 10:49:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A3201A968; Fri, 26 Jan 2018 10:49:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QAn2Ig089657; Fri, 26 Jan 2018 10:49:02 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QAn2Xt089656; Fri, 26 Jan 2018 10:49:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201801261049.w0QAn2Xt089656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 26 Jan 2018 10:49:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328436 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 328436 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 10:49:03 -0000 Author: hselasky Date: Fri Jan 26 10:49:02 2018 New Revision: 328436 URL: https://svnweb.freebsd.org/changeset/base/328436 Log: Decouple Linux files from the belonging character device right after open in the LinuxKPI. This is done by calling finit() just before returning a magic value of ENXIO in the "linux_dev_fdopen" function. The Linux file structure should mimic the BSD file structure as much as possible. This patch decouples the Linux file structure from the belonging character device right after the "linux_dev_fdopen" function has returned. This fixes an issue which allows a Linux file handle to exist after a character device has been destroyed and removed from the directory index of /dev. Only when the reference count of the BSD file handle reaches zero, the Linux file handle is destroyed. This fixes use-after-free issues related to accessing the Linux file structure after the character device has been destroyed. While at it add a missing NULL check for non-present file operation. Calling a NULL pointer will result in a segmentation fault. Reviewed by: kib @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Fri Jan 26 09:38:40 2018 (r328435) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Fri Jan 26 10:49:02 2018 (r328436) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -391,18 +392,6 @@ kobject_init_and_add(struct kobject *kobj, const struc } static void -linux_file_dtor(void *cdp) -{ - struct linux_file *filp; - - linux_set_current(curthread); - filp = cdp; - filp->f_op->release(filp->f_vnode, filp); - vdrop(filp->f_vnode); - kfree(filp); -} - -static void linux_kq_lock(void *arg) { spinlock_t *s = arg; @@ -438,7 +427,7 @@ linux_kq_lock_unowned(void *arg) } static void -linux_dev_kqfilter_poll(struct linux_file *, int); +linux_file_kqfilter_poll(struct linux_file *, int); struct linux_file * linux_file_alloc(void) @@ -678,24 +667,31 @@ static struct cdev_pager_ops linux_cdev_pager_ops[2] = }, }; +#define OPW(fp,td,code) ({ \ + struct file *__fpop; \ + int __retval; \ + \ + __fpop = (td)->td_fpop; \ + (td)->td_fpop = (fp); \ + __retval = (code); \ + (td)->td_fpop = __fpop; \ + __retval; \ +}) + static int -linux_dev_open(struct cdev *dev, int oflags, int devtype, struct thread *td) +linux_dev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *file) { struct linux_cdev *ldev; struct linux_file *filp; - struct file *file; int error; - file = td->td_fpop; ldev = dev->si_drv1; - if (ldev == NULL) - return (ENODEV); filp = linux_file_alloc(); filp->f_dentry = &filp->f_dentry_store; filp->f_op = ldev->ops; + filp->f_mode = file->f_flag; filp->f_flags = file->f_flag; - vhold(file->f_vnode); filp->f_vnode = file->f_vnode; filp->_file = file; @@ -704,35 +700,17 @@ linux_dev_open(struct cdev *dev, int oflags, int devty if (filp->f_op->open) { error = -filp->f_op->open(file->f_vnode, filp); if (error) { - vdrop(filp->f_vnode); kfree(filp); - goto done; + return (error); } } - error = devfs_set_cdevpriv(filp, linux_file_dtor); - if (error) { - filp->f_op->release(file->f_vnode, filp); - vdrop(filp->f_vnode); - kfree(filp); - } -done: - return (error); -} -static int -linux_dev_close(struct cdev *dev, int fflag, int devtype, struct thread *td) -{ - struct linux_file *filp; - struct file *file; - int error; + /* hold on to the vnode - used for fstat() */ + vhold(filp->f_vnode); - file = td->td_fpop; - if ((error = devfs_get_cdevpriv((void **)&filp)) != 0) - return (error); - filp->f_flags = file->f_flag; - devfs_clear_cdevpriv(); - - return (0); + /* release the file from devfs */ + finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops); + return (ENXIO); } #define LINUX_IOCTL_MIN_PTR 0x10000UL @@ -850,24 +828,12 @@ linux_access_ok(int rw, const void *uaddr, size_t len) } static int -linux_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, - struct thread *td) +linux_file_ioctl_sub(struct file *fp, struct linux_file *filp, + u_long cmd, caddr_t data, struct thread *td) { - struct linux_file *filp; - struct file *file; unsigned size; int error; - file = td->td_fpop; - if ((error = devfs_get_cdevpriv((void **)&filp)) != 0) - return (error); - filp->f_flags = file->f_flag; - - /* the LinuxKPI supports blocking and non-blocking I/O */ - if (cmd == FIONBIO || cmd == FIOASYNC) - return (0); - - linux_set_current(td); size = IOCPARM_LEN(cmd); /* refer to logic in sys_ioctl() */ if (size > 0) { @@ -888,17 +854,17 @@ linux_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t if (td->td_proc->p_elf_machine == EM_386) { /* try the compat IOCTL handler first */ if (filp->f_op->compat_ioctl != NULL) - error = -filp->f_op->compat_ioctl(filp, cmd, (u_long)data); + error = -OPW(fp, td, filp->f_op->compat_ioctl(filp, cmd, (u_long)data)); else error = ENOTTY; /* fallback to the regular IOCTL handler, if any */ if (error == ENOTTY && filp->f_op->unlocked_ioctl != NULL) - error = -filp->f_op->unlocked_ioctl(filp, cmd, (u_long)data); + error = -OPW(fp, td, filp->f_op->unlocked_ioctl(filp, cmd, (u_long)data)); } else #endif if (filp->f_op->unlocked_ioctl != NULL) - error = -filp->f_op->unlocked_ioctl(filp, cmd, (u_long)data); + error = -OPW(fp, td, filp->f_op->unlocked_ioctl(filp, cmd, (u_long)data)); else error = ENOTTY; if (size > 0) { @@ -908,118 +874,15 @@ linux_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t if (error == EWOULDBLOCK) { /* update kqfilter status, if any */ - linux_dev_kqfilter_poll(filp, + linux_file_kqfilter_poll(filp, LINUX_KQ_FLAG_HAS_READ | LINUX_KQ_FLAG_HAS_WRITE); } else if (error == ERESTARTSYS) error = ERESTART; return (error); } -static int -linux_dev_read(struct cdev *dev, struct uio *uio, int ioflag) -{ - struct linux_file *filp; - struct thread *td; - struct file *file; - ssize_t bytes; - int error; - - td = curthread; - file = td->td_fpop; - if ((error = devfs_get_cdevpriv((void **)&filp)) != 0) - return (error); - filp->f_flags = file->f_flag; - /* XXX no support for I/O vectors currently */ - if (uio->uio_iovcnt != 1) - return (EOPNOTSUPP); - linux_set_current(td); - if (filp->f_op->read) { - bytes = filp->f_op->read(filp, uio->uio_iov->iov_base, - uio->uio_iov->iov_len, &uio->uio_offset); - if (bytes >= 0) { - uio->uio_iov->iov_base = - ((uint8_t *)uio->uio_iov->iov_base) + bytes; - uio->uio_iov->iov_len -= bytes; - uio->uio_resid -= bytes; - } else { - error = -bytes; - if (error == ERESTARTSYS) - error = ERESTART; - } - } else - error = ENXIO; - - /* update kqfilter status, if any */ - linux_dev_kqfilter_poll(filp, LINUX_KQ_FLAG_HAS_READ); - - return (error); -} - -static int -linux_dev_write(struct cdev *dev, struct uio *uio, int ioflag) -{ - struct linux_file *filp; - struct thread *td; - struct file *file; - ssize_t bytes; - int error; - - td = curthread; - file = td->td_fpop; - if ((error = devfs_get_cdevpriv((void **)&filp)) != 0) - return (error); - filp->f_flags = file->f_flag; - /* XXX no support for I/O vectors currently */ - if (uio->uio_iovcnt != 1) - return (EOPNOTSUPP); - linux_set_current(td); - if (filp->f_op->write) { - bytes = filp->f_op->write(filp, uio->uio_iov->iov_base, - uio->uio_iov->iov_len, &uio->uio_offset); - if (bytes >= 0) { - uio->uio_iov->iov_base = - ((uint8_t *)uio->uio_iov->iov_base) + bytes; - uio->uio_iov->iov_len -= bytes; - uio->uio_resid -= bytes; - } else { - error = -bytes; - if (error == ERESTARTSYS) - error = ERESTART; - } - } else - error = ENXIO; - - /* update kqfilter status, if any */ - linux_dev_kqfilter_poll(filp, LINUX_KQ_FLAG_HAS_WRITE); - - return (error); -} - #define LINUX_POLL_TABLE_NORMAL ((poll_table *)1) -static int -linux_dev_poll(struct cdev *dev, int events, struct thread *td) -{ - struct linux_file *filp; - struct file *file; - int revents; - - if (devfs_get_cdevpriv((void **)&filp) != 0) - goto error; - - file = td->td_fpop; - filp->f_flags = file->f_flag; - linux_set_current(td); - if (filp->f_op->poll != NULL) - revents = filp->f_op->poll(filp, LINUX_POLL_TABLE_NORMAL) & events; - else - revents = 0; - - return (revents); -error: - return (events & (POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM)); -} - /* * This function atomically updates the poll wakeup state and returns * the previous state at the time of update. @@ -1127,7 +990,7 @@ linux_poll_wakeup(struct linux_file *filp) } static void -linux_dev_kqfilter_detach(struct knote *kn) +linux_file_kqfilter_detach(struct knote *kn) { struct linux_file *filp = kn->kn_hook; @@ -1137,7 +1000,7 @@ linux_dev_kqfilter_detach(struct knote *kn) } static int -linux_dev_kqfilter_read_event(struct knote *kn, long hint) +linux_file_kqfilter_read_event(struct knote *kn, long hint) { struct linux_file *filp = kn->kn_hook; @@ -1147,7 +1010,7 @@ linux_dev_kqfilter_read_event(struct knote *kn, long h } static int -linux_dev_kqfilter_write_event(struct knote *kn, long hint) +linux_file_kqfilter_write_event(struct knote *kn, long hint) { struct linux_file *filp = kn->kn_hook; @@ -1158,24 +1021,26 @@ linux_dev_kqfilter_write_event(struct knote *kn, long static struct filterops linux_dev_kqfiltops_read = { .f_isfd = 1, - .f_detach = linux_dev_kqfilter_detach, - .f_event = linux_dev_kqfilter_read_event, + .f_detach = linux_file_kqfilter_detach, + .f_event = linux_file_kqfilter_read_event, }; static struct filterops linux_dev_kqfiltops_write = { .f_isfd = 1, - .f_detach = linux_dev_kqfilter_detach, - .f_event = linux_dev_kqfilter_write_event, + .f_detach = linux_file_kqfilter_detach, + .f_event = linux_file_kqfilter_write_event, }; static void -linux_dev_kqfilter_poll(struct linux_file *filp, int kqflags) +linux_file_kqfilter_poll(struct linux_file *filp, int kqflags) { int temp; if (filp->f_kqflags & kqflags) { + struct thread *td = curthread; + /* get the latest polling state */ - temp = filp->f_op->poll(filp, NULL); + temp = OPW(filp->_file, td, filp->f_op->poll(filp, NULL)); spin_lock(&filp->f_kqlock); /* clear kqflags */ @@ -1196,17 +1061,14 @@ linux_dev_kqfilter_poll(struct linux_file *filp, int k } static int -linux_dev_kqfilter(struct cdev *dev, struct knote *kn) +linux_file_kqfilter(struct file *file, struct knote *kn) { struct linux_file *filp; - struct file *file; struct thread *td; int error; td = curthread; - file = td->td_fpop; - if ((error = devfs_get_cdevpriv((void **)&filp)) != 0) - return (error); + filp = (struct linux_file *)file->f_data; filp->f_flags = file->f_flag; if (filp->f_op->poll == NULL) return (EINVAL); @@ -1218,12 +1080,14 @@ linux_dev_kqfilter(struct cdev *dev, struct knote *kn) kn->kn_fop = &linux_dev_kqfiltops_read; kn->kn_hook = filp; knlist_add(&filp->f_selinfo.si_note, kn, 1); + error = 0; break; case EVFILT_WRITE: filp->f_kqflags |= LINUX_KQ_FLAG_HAS_WRITE; kn->kn_fop = &linux_dev_kqfiltops_write; kn->kn_hook = filp; knlist_add(&filp->f_selinfo.si_note, kn, 1); + error = 0; break; default: error = EINVAL; @@ -1235,32 +1099,28 @@ linux_dev_kqfilter(struct cdev *dev, struct knote *kn) linux_set_current(td); /* update kqfilter status, if any */ - linux_dev_kqfilter_poll(filp, + linux_file_kqfilter_poll(filp, LINUX_KQ_FLAG_HAS_READ | LINUX_KQ_FLAG_HAS_WRITE); } return (error); } static int -linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t *offset, - vm_size_t size, struct vm_object **object, int nprot) +linux_file_mmap_single(struct file *fp, vm_ooffset_t *offset, + vm_size_t size, struct vm_object **object, int nprot, + struct thread *td) { struct vm_area_struct *vmap; struct mm_struct *mm; struct linux_file *filp; - struct thread *td; - struct file *file; vm_memattr_t attr; int error; - td = curthread; - file = td->td_fpop; - if ((error = devfs_get_cdevpriv((void **)&filp)) != 0) - return (error); - filp->f_flags = file->f_flag; + filp = (struct linux_file *)fp->f_data; + filp->f_flags = fp->f_flag; if (filp->f_op->mmap == NULL) - return (ENODEV); + return (EOPNOTSUPP); linux_set_current(td); @@ -1288,7 +1148,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t * if (unlikely(down_write_killable(&vmap->vm_mm->mmap_sem))) { error = EINTR; } else { - error = -filp->f_op->mmap(filp, vmap); + error = -OPW(fp, td, filp->f_op->mmap(filp, vmap)); up_write(&vmap->vm_mm->mmap_sem); } @@ -1351,11 +1211,11 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t * if (vm_no_fault) { *object = cdev_pager_allocate(vm_private_data, OBJT_DEVICE, &linux_cdev_pager_ops[1], size, nprot, *offset, - curthread->td_ucred); + td->td_ucred); } else { *object = cdev_pager_allocate(vm_private_data, OBJT_MGTDEVICE, &linux_cdev_pager_ops[0], size, nprot, *offset, - curthread->td_ucred); + td->td_ucred); } /* check if allocating the VM object failed */ @@ -1376,7 +1236,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t * (vm_paddr_t)vmap->vm_pfn << PAGE_SHIFT, vmap->vm_len); *object = vm_pager_allocate(OBJT_SG, sg, vmap->vm_len, - nprot, 0, curthread->td_ucred); + nprot, 0, td->td_ucred); linux_cdev_handle_free(vmap); @@ -1397,15 +1257,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t * struct cdevsw linuxcdevsw = { .d_version = D_VERSION, - .d_flags = D_TRACKCLOSE, - .d_open = linux_dev_open, - .d_close = linux_dev_close, - .d_read = linux_dev_read, - .d_write = linux_dev_write, - .d_ioctl = linux_dev_ioctl, - .d_mmap_single = linux_dev_mmap_single, - .d_poll = linux_dev_poll, - .d_kqfilter = linux_dev_kqfilter, + .d_fdopen = linux_dev_fdopen, .d_name = "lkpidev", }; @@ -1425,22 +1277,65 @@ linux_file_read(struct file *file, struct uio *uio, st return (EOPNOTSUPP); linux_set_current(td); if (filp->f_op->read) { - bytes = filp->f_op->read(filp, uio->uio_iov->iov_base, - uio->uio_iov->iov_len, &uio->uio_offset); + bytes = OPW(file, td, filp->f_op->read(filp, uio->uio_iov->iov_base, + uio->uio_iov->iov_len, &uio->uio_offset)); if (bytes >= 0) { uio->uio_iov->iov_base = ((uint8_t *)uio->uio_iov->iov_base) + bytes; uio->uio_iov->iov_len -= bytes; uio->uio_resid -= bytes; - } else + } else { error = -bytes; + if (error == ERESTARTSYS) + error = ERESTART; + } } else error = ENXIO; + /* update kqfilter status, if any */ + linux_file_kqfilter_poll(filp, LINUX_KQ_FLAG_HAS_READ); + return (error); } static int +linux_file_write(struct file *file, struct uio *uio, struct ucred *active_cred, + int flags, struct thread *td) +{ + struct linux_file *filp; + ssize_t bytes; + int error; + + error = 0; + filp = (struct linux_file *)file->f_data; + filp->f_flags = file->f_flag; + /* XXX no support for I/O vectors currently */ + if (uio->uio_iovcnt != 1) + return (EOPNOTSUPP); + linux_set_current(td); + if (filp->f_op->write) { + bytes = OPW(file, td, filp->f_op->write(filp, uio->uio_iov->iov_base, + uio->uio_iov->iov_len, &uio->uio_offset)); + if (bytes >= 0) { + uio->uio_iov->iov_base = + ((uint8_t *)uio->uio_iov->iov_base) + bytes; + uio->uio_iov->iov_len -= bytes; + uio->uio_resid -= bytes; + } else { + error = -bytes; + if (error == ERESTARTSYS) + error = ERESTART; + } + } else + error = ENXIO; + + /* update kqfilter status, if any */ + linux_file_kqfilter_poll(filp, LINUX_KQ_FLAG_HAS_WRITE); + + return (error); +} + +static int linux_file_poll(struct file *file, int events, struct ucred *active_cred, struct thread *td) { @@ -1451,7 +1346,7 @@ linux_file_poll(struct file *file, int events, struct filp->f_flags = file->f_flag; linux_set_current(td); if (filp->f_op->poll != NULL) - revents = filp->f_op->poll(filp, LINUX_POLL_TABLE_NORMAL) & events; + revents = OPW(file, td, filp->f_op->poll(filp, LINUX_POLL_TABLE_NORMAL)) & events; else revents = 0; @@ -1465,11 +1360,16 @@ linux_file_close(struct file *file, struct thread *td) int error; filp = (struct linux_file *)file->f_data; + + KASSERT(file_count(filp) == 0, ("File refcount(%d) is not zero", file_count(filp))); + filp->f_flags = file->f_flag; linux_set_current(td); linux_poll_wait_dequeue(filp); - error = -filp->f_op->release(NULL, filp); + error = -OPW(file, td, filp->f_op->release(filp->f_vnode, filp)); funsetown(&filp->f_sigio); + if (filp->f_vnode != NULL) + vdrop(filp->f_vnode); kfree(filp); return (error); @@ -1493,30 +1393,128 @@ linux_file_ioctl(struct file *fp, u_long cmd, void *da case FIOASYNC: if (filp->f_op->fasync == NULL) break; - error = filp->f_op->fasync(0, filp, fp->f_flag & FASYNC); + error = -OPW(fp, td, filp->f_op->fasync(0, filp, fp->f_flag & FASYNC)); break; case FIOSETOWN: error = fsetown(*(int *)data, &filp->f_sigio); - if (error == 0) - error = filp->f_op->fasync(0, filp, - fp->f_flag & FASYNC); + if (error == 0) { + if (filp->f_op->fasync == NULL) + break; + error = -OPW(fp, td, filp->f_op->fasync(0, filp, + fp->f_flag & FASYNC)); + } break; case FIOGETOWN: *(int *)data = fgetown(&filp->f_sigio); break; default: - error = ENOTTY; + error = linux_file_ioctl_sub(fp, filp, cmd, data, td); break; } return (error); } static int +linux_file_mmap_sub(struct thread *td, vm_size_t objsize, vm_prot_t prot, + vm_prot_t *maxprotp, int *flagsp, struct file *fp, + vm_ooffset_t *foff, vm_object_t *objp) +{ + /* + * Character devices do not provide private mappings + * of any kind: + */ + if ((*maxprotp & VM_PROT_WRITE) == 0 && + (prot & VM_PROT_WRITE) != 0) + return (EACCES); + if ((*flagsp & (MAP_PRIVATE | MAP_COPY)) != 0) + return (EINVAL); + + return (linux_file_mmap_single(fp, foff, objsize, objp, (int)prot, td)); +} + +static int +linux_file_mmap(struct file *fp, vm_map_t map, vm_offset_t *addr, vm_size_t size, + vm_prot_t prot, vm_prot_t cap_maxprot, int flags, vm_ooffset_t foff, + struct thread *td) +{ + struct linux_file *filp; + struct mount *mp; + struct vnode *vp; + vm_object_t object; + vm_prot_t maxprot; + int error; + + filp = (struct linux_file *)fp->f_data; + + vp = filp->f_vnode; + if (vp == NULL) + return (EOPNOTSUPP); + + /* + * Ensure that file and memory protections are + * compatible. + */ + mp = vp->v_mount; + if (mp != NULL && (mp->mnt_flag & MNT_NOEXEC) != 0) { + maxprot = VM_PROT_NONE; + if ((prot & VM_PROT_EXECUTE) != 0) + return (EACCES); + } else + maxprot = VM_PROT_EXECUTE; + if ((fp->f_flag & FREAD) != 0) + maxprot |= VM_PROT_READ; + else if ((prot & VM_PROT_READ) != 0) + return (EACCES); + + /* + * If we are sharing potential changes via MAP_SHARED and we + * are trying to get write permission although we opened it + * without asking for it, bail out. + * + * Note that most character devices always share mappings. + * + * Rely on linux_file_mmap_sub() to fail invalid MAP_PRIVATE + * requests rather than doing it here. + */ + if ((flags & MAP_SHARED) != 0) { + if ((fp->f_flag & FWRITE) != 0) + maxprot |= VM_PROT_WRITE; + else if ((prot & VM_PROT_WRITE) != 0) + return (EACCES); + } + maxprot &= cap_maxprot; + + error = linux_file_mmap_sub(td, size, prot, &maxprot, &flags, fp, &foff, + &object); + if (error != 0) + return (error); + + error = vm_mmap_object(map, addr, size, prot, maxprot, flags, object, + foff, FALSE, td); + if (error != 0) + vm_object_deallocate(object); + return (error); +} + +static int linux_file_stat(struct file *fp, struct stat *sb, struct ucred *active_cred, struct thread *td) { + struct linux_file *filp; + struct vnode *vp; + int error; - return (EOPNOTSUPP); + filp = (struct linux_file *)fp->f_data; + if (filp->f_vnode == NULL) + return (EOPNOTSUPP); + + vp = filp->f_vnode; + + vn_lock(vp, LK_SHARED | LK_RETRY); + error = vn_stat(vp, sb, td->td_ucred, NOCRED, td); + VOP_UNLOCK(vp, 0); + + return (error); } static int @@ -1544,14 +1542,15 @@ linux_iminor(struct inode *inode) struct fileops linuxfileops = { .fo_read = linux_file_read, - .fo_write = invfo_rdwr, + .fo_write = linux_file_write, .fo_truncate = invfo_truncate, - .fo_kqfilter = invfo_kqfilter, + .fo_kqfilter = linux_file_kqfilter, .fo_stat = linux_file_stat, .fo_fill_kinfo = linux_file_fill_kinfo, .fo_poll = linux_file_poll, .fo_close = linux_file_close, .fo_ioctl = linux_file_ioctl, + .fo_mmap = linux_file_mmap, .fo_chmod = invfo_chmod, .fo_chown = invfo_chown, .fo_sendfile = invfo_sendfile, From owner-svn-src-all@freebsd.org Fri Jan 26 10:49:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 984D8ECF653; Fri, 26 Jan 2018 10:49:42 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 9D40A6DDFC; Fri, 26 Jan 2018 10:49:41 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 695C8D438CE; Fri, 26 Jan 2018 21:49:36 +1100 (AEDT) Date: Fri, 26 Jan 2018 21:49:35 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Schouten cc: Warner Losh , Eitan Adler , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328430 - head/sbin/devd In-Reply-To: Message-ID: <20180126212938.E1040@besplex.bde.org> References: <201801260440.w0Q4efhg008105@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=YbvN30Zf c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=9zjIyH2LsWiY7TYil1EA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 26 Jan 2018 10:49:42 -0000 On Fri, 26 Jan 2018, Ed Schouten wrote: > static void usage(void) __dead2; > > This should be spelled: > > [[noreturn]] static void usage(); That would be as silly as __dead2, and has a worse syntactic style (attributes before the return type mess up the formatting). It is obvious even to lint that usage() doesn't return, since it finishes with exit() and exit() is declared as not returning. (lint in FreeBSD was actually documented as not understanding exit(), and it never understood __dead2 or C++, so usage() and all other uses of exit() would need /* NOTREACHED */ after them for lint, but that would be even uglier than [[noreturn]] and the style bug of doing it for usage() is less common than the style bug of declaring usage() as __dead2.) This file has further style bugs which make the whole prototype dead. With normal style, or even with functions sorted alphabetically, main() is before usage() so a forward declaration of usage() is needed. However, in this file, usage() is before main(). Also, this file usage a random style for declaring forward prototypes when they are not needed. It declares unnecessary ones for usage() and event_loop(), and a necessary one for devdlog(), but doesn't declare unnecessary ones for approx. 5 other functions. Bruce From owner-svn-src-all@freebsd.org Fri Jan 26 11:01:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E8D4ECFF3A for ; Fri, 26 Jan 2018 11:01:13 +0000 (UTC) (envelope-from suke_limited@163.com) Received: from m12-19.163.com (m12-11.163.com [220.181.12.11]) by mx1.freebsd.org (Postfix) with ESMTP id C8FCF6E603 for ; Fri, 26 Jan 2018 11:01:10 +0000 (UTC) (envelope-from suke_limited@163.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:From:Subject:MIME-Version:Message-ID; bh=bV4h1 IjpPcKo879HmHxAISSPeRvN8UtNDDWkXzrAupY=; b=UXqRXYiacrI3r9BNlSvpJ u/PBL9R2INp3OQQpEKsuzOV0lDl0Ke6OvWRcaBUHyA4tg24e6KafB8u6r5YimxpS Jb082pTs5E0+LfuRSFLA2WxPOUcNiQYt3ZoJDhDo0n01KYT9xK/yslZAX3fuIp9h XRHW8Mvy3FAA9Le3BfV40A= Received: from localhost (unknown [127.0.0.1]) by smtp99 (Coremail) with SMTP id TSWEB_0000011700007F9D5A6B0A5B; Fri, 26 Jan 2018 19:00:43 +0800 (CST) Received: from suke_limited$163.com ( [14.220.239.67] ) by ajax-webmail-wmsvr144 (Coremail) ; Fri, 26 Jan 2018 10:24:04 +0800 (CST) X-Originating-IP: [14.220.239.67] Date: Fri, 26 Jan 2018 19:00:00 +0800 (CST) From: suke_limited To: svn-src-all@freebsd.org Subject: nice profile can use 3 different diffuser X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 20160729(86883.8884) Copyright (c) 2002-2018 www.mailtech.cn 163com X-CM-CTRLDATA: H+Tab2Zvb3Rlcl9odG09MTA0NDI6NTY= MIME-Version: 1.0 Message-ID: <7533c03c.2b2b.161304772ec.Coremail.suke_limited@163.com> X-Coremail-Locale: zh_CN X-CM-TRANSID: E8CowACnMtBwCmtahAMJAA--.55128W X-CM-SenderInfo: 5vxnvspolpx3lhg6il2tof0z/1tbiTATZm1SIXpzoEwAAsv X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 26 Jan 2018 11:01:13 -0000 RGVhciBjdXN0b21lcgogCnBsZWFzZSBjaGVjayB0aGUgYmV0dGVyIHNvbHV0aW9uIGZvciB5b3Vy IGxpbmVyIGxlZCBwcm9qZWN0CgoKMSBwcm9maWxlIGNhbiB1c2UgMyBkaWZmZXJlbnQgZGlmZnVz ZXIgYmUgYmV0dGVyIGZvciB5b3VyIGNob2ljZQoKCiAKCgoKCktvbmVyICBMdGQKU3VrZSBjaGVu ZyAgKCBQcm9kdWN0ICBkZXB0Likg4oCNCnN1a2VfbGltaXRlZEAxNjMuY29t From owner-svn-src-all@freebsd.org Fri Jan 26 11:36:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C0EEED1627; Fri, 26 Jan 2018 11:36:41 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 9AE866F51D; Fri, 26 Jan 2018 11:36:40 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 8415DD4E3E2; Fri, 26 Jan 2018 22:36:38 +1100 (AEDT) Date: Fri, 26 Jan 2018 22:36:38 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pedro Giffuni cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs In-Reply-To: <21b6bdda-65b7-89da-4dd6-bed64978eba8@FreeBSD.org> Message-ID: <20180126214948.C1040@besplex.bde.org> References: <201801241758.w0OHwm26063524@repo.freebsd.org> <20180126020540.B2181@besplex.bde.org> <8d5ddd06-14b2-e7e1-14dd-5e9d42f9b33c@FreeBSD.org> <20180126053133.R3207@besplex.bde.org> <21b6bdda-65b7-89da-4dd6-bed64978eba8@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=LKgWeNe9 c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=yrInW6LWO6Wa9mYlnkQA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 26 Jan 2018 11:36:41 -0000 On Thu, 25 Jan 2018, Pedro Giffuni wrote: > On 25/01/2018 14:24, Bruce Evans wrote: >> ... >> This code only works because (if?) nfs is the only caller and nfs never >> passes insane values. >> > > I am starting to think that we should simply match uio_resid and set it to > ssize_t. > Returning the value to int is certainly not the solution. Of course using the correct type (int) is part of the solution. uio_must be checked before it is used for cookies, and after checking it, it is small so it fits easily in an int. It must also checked to be nonnegative, so that it doesn't suffer unsigned poisoning when it is promoted, so it would also fit in a u_int, but using u_int to store it is silly as using 1U instead of 1 for a count of 1. The bounds checking is something like: if (ap->uio_resid < 0) ap->uio_resid = 0; if (ap->a_ncookies != NULL) { if (ap->uio_resid >= 64 * 1024) ap->uio_resid = 64 * 1024; ncookies = ap->uio_resid; } This checks for negative values for all cases and converts to 0 (EOF) to preserve historical behaviour for the syscall case and to avoid overflow for the cookies case (in case the caller is buggy). The correct handling is to return EINVAL, but EOF is good enough. In the syscall case, uio_resid can be up to SSIZE_MAX, so don't check it or corrupt it by assigning it to an int or u_int. Limit uio_resid from above only in the cookies case. The final limit should be about 128K (whatever nfs uses) or maybe 1M. Don't return EINVAL above the limit, since nfs probably wouldn't know how to handle that (by retrying with a smaller size). Test its handling of short counts instead. It is expected than nfs asks for 128K and we supply at most 64K. The supply is always reduced at EOF. Hopefully nfs doesn't treat the short count as EOF. It should retry until we supply 0. After limiting uio_resid, assign it to the int ncookies. This doesn't fix the abuse of the ncookies counter to hold the size of the cookies array in bytes for this and the next couple of statements. Normally the bounds checking should be at the top level, with at most KASSERT()s at lower levels, but here the levels are mixed, and it isn't clear if kernel callers have already checked, and it doesn't cost much to do much the same checking for the kernel callers as for the syscall callers. Perhaps the 128K limit is good for all cases (this depends on callers not having buggy short count handling). Directories of this size are very rare (don't forget to create very large ones when you test this). Doing anything with directories of this size tends to be slow anyway, and the slowness has nothing to do with reading only 128K instead of SSIZE_MAX bytes at a time. readdir() in FreeBSD seems to use a read size of only PAGE_SIZE, except in the unionfs case it seems to try to read the whole direction. It malloc()s the buffer in both cases. Blindy malloc()ing or mmap()ing a buffer large enough for a whole file or directory is no good, since in theory even directory sizes can be much larger than memory. Bruce From owner-svn-src-all@freebsd.org Fri Jan 26 14:03:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C942DED8363; Fri, 26 Jan 2018 14:03:37 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2EB4E741CF; Fri, 26 Jan 2018 14:03:36 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id f4bHe95NAZ8gBf4bIeMgcc; Fri, 26 Jan 2018 07:03:29 -0700 X-Authority-Analysis: v=2.2 cv=M/g9E24s c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=RgaUWeydRksA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=hmGqi0VmbsYnmpwqu18A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 47B5E1F3E; Fri, 26 Jan 2018 06:03:27 -0800 (PST) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w0QE3Qhg016587; Fri, 26 Jan 2018 06:03:26 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w0QE3Qxf016584; Fri, 26 Jan 2018 06:03:26 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201801261403.w0QE3Qxf016584@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Conrad Meyer cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328417 - in head/sys: contrib/ipfilter/netinet fs/nfs fs/nfsclient fs/nfsserver netinet nfsclient sys In-Reply-To: Message from Conrad Meyer of "Thu, 25 Jan 2018 22:25:13 +0000." <201801252225.w0PMPDVQ023040@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 26 Jan 2018 06:03:26 -0800 X-CMAE-Envelope: MS4wfGEvNTrVX+gJSgux0k4E5j1priK9WGyElxZ6uVJhjrfxGVtmRwmO1srZW9VY0INk09QHgDgZV4V4pq6rSvs7yDVewa+ycbI8F7VIv6kCULbzAKE0G5B7 TVNEnuVQ0XYtIiFbHnuRRd1tBzKrnlt6PF1jjZGd9KXN18QbqRiOJnhYbG0QCgBNZgtCy8ETFWfv2EAtII3hXXude7RMmyRNSt5HcRUcwD0JQjitVie88HM8 2MBihjqZZ+CDfDqyixSdvar90+MnWH7voJxF4Tyjkuv7oxb6urPA2l/vVruO5ENK X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 26 Jan 2018 14:03:38 -0000 In message <201801252225.w0PMPDVQ023040@repo.freebsd.org>, Conrad Meyer writes: > Author: cem > Date: Thu Jan 25 22:25:13 2018 > New Revision: 328417 > URL: https://svnweb.freebsd.org/changeset/base/328417 > > Log: > style: Remove remaining deprecated MALLOC/FREE macros > > Mechanically replace uses of MALLOC/FREE with appropriate invocations of > malloc(9) / free(9) (a series of sed expressions). Something like: > > * MALLOC(a, b, ... -> a = malloc(... > * FREE( -> free( > * free((caddr_t) -> free( > > No functional change. > > For now, punt on modifying contrib ipfilter code, leaving a definition of > the macro in its KMALLOC(). Yes, it's best not to deviate contrib code too much from original or we end up with a fork which is difficult to impossible to merge upstream into. Someone had suggested this very thing previously. Gleb (glebius) and I objected. > > Reported by: jhb > Reviewed by: cy, imp, markj, rmacklem > Sponsored by: Dell EMC Isilon > Differential Revision: https://reviews.freebsd.org/D14035 > > Modified: > head/sys/contrib/ipfilter/netinet/ip_compat.h > head/sys/fs/nfs/nfs_commonkrpc.c > head/sys/fs/nfs/nfs_commonsubs.c > head/sys/fs/nfs/nfsport.h > head/sys/fs/nfsclient/nfs_clcomsubs.c > head/sys/fs/nfsclient/nfs_clnode.c > head/sys/fs/nfsclient/nfs_clport.c > head/sys/fs/nfsclient/nfs_clrpcops.c > head/sys/fs/nfsclient/nfs_clstate.c > head/sys/fs/nfsclient/nfs_clsubs.c > head/sys/fs/nfsclient/nfs_clvfsops.c > head/sys/fs/nfsclient/nfs_clvnops.c > head/sys/fs/nfsclient/nfsnode.h > head/sys/fs/nfsserver/nfs_nfsdcache.c > head/sys/fs/nfsserver/nfs_nfsdport.c > head/sys/fs/nfsserver/nfs_nfsdserv.c > head/sys/fs/nfsserver/nfs_nfsdstate.c > head/sys/netinet/ip_mroute.c > head/sys/nfsclient/nfsnode.h > head/sys/sys/malloc.h > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Fri Jan 26 16:56:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77010EB697B for ; Fri, 26 Jan 2018 16:56:09 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (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 030BB7ADA2 for ; Fri, 26 Jan 2018 16:56:08 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: cb6ae677-02b9-11e8-bb8e-b35b57339d60 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id cb6ae677-02b9-11e8-bb8e-b35b57339d60; Fri, 26 Jan 2018 16:56:04 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w0QGu5QY013985; Fri, 26 Jan 2018 09:56:05 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1516985765.42536.251.camel@freebsd.org> Subject: Re: svn commit: r328430 - head/sbin/devd From: Ian Lepore To: Warner Losh , Matt Joras Cc: Eitan Adler , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 26 Jan 2018 09:56:05 -0700 In-Reply-To: References: <201801260440.w0Q4efhg008105@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 26 Jan 2018 16:56:09 -0000 On Thu, 2018-01-25 at 22:59 -0700, Warner Losh wrote: > On Thu, Jan 25, 2018 at 10:02 PM, Matt Joras wrote: > > > > > On Thu, Jan 25, 2018 at 8:52 PM, Warner Losh wrote: > > > > > > > > > > > > On Thu, Jan 25, 2018 at 9:40 PM, Eitan Adler wrote: > > > > > > > > > > > > Author: eadler > > > > Date: Fri Jan 26 04:40:41 2018 > > > > New Revision: 328430 > > > > URL: https://svnweb.freebsd.org/changeset/base/328430 > > > > > > > > Log: > > > > devd: minor nits > > > > > > > > - mark usage as noreturn > > > > - config does not need a virtual destructor > > > > > > Everything needs a virtual destructor...Please back that part of this > > > out... > > > > > > Warner > > Needs? If there's not inheritance there's no _need_ to do it, and it's > > arguably superfluous. That being said it's also an arguably > > superfluous change to remove it. > > > OK. Needs might not be the proper word. It's a stylistic thing in all the > C++ code I write. It keeps me from having to go back later and add it back > when it really does need it after subclasses are derived from it. It's an > important detail that often gets overlooked. The cost is minimal. And this > isn't one of the rare cases where it's harmful to have it. > > Warner Bah. When a class is not designed for inheritence, it should NOT have a virtual dtor. Not just because of the extra overhead of vtable dispatching where it isn't needed, but also because it lulls someone who comes along and looks at the class into thinking it was designed to be derived-from. If it wasn't specifically designed to be derived- from, then before doing so somebody needs to make sure the class is ready for that. Modern compilers will warn about a class with virtual functions and no virtual dtor, so just blindly including it is more harmful than prophylactic these days, IMO. -- Ian From owner-svn-src-all@freebsd.org Fri Jan 26 17:13:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5959EB7939; Fri, 26 Jan 2018 17:13:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 984D77B9F2; Fri, 26 Jan 2018 17:13:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 932E31E6FD; Fri, 26 Jan 2018 17:13:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QHD08c082897; Fri, 26 Jan 2018 17:13:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QHD0Up082894; Fri, 26 Jan 2018 17:13:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801261713.w0QHD0Up082894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 26 Jan 2018 17:13:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328437 - in head/stand: i386/gptboot libsa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: i386/gptboot libsa X-SVN-Commit-Revision: 328437 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 17:13:01 -0000 Author: imp Date: Fri Jan 26 17:13:00 2018 New Revision: 328437 URL: https://svnweb.freebsd.org/changeset/base/328437 Log: Split panic routine Split panic routine so that the 'Hit Any Key to continue' behavior can be overriden. Sponsored by: Netflix Modified: head/stand/i386/gptboot/gptboot.c head/stand/libsa/panic.c head/stand/libsa/stand.h Modified: head/stand/i386/gptboot/gptboot.c ============================================================================== --- head/stand/i386/gptboot/gptboot.c Fri Jan 26 10:49:02 2018 (r328436) +++ head/stand/i386/gptboot/gptboot.c Fri Jan 26 17:13:00 2018 (r328437) @@ -102,7 +102,6 @@ static struct bios_smap smap; static char *heap_next; static char *heap_end; -void exit(int); static void load(void); static int parse_cmds(char *, int *); static int dskread(void *, daddr_t, unsigned); @@ -365,6 +364,7 @@ main(void) void exit(int x) { + while (1); } static void Modified: head/stand/libsa/panic.c ============================================================================== --- head/stand/libsa/panic.c Fri Jan 26 10:49:02 2018 (r328436) +++ head/stand/libsa/panic.c Fri Jan 26 17:13:00 2018 (r328437) @@ -39,7 +39,18 @@ __FBSDID("$FreeBSD$"); #include #include -extern void exit(int) __dead2; +/* + * Boot loaders and other standalone programs that wish to have a + * different panic policy can provide their own panic_action rotuine. + */ +__weak_symbol void +panic_action(void) +{ + printf("--> Press a key on the console to reboot <--\n"); + getchar(); + printf("Rebooting...\n"); + exit(1); +} void panic(const char *fmt,...) @@ -51,9 +62,5 @@ panic(const char *fmt,...) vprintf(fmt, ap); va_end(ap); printf("\n"); - - printf("--> Press a key on the console to reboot <--\n"); - getchar(); - printf("Rebooting...\n"); - exit(1); + panic_action(); } Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Fri Jan 26 10:49:02 2018 (r328436) +++ head/stand/libsa/stand.h Fri Jan 26 17:13:00 2018 (r328437) @@ -368,7 +368,6 @@ static __inline quad_t qmin(quad_t a, quad_t b) { retu static __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); } static __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); } - /* null functions for device/filesystem switches (undocumented) */ extern int nodev(void); extern int noioctl(struct open_file *, u_long, void *); @@ -387,13 +386,14 @@ extern int null_readdir(struct open_file *f, struct di * Machine dependent functions and data, must be provided or stubbed by * the consumer */ -extern void exit(int); +extern void exit(int) __dead2; extern int getchar(void); extern int ischar(void); extern void putchar(int); extern int devopen(struct open_file *, const char *, const char **); extern int devclose(struct open_file *f); extern void panic(const char *, ...) __dead2 __printflike(1, 2); +extern void panic_action(void) __weak_symbol __dead2; extern time_t getsecs(void); extern struct fs_ops *file_system[]; extern struct fs_ops *exclusive_file_system; From owner-svn-src-all@freebsd.org Fri Jan 26 17:13:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18D46EB796D; Fri, 26 Jan 2018 17:13:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E4D517BAAC; Fri, 26 Jan 2018 17:13:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5585A1E6FE; Fri, 26 Jan 2018 17:13:05 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QHD5Ma082951; Fri, 26 Jan 2018 17:13:05 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QHD49k082948; Fri, 26 Jan 2018 17:13:04 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801261713.w0QHD49k082948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 26 Jan 2018 17:13:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328438 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 328438 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 17:13:08 -0000 Author: imp Date: Fri Jan 26 17:13:04 2018 New Revision: 328438 URL: https://svnweb.freebsd.org/changeset/base/328438 Log: Implement abort() as a call to panic. Sponsored by: Netflix Added: head/stand/libsa/abort.c (contents, props changed) Modified: head/stand/libsa/Makefile head/stand/libsa/stand.h Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Fri Jan 26 17:13:00 2018 (r328437) +++ head/stand/libsa/Makefile Fri Jan 26 17:13:04 2018 (r328438) @@ -19,7 +19,7 @@ LIB?= sa NO_PIC= # standalone components and stuff we have modified locally -SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c environment.c getopt.c gets.c \ +SRCS+= gzguts.h zutil.h __main.c abort.c assert.c bcd.c environment.c getopt.c gets.c \ globals.c pager.c panic.c printf.c strdup.c strerror.c strtol.c strtoul.c \ random.c sbrk.c twiddle.c zalloc.c zalloc_malloc.c Added: head/stand/libsa/abort.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/libsa/abort.c Fri Jan 26 17:13:04 2018 (r328438) @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2018 Netflix. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +void +abort(void) +{ + panic("Bootloader aborted by abort"); +} Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Fri Jan 26 17:13:00 2018 (r328437) +++ head/stand/libsa/stand.h Fri Jan 26 17:13:04 2018 (r328438) @@ -346,6 +346,9 @@ extern int unsetenv(const char *name); extern ev_sethook_t env_noset; /* refuse set operation */ extern ev_unsethook_t env_nounset; /* refuse unset operation */ +/* stdlib.h routines */ +extern void abort(void); + /* BCD conversions (undocumented) */ extern u_char const bcd2bin_data[]; extern u_char const bin2bcd_data[]; From owner-svn-src-all@freebsd.org Fri Jan 26 17:13:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2D5FEB7973; Fri, 26 Jan 2018 17:13:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 90E407BAD7; Fri, 26 Jan 2018 17:13:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BFE01E6FF; Fri, 26 Jan 2018 17:13:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QHD9Lk083005; Fri, 26 Jan 2018 17:13:09 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QHD9fQ083003; Fri, 26 Jan 2018 17:13:09 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801261713.w0QHD9fQ083003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 26 Jan 2018 17:13:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328439 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 328439 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 17:13:10 -0000 Author: imp Date: Fri Jan 26 17:13:09 2018 New Revision: 328439 URL: https://svnweb.freebsd.org/changeset/base/328439 Log: Provide abs form stdlib.h. Sponsored by: Netflix Modified: head/stand/libsa/Makefile head/stand/libsa/stand.h Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Fri Jan 26 17:13:04 2018 (r328438) +++ head/stand/libsa/Makefile Fri Jan 26 17:13:09 2018 (r328439) @@ -37,6 +37,11 @@ SRCS+= bcmp.c bcopy.c bzero.c ffs.c fls.c \ qdivrem.c strcat.c strchr.c strcmp.c strcpy.c stpcpy.c stpncpy.c \ strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \ strnlen.c strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c + +# stdlib functions from libc +.PATH: ${LIBC_SRC}/stdlib +SRCS+= abs.c + .if ${MACHINE_CPUARCH} == "arm" .PATH: ${LIBC_SRC}/arm/gen Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Fri Jan 26 17:13:04 2018 (r328438) +++ head/stand/libsa/stand.h Fri Jan 26 17:13:09 2018 (r328439) @@ -347,6 +347,7 @@ extern ev_sethook_t env_noset; /* refuse set operatio extern ev_unsethook_t env_nounset; /* refuse unset operation */ /* stdlib.h routines */ +extern int abs(int a); extern void abort(void); /* BCD conversions (undocumented) */ From owner-svn-src-all@freebsd.org Fri Jan 26 17:24:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A890BEB939D; Fri, 26 Jan 2018 17:24:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54FC87C4C9; Fri, 26 Jan 2018 17:24:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 500851E8C2; Fri, 26 Jan 2018 17:24:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QHOP5Z087758; Fri, 26 Jan 2018 17:24:25 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QHOPhT087757; Fri, 26 Jan 2018 17:24:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801261724.w0QHOPhT087757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 26 Jan 2018 17:24:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328440 - head/contrib/lua/src X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/contrib/lua/src X-SVN-Commit-Revision: 328440 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 17:24:25 -0000 Author: imp Date: Fri Jan 26 17:24:25 2018 New Revision: 328440 URL: https://svnweb.freebsd.org/changeset/base/328440 Log: Preserve the original luaconf.h in a convenient place. Clients will almost certainly need to override this, so reinforce that. If that's not hte case, clients can always do a #include luaconf.h.dist. Added: head/contrib/lua/src/luaconf.h.dist (contents, props changed) - copied, changed from r328439, head/contrib/lua/src/luaconf.h Deleted: head/contrib/lua/src/luaconf.h Copied and modified: head/contrib/lua/src/luaconf.h.dist (from r328439, head/contrib/lua/src/luaconf.h) ============================================================================== From owner-svn-src-all@freebsd.org Fri Jan 26 17:40:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9EAFEB9EF0; Fri, 26 Jan 2018 17:40:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5CA917D0A3; Fri, 26 Jan 2018 17:40:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57AFE1EA85; Fri, 26 Jan 2018 17:40:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QHeDSc093131; Fri, 26 Jan 2018 17:40:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QHeDOg093130; Fri, 26 Jan 2018 17:40:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801261740.w0QHeDOg093130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 26 Jan 2018 17:40:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328441 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 328441 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 17:40:13 -0000 Author: imp Date: Fri Jan 26 17:40:13 2018 New Revision: 328441 URL: https://svnweb.freebsd.org/changeset/base/328441 Log: abort() should be marked __dead2 since it won't return. Modified: head/stand/libsa/stand.h Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Fri Jan 26 17:24:25 2018 (r328440) +++ head/stand/libsa/stand.h Fri Jan 26 17:40:13 2018 (r328441) @@ -348,7 +348,7 @@ extern ev_unsethook_t env_nounset; /* refuse unset op /* stdlib.h routines */ extern int abs(int a); -extern void abort(void); +extern void abort(void) __dead2; /* BCD conversions (undocumented) */ extern u_char const bcd2bin_data[]; From owner-svn-src-all@freebsd.org Fri Jan 26 17:55:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 730D1EBEBBA; Fri, 26 Jan 2018 17:55:18 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 240E27DE0E; Fri, 26 Jan 2018 17:55:18 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AA861ED9E; Fri, 26 Jan 2018 17:55:18 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QHtHcF003314; Fri, 26 Jan 2018 17:55:17 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QHtHuS003312; Fri, 26 Jan 2018 17:55:17 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201801261755.w0QHtHuS003312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 26 Jan 2018 17:55:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328442 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 328442 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 17:55:18 -0000 Author: ian Date: Fri Jan 26 17:55:17 2018 New Revision: 328442 URL: https://svnweb.freebsd.org/changeset/base/328442 Log: Add support to the imx5/6 watchdog for the external reset signal. Also, if the "power down" watchdog used by the ROM boot code is still active when the regular watchdog is activated, turn off the power-down watchdog. This adds support for the "fsl,ext-reset-output" FDT property. When present, that property indicates that a chip reset is accomplished by asserting the WDOG1_B external signal, which is supposed to trigger some external component such as a PMIC to ready the hardware for reset (for example, adjusting voltages from idle to full-power levels), and assert the POR signal to SoC when ready. To guard against misconfiguation leading to a non-rebootable system, the external reset signal is backstopped by code that asserts a normal internal chip reset if nothing responds to the external reset signal within one second. Modified: head/sys/arm/freescale/imx/imx_machdep.c head/sys/arm/freescale/imx/imx_wdog.c Modified: head/sys/arm/freescale/imx/imx_machdep.c ============================================================================== --- head/sys/arm/freescale/imx/imx_machdep.c Fri Jan 26 17:40:13 2018 (r328441) +++ head/sys/arm/freescale/imx/imx_machdep.c Fri Jan 26 17:55:17 2018 (r328442) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -65,27 +66,51 @@ SYSCTL_STRING(_hw_imx, OID_AUTO, last_reset_reason, CT void imx_wdog_cpu_reset(vm_offset_t wdcr_physaddr) { - volatile uint16_t * pcr; + volatile uint16_t cr, *pcr; + if ((pcr = devmap_ptov(wdcr_physaddr, sizeof(*pcr))) == NULL) { + printf("imx_wdog_cpu_reset(): " + "cannot find control register... locking up now."); + for (;;) + cpu_spinwait(); + } + cr = *pcr; + /* - * Trigger an immediate reset by clearing the SRS bit in the watchdog - * control register. The reset happens on the next cycle of the wdog - * 32KHz clock, so hang out in a spin loop until the reset takes effect. + * If the watchdog hardware has been set up to trigger an external reset + * signal on watchdog timeout, then we do software-requested rebooting + * the same way, by asserting the external reset signal. * + * Asserting external reset is supposed to result in some external + * component asserting the POR pin on the SoC, possibly after adjusting + * and stabilizing system voltages, or taking other system-wide reset + * actions. Just in case there is some kind of misconfiguration, we + * hang out and do nothing for a full second, then continue on into + * the code to assert a software reset as well. + */ + if (cr & WDOG_CR_WDT) { + cr &= ~WDOG_CR_WDA; /* Assert active-low ext reset bit. */ + *pcr = cr; + DELAY(1000000); + printf("imx_wdog_cpu_reset(): " + "External reset failed, trying internal cpu-reset\n"); + DELAY(10000); /* Time for printf to appear */ + } + + /* * Imx6 erratum ERR004346 says the SRS bit has to be cleared twice * within the same cycle of the 32khz clock to reliably trigger the * reset. Writing it 3 times in a row ensures at least 2 of the writes * happen in the same 32k clock cycle. */ - if ((pcr = devmap_ptov(wdcr_physaddr, sizeof(*pcr))) == NULL) { - printf("cpu_reset() can't find its control register... locking up now."); - } else { - *pcr &= ~WDOG_CR_SRS; - *pcr &= ~WDOG_CR_SRS; - *pcr &= ~WDOG_CR_SRS; - } + cr &= ~WDOG_CR_SRS; /* Assert active-low software reset bit. */ + *pcr = cr; + *pcr = cr; + *pcr = cr; + + /* Reset happens on the next tick of the 32khz clock, wait for it. */ for (;;) - continue; + cpu_spinwait(); } void Modified: head/sys/arm/freescale/imx/imx_wdog.c ============================================================================== --- head/sys/arm/freescale/imx/imx_wdog.c Fri Jan 26 17:40:13 2018 (r328441) +++ head/sys/arm/freescale/imx/imx_wdog.c Fri Jan 26 17:55:17 2018 (r328442) @@ -49,13 +49,16 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include struct imx_wdog_softc { struct mtx sc_mtx; device_t sc_dev; struct resource *sc_res[2]; + void *sc_ih; uint32_t sc_timeout; + bool sc_pde_enabled; }; static struct resource_spec imx_wdog_spec[] = { @@ -122,6 +125,12 @@ imx_watchdog(void *arg, u_int cmd, int *error) /* Refresh counter */ WR2(sc, WDOG_SR_REG, WDOG_SR_STEP1); WR2(sc, WDOG_SR_REG, WDOG_SR_STEP2); + /* Watchdog active, can disable rom-boot watchdog. */ + if (sc->sc_pde_enabled) { + sc->sc_pde_enabled = false; + reg = RD2(sc, WDOG_MCR_REG); + WR2(sc, WDOG_MCR_REG, reg & ~WDOG_MCR_PDE); + } *error = 0; } } @@ -129,6 +138,27 @@ imx_watchdog(void *arg, u_int cmd, int *error) } static int +imx_wdog_intr(void *arg) +{ + struct imx_wdog_softc *sc = arg; + + /* + * When configured for external reset, the actual reset is supposed to + * happen when some external device responds to the assertion of the + * WDOG_B signal by asserting the POR signal to the chip. This + * interrupt handler is a backstop mechanism; it is set up to fire + * simultaneously with WDOG_B, and if the external reset happens we'll + * never actually make it to here. If we do make it here, just trigger + * a software reset. That code will see that external reset is + * configured, and it will wait for 1 second for it to take effect, then + * it will do a software reset as a fallback. + */ + imx_wdog_cpu_reset(BUS_SPACE_PHYSADDR(sc->sc_res[MEMRES], WDOG_CR_REG)); + + return (FILTER_HANDLED); /* unreached */ +} + +static int imx_wdog_probe(device_t dev) { @@ -157,7 +187,26 @@ imx_wdog_attach(device_t dev) mtx_init(&sc->sc_mtx, device_get_nameunit(dev), "imx_wdt", MTX_DEF); - /* TODO: handle interrupt */ + /* + * If we're configured to assert an external reset signal, set up the + * hardware to do so, and install an interrupt handler whose only + * purpose is to backstop the external reset. Don't worry if the + * interrupt setup fails, since it's only a backstop measure. + */ + if (ofw_bus_has_prop(sc->sc_dev, "fsl,ext-reset-output")) { + WR2(sc, WDOG_CR_REG, WDOG_CR_WDT | RD2(sc, WDOG_CR_REG)); + bus_setup_intr(sc->sc_dev, sc->sc_res[IRQRES], + INTR_TYPE_MISC | INTR_MPSAFE, imx_wdog_intr, NULL, sc, + &sc->sc_ih); + WR2(sc, WDOG_ICR_REG, WDOG_ICR_WIE); /* Enable, count is 0. */ + } + + /* + * Note whether the rom-boot so-called "power-down" watchdog is active, + * so we can disable it when the regular watchdog is first enabled. + */ + if (RD2(sc, WDOG_MCR_REG) & WDOG_MCR_PDE) + sc->sc_pde_enabled = true; EVENTHANDLER_REGISTER(watchdog_list, imx_watchdog, sc, 0); return (0); From owner-svn-src-all@freebsd.org Fri Jan 26 17:56:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 469D1EBECAB; Fri, 26 Jan 2018 17:56:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E59857DF6D; Fri, 26 Jan 2018 17:56:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD4B41ED9F; Fri, 26 Jan 2018 17:56:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QHuKK0003394; Fri, 26 Jan 2018 17:56:20 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QHuKxT003393; Fri, 26 Jan 2018 17:56:20 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801261756.w0QHuKxT003393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 26 Jan 2018 17:56:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328443 - head/contrib/lua/src X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/contrib/lua/src X-SVN-Commit-Revision: 328443 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 17:56:21 -0000 Author: imp Date: Fri Jan 26 17:56:20 2018 New Revision: 328443 URL: https://svnweb.freebsd.org/changeset/base/328443 Log: Gross hack to omit printing hex floating point when the lua number type is int64. While lua is setup for the representation, it's not setup to properly print the numbers as ints. This is the least-gross way around that, and won't affect the bootloader where we do this. Modified: head/contrib/lua/src/lstrlib.c Modified: head/contrib/lua/src/lstrlib.c ============================================================================== --- head/contrib/lua/src/lstrlib.c Fri Jan 26 17:55:17 2018 (r328442) +++ head/contrib/lua/src/lstrlib.c Fri Jan 26 17:56:20 2018 (r328443) @@ -951,12 +951,16 @@ static void addliteral (lua_State *L, luaL_Buffer *b, case LUA_TNUMBER: { char *buff = luaL_prepbuffsize(b, MAX_ITEM); int nb; +#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 if (!lua_isinteger(L, arg)) { /* float? */ lua_Number n = lua_tonumber(L, arg); /* write as hexa ('%a') */ nb = lua_number2strx(L, buff, MAX_ITEM, "%" LUA_NUMBER_FRMLEN "a", n); checkdp(buff, nb); /* ensure it uses a dot */ } else { /* integers */ +#else + { +#endif lua_Integer n = lua_tointeger(L, arg); const char *format = (n == LUA_MININTEGER) /* corner case? */ ? "0x%" LUA_INTEGER_FRMLEN "x" /* use hexa */ From owner-svn-src-all@freebsd.org Fri Jan 26 18:17:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01DD9EC12FB; Fri, 26 Jan 2018 18:17:12 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 963CD805B6; Fri, 26 Jan 2018 18:17:11 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88AF81F0F4; Fri, 26 Jan 2018 18:17:11 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QIHBOk016998; Fri, 26 Jan 2018 18:17:11 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QIHB9e016997; Fri, 26 Jan 2018 18:17:11 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201801261817.w0QIHB9e016997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 26 Jan 2018 18:17:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328444 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 328444 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 18:17:12 -0000 Author: mckusick Date: Fri Jan 26 18:17:11 2018 New Revision: 328444 URL: https://svnweb.freebsd.org/changeset/base/328444 Log: For many years the message "fsync: giving up on dirty" has occationally appeared on UFS/FFS filesystems. In some cases it was promptly followed by a panic of "softdep_deallocate_dependencies: dangling deps". This fix should eliminate both of these occurences. Submitted by: Andreas Longwitz Reviewed by: kib Tested by: Peter Holm (pho) PR: 225423 MFC after: 1 week Modified: head/sys/kern/vfs_default.c Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Fri Jan 26 17:56:20 2018 (r328443) +++ head/sys/kern/vfs_default.c Fri Jan 26 18:17:11 2018 (r328444) @@ -631,13 +631,21 @@ vop_stdfsync(ap) struct thread *a_td; } */ *ap; { - struct vnode *vp = ap->a_vp; - struct buf *bp; + struct vnode *vp; + struct buf *bp, *nbp; struct bufobj *bo; - struct buf *nbp; - int error = 0; - int maxretry = 1000; /* large, arbitrarily chosen */ + struct mount *mp; + int error, maxretry; + error = 0; + maxretry = 10000; /* large, arbitrarily chosen */ + vp = ap->a_vp; + mp = NULL; + if (vp->v_type == VCHR) { + VI_LOCK(vp); + mp = vp->v_rdev->si_mountpt; + VI_UNLOCK(vp); + } bo = &vp->v_bufobj; BO_LOCK(bo); loop1: @@ -680,6 +688,8 @@ loop2: bremfree(bp); bawrite(bp); } + if (maxretry < 1000) + pause("dirty", hz < 1000 ? 1 : hz / 1000); BO_LOCK(bo); goto loop2; } @@ -701,7 +711,8 @@ loop2: TAILQ_FOREACH(bp, &bo->bo_dirty.bv_hd, b_bobufs) if ((error = bp->b_error) != 0) break; - if (error == 0 && --maxretry >= 0) + if ((mp != NULL && mp->mnt_secondary_writes > 0) || + (error == 0 && --maxretry >= 0)) goto loop1; error = EAGAIN; } From owner-svn-src-all@freebsd.org Fri Jan 26 18:42:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23FADEC2A03; Fri, 26 Jan 2018 18:42:29 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CE59281769; Fri, 26 Jan 2018 18:42:28 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C952C1F4B6; Fri, 26 Jan 2018 18:42:28 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QIgSJ7031565; Fri, 26 Jan 2018 18:42:28 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QIgSJn031564; Fri, 26 Jan 2018 18:42:28 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201801261842.w0QIgSJn031564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 26 Jan 2018 18:42:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328445 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 328445 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 18:42:29 -0000 Author: scottl Date: Fri Jan 26 18:42:28 2018 New Revision: 328445 URL: https://svnweb.freebsd.org/changeset/base/328445 Log: Fix a cut-and-paste error in a panic message Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Fri Jan 26 18:17:11 2018 (r328444) +++ head/sys/cam/scsi/scsi_da.c Fri Jan 26 18:42:28 2018 (r328445) @@ -1589,7 +1589,7 @@ da_periph_release(struct cam_periph *periph, da_ref_to da_ref_text[token], token); cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1); if (cnt != 1) - panic("Unholding %d with cnt = %d", token, cnt); + panic("Releasing %d with cnt = %d", token, cnt); } static inline void From owner-svn-src-all@freebsd.org Fri Jan 26 18:43:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52105EC2AB6 for ; Fri, 26 Jan 2018 18:43:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic304-35.consmr.mail.ne1.yahoo.com (sonic304-35.consmr.mail.ne1.yahoo.com [66.163.191.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DAA69818DF for ; Fri, 26 Jan 2018 18:43:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1516992201; bh=34glKoewZFX/+SxFiDNcehPZGAn7FM2eRPgnjyYt6lQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=JsO+3UgDkkySei6pOVh9fNu/Uln/xlT9jPvaoBdo7TczbvcvMxabE/Bh7KKxPSss2H5BS7V9oXOUJPXxG8YsiVTfx583vcLQ/XRrYgu7DwlMGBzyhrzCxmsIbGgn41++NADmjx/5VkO1gzW5YWZ85Fa/w/lXwEt69RZrB1YsdgjDTMEyvuz78OBXmfAdSuzL4wbaiIdv3UqlGvCbSBc5Ibuww+ZOMiaHoC6big40ni2EHVpVX6lh00OnisaLJ9kPONMcUc2CLMSs1x0Iw+O2Bq8P8S0regZGUyq7X2xBdYDHepP/c0byiETOpk7zhAPnaYRoSpMte5DCUJJGwfTjUQ== X-YMail-OSG: pz23J5EVM1lRAih4g_LiHJSdvFplFb2kooTe6TTSSotp6VvxxtmNeBnl3XG2Y6V tDKF0pDaCDb190PtdOOaENtqHsp6wxjV1oBGobFalL8jFGPw_UncMPBlDyXOspgekMbN4csUTImh ILvZZ.tcLNlSA1sF8MjNv8TS02ihKhlKzP3Jr.jJ6ooTmKiwdYYaBqQDuM7iOHaqYcnB6__2cbCl AOBcwzvAmPJ3VEq5oUcYClaHsmp3ccSFK0muWn8jX.F6IXZB2aV.q0TYiveGxgtAQdXYoz6XhnSZ h0nGt0WTCHLSgWa3sgZaebYf8zdOtGXKYP9T8fgpB1NRov6x3L3iqIPlk7l_nePZJTYN_oWdQbqf XwCd6EtjX3BKxOtjr4KMCN5eMB.UDAXJj.4MjCfJBN.XQ9OYE5N.esk4Veqv8xVmSxfRIfEYuGrI 1ODWgGn6Rcdel889xroYT4fR1Qzqb.mVxTxappgq8lWhrgTnvXw5DrOzx4ofTYWH07X6bMwokNw1 GxQK4OZPqww-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.ne1.yahoo.com with HTTP; Fri, 26 Jan 2018 18:43:21 +0000 Received: from smtp233.mail.ne1.yahoo.com (EHLO [192.168.0.8]) ([10.218.253.208]) by smtp411.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 269995b754cd839cff391d29ff87b5af; Fri, 26 Jan 2018 18:43:18 +0000 (UTC) Subject: Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801241758.w0OHwm26063524@repo.freebsd.org> <20180126020540.B2181@besplex.bde.org> <8d5ddd06-14b2-e7e1-14dd-5e9d42f9b33c@FreeBSD.org> <20180126053133.R3207@besplex.bde.org> <21b6bdda-65b7-89da-4dd6-bed64978eba8@FreeBSD.org> <20180126214948.C1040@besplex.bde.org> From: Pedro Giffuni Message-ID: <10edbded-b2b5-07e8-b527-b9b4c46d0bae@FreeBSD.org> Date: Fri, 26 Jan 2018 13:43:16 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180126214948.C1040@besplex.bde.org> Content-Type: multipart/mixed; boundary="------------CD1214954B5C6366568C4C97" Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 26 Jan 2018 18:43:28 -0000 This is a multi-part message in MIME format. --------------CD1214954B5C6366568C4C97 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 01/26/18 06:36, Bruce Evans wrote: > On Thu, 25 Jan 2018, Pedro Giffuni wrote: > >> On 25/01/2018 14:24, Bruce Evans wrote: >>> ... >>> This code only works because (if?) nfs is the only caller and nfs never >>> passes insane values. >>> >> >> I am starting to think that we should simply match uio_resid and set >> it to ssize_t. >> Returning the value to int is certainly not the solution. > > Of course using the correct type (int) is part of the solution. > int *was* the correct type, now it doesn't cover all the range. > uio_must be checked before it is used for cookies, and after checking > it, it > is small so it fits easily in an int.  It must also checked to be > nonnegative, Our problem is not really uio_*, our problem is ncookies and we only test that it is >0. I think the attached patch, still keeping the unsigned ncookies, is sufficient. > > so that it doesn't suffer unsigned poisoning when it is promoted, so > it would > also fit in a u_int, but using u_int to store it is silly as using 1U > instead > of 1 for a count of 1. > > The bounds checking is something like: > >     if (ap->uio_resid < 0) >         ap->uio_resid = 0; >     if (ap->a_ncookies != NULL) { >         if (ap->uio_resid >= 64 * 1024) >             ap->uio_resid = 64 * 1024; >         ncookies = ap->uio_resid; >     } > > This checks for negative values for all cases and converts to 0 (EOF) to > preserve historical behaviour for the syscall case and to avoid overflow > for the cookies case (in case the caller is buggy).  The correct handling > is to return EINVAL, but EOF is good enough. > This also touches uio_resid which is probably not good as it is used later on. Our job is not to "fix" the caller but only to apply a reasonable behavior. I also don't like the magic numbers here. > In the syscall case, uio_resid can be up to SSIZE_MAX, so don't check it > or corrupt it by assigning it to an int or u_int. > The minimal type conversion does not really involve corruption: ncookies is local and the caller will not perceive any change. Pedro. > Limit uio_resid from above only in the cookies case.  The final limit > should > be about 128K (whatever nfs uses) or maybe 1M.  Don't return EINVAL above > the limit, since nfs probably wouldn't know how to handle that (by > retrying > with a smaller size).  Test its handling of short counts instead. It is > expected than nfs asks for 128K and we supply at most 64K.  The supply is > always reduced at EOF.  Hopefully nfs doesn't treat the short count as > EOF. > It should retry until we supply 0. > > After limiting uio_resid, assign it to the int ncookies. > > This doesn't fix the abuse of the ncookies counter to hold the size of > the > cookies array in bytes for this and the next couple of statements. > > Normally the bounds checking should be at the top level, with at most > KASSERT()s at lower levels, but here the levels are mixed, and it isn't > clear if kernel callers have already checked, and it doesn't cost much > to do much the same checking for the kernel callers as for the syscall > callers. > > Perhaps the 128K limit is good for all cases (this depends on callers not > having buggy short count handling).  Directories of this size are very > rare (don't forget to create very large ones when you test this). Doing > anything with directories of this size tends to be slow anyway, and the > slowness has nothing to do with reading only 128K instead of SSIZE_MAX > bytes at a time. > > readdir() in FreeBSD seems to use a read size of only PAGE_SIZE, except > in the unionfs case it seems to try to read the whole direction. It > malloc()s the buffer in both cases.  Blindy malloc()ing or mmap()ing > a buffer large enough for a whole file or directory is no good, since > in theory even directory sizes can be much larger than memory. > > Bruce --------------CD1214954B5C6366568C4C97 Content-Type: text/x-patch; name="ext2_ncookies.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ext2_ncookies.diff" Index: sys/fs/ext2fs/ext2_lookup.c =================================================================== --- sys/fs/ext2fs/ext2_lookup.c (revision 328443) +++ sys/fs/ext2fs/ext2_lookup.c (working copy) @@ -153,7 +153,10 @@ return (EINVAL); ip = VTOI(vp); if (ap->a_ncookies != NULL) { - ncookies = uio->uio_resid; + if (uio->uio_resid < 0) + ncookies = 0; + else + ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; else if (ip->i_size - uio->uio_offset < ncookies) --------------CD1214954B5C6366568C4C97-- From owner-svn-src-all@freebsd.org Fri Jan 26 21:06:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DF48EC9505; Fri, 26 Jan 2018 21:06:09 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x244.google.com (mail-it0-x244.google.com [IPv6:2607:f8b0:4001:c0b::244]) (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 A4B3085D00; Fri, 26 Jan 2018 21:06:08 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x244.google.com with SMTP id c102so25394316itd.0; Fri, 26 Jan 2018 13:06:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=8E5iCinvKLNtNIupwC5hhmD4IEr+WM9SVrLsy3f/bIE=; b=AqUvuC7CNQPWs5Rx0hH6DPIDMHB8y2cYHuhf5SKRJ01d9DEZxlOrOG80ajw5Cv9toj XGSoIwRu8tvAC8pdq/aVrfa1P67ONURbFe25hOfz4V9bwcjYQMpNcNEAY8SRz0tuISG2 nEFGXpYsW7R0LcQEXYiid7Biz6q0ihTFjZ6b6Iu7MoOPCJIMmv/pvTME5vGS+IlpTSzq B8W25iHhDNLXZKhNvdPhlnF2TsAvilPYadseAzqVpUQTaBbGo6MR2e9C4apYgK7oDLN2 VBTnqqvaYNKqeNuvh4+JfCI3432y+1sgo95uEsmrm22UeJOH+PJLmdLMh2Hg82xrcEEm 7BRw== 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=8E5iCinvKLNtNIupwC5hhmD4IEr+WM9SVrLsy3f/bIE=; b=QieXx+yem3iQiYr3m/hB6flRMfy0XAiwc7yAMBTm3PSlw7vGU5LLTKMKlk2fTSppop eEaGcQo5kT9azlvm4YeQnp+2c29Y3h7yEdPtVweZt4+t2ltz8x8fsU9Jhlg8VOKkwi2Y PMqtUT97Mp5X1E+RFE8I6tZPUys1oAlx3szNivTzsb7iWzCuxeYjtg67z685iiSOHGlT 53p9AKeWU7E1JWtYNzIdiMpXeL8MVJM5iqp70m1f1ndM+GjXsQoClCQw0rALqBIrkXfe jk8BHXJg+SjzZkRZAt9GzOvPwhiTitlAv+goZ3Oi4PzQxL+qxoQnSPGdp/ITlh7PAZqO ZHRg== X-Gm-Message-State: AKwxytdSsXH5NZz5wnsPOBYCneSv5ok1VcC74z0G/qPnjs0Wrmxew6iH r5NDnum0lvI+IGm2/cqMR+haPcoKKlOiOswv4ozmSuSg X-Google-Smtp-Source: AH8x227HKex7QKy151F6FEQQXJnpvqubwDtzuOuNX8MJC+3jbsDEK/+N8/NJDGfH1Zqn/2EmlPa6Y5PrKDoGzKqr1XQ= X-Received: by 10.36.172.45 with SMTP id s45mr19675854ite.69.1517000767940; Fri, 26 Jan 2018 13:06:07 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.152.9 with HTTP; Fri, 26 Jan 2018 13:05:47 -0800 (PST) In-Reply-To: <201801261713.w0QHD0Up082894@repo.freebsd.org> References: <201801261713.w0QHD0Up082894@repo.freebsd.org> From: Ed Maste Date: Fri, 26 Jan 2018 16:05:47 -0500 X-Google-Sender-Auth: U8lWU3tYJcrtW-70WXnMDvvkR7E Message-ID: Subject: Re: svn commit: r328437 - in head/stand: i386/gptboot libsa To: Warner Losh 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.25 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: Fri, 26 Jan 2018 21:06:09 -0000 On 26 January 2018 at 12:13, Warner Losh wrote: > Author: imp > Date: Fri Jan 26 17:13:00 2018 > New Revision: 328437 > URL: https://svnweb.freebsd.org/changeset/base/328437 > > Log: > Split panic routine ... > -extern void exit(int); > +extern void exit(int) __dead2; MIPS is now failing with: 18:49:00 /usr/src/stand/uboot/lib/reboot.c: In function 'exit': 18:49:00 /usr/src/stand/uboot/lib/reboot.c:38: warning: 'noreturn' function does return (from https://ci.freebsd.org/job/FreeBSD-head-mips-build/137/console) From owner-svn-src-all@freebsd.org Fri Jan 26 21:51:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBCBAECB11C; Fri, 26 Jan 2018 21:51:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6EE948733D; Fri, 26 Jan 2018 21:51:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69AFC2137B; Fri, 26 Jan 2018 21:51:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QLp0HB021259; Fri, 26 Jan 2018 21:51:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QLp0sE021257; Fri, 26 Jan 2018 21:51:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801262151.w0QLp0sE021257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 26 Jan 2018 21:51:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328446 - head/stand/uboot/lib X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/uboot/lib X-SVN-Commit-Revision: 328446 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 21:51:00 -0000 Author: imp Date: Fri Jan 26 21:50:59 2018 New Revision: 328446 URL: https://svnweb.freebsd.org/changeset/base/328446 Log: Now that exit is __dead2, we need to tag ub_exit() as __dead2. To do that, we have to put a while (1); after the syscall that will never return to fake out the compiler.... Modified: head/stand/uboot/lib/glue.c head/stand/uboot/lib/glue.h Modified: head/stand/uboot/lib/glue.c ============================================================================== --- head/stand/uboot/lib/glue.c Fri Jan 26 18:42:28 2018 (r328445) +++ head/stand/uboot/lib/glue.c Fri Jan 26 21:50:59 2018 (r328446) @@ -187,6 +187,7 @@ ub_reset(void) { syscall(API_RESET, NULL); + while (1); /* Can't tag syscall as __dead2 */ } static struct mem_region mr[UB_MAX_MR]; Modified: head/stand/uboot/lib/glue.h ============================================================================== --- head/stand/uboot/lib/glue.h Fri Jan 26 18:42:28 2018 (r328445) +++ head/stand/uboot/lib/glue.h Fri Jan 26 21:50:59 2018 (r328446) @@ -78,7 +78,7 @@ void ub_putc(char); void ub_puts(const char *); /* system */ -void ub_reset(void); +void ub_reset(void) __dead2; struct sys_info *ub_get_sys_info(void); /* time */ From owner-svn-src-all@freebsd.org Fri Jan 26 21:51:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5DBAECB14B; Fri, 26 Jan 2018 21:51:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54BAA8745F; Fri, 26 Jan 2018 21:51:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4EF7621385; Fri, 26 Jan 2018 21:51:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QLp91I021313; Fri, 26 Jan 2018 21:51:09 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QLp9Em021312; Fri, 26 Jan 2018 21:51:09 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801262151.w0QLp9Em021312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 26 Jan 2018 21:51:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328447 - head/stand/mips/beri/boot2 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/mips/beri/boot2 X-SVN-Commit-Revision: 328447 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 21:51:09 -0000 Author: imp Date: Fri Jan 26 21:51:09 2018 New Revision: 328447 URL: https://svnweb.freebsd.org/changeset/base/328447 Log: BERI isn't BTX, so we don't have to provide exit(). Just remove it since it's unused. Modified: head/stand/mips/beri/boot2/boot2.c Modified: head/stand/mips/beri/boot2/boot2.c ============================================================================== --- head/stand/mips/beri/boot2/boot2.c Fri Jan 26 21:50:59 2018 (r328446) +++ head/stand/mips/beri/boot2/boot2.c Fri Jan 26 21:51:09 2018 (r328447) @@ -137,7 +137,6 @@ static int comspeed = SIOSPD; struct bootinfo bootinfo; static uint8_t ioctrl = IO_KEYBOARD; -void exit(int); void putchar(int); static void boot_fromdram(void); static void boot_fromfs(void); @@ -276,12 +275,6 @@ main(u_int argc, const char *argv[], const char *envv[ else load(); } -} - -/* XXX - Needed for btxld to link the boot2 binary; do not remove. */ -void -exit(int x) -{ } static void From owner-svn-src-all@freebsd.org Fri Jan 26 21:51:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF579ECB16F; Fri, 26 Jan 2018 21:51:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 24BA88760A; Fri, 26 Jan 2018 21:51:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D254C2138E; Fri, 26 Jan 2018 21:51:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QLpDWF021366; Fri, 26 Jan 2018 21:51:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QLpDIk021365; Fri, 26 Jan 2018 21:51:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801262151.w0QLpDIk021365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 26 Jan 2018 21:51:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328448 - head/stand/powerpc/kboot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/powerpc/kboot X-SVN-Commit-Revision: 328448 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 21:51:16 -0000 Author: imp Date: Fri Jan 26 21:51:13 2018 New Revision: 328448 URL: https://svnweb.freebsd.org/changeset/base/328448 Log: Make exit() never return until host_exit can be written. Modified: head/stand/powerpc/kboot/main.c Modified: head/stand/powerpc/kboot/main.c ============================================================================== --- head/stand/powerpc/kboot/main.c Fri Jan 26 21:51:09 2018 (r328447) +++ head/stand/powerpc/kboot/main.c Fri Jan 26 21:51:13 2018 (r328448) @@ -130,7 +130,7 @@ main(int argc, const char **argv) void exit(int code) { - /* XXX: host_exit */ + while (1); /* XXX: host_exit */ } void From owner-svn-src-all@freebsd.org Fri Jan 26 22:08:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADAE0ECBFC0 for ; Fri, 26 Jan 2018 22:08:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x232.google.com (mail-it0-x232.google.com [IPv6:2607:f8b0:4001:c0b::232]) (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 3768968081 for ; Fri, 26 Jan 2018 22:08:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x232.google.com with SMTP id k131so2187290ith.4 for ; Fri, 26 Jan 2018 14:08:43 -0800 (PST) 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=UCNIaACIKEnXyRtPXkuidV3rxjUagNlBF+6WI6oFkmE=; b=DQjQxbEeQSc8CZP+0XCNpfhWLSifnYJUz5uL0HOhszsQLKav3IdxkIwZUgNyJi6m8A sDxRDrtk5bJLLx7PcETgOKPdkQfP2PbPO+u4qtLZ4zyht1MKjbJg6b3+YwNUubuIXRGd 1JTm+hXeIMsDnI7izxfxpank1uAU6HHShRwZaiIQCvKpnIrE5Bot8P05gM4weaYqV9qq igwmLVavMLns4WNflRdk5iCB3nIrIz2URx6XbQSknJ2QJPYg/V6MTqjlHSt/siuGMXI0 Jt733DLx9slor+MDNmqTry7o9vdCjtZxvqjTrZXPfco5u6BUzf030zaaceauL1mTcm9y EEeQ== 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=UCNIaACIKEnXyRtPXkuidV3rxjUagNlBF+6WI6oFkmE=; b=WRBeFOHxzqwXYc2K0+iiKBolnJJ88lEE+30HXeoHwrDdbUb31H2Cng6wfOI9lSAd8Z 2Cc3TQYscJNz6V0tv0iwu+GTAvChqRLrELIklRT/+xldcJLOQl5Dlp4FUKF6jSYWm/Ke 7hniWExzlVhi0JC5blzxCSP0qH5UPTrHSPWJTBjdV3fShPpA/0+WH3VGE7pz3f3Ysen0 Hvc3hwaYu0ZqqUqb8gCntlo1Z3n9HSgp9R7wgwf8ZjFVg6M0iNUadUwCUiDe/0N1UqCl dwxCs/dqERe7joCm3lw4XlOTH0gnTjpM9k1NsoIx34Nsx334AklWsqQ97KXxJPB4Aelc zz4w== X-Gm-Message-State: AKwxytcpsJtZBuZYmSxlP7+hP5xkLV3SYs51zWF1IQXO42aqaHnipeoW 4A98bNDK6akMAiqhwQv06LyEHmSSPXWmcmXeK3svEw== X-Google-Smtp-Source: AH8x22493W6JbCI49Hi6ZQSfp/abz9QE83qxMwX06iDODhxXAE1aum2DRtbzVqq7YRd0I4C8gYk4y5JSLumnq+hmZXQ= X-Received: by 10.36.74.200 with SMTP id k191mr19707726itb.69.1517004522448; Fri, 26 Jan 2018 14:08:42 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Fri, 26 Jan 2018 14:08:41 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201801261713.w0QHD0Up082894@repo.freebsd.org> From: Warner Losh Date: Fri, 26 Jan 2018 15:08:41 -0700 X-Google-Sender-Auth: k_T0kMaQl7p1mIQf0SHPfR0Eui4 Message-ID: Subject: Re: svn commit: r328437 - in head/stand: i386/gptboot libsa To: Ed Maste Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 26 Jan 2018 22:08:43 -0000 On Fri, Jan 26, 2018 at 2:05 PM, Ed Maste wrote: > On 26 January 2018 at 12:13, Warner Losh wrote: > > Author: imp > > Date: Fri Jan 26 17:13:00 2018 > > New Revision: 328437 > > URL: https://svnweb.freebsd.org/changeset/base/328437 > > > > Log: > > Split panic routine > ... > > -extern void exit(int); > > +extern void exit(int) __dead2; > > MIPS is now failing with: > 18:49:00 /usr/src/stand/uboot/lib/reboot.c: In function 'exit': > 18:49:00 /usr/src/stand/uboot/lib/reboot.c:38: warning: 'noreturn' > function does return > (from https://ci.freebsd.org/job/FreeBSD-head-mips-build/137/console) > r328448 fixes this and similar issues on powerpc. Warner From owner-svn-src-all@freebsd.org Fri Jan 26 22:22:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 763E1ECCA23; Fri, 26 Jan 2018 22:22:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 241276895C; Fri, 26 Jan 2018 22:22:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F054217B3; Fri, 26 Jan 2018 22:22:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QMMMYo038002; Fri, 26 Jan 2018 22:22:22 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QMMLnt037996; Fri, 26 Jan 2018 22:22:21 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801262222.w0QMMLnt037996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 26 Jan 2018 22:22:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328449 - in head/stand: i386/gptboot mips/beri/loader mips/uboot powerpc/kboot uboot/common uboot/lib X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: i386/gptboot mips/beri/loader mips/uboot powerpc/kboot uboot/common uboot/lib X-SVN-Commit-Revision: 328449 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 22:22:22 -0000 Author: imp Date: Fri Jan 26 22:22:21 2018 New Revision: 328449 URL: https://svnweb.freebsd.org/changeset/base/328449 Log: Tag unreachable places as such. I left the while (1); in place since in this context we want to busy wait to stop. Suggested by: pfg@ Modified: head/stand/i386/gptboot/gptboot.c head/stand/mips/beri/loader/main.c head/stand/mips/uboot/conf.c head/stand/powerpc/kboot/main.c head/stand/uboot/common/main.c head/stand/uboot/lib/glue.c Modified: head/stand/i386/gptboot/gptboot.c ============================================================================== --- head/stand/i386/gptboot/gptboot.c Fri Jan 26 21:51:13 2018 (r328448) +++ head/stand/i386/gptboot/gptboot.c Fri Jan 26 22:22:21 2018 (r328449) @@ -365,6 +365,7 @@ void exit(int x) { while (1); + __unreachable(); } static void Modified: head/stand/mips/beri/loader/main.c ============================================================================== --- head/stand/mips/beri/loader/main.c Fri Jan 26 21:51:13 2018 (r328448) +++ head/stand/mips/beri/loader/main.c Fri Jan 26 22:22:21 2018 (r328449) @@ -193,6 +193,7 @@ abort(void) printf("error: loader abort\n"); while (1); + __unreachable(); } void @@ -201,6 +202,7 @@ exit(int code) printf("error: loader exit\n"); while (1); + __unreachable(); } void @@ -209,6 +211,7 @@ longjmperror(void) printf("error: loader longjmp error\n"); while (1); + __unreachable(); } time_t Modified: head/stand/mips/uboot/conf.c ============================================================================== --- head/stand/mips/uboot/conf.c Fri Jan 26 21:51:13 2018 (r328448) +++ head/stand/mips/uboot/conf.c Fri Jan 26 22:22:21 2018 (r328449) @@ -105,6 +105,7 @@ abort(void) printf("error: loader abort\n"); while (1); + __unreachable(); } void @@ -113,6 +114,7 @@ longjmperror(void) printf("error: loader longjmp error\n"); while (1); + __unreachable(); } int debug = 1; Modified: head/stand/powerpc/kboot/main.c ============================================================================== --- head/stand/powerpc/kboot/main.c Fri Jan 26 21:51:13 2018 (r328448) +++ head/stand/powerpc/kboot/main.c Fri Jan 26 22:22:21 2018 (r328449) @@ -131,6 +131,7 @@ void exit(int code) { while (1); /* XXX: host_exit */ + __unreachable(); } void Modified: head/stand/uboot/common/main.c ============================================================================== --- head/stand/uboot/common/main.c Fri Jan 26 21:51:13 2018 (r328448) +++ head/stand/uboot/common/main.c Fri Jan 26 22:22:21 2018 (r328449) @@ -526,7 +526,8 @@ command_reboot(int argc, char *argv[]) ub_reset(); printf("Reset failed!\n"); - while(1); + while (1); + __unreachable(); } COMMAND_SET(devinfo, "devinfo", "show U-Boot devices", command_devinfo); Modified: head/stand/uboot/lib/glue.c ============================================================================== --- head/stand/uboot/lib/glue.c Fri Jan 26 21:51:13 2018 (r328448) +++ head/stand/uboot/lib/glue.c Fri Jan 26 22:22:21 2018 (r328449) @@ -187,7 +187,8 @@ ub_reset(void) { syscall(API_RESET, NULL); - while (1); /* Can't tag syscall as __dead2 */ + while (1); /* fallback if API_RESET failed */ + __unreachable(); } static struct mem_region mr[UB_MAX_MR]; From owner-svn-src-all@freebsd.org Fri Jan 26 22:22:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E394ECCA66; Fri, 26 Jan 2018 22:22:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3398068A28; Fri, 26 Jan 2018 22:22: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A70E72188E; Fri, 26 Jan 2018 22:22: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 w0QMMRof038056; Fri, 26 Jan 2018 22:22:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QMMQXC038055; Fri, 26 Jan 2018 22:22:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801262222.w0QMMQXC038055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 26 Jan 2018 22:22:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328450 - head/sys/dev/ntb X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/ntb X-SVN-Commit-Revision: 328450 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 22:22:30 -0000 Author: mav Date: Fri Jan 26 22:22:26 2018 New Revision: 328450 URL: https://svnweb.freebsd.org/changeset/base/328450 Log: Use bus_dmamem_alloc(9) KPI instead of contigmalloc(9). I suppose it should make this code NUMA-aware with recent NUMA drop-in, trying to allocate shared memory buffers from domain closer to NT-bridge. MFC after: 2 weeks Modified: head/sys/dev/ntb/ntb_transport.c Modified: head/sys/dev/ntb/ntb_transport.c ============================================================================== --- head/sys/dev/ntb/ntb_transport.c Fri Jan 26 22:22:21 2018 (r328449) +++ head/sys/dev/ntb/ntb_transport.c Fri Jan 26 22:22:26 2018 (r328450) @@ -182,6 +182,8 @@ struct ntb_transport_mw { size_t xlat_size; size_t buff_size; /* Rx buff is off virt_addr / dma_addr */ + bus_dma_tag_t dma_tag; + bus_dmamap_t dma_map; caddr_t virt_addr; bus_addr_t dma_addr; }; @@ -1147,10 +1149,25 @@ out: NTB_LINK_DOWN_TIMEOUT * hz / 1000, ntb_transport_link_work, nt); } +struct ntb_load_cb_args { + bus_addr_t addr; + int error; +}; + +static void +ntb_load_cb(void *xsc, bus_dma_segment_t *segs, int nsegs, int error) +{ + struct ntb_load_cb_args *cba = (struct ntb_load_cb_args *)xsc; + + if (!(cba->error = error)) + cba->addr = segs[0].ds_addr; +} + static int ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw, size_t size) { struct ntb_transport_mw *mw = &nt->mw_vec[num_mw]; + struct ntb_load_cb_args cba; size_t xlat_size, buff_size; int rc; @@ -1171,30 +1188,36 @@ ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw, s mw->xlat_size = xlat_size; mw->buff_size = buff_size; - mw->virt_addr = contigmalloc(mw->buff_size, M_NTB_T, M_ZERO, 0, - mw->addr_limit, mw->xlat_align, 0); - if (mw->virt_addr == NULL) { + if (bus_dma_tag_create(bus_get_dma_tag(nt->dev), mw->xlat_align, 0, + mw->addr_limit, BUS_SPACE_MAXADDR, + NULL, NULL, mw->buff_size, 1, mw->buff_size, + 0, NULL, NULL, &mw->dma_tag)) { + ntb_printf(0, "Unable to create MW tag of size %zu/%zu\n", + mw->buff_size, mw->xlat_size); + mw->xlat_size = 0; + mw->buff_size = 0; + return (ENOMEM); + } + if (bus_dmamem_alloc(mw->dma_tag, (void **)&mw->virt_addr, + BUS_DMA_WAITOK | BUS_DMA_ZERO, &mw->dma_map)) { + bus_dma_tag_destroy(mw->dma_tag); ntb_printf(0, "Unable to allocate MW buffer of size %zu/%zu\n", mw->buff_size, mw->xlat_size); mw->xlat_size = 0; mw->buff_size = 0; return (ENOMEM); } - /* TODO: replace with bus_space_* functions */ - mw->dma_addr = vtophys(mw->virt_addr); - - /* - * Ensure that the allocation from contigmalloc is aligned as - * requested. XXX: This may not be needed -- brought in for parity - * with the Linux driver. - */ - if (mw->dma_addr % mw->xlat_align != 0) { - ntb_printf(0, - "DMA memory 0x%jx not aligned to BAR size 0x%zx\n", - (uintmax_t)mw->dma_addr, size); - ntb_free_mw(nt, num_mw); + if (bus_dmamap_load(mw->dma_tag, mw->dma_map, mw->virt_addr, + mw->buff_size, ntb_load_cb, &cba, BUS_DMA_NOWAIT) || cba.error) { + bus_dmamem_free(mw->dma_tag, mw->virt_addr, mw->dma_map); + bus_dma_tag_destroy(mw->dma_tag); + ntb_printf(0, "Unable to load MW buffer of size %zu/%zu\n", + mw->buff_size, mw->xlat_size); + mw->xlat_size = 0; + mw->buff_size = 0; return (ENOMEM); } + mw->dma_addr = cba.addr; /* Notify HW the memory location of the receive buffer */ rc = ntb_mw_set_trans(nt->dev, num_mw, mw->dma_addr, mw->xlat_size); @@ -1216,7 +1239,9 @@ ntb_free_mw(struct ntb_transport_ctx *nt, int num_mw) return; ntb_mw_clear_trans(nt->dev, num_mw); - contigfree(mw->virt_addr, mw->xlat_size, M_NTB_T); + bus_dmamap_unload(mw->dma_tag, mw->dma_map); + bus_dmamem_free(mw->dma_tag, mw->virt_addr, mw->dma_map); + bus_dma_tag_destroy(mw->dma_tag); mw->xlat_size = 0; mw->buff_size = 0; mw->virt_addr = NULL; From owner-svn-src-all@freebsd.org Fri Jan 26 22:23:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37E22ECCB41; Fri, 26 Jan 2018 22:23:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E1B0368BEF; Fri, 26 Jan 2018 22:23:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCB37218D1; Fri, 26 Jan 2018 22:23:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QMNOvb040990; Fri, 26 Jan 2018 22:23:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QMNOon040989; Fri, 26 Jan 2018 22:23:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801262223.w0QMNOon040989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 26 Jan 2018 22:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328451 - stable/11/sys/boot/fdt X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/boot/fdt X-SVN-Commit-Revision: 328451 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 22:23:25 -0000 Author: kevans Date: Fri Jan 26 22:23:24 2018 New Revision: 328451 URL: https://svnweb.freebsd.org/changeset/base/328451 Log: MFC (conceptually) r327991, r328009: Don't clobber FDT enroute to the kernel This is a direct commit to stable/11 due to path changes that have occured in HEAD. The diffs remain the same, but rebased against their old locations. MFC r327991: stand/fdt: don't send clobbered FDT to the kernel If fdt_overlay_apply fails at some stage to apply the overlay to the base, both the base and overlay may be in an inconsistent state (some fixups applied, some phandles adjusted, some symbols merged). These can be bad for a number of reasons, to include user frustration if some fixups applied and not others. Fail a little safer by making a clean copy of the base FDT for every overlay that we can simply discard if things go awry. This also allows us the luxury of simply discarding overlays if we hit some kind of memory limit or if they're malformed and extremely large for some reason. We'll now leave a nice error message indicating that some overlays could not be applied due to size restrictions and we apply what we can. I note that our overlay implementation has some flaws that might still leave your system in an unbootable state even if an overlay applies correctly; please exercise caution in using overlays until we can swap it out for libfdt's implementation. MFC r328009: stand/fdt: Don't leak next_fdtp if we fail to open overlay Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- stable/11/sys/boot/fdt/fdt_loader_cmd.c Fri Jan 26 22:22:26 2018 (r328450) +++ stable/11/sys/boot/fdt/fdt_loader_cmd.c Fri Jan 26 22:23:24 2018 (r328451) @@ -339,60 +339,79 @@ void fdt_apply_overlays() { struct preloaded_file *fp; - size_t overlays_size, max_overlay_size, new_fdtp_size; + size_t max_overlay_size, next_fdtp_size; + size_t current_fdtp_size; + void *current_fdtp; void *new_fdtp; + void *next_fdtp; void *overlay; int rv; if ((fdtp == NULL) || (fdtp_size == 0)) return; - overlays_size = 0; + new_fdtp = NULL; max_overlay_size = 0; for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { if (max_overlay_size < fp->f_size) max_overlay_size = fp->f_size; - overlays_size += fp->f_size; } /* Nothing to apply */ - if (overlays_size == 0) + if (max_overlay_size == 0) return; - /* It's actually more than enough */ - new_fdtp_size = fdtp_size + overlays_size; - new_fdtp = malloc(new_fdtp_size); - if (new_fdtp == NULL) { - printf("failed to allocate memory for DTB blob with overlays\n"); - return; - } - overlay = malloc(max_overlay_size); if (overlay == NULL) { printf("failed to allocate memory for DTB blob with overlays\n"); - free(new_fdtp); return; } - - rv = fdt_open_into(fdtp, new_fdtp, new_fdtp_size); - if (rv != 0) { - printf("failed to open DTB blob for applying overlays\n"); - free(new_fdtp); - free(overlay); - return; - } - + current_fdtp = fdtp; + current_fdtp_size = fdtp_size; for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { printf("applying DTB overlay '%s'\n", fp->f_name); + next_fdtp_size = current_fdtp_size + fp->f_size; + next_fdtp = malloc(next_fdtp_size); + if (next_fdtp == NULL) { + /* + * Output warning, then move on to applying other + * overlays in case this one is simply too large. + */ + printf("failed to allocate memory for overlay base\n"); + continue; + } + rv = fdt_open_into(current_fdtp, next_fdtp, next_fdtp_size); + if (rv != 0) { + free(next_fdtp); + printf("failed to open base dtb into overlay base\n"); + continue; + } COPYOUT(fp->f_addr, overlay, fp->f_size); /* Both overlay and new_fdtp may be modified in place */ - fdt_overlay_apply(new_fdtp, overlay); + rv = fdt_overlay_apply(next_fdtp, overlay); + if (rv == 0) { + /* Rotate next -> current */ + if (current_fdtp != fdtp) + free(current_fdtp); + current_fdtp = next_fdtp; + current_fdtp_size = next_fdtp_size; + } else { + /* + * Assume here that the base we tried to apply on is + * either trashed or in an inconsistent state. Trying to + * load it might work, but it's better to discard it and + * play it safe. */ + free(next_fdtp); + printf("failed to apply overlay: %s\n", + fdt_strerror(rv)); + } } - - free(fdtp); - fdtp = new_fdtp; - fdtp_size = new_fdtp_size; - + /* We could have failed to apply all overlays; then we do nothing */ + if (current_fdtp != fdtp) { + free(fdtp); + fdtp = current_fdtp; + fdtp_size = current_fdtp_size; + } free(overlay); } From owner-svn-src-all@freebsd.org Fri Jan 26 23:14:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34046ECEEA2; Fri, 26 Jan 2018 23:14:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CE0866A664; Fri, 26 Jan 2018 23:14:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5469220D5; Fri, 26 Jan 2018 23:14:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QNEkGp066085; Fri, 26 Jan 2018 23:14:46 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QNEkpP066084; Fri, 26 Jan 2018 23:14:46 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201801262314.w0QNEkpP066084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 26 Jan 2018 23:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328452 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 328452 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 23:14:47 -0000 Author: imp Date: Fri Jan 26 23:14:46 2018 New Revision: 328452 URL: https://svnweb.freebsd.org/changeset/base/328452 Log: Fix a sleepable malloc in ndastart. We shouldn't be sleeping here. Return ENOMEM when we can't malloc a buffer for the DSM TRIM. This should fix the WITNESS warnings similar to the following: uma_zalloc_arg: zone "16" with the following non-sleepable locks held: exclusive sleep mutex CAM device lock (CAM device lock) r = 0 (0xfffff800080c34d0) locked @ /usr/src/sys/cam/nvme/nvme_da.c:351 Reviewed by: scottl@ Sponsored by: Netflix Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Fri Jan 26 22:23:24 2018 (r328451) +++ head/sys/cam/nvme/nvme_da.c Fri Jan 26 23:14:46 2018 (r328452) @@ -897,7 +897,13 @@ ndastart(struct cam_periph *periph, union ccb *start_c struct nvme_dsm_range *dsm_range; dsm_range = - malloc(sizeof(*dsm_range), M_NVMEDA, M_ZERO | M_WAITOK); + malloc(sizeof(*dsm_range), M_NVMEDA, M_ZERO | M_NOWAIT); + if (dsm_range == NULL) { + biofinish(bp, NULL, ENOMEM); + xpt_release_ccb(start_ccb); + ndaschedule(periph); + return; + } dsm_range->length = bp->bio_bcount / softc->disk->d_sectorsize; dsm_range->starting_lba = From owner-svn-src-all@freebsd.org Fri Jan 26 23:21:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93979ECF52E for ; Fri, 26 Jan 2018 23:21:34 +0000 (UTC) (envelope-from joerg@bec.de) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:c:538::195]) (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 334256ABBE for ; Fri, 26 Jan 2018 23:21:33 +0000 (UTC) (envelope-from joerg@bec.de) Received: from britannica.bec.de (p200300D2ABC4DD104639C4FFFE599710.dip0.t-ipconnect.de [IPv6:2003:d2:abc4:dd10:4639:c4ff:fe59:9710]) (Authenticated sender: joerg@bec.de) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 478C6A80C6 for ; Sat, 27 Jan 2018 00:21:32 +0100 (CET) Date: Sat, 27 Jan 2018 00:20:46 +0100 From: Joerg Sonnenberger To: svn-src-all@freebsd.org Subject: Re: svn commit: r328446 - head/stand/uboot/lib Message-ID: <20180126232046.GA9972@britannica.bec.de> References: <201801262151.w0QLp0sE021257@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201801262151.w0QLp0sE021257@repo.freebsd.org> User-Agent: Mutt/1.9.0 (2017-09-02) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 26 Jan 2018 23:21:34 -0000 On Fri, Jan 26, 2018 at 09:51:00PM +0000, Warner Losh wrote: > Author: imp > Date: Fri Jan 26 21:50:59 2018 > New Revision: 328446 > URL: https://svnweb.freebsd.org/changeset/base/328446 > > Log: > Now that exit is __dead2, we need to tag ub_exit() as __dead2. To do > that, we have to put a while (1); after the syscall that will never > return to fake out the compiler.... __builtin_unreachable() ? Joerg From owner-svn-src-all@freebsd.org Fri Jan 26 23:21:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EC9FECF558; Fri, 26 Jan 2018 23:21:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E708A6AC05; Fri, 26 Jan 2018 23:21:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1ED922235; Fri, 26 Jan 2018 23:21:50 +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 w0QNLoNV068959; Fri, 26 Jan 2018 23:21:50 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QNLoI4068958; Fri, 26 Jan 2018 23:21:50 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801262321.w0QNLoI4068958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 26 Jan 2018 23:21:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328453 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 328453 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 23:21:51 -0000 Author: jhb Date: Fri Jan 26 23:21:50 2018 New Revision: 328453 URL: https://svnweb.freebsd.org/changeset/base/328453 Log: Move per-operation data out of the csession structure. Create a struct cryptop_data which contains state needed for a single symmetric crypto operation and move that state out of the session. This closes a race with the CRYPTO_F_DONE flag that can result in use after free. While here, remove the 'cse->error' member. It was just a copy of 'crp->crp_etype' and cryptodev_op() and cryptodev_aead() checked both 'crp->crp_etype' and 'cse->error'. Similarly, do not check for an error from mtx_sleep() since it is not used with PCATCH or a timeout so cannot fail with an error. PR: 218597 Reviewed by: kib Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D13928 Modified: head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Fri Jan 26 23:14:46 2018 (r328452) +++ head/sys/opencrypto/cryptodev.c Fri Jan 26 23:21:50 2018 (r328453) @@ -281,10 +281,14 @@ struct csession { caddr_t mackey; int mackeylen; +}; - struct iovec iovec; +struct cryptop_data { + struct csession *cse; + + struct iovec iovec[1]; struct uio uio; - int error; + bool done; }; struct fcrypt { @@ -708,9 +712,37 @@ bail: #undef SES2 } -static int cryptodev_cb(void *); +static int cryptodev_cb(struct cryptop *); +static struct cryptop_data * +cod_alloc(struct csession *cse, size_t len, struct thread *td) +{ + struct cryptop_data *cod; + struct uio *uio; + cod = malloc(sizeof(struct cryptop_data), M_XDATA, M_WAITOK | M_ZERO); + + cod->cse = cse; + uio = &cod->uio; + uio->uio_iov = cod->iovec; + uio->uio_iovcnt = 1; + uio->uio_resid = len; + uio->uio_segflg = UIO_SYSSPACE; + uio->uio_rw = UIO_WRITE; + uio->uio_td = td; + uio->uio_iov[0].iov_len = len; + uio->uio_iov[0].iov_base = malloc(len, M_XDATA, M_WAITOK); + return (cod); +} + +static void +cod_free(struct cryptop_data *cod) +{ + + free(cod->uio.uio_iov[0].iov_base, M_XDATA); + free(cod, M_XDATA); +} + static int cryptodev_op( struct csession *cse, @@ -718,6 +750,7 @@ cryptodev_op( struct ucred *active_cred, struct thread *td) { + struct cryptop_data *cod = NULL; struct cryptop *crp = NULL; struct cryptodesc *crde = NULL, *crda = NULL; int error; @@ -734,20 +767,10 @@ cryptodev_op( } } - cse->uio.uio_iov = &cse->iovec; - cse->uio.uio_iovcnt = 1; - cse->uio.uio_offset = 0; - cse->uio.uio_resid = cop->len; - cse->uio.uio_segflg = UIO_SYSSPACE; - cse->uio.uio_rw = UIO_WRITE; - cse->uio.uio_td = td; - cse->uio.uio_iov[0].iov_len = cop->len; - if (cse->thash) { - cse->uio.uio_iov[0].iov_len += cse->thash->hashsize; - cse->uio.uio_resid += cse->thash->hashsize; - } - cse->uio.uio_iov[0].iov_base = malloc(cse->uio.uio_iov[0].iov_len, - M_XDATA, M_WAITOK); + if (cse->thash) + cod = cod_alloc(cse, cop->len + cse->thash->hashsize, td); + else + cod = cod_alloc(cse, cop->len, td); crp = crypto_getreq((cse->txform != NULL) + (cse->thash != NULL)); if (crp == NULL) { @@ -774,7 +797,7 @@ cryptodev_op( goto bail; } - if ((error = copyin(cop->src, cse->uio.uio_iov[0].iov_base, + if ((error = copyin(cop->src, cod->uio.uio_iov[0].iov_base, cop->len))) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; @@ -806,10 +829,10 @@ cryptodev_op( crp->crp_ilen = cop->len; crp->crp_flags = CRYPTO_F_IOV | CRYPTO_F_CBIMM | (cop->flags & COP_F_BATCH); - crp->crp_buf = (caddr_t)&cse->uio; - crp->crp_callback = (int (*) (struct cryptop *)) cryptodev_cb; + crp->crp_uio = &cod->uio; + crp->crp_callback = cryptodev_cb; crp->crp_sid = cse->sid; - crp->crp_opaque = (void *)cse; + crp->crp_opaque = cod; if (cop->iv) { if (crde == NULL) { @@ -852,19 +875,20 @@ again: * entry and the crypto_done callback into us. */ error = crypto_dispatch(crp); - mtx_lock(&cse->lock); - if (error == 0 && (crp->crp_flags & CRYPTO_F_DONE) == 0) - error = msleep(crp, &cse->lock, PWAIT, "crydev", 0); - mtx_unlock(&cse->lock); - if (error != 0) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } + mtx_lock(&cse->lock); + while (!cod->done) + mtx_sleep(cod, &cse->lock, PWAIT, "crydev", 0); + mtx_unlock(&cse->lock); + if (crp->crp_etype == EAGAIN) { crp->crp_etype = 0; crp->crp_flags &= ~CRYPTO_F_DONE; + cod->done = false; goto again; } @@ -874,21 +898,15 @@ again: goto bail; } - if (cse->error) { - SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); - error = cse->error; - goto bail; - } - if (cop->dst && - (error = copyout(cse->uio.uio_iov[0].iov_base, cop->dst, + (error = copyout(cod->uio.uio_iov[0].iov_base, cop->dst, cop->len))) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } if (cop->mac && - (error = copyout((caddr_t)cse->uio.uio_iov[0].iov_base + cop->len, + (error = copyout((caddr_t)cod->uio.uio_iov[0].iov_base + cop->len, cop->mac, cse->thash->hashsize))) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; @@ -897,8 +915,8 @@ again: bail: if (crp) crypto_freereq(crp); - if (cse->uio.uio_iov[0].iov_base) - free(cse->uio.uio_iov[0].iov_base, M_XDATA); + if (cod) + cod_free(cod); return (error); } @@ -910,7 +928,7 @@ cryptodev_aead( struct ucred *active_cred, struct thread *td) { - struct uio *uio; + struct cryptop_data *cod = NULL; struct cryptop *crp = NULL; struct cryptodesc *crde = NULL, *crda = NULL; int error; @@ -926,19 +944,9 @@ cryptodev_aead( return (EINVAL); } - uio = &cse->uio; - uio->uio_iov = &cse->iovec; - uio->uio_iovcnt = 1; - uio->uio_offset = 0; - uio->uio_resid = caead->aadlen + caead->len + cse->thash->hashsize; - uio->uio_segflg = UIO_SYSSPACE; - uio->uio_rw = UIO_WRITE; - uio->uio_td = td; - uio->uio_iov[0].iov_len = uio->uio_resid; + cod = cod_alloc(cse, caead->aadlen + caead->len + cse->thash->hashsize, + td); - uio->uio_iov[0].iov_base = malloc(uio->uio_iov[0].iov_len, - M_XDATA, M_WAITOK); - crp = crypto_getreq(2); if (crp == NULL) { error = ENOMEM; @@ -954,13 +962,13 @@ cryptodev_aead( crde = crda->crd_next; } - if ((error = copyin(caead->aad, cse->uio.uio_iov[0].iov_base, + if ((error = copyin(caead->aad, cod->uio.uio_iov[0].iov_base, caead->aadlen))) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } - if ((error = copyin(caead->src, (char *)cse->uio.uio_iov[0].iov_base + + if ((error = copyin(caead->src, (char *)cod->uio.uio_iov[0].iov_base + caead->aadlen, caead->len))) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; @@ -997,10 +1005,10 @@ cryptodev_aead( crp->crp_ilen = caead->aadlen + caead->len; crp->crp_flags = CRYPTO_F_IOV | CRYPTO_F_CBIMM | (caead->flags & COP_F_BATCH); - crp->crp_buf = (caddr_t)&cse->uio.uio_iov; - crp->crp_callback = (int (*) (struct cryptop *)) cryptodev_cb; + crp->crp_uio = &cod->uio; + crp->crp_callback = cryptodev_cb; crp->crp_sid = cse->sid; - crp->crp_opaque = (void *)cse; + crp->crp_opaque = cod; if (caead->iv) { if (caead->ivlen > sizeof(crde->crd_iv)) { @@ -1020,7 +1028,7 @@ cryptodev_aead( crde->crd_len -= cse->txform->blocksize; } - if ((error = copyin(caead->tag, (caddr_t)cse->uio.uio_iov[0].iov_base + + if ((error = copyin(caead->tag, (caddr_t)cod->uio.uio_iov[0].iov_base + caead->len + caead->aadlen, cse->thash->hashsize))) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; @@ -1034,19 +1042,20 @@ again: * entry and the crypto_done callback into us. */ error = crypto_dispatch(crp); - mtx_lock(&cse->lock); - if (error == 0 && (crp->crp_flags & CRYPTO_F_DONE) == 0) - error = msleep(crp, &cse->lock, PWAIT, "crydev", 0); - mtx_unlock(&cse->lock); - if (error != 0) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } + mtx_lock(&cse->lock); + while (!cod->done) + mtx_sleep(cod, &cse->lock, PWAIT, "crydev", 0); + mtx_unlock(&cse->lock); + if (crp->crp_etype == EAGAIN) { crp->crp_etype = 0; crp->crp_flags &= ~CRYPTO_F_DONE; + cod->done = false; goto again; } @@ -1056,20 +1065,14 @@ again: goto bail; } - if (cse->error) { - error = cse->error; - SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); - goto bail; - } - if (caead->dst && (error = copyout( - (caddr_t)cse->uio.uio_iov[0].iov_base + caead->aadlen, caead->dst, + (caddr_t)cod->uio.uio_iov[0].iov_base + caead->aadlen, caead->dst, caead->len))) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } - if ((error = copyout((caddr_t)cse->uio.uio_iov[0].iov_base + + if ((error = copyout((caddr_t)cod->uio.uio_iov[0].iov_base + caead->aadlen + caead->len, caead->tag, cse->thash->hashsize))) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; @@ -1077,21 +1080,26 @@ again: bail: crypto_freereq(crp); - free(cse->uio.uio_iov[0].iov_base, M_XDATA); + if (cod) + cod_free(cod); return (error); } static int -cryptodev_cb(void *op) +cryptodev_cb(struct cryptop *crp) { - struct cryptop *crp = (struct cryptop *) op; - struct csession *cse = (struct csession *)crp->crp_opaque; + struct cryptop_data *cod = crp->crp_opaque; - mtx_lock(&cse->lock); - cse->error = crp->crp_etype; - wakeup_one(crp); - mtx_unlock(&cse->lock); + /* + * Lock to ensure the wakeup() is not missed by the loops + * waiting on cod->done in cryptodev_op() and + * cryptodev_aead(). + */ + mtx_lock(&cod->cse->lock); + cod->done = true; + mtx_unlock(&cod->cse->lock); + wakeup(cod); return (0); } From owner-svn-src-all@freebsd.org Fri Jan 26 23:49:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 896A3ED0869; Fri, 26 Jan 2018 23:49:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A75E6BA24; Fri, 26 Jan 2018 23:49:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35201225A4; Fri, 26 Jan 2018 23:49:33 +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 w0QNnXJA081846; Fri, 26 Jan 2018 23:49:33 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QNnVpW081830; Fri, 26 Jan 2018 23:49:31 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801262349.w0QNnVpW081830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 26 Jan 2018 23:49: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: r328454 - in stable/11: lib/libsysdecode sys/compat/freebsd32 sys/kern sys/sys usr.bin/kdump usr.bin/ktrace usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/11: lib/libsysdecode sys/compat/freebsd32 sys/kern sys/sys usr.bin/kdump usr.bin/ktrace usr.bin/truss X-SVN-Commit-Revision: 328454 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 23:49:33 -0000 Author: jhb Date: Fri Jan 26 23:49:31 2018 New Revision: 328454 URL: https://svnweb.freebsd.org/changeset/base/328454 Log: MFC 326184: Decode kevent structures logged via ktrace(2) in kdump. - Add a new KTR_STRUCT_ARRAY ktrace record type which dumps an array of structures. The structure name in the record payload is preceded by a size_t containing the size of the individual structures. Use this to replace the previous code that dumped the kevent arrays dumped for kevent(). kdump is now able to decode the kevent structures rather than dumping their contents via a hexdump. One change from before is that the 'changes' and 'events' arrays are not marked with separate 'read' and 'write' annotations in kdump output. Instead, the first array is the 'changes' array, and the second array (only present if kevent doesn't fail with an error) is the 'events' array. For kevent(), empty arrays are denoted by an entry with an array containing zero entries rather than no record. - Move kevent decoding tables from truss to libsysdecode. This adds three new functions to decode members of struct kevent: sysdecode_kevent_filter, sysdecode_kevent_flags, and sysdecode_kevent_fflags. kdump uses these helper functions to pretty-print kevent fields. - Move structure definitions for freebsd11 and freebsd32 kevent structures to so that they can be shared with userland. The 32-bit structures are only exposed if _WANT_KEVENT32 is defined. The freebsd11 structures are only exposed if _WANT_FREEBSD11_KEVENT is defined. The 32-bit freebsd11 structure requires both. - Decode freebsd11 kevent structures in truss for the compat11.kevent() system call. - Log 32-bit kevent structures via ktrace for 32-bit compat kevent() system calls. - While here, constify the 'void *data' argument to ktrstruct(). Note that this version of the change for 11.x does not include freebsd11 kevent structures or _WANT_FREEBSD11_KEVENT. It also does not include the change to decode the compat11.kevent system call in truss. Added: stable/11/lib/libsysdecode/sysdecode_kevent.3 - copied unchanged from r326184, head/lib/libsysdecode/sysdecode_kevent.3 Modified: stable/11/lib/libsysdecode/Makefile stable/11/lib/libsysdecode/flags.c stable/11/lib/libsysdecode/mktables stable/11/lib/libsysdecode/sysdecode.3 stable/11/lib/libsysdecode/sysdecode.h stable/11/sys/compat/freebsd32/freebsd32.h stable/11/sys/compat/freebsd32/freebsd32_misc.c stable/11/sys/kern/kern_event.c stable/11/sys/kern/kern_ktrace.c stable/11/sys/sys/event.h stable/11/sys/sys/ktrace.h stable/11/usr.bin/kdump/kdump.c stable/11/usr.bin/ktrace/ktrace.h stable/11/usr.bin/truss/syscall.h stable/11/usr.bin/truss/syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/Makefile ============================================================================== --- stable/11/lib/libsysdecode/Makefile Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/lib/libsysdecode/Makefile Fri Jan 26 23:49:31 2018 (r328454) @@ -17,6 +17,7 @@ MAN= sysdecode.3 \ sysdecode_cap_rights.3 \ sysdecode_enum.3 \ sysdecode_fcntl_arg.3 \ + sysdecode_kevent.3 \ sysdecode_ioctlname.3 \ sysdecode_mask.3 \ sysdecode_quotactl_cmd.3 \ @@ -69,6 +70,9 @@ MLINKS+=sysdecode_enum.3 sysdecode_acltype.3 \ sysdecode_enum.3 sysdecode_vmresult.3 \ sysdecode_enum.3 sysdecode_whence.3 MLINKS+=sysdecode_fcntl_arg.3 sysdecode_fcntl_arg_p.3 +MLINKS+=sysdecode_kevent.3 sysdecode_kevent_fflags.3 \ + sysdecode_kevent.3 sysdecode_kevent_filter.3 \ + sysdecode_kevent.3 sysdecode_kevent_flags.3 MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \ sysdecode_mask.3 sysdecode_atflags.3 \ sysdecode_mask.3 sysdecode_capfcntlrights.3 \ Modified: stable/11/lib/libsysdecode/flags.c ============================================================================== --- stable/11/lib/libsysdecode/flags.c Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/lib/libsysdecode/flags.c Fri Jan 26 23:49:31 2018 (r328454) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -499,6 +500,116 @@ sysdecode_getrusage_who(int who) { return (lookup_value(rusage, who)); +} + +static struct name_table kevent_user_ffctrl[] = { + X(NOTE_FFNOP) X(NOTE_FFAND) X(NOTE_FFOR) X(NOTE_FFCOPY) + XEND +}; + +static struct name_table kevent_rdwr_fflags[] = { + X(NOTE_LOWAT) X(NOTE_FILE_POLL) XEND +}; + +static struct name_table kevent_vnode_fflags[] = { + X(NOTE_DELETE) X(NOTE_WRITE) X(NOTE_EXTEND) X(NOTE_ATTRIB) + X(NOTE_LINK) X(NOTE_RENAME) X(NOTE_REVOKE) X(NOTE_OPEN) X(NOTE_CLOSE) + X(NOTE_CLOSE_WRITE) X(NOTE_READ) XEND +}; + +static struct name_table kevent_proc_fflags[] = { + X(NOTE_EXIT) X(NOTE_FORK) X(NOTE_EXEC) X(NOTE_TRACK) X(NOTE_TRACKERR) + X(NOTE_CHILD) XEND +}; + +static struct name_table kevent_timer_fflags[] = { + X(NOTE_SECONDS) X(NOTE_MSECONDS) X(NOTE_USECONDS) X(NOTE_NSECONDS) + XEND +}; + +void +sysdecode_kevent_fflags(FILE *fp, short filter, int fflags, int base) +{ + int rem; + + if (fflags == 0) { + fputs("0", fp); + return; + } + + switch (filter) { + case EVFILT_READ: + case EVFILT_WRITE: + if (!print_mask_int(fp, kevent_rdwr_fflags, fflags, &rem)) + fprintf(fp, "%#x", rem); + else if (rem != 0) + fprintf(fp, "|%#x", rem); + break; + case EVFILT_VNODE: + if (!print_mask_int(fp, kevent_vnode_fflags, fflags, &rem)) + fprintf(fp, "%#x", rem); + else if (rem != 0) + fprintf(fp, "|%#x", rem); + break; + case EVFILT_PROC: + case EVFILT_PROCDESC: + if (!print_mask_int(fp, kevent_proc_fflags, fflags, &rem)) + fprintf(fp, "%#x", rem); + else if (rem != 0) + fprintf(fp, "|%#x", rem); + break; + case EVFILT_TIMER: + if (!print_mask_int(fp, kevent_timer_fflags, fflags, &rem)) + fprintf(fp, "%#x", rem); + else if (rem != 0) + fprintf(fp, "|%#x", rem); + break; + case EVFILT_USER: { + unsigned int ctrl, data; + + ctrl = fflags & NOTE_FFCTRLMASK; + data = fflags & NOTE_FFLAGSMASK; + + if (fflags & NOTE_TRIGGER) { + fputs("NOTE_TRIGGER", fp); + if (fflags == NOTE_TRIGGER) + return; + fputc('|', fp); + } + + /* + * An event with 'ctrl' == NOTE_FFNOP is either a reported + * (output) event for which only 'data' should be output + * or a pointless input event. Assume that pointless + * input events don't occur in practice. An event with + * NOTE_TRIGGER is always an input event. + */ + if (ctrl != NOTE_FFNOP || fflags & NOTE_TRIGGER) { + fprintf(fp, "%s|%#x", + lookup_value(kevent_user_ffctrl, ctrl), data); + } else { + print_integer(fp, data, base); + } + break; + } + default: + print_integer(fp, fflags, base); + break; + } +} + +bool +sysdecode_kevent_flags(FILE *fp, int flags, int *rem) +{ + + return (print_mask_int(fp, keventflags, flags, rem)); +} + +const char * +sysdecode_kevent_filter(int filter) +{ + + return (lookup_value(keventfilters, filter)); } const char * Modified: stable/11/lib/libsysdecode/mktables ============================================================================== --- stable/11/lib/libsysdecode/mktables Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/lib/libsysdecode/mktables Fri Jan 26 23:49:31 2018 (r328454) @@ -107,6 +107,8 @@ gen_table "mmapprot" "PROT_[A-Z]+[[:space:]]+0x gen_table "ngbtsolevel" "SOL_[A-Z0-9]+[[:space:]]+0x[0-9A-Fa-f]+" "netgraph/bluetooth/include/ng_btsocket.h" gen_table "fileflags" "[SU]F_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/stat.h" "UF_COMPRESSED|UF_TRACKED|UF_SETTABLE|SF_SETTABLE" gen_table "filemode" "S_[A-Z]+[[:space:]]+[0-6]{7}" "sys/stat.h" +gen_table "keventflags" "EV_[A-Z]+[[:space:]]+0x[0-9]+" "sys/event.h" "EV_SYSFLAGS|EV_DROP|EV_FLAG[12]" +gen_table "keventfilters" "EVFILT_[A-Z]+[[:space:]]+\(-[0-9]+\)" "sys/event.h" gen_table "mountflags" "MNT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mount.h" gen_table "msyncflags" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h" gen_table "nfssvcflags" "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+" "nfs/nfssvc.h" Modified: stable/11/lib/libsysdecode/sysdecode.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.3 Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/lib/libsysdecode/sysdecode.3 Fri Jan 26 23:49:31 2018 (r328454) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 3, 2017 +.Dd November 24, 2017 .Dt SYSDECODE 3 .Os .Sh NAME @@ -73,6 +73,7 @@ A placeholder for use when the ABI is not known. .Xr sysdecode_enum 3 , .Xr sysdecode_fcntl_arg 3 , .Xr sysdecode_ioctlname 3 , +.Xr sysdecode_kevent 3 , .Xr sysdecode_mask 3 , .Xr sysdecode_quotactl_cmd 3 , .Xr sysdecode_sigcode 3 , Modified: stable/11/lib/libsysdecode/sysdecode.h ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.h Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/lib/libsysdecode/sysdecode.h Fri Jan 26 23:49:31 2018 (r328454) @@ -60,6 +60,10 @@ const char *sysdecode_getrusage_who(int _who); const char *sysdecode_idtype(int _idtype); const char *sysdecode_ioctlname(unsigned long _val); const char *sysdecode_ipproto(int _protocol); +void sysdecode_kevent_fflags(FILE *_fp, short _filter, int _fflags, + int _base); +const char *sysdecode_kevent_filter(int _filter); +bool sysdecode_kevent_flags(FILE *_fp, int _flags, int *_rem); const char *sysdecode_kldsym_cmd(int _cmd); const char *sysdecode_kldunload_flags(int _flags); const char *sysdecode_lio_listio_mode(int _mode); Copied: stable/11/lib/libsysdecode/sysdecode_kevent.3 (from r326184, head/lib/libsysdecode/sysdecode_kevent.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libsysdecode/sysdecode_kevent.3 Fri Jan 26 23:49:31 2018 (r328454, copy of r326184, head/lib/libsysdecode/sysdecode_kevent.3) @@ -0,0 +1,126 @@ +.\" +.\" Copyright (c) 2017 John Baldwin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 24, 2017 +.Dt sysdecode_kevent 3 +.Os +.Sh NAME +.Nm sysdecode_kevent , +.Nm sysdecode_kevent_fflags , +.Nm sysdecode_kevent_filter , +.Nm sysdecode_kevent_flags +.Nd output description of kevent structure fields +.Sh LIBRARY +.Lb libsysdecode +.Sh SYNOPSIS +.In sys/types.h +.In stdbool.h +.In stdio.h +.In sysdecode.h +.Ft void +.Fn sysdecode_kevent_fflags "FILE *fp" "short filter" "int fflags" "int base" +.Ft bool +.Fn sysdecode_kevent_flags "FILE *fp" "int flags" "int *rem" +.Ft const char * +.Fn sysdecode_kevent_filter "int filter" +.Sh DESCRIPTION +These functions provide text descriptions of +.Vt struct kevent +fields. +.Pp +The +.Fn sysdecode_kevent_fflags +function outputs a text description of the +.Fa fflags +member of a +.Vt struct kevent +to the stream +.Fa fp . +For the +.Dv EVFILT_READ , +.Dv EVFILT_WRITE , +.Dv EVFILT_VNODE , +.Dv EVFILT_PROC , +.Dv EVFILT_PROCDESC , +.Dv EVFILT_TIMER , +and +.Dv EVFILT_USER +filters, +.Fn sysdecode_kevent_fflags +outputs a bitmask of filter-specific +.Dv NOTE_* +flags as documented in +.Xr kevent 2 . +For other values of +.Fa filter , +the value of +.Fa fflags +is output in the indicated +.Fa base +.Pq one of 8, 10, or 16 . +.Pp +The +.Fn sysdecode_kevent_filter +function returns a text description of the +.Fa filter +member of a +.Vt struct kevent . +.Dv NULL +is returned if the +.Fa filter +value is unknown. +.Pp +The +.Fn sysdecode_kevent_flags +function outputs a text description of the +.Fa flags +member of a +.Vt struct kevent +to the stream +.Fa fp . +This function uses the same calling convention and formatting as the other +functions described in +.Xr sysdecode_mask 3 . +.Sh RETURN VALUES +The +.Nm sysdecode_kevent_filter +function returns the name of a filter or +.Dv NULL if the filter value is unknown. +.Pp +The +.Nm sysdecode_kevent_flags +function returns +.Dv true +if any flags in the +.Fa flags +field were decoded and +.Dv false +if no flags were decoded. +.Sh SEE ALSO +.Xr sysdecode 3 , +.Xr sysdecode_enum 3 , +.Xr sysdecode_mask 3 Modified: stable/11/sys/compat/freebsd32/freebsd32.h ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32.h Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/sys/compat/freebsd32/freebsd32.h Fri Jan 26 23:49:31 2018 (r328454) @@ -135,15 +135,6 @@ struct statfs32 { int32_t f_spare[2]; }; -struct kevent32 { - u_int32_t ident; /* identifier for this event */ - short filter; /* filter for event */ - u_short flags; - u_int fflags; - int32_t data; - u_int32_t udata; /* opaque user data identifier */ -}; - struct iovec32 { u_int32_t iov_base; int iov_len; Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 26 23:49:31 2018 (r328454) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_ktrace.h" #define __ELF_WORD_SIZE 32 @@ -83,6 +84,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef KTRACE +#include +#endif #ifdef INET #include @@ -658,6 +662,9 @@ freebsd32_kevent(struct thread *td, struct freebsd32_k .k_copyout = freebsd32_kevent_copyout, .k_copyin = freebsd32_kevent_copyin, }; +#ifdef KTRACE + struct kevent32 *eventlist = uap->eventlist; +#endif int error; @@ -670,8 +677,18 @@ freebsd32_kevent(struct thread *td, struct freebsd32_k tsp = &ts; } else tsp = NULL; +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT_ARRAY)) + ktrstructarray("kevent32", UIO_USERSPACE, uap->changelist, + uap->nchanges, sizeof(struct kevent32)); +#endif error = kern_kevent(td, uap->fd, uap->nchanges, uap->nevents, &k_ops, tsp); +#ifdef KTRACE + if (error == 0 && KTRPOINT(td, KTR_STRUCT_ARRAY)) + ktrstructarray("kevent32", UIO_USERSPACE, eventlist, + td->td_retval[0], sizeof(struct kevent32)); +#endif return (error); } Modified: stable/11/sys/kern/kern_event.c ============================================================================== --- stable/11/sys/kern/kern_event.c Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/sys/kern/kern_event.c Fri Jan 26 23:49:31 2018 (r328454) @@ -860,17 +860,6 @@ kern_kqueue(struct thread *td, int flags, struct filec return (0); } -#ifdef KTRACE -static size_t -kev_iovlen(int n, u_int kgio) -{ - - if (n < 0 || n >= kgio / sizeof(struct kevent)) - return (kgio); - return (n * sizeof(struct kevent)); -} -#endif - #ifndef _SYS_SYSPROTO_H_ struct kevent_args { int fd; @@ -890,14 +879,10 @@ sys_kevent(struct thread *td, struct kevent_args *uap) .k_copyout = kevent_copyout, .k_copyin = kevent_copyin, }; - int error; #ifdef KTRACE - struct uio ktruio; - struct iovec ktriov; - struct uio *ktruioin = NULL; - struct uio *ktruioout = NULL; - u_int kgio; + struct kevent *eventlist = uap->eventlist; #endif + int error; if (uap->timeout != NULL) { error = copyin(uap->timeout, &ts, sizeof(ts)); @@ -908,31 +893,18 @@ sys_kevent(struct thread *td, struct kevent_args *uap) tsp = NULL; #ifdef KTRACE - if (KTRPOINT(td, KTR_GENIO)) { - kgio = ktr_geniosize; - ktriov.iov_base = uap->changelist; - ktriov.iov_len = kev_iovlen(uap->nchanges, kgio); - ktruio = (struct uio){ .uio_iov = &ktriov, .uio_iovcnt = 1, - .uio_segflg = UIO_USERSPACE, .uio_rw = UIO_READ, - .uio_td = td }; - ktruioin = cloneuio(&ktruio); - ktriov.iov_base = uap->eventlist; - ktriov.iov_len = kev_iovlen(uap->nevents, kgio); - ktriov.iov_len = uap->nevents * sizeof(struct kevent); - ktruioout = cloneuio(&ktruio); - } + if (KTRPOINT(td, KTR_STRUCT_ARRAY)) + ktrstructarray("kevent", UIO_USERSPACE, uap->changelist, + uap->nchanges, sizeof(struct kevent)); #endif error = kern_kevent(td, uap->fd, uap->nchanges, uap->nevents, &k_ops, tsp); #ifdef KTRACE - if (ktruioin != NULL) { - ktruioin->uio_resid = kev_iovlen(uap->nchanges, kgio); - ktrgenio(uap->fd, UIO_WRITE, ktruioin, 0); - ktruioout->uio_resid = kev_iovlen(td->td_retval[0], kgio); - ktrgenio(uap->fd, UIO_READ, ktruioout, error); - } + if (error == 0 && KTRPOINT(td, KTR_STRUCT_ARRAY)) + ktrstructarray("kevent", UIO_USERSPACE, eventlist, + td->td_retval[0], sizeof(struct kevent)); #endif return (error); Modified: stable/11/sys/kern/kern_ktrace.c ============================================================================== --- stable/11/sys/kern/kern_ktrace.c Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/sys/kern/kern_ktrace.c Fri Jan 26 23:49:31 2018 (r328454) @@ -104,6 +104,7 @@ struct ktr_request { struct ktr_csw ktr_csw; struct ktr_fault ktr_fault; struct ktr_faultend ktr_faultend; + struct ktr_struct_array ktr_struct_array; } ktr_data; STAILQ_ENTRY(ktr_request) ktr_list; }; @@ -123,6 +124,7 @@ static int data_lengths[] = { [KTR_CAPFAIL] = sizeof(struct ktr_cap_fail), [KTR_FAULT] = sizeof(struct ktr_fault), [KTR_FAULTEND] = sizeof(struct ktr_faultend), + [KTR_STRUCT_ARRAY] = sizeof(struct ktr_struct_array), }; static STAILQ_HEAD(, ktr_request) ktr_free; @@ -740,7 +742,7 @@ ktrcsw(int out, int user, const char *wmesg) } void -ktrstruct(const char *name, void *data, size_t datalen) +ktrstruct(const char *name, const void *data, size_t datalen) { struct ktr_request *req; char *buf; @@ -757,6 +759,52 @@ ktrstruct(const char *name, void *data, size_t datalen free(buf, M_KTRACE); return; } + req->ktr_buffer = buf; + req->ktr_header.ktr_len = buflen; + ktr_submitrequest(curthread, req); +} + +void +ktrstructarray(const char *name, enum uio_seg seg, const void *data, + int num_items, size_t struct_size) +{ + struct ktr_request *req; + struct ktr_struct_array *ksa; + char *buf; + size_t buflen, datalen, namelen; + int max_items; + + /* Trim array length to genio size. */ + max_items = ktr_geniosize / struct_size; + if (num_items > max_items) { + if (max_items == 0) + num_items = 1; + else + num_items = max_items; + } + datalen = num_items * struct_size; + + if (data == NULL) + datalen = 0; + + namelen = strlen(name) + 1; + buflen = namelen + datalen; + buf = malloc(buflen, M_KTRACE, M_WAITOK); + strcpy(buf, name); + if (seg == UIO_SYSSPACE) + bcopy(data, buf + namelen, datalen); + else { + if (copyin(data, buf + namelen, datalen) != 0) { + free(buf, M_KTRACE); + return; + } + } + if ((req = ktr_getrequest(KTR_STRUCT_ARRAY)) == NULL) { + free(buf, M_KTRACE); + return; + } + ksa = &req->ktr_data.ktr_struct_array; + ksa->struct_size = struct_size; req->ktr_buffer = buf; req->ktr_header.ktr_len = buflen; ktr_submitrequest(curthread, req); Modified: stable/11/sys/sys/event.h ============================================================================== --- stable/11/sys/sys/event.h Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/sys/sys/event.h Fri Jan 26 23:49:31 2018 (r328454) @@ -64,6 +64,17 @@ struct kevent { void *udata; /* opaque user data identifier */ }; +#if defined(_WANT_KEVENT32) || (defined(_KERNEL) && defined(__LP64__)) +struct kevent32 { + u_int32_t ident; /* identifier for this event */ + short filter; /* filter for event */ + u_short flags; + u_int fflags; + int32_t data; + u_int32_t udata; /* opaque user data identifier */ +}; +#endif + /* actions */ #define EV_ADD 0x0001 /* add event to kq (implies enable) */ #define EV_DELETE 0x0002 /* delete event from kq */ Modified: stable/11/sys/sys/ktrace.h ============================================================================== --- stable/11/sys/sys/ktrace.h Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/sys/sys/ktrace.h Fri Jan 26 23:49:31 2018 (r328454) @@ -219,6 +219,18 @@ struct ktr_faultend { }; /* + * KTR_STRUCT_ARRAY - array of misc. structs + */ +#define KTR_STRUCT_ARRAY 15 +struct ktr_struct_array { + size_t struct_size; + /* + * Followed by null-terminated structure name and then payload + * contents. + */ +}; + +/* * KTR_DROP - If this bit is set in ktr_type, then at least one event * between the previous record and this record was dropped. */ @@ -242,6 +254,7 @@ struct ktr_faultend { #define KTRFAC_CAPFAIL (1< #include #include #include #include +#include #include #include #include @@ -109,6 +113,8 @@ void ktrstruct(char *, size_t); void ktrcapfail(struct ktr_cap_fail *); void ktrfault(struct ktr_fault *); void ktrfaultend(struct ktr_faultend *); +void ktrkevent(struct kevent *); +void ktrstructarray(struct ktr_struct_array *, size_t); void limitfd(int fd); void usage(void); @@ -546,6 +552,9 @@ main(int argc, char *argv[]) case KTR_FAULTEND: ktrfaultend((struct ktr_faultend *)m); break; + case KTR_STRUCT_ARRAY: + ktrstructarray((struct ktr_struct_array *)m, ktrlen); + break; default: printf("\n"); break; @@ -714,6 +723,7 @@ dumpheader(struct ktr_header *kth) type = "USER"; break; case KTR_STRUCT: + case KTR_STRUCT_ARRAY: type = "STRU"; break; case KTR_SYSCTL: @@ -2106,6 +2116,104 @@ ktrfaultend(struct ktr_faultend *ktr) else printf("", ktr->result); printf("\n"); +} + +void +ktrkevent(struct kevent *kev) +{ + + printf("{ ident="); + switch (kev->filter) { + case EVFILT_READ: + case EVFILT_WRITE: + case EVFILT_VNODE: + case EVFILT_PROC: + case EVFILT_TIMER: + case EVFILT_PROCDESC: + printf("%ju", (uintmax_t)kev->ident); + break; + case EVFILT_SIGNAL: + print_signal(kev->ident); + break; + default: + printf("%p", (void *)kev->ident); + } + printf(", filter="); + print_integer_arg(sysdecode_kevent_filter, kev->filter); + printf(", flags="); + print_mask_arg0(sysdecode_kevent_flags, kev->flags); + printf(", fflags="); + sysdecode_kevent_fflags(stdout, kev->filter, kev->fflags, + decimal ? 10 : 16); + printf(", data=%#jx, udata=%p }", (uintmax_t)kev->data, kev->udata); +} + +void +ktrstructarray(struct ktr_struct_array *ksa, size_t buflen) +{ + struct kevent kev; + char *name, *data; + size_t namelen, datalen; + int i; + bool first; + + buflen -= sizeof(*ksa); + for (name = (char *)(ksa + 1), namelen = 0; + namelen < buflen && name[namelen] != '\0'; + ++namelen) + /* nothing */; + if (namelen == buflen) + goto invalid; + if (name[namelen] != '\0') + goto invalid; + /* sanity check */ + for (i = 0; i < (int)namelen; ++i) + if (!isalnum(name[i]) && name[i] != '_') + goto invalid; + data = name + namelen + 1; + datalen = buflen - namelen - 1; + printf("struct %s[] = { ", name); + first = true; + for (; datalen >= ksa->struct_size; + data += ksa->struct_size, datalen -= ksa->struct_size) { + if (!first) + printf("\n "); + else + first = false; + if (strcmp(name, "kevent") == 0) { + if (ksa->struct_size != sizeof(kev)) + goto bad_size; + memcpy(&kev, data, sizeof(kev)); + ktrkevent(&kev); +#ifdef _WANT_KEVENT32 + } else if (strcmp(name, "kevent32") == 0) { + struct kevent32 kev32; + + if (ksa->struct_size != sizeof(kev32)) + goto bad_size; + memcpy(&kev32, data, sizeof(kev32)); + memset(&kev, 0, sizeof(kev)); + kev.ident = kev32.ident; + kev.filter = kev32.filter; + kev.flags = kev32.flags; + kev.fflags = kev32.fflags; + kev.data = kev32.data; + kev.udata = (void *)(uintptr_t)kev32.udata; + ktrkevent(&kev); +#endif + } else { + printf(" }\n"); + return; + } + } + printf(" }\n"); + return; +invalid: + printf("invalid record\n"); + return; +bad_size: + printf(" }\n"); + return; } void Modified: stable/11/usr.bin/ktrace/ktrace.h ============================================================================== --- stable/11/usr.bin/ktrace/ktrace.h Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/usr.bin/ktrace/ktrace.h Fri Jan 26 23:49:31 2018 (r328454) @@ -32,7 +32,8 @@ #define DEF_POINTS (KTRFAC_SYSCALL | KTRFAC_SYSRET | KTRFAC_NAMEI | \ KTRFAC_GENIO | KTRFAC_PSIG | KTRFAC_USER | \ - KTRFAC_STRUCT | KTRFAC_SYSCTL | KTRFAC_CAPFAIL) + KTRFAC_STRUCT | KTRFAC_SYSCTL | KTRFAC_CAPFAIL | \ + KTRFAC_STRUCT_ARRAY) #define PROC_ABI_POINTS (KTRFAC_PROCCTOR | KTRFAC_PROCDTOR) Modified: stable/11/usr.bin/truss/syscall.h ============================================================================== --- stable/11/usr.bin/truss/syscall.h Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/usr.bin/truss/syscall.h Fri Jan 26 23:49:31 2018 (r328454) @@ -51,7 +51,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHe Sockoptname, Msgflags, CapRights, PUInt, PQuadHex, Acltype, Extattrnamespace, Minherit, Mlockall, Mountflags, Msync, Priowhich, Ptraceop, Quotactlcmd, Reboothowto, Rtpriofunc, Schedpolicy, Schedparam, - PSig, Siginfo, + PSig, Siginfo, Kevent11, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, Modified: stable/11/usr.bin/truss/syscalls.c ============================================================================== --- stable/11/usr.bin/truss/syscalls.c Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/usr.bin/truss/syscalls.c Fri Jan 26 23:49:31 2018 (r328454) @@ -638,43 +638,6 @@ struct xlat { #define X(a) { a, #a }, #define XEND { 0, NULL } -static struct xlat kevent_filters[] = { - X(EVFILT_READ) X(EVFILT_WRITE) X(EVFILT_AIO) X(EVFILT_VNODE) - X(EVFILT_PROC) X(EVFILT_SIGNAL) X(EVFILT_TIMER) - X(EVFILT_PROCDESC) X(EVFILT_FS) X(EVFILT_LIO) X(EVFILT_USER) - X(EVFILT_SENDFILE) XEND -}; - -static struct xlat kevent_flags[] = { - X(EV_ADD) X(EV_DELETE) X(EV_ENABLE) X(EV_DISABLE) X(EV_ONESHOT) - X(EV_CLEAR) X(EV_RECEIPT) X(EV_DISPATCH) X(EV_FORCEONESHOT) - X(EV_DROP) X(EV_FLAG1) X(EV_ERROR) X(EV_EOF) XEND -}; - -static struct xlat kevent_user_ffctrl[] = { - X(NOTE_FFNOP) X(NOTE_FFAND) X(NOTE_FFOR) X(NOTE_FFCOPY) - XEND -}; - -static struct xlat kevent_rdwr_fflags[] = { - X(NOTE_LOWAT) X(NOTE_FILE_POLL) XEND -}; - -static struct xlat kevent_vnode_fflags[] = { - X(NOTE_DELETE) X(NOTE_WRITE) X(NOTE_EXTEND) X(NOTE_ATTRIB) - X(NOTE_LINK) X(NOTE_RENAME) X(NOTE_REVOKE) XEND -}; - -static struct xlat kevent_proc_fflags[] = { - X(NOTE_EXIT) X(NOTE_FORK) X(NOTE_EXEC) X(NOTE_TRACK) X(NOTE_TRACKERR) - X(NOTE_CHILD) XEND -}; - -static struct xlat kevent_timer_fflags[] = { - X(NOTE_SECONDS) X(NOTE_MSECONDS) X(NOTE_USECONDS) X(NOTE_NSECONDS) - XEND -}; - static struct xlat poll_flags[] = { X(POLLSTANDARD) X(POLLIN) X(POLLPRI) X(POLLOUT) X(POLLERR) X(POLLHUP) X(POLLNVAL) X(POLLRDNORM) X(POLLRDBAND) @@ -1125,7 +1088,7 @@ strsig2(int sig) } static void -print_kevent(FILE *fp, struct kevent *ke, int input) +print_kevent(FILE *fp, struct kevent *ke) { switch (ke->filter) { @@ -1143,42 +1106,12 @@ print_kevent(FILE *fp, struct kevent *ke, int input) default: fprintf(fp, "%p", (void *)ke->ident); } - fprintf(fp, ",%s,%s,", xlookup(kevent_filters, ke->filter), - xlookup_bits(kevent_flags, ke->flags)); - switch (ke->filter) { - case EVFILT_READ: - case EVFILT_WRITE: - fputs(xlookup_bits(kevent_rdwr_fflags, ke->fflags), fp); - break; - case EVFILT_VNODE: - fputs(xlookup_bits(kevent_vnode_fflags, ke->fflags), fp); - break; - case EVFILT_PROC: - case EVFILT_PROCDESC: - fputs(xlookup_bits(kevent_proc_fflags, ke->fflags), fp); - break; - case EVFILT_TIMER: - fputs(xlookup_bits(kevent_timer_fflags, ke->fflags), fp); - break; - case EVFILT_USER: { - int ctrl, data; - - ctrl = ke->fflags & NOTE_FFCTRLMASK; - data = ke->fflags & NOTE_FFLAGSMASK; - if (input) { - fputs(xlookup(kevent_user_ffctrl, ctrl), fp); - if (ke->fflags & NOTE_TRIGGER) - fputs("|NOTE_TRIGGER", fp); - if (data != 0) - fprintf(fp, "|%#x", data); - } else { - fprintf(fp, "%#x", data); - } - break; - } - default: - fprintf(fp, "%#x", ke->fflags); - } + fprintf(fp, ","); + print_integer_arg(sysdecode_kevent_filter, fp, ke->filter); + fprintf(fp, ","); + print_mask_arg(sysdecode_kevent_flags, fp, ke->flags); + fprintf(fp, ","); + sysdecode_kevent_fflags(fp, ke->filter, ke->fflags, 16); fprintf(fp, ",%p,%p", (void *)ke->data, (void *)ke->udata); } @@ -1783,7 +1716,7 @@ print_arg(struct syscall_args *sc, unsigned long *args fputc('{', fp); for (i = 0; i < numevents; i++) { fputc(' ', fp); - print_kevent(fp, &ke[i], sc->offset == 1); + print_kevent(fp, &ke[i]); } fputs(" }", fp); } else { From owner-svn-src-all@freebsd.org Fri Jan 26 23:56:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0580AED0DF8; Fri, 26 Jan 2018 23:56:08 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A7E8C6BFA4; Fri, 26 Jan 2018 23:56:07 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2CCE22736; Fri, 26 Jan 2018 23:56:07 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QNu7Z2087148; Fri, 26 Jan 2018 23:56:07 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QNu796087146; Fri, 26 Jan 2018 23:56:07 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201801262356.w0QNu796087146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 26 Jan 2018 23:56:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328455 - in head/sys/cam: . scsi X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head/sys/cam: . scsi X-SVN-Commit-Revision: 328455 X-SVN-Commit-Repository: base 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.25 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: Fri, 26 Jan 2018 23:56:08 -0000 Author: scottl Date: Fri Jan 26 23:56:07 2018 New Revision: 328455 URL: https://svnweb.freebsd.org/changeset/base/328455 Log: Move CAM_PERIPH_PRINT() to cam_periph.h Modified: head/sys/cam/cam_periph.h head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/cam_periph.h ============================================================================== --- head/sys/cam/cam_periph.h Fri Jan 26 23:49:31 2018 (r328454) +++ head/sys/cam/cam_periph.h Fri Jan 26 23:56:07 2018 (r328455) @@ -260,5 +260,8 @@ cam_periph_acquire_next(struct cam_periph *pperiph) (periph) != NULL; \ (periph) = cam_periph_acquire_next(periph)) +#define CAM_PERIPH_PRINT(p, msg, args...) \ + printf("%s%d:" msg, (periph)->periph_name, (periph)->unit_number, ##args) + #endif /* _KERNEL */ #endif /* _CAM_CAM_PERIPH_H */ Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Fri Jan 26 23:49:31 2018 (r328454) +++ head/sys/cam/scsi/scsi_da.c Fri Jan 26 23:56:07 2018 (r328455) @@ -1497,9 +1497,6 @@ static MALLOC_DEFINE(M_SCSIDA, "scsi_da", "scsi_da buf #endif #if DA_TRACK_REFS > 1 -#define CAM_PERIPH_PRINT(p, msg, args...) \ - printf("%s%d:" msg, (periph)->periph_name, (periph)->unit_number, ##args) - static const char *da_ref_text[] = { "bogus", "open", From owner-svn-src-all@freebsd.org Sat Jan 27 00:09:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CAA2ED198F; Sat, 27 Jan 2018 00:09:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 28DD16C5FB; Sat, 27 Jan 2018 00:09:44 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E0EB228CF; Sat, 27 Jan 2018 00:09:44 +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 w0R09hY7092046; Sat, 27 Jan 2018 00:09:43 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R09hJK092045; Sat, 27 Jan 2018 00:09:43 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201801270009.w0R09hJK092045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 27 Jan 2018 00:09:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328456 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 328456 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 00:09:44 -0000 Author: trasz Date: Sat Jan 27 00:09:43 2018 New Revision: 328456 URL: https://svnweb.freebsd.org/changeset/base/328456 Log: Remove mention of sys/boot/ from hier(7), it doesn't exist anymore. MFC after: 2 weeks Modified: head/share/man/man7/hier.7 Modified: head/share/man/man7/hier.7 ============================================================================== --- head/share/man/man7/hier.7 Fri Jan 26 23:56:07 2018 (r328455) +++ head/share/man/man7/hier.7 Sat Jan 27 00:09:43 2018 (r328456) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 15, 2018 +.Dd January 27, 2018 .Dt HIER 7 .Os .Sh NAME @@ -660,8 +660,6 @@ AMD64 architecture support ARM architecture support .It Pa arm64/ ARMv8 architecture support -.It Pa boot/ -bootloader code .It Pa cam/ .Xr cam 4 and From owner-svn-src-all@freebsd.org Sat Jan 27 00:33:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26F1AED2E0C; Sat, 27 Jan 2018 00:33:11 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f180.google.com (mail-io0-f180.google.com [209.85.223.180]) (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 916536D306; Sat, 27 Jan 2018 00:33:10 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f180.google.com with SMTP id b198so2200313iof.6; Fri, 26 Jan 2018 16:33:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=MvuIuhc0GBiIsoYFR+mIv+iYl+3f3SSjQCRIyr6zKD8=; b=fgDcMF4b/aGWAMv/DhBA5TJCUx6a2AXgUCemMe+9/Uk5hr0JqLtz2QzrnIHBv2n0cA jknqGhDPhKhI9n8rMwzRpCT2La57gjOswn9IFRoPLXe1gftdcjZYTjm3GrIylYzujnEN g7x3PiSdbC60apU9b6fHK9p1fRcn433iMZa+osgScJVwCZV9npmrruLZrp76jBQUozia luKaZySscnhBUiz4pSB2jOsE184k7tfZke0K0vD0KYVHBuAmV0O6XAE+SnWtJP72vloN AJJReg/FH2cU5MCNUGiFyo07GniAkpnG/FpA9Y176qBffowptMgx9IpnYVUMwYk9dbj2 N1Kg== X-Gm-Message-State: AKwxyter7R7ajoDJq+TXTFSbhzYG7qapyKgxvCgHFpfC1Aai1Nh4izUK gWMluSap94YDwgwjxaw5c+rfMxF5 X-Google-Smtp-Source: AH8x22468P0l+cLAv2vek4aD8mNEJ5wGMnr7B4cUfWr0LrrFQ2npqVfInEeRwRLpfLuSGYoGpU6YfQ== X-Received: by 10.107.162.147 with SMTP id l141mr4422782ioe.1.1517013184043; Fri, 26 Jan 2018 16:33:04 -0800 (PST) Received: from mail-io0-f171.google.com (mail-io0-f171.google.com. [209.85.223.171]) by smtp.gmail.com with ESMTPSA id c9sm1161375iod.5.2018.01.26.16.33.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 16:33:03 -0800 (PST) Received: by mail-io0-f171.google.com with SMTP id d13so2207627iog.5; Fri, 26 Jan 2018 16:33:03 -0800 (PST) X-Received: by 10.107.35.84 with SMTP id j81mr17346385ioj.226.1517013183562; Fri, 26 Jan 2018 16:33:03 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Fri, 26 Jan 2018 16:33:03 -0800 (PST) In-Reply-To: <201801270009.w0R09hJK092045@repo.freebsd.org> References: <201801270009.w0R09hJK092045@repo.freebsd.org> From: Conrad Meyer Date: Fri, 26 Jan 2018 16:33:03 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328456 - head/share/man/man7 To: Edward Tomasz Napierala Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 00:33:11 -0000 This isn't quite right =E2=80=94 it's now located in src/stand. On Fri, Jan 26, 2018 at 4:09 PM, Edward Tomasz Napierala wrote: > Author: trasz > Date: Sat Jan 27 00:09:43 2018 > New Revision: 328456 > URL: https://svnweb.freebsd.org/changeset/base/328456 > > Log: > Remove mention of sys/boot/ from hier(7), it doesn't exist anymore. > > MFC after: 2 weeks > > Modified: > head/share/man/man7/hier.7 > > Modified: head/share/man/man7/hier.7 > =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/share/man/man7/hier.7 Fri Jan 26 23:56:07 2018 (r328455) > +++ head/share/man/man7/hier.7 Sat Jan 27 00:09:43 2018 (r328456) > @@ -28,7 +28,7 @@ > .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 > .\" $FreeBSD$ > .\" > -.Dd January 15, 2018 > +.Dd January 27, 2018 > .Dt HIER 7 > .Os > .Sh NAME > @@ -660,8 +660,6 @@ AMD64 architecture support > ARM architecture support > .It Pa arm64/ > ARMv8 architecture support > -.It Pa boot/ > -bootloader code > .It Pa cam/ > .Xr cam 4 > and > From owner-svn-src-all@freebsd.org Sat Jan 27 00:39:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81A7CED3206; Sat, 27 Jan 2018 00:39:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 31B656D6CF; Sat, 27 Jan 2018 00:39:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A2D422D97; Sat, 27 Jan 2018 00:39:50 +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 w0R0doWd007284; Sat, 27 Jan 2018 00:39:50 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R0dodu007283; Sat, 27 Jan 2018 00:39:50 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801270039.w0R0dodu007283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 27 Jan 2018 00:39:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328457 - head/lib/libc/mips/gen X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/libc/mips/gen X-SVN-Commit-Revision: 328457 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 00:39:50 -0000 Author: jhb Date: Sat Jan 27 00:39:49 2018 New Revision: 328457 URL: https://svnweb.freebsd.org/changeset/base/328457 Log: Clarify some comments in the MIPS makecontext(). - N32 and N64 do not have a $a0-3 gap. - Use 'sp += 4' to skip over the gap for O32 rather than '+= i'. It doesn't make a functional change, but makes the code match the comment. Sponsored by: DARPA / AFRL Modified: head/lib/libc/mips/gen/makecontext.c Modified: head/lib/libc/mips/gen/makecontext.c ============================================================================== --- head/lib/libc/mips/gen/makecontext.c Sat Jan 27 00:09:43 2018 (r328456) +++ head/lib/libc/mips/gen/makecontext.c Sat Jan 27 00:39:49 2018 (r328457) @@ -95,19 +95,18 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int for (i = 0; i < argc && i < 4; i++) /* LINTED register_t is safe */ mc->mc_regs[A0 + i] = va_arg(ap, register_t); - /* Pass remaining arguments on the stack above the $a0-3 gap. */ - sp += i; + /* Skip over the $a0-3 gap. */ + sp += 4; #endif #if defined(__mips_n32) || defined(__mips_n64) /* Up to the first 8 arguments are passed in $a0-7. */ for (i = 0; i < argc && i < 8; i++) /* LINTED register_t is safe */ mc->mc_regs[A0 + i] = va_arg(ap, register_t); - /* Pass remaining arguments on the stack above the $a0-3 gap. */ #endif - /* Pass remaining arguments on the stack above the $a0-3 gap. */ + /* Pass remaining arguments on the stack. */ for (; i < argc; i++) - /* LINTED uintptr_t is safe */ + /* LINTED register_t is safe */ *sp++ = va_arg(ap, register_t); va_end(ap); } From owner-svn-src-all@freebsd.org Sat Jan 27 00:50:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B364DED3A00; Sat, 27 Jan 2018 00:50:53 +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 CBEFD6DDBD; Sat, 27 Jan 2018 00:50:52 +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 w0R0oiWH006995; Fri, 26 Jan 2018 16:50:44 -0800 (PST) (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 w0R0oiNR006994; Fri, 26 Jan 2018 16:50:44 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801270050.w0R0oiNR006994@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r328456 - head/share/man/man7 In-Reply-To: <201801270009.w0R09hJK092045@repo.freebsd.org> To: Edward Tomasz Napierala Date: Fri, 26 Jan 2018 16:50:44 -0800 (PST) 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.25 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: Sat, 27 Jan 2018 00:50:53 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: trasz > Date: Sat Jan 27 00:09:43 2018 > New Revision: 328456 > URL: https://svnweb.freebsd.org/changeset/base/328456 > > Log: > Remove mention of sys/boot/ from hier(7), it doesn't exist anymore. > > MFC after: 2 weeks I do not believe you want to MFC this, as sys/boot exists in 11 > > Modified: > head/share/man/man7/hier.7 > > Modified: head/share/man/man7/hier.7 > ============================================================================== > --- head/share/man/man7/hier.7 Fri Jan 26 23:56:07 2018 (r328455) > +++ head/share/man/man7/hier.7 Sat Jan 27 00:09:43 2018 (r328456) > @@ -28,7 +28,7 @@ > .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 > .\" $FreeBSD$ > .\" > -.Dd January 15, 2018 > +.Dd January 27, 2018 > .Dt HIER 7 > .Os > .Sh NAME > @@ -660,8 +660,6 @@ AMD64 architecture support > ARM architecture support > .It Pa arm64/ > ARMv8 architecture support > -.It Pa boot/ > -bootloader code > .It Pa cam/ > .Xr cam 4 > and > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sat Jan 27 05:56:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49DF9EDEC5C; Sat, 27 Jan 2018 05:56:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F16A477B72; Sat, 27 Jan 2018 05:56:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1B6D265D0; Sat, 27 Jan 2018 05:56:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R5uHwB066117; Sat, 27 Jan 2018 05:56:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R5uHUK066109; Sat, 27 Jan 2018 05:56:17 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801270556.w0R5uHUK066109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 05:56:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328459 - in stable/11/sys: boot/fdt contrib/libfdt X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/sys: boot/fdt contrib/libfdt X-SVN-Commit-Revision: 328459 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 05:56:18 -0000 Author: kevans Date: Sat Jan 27 05:56:16 2018 New Revision: 328459 URL: https://svnweb.freebsd.org/changeset/base/328459 Log: MFC (conceptually) r328106: libfdt: Update to 1.4.6, use libfdt for overlays This is a direct commit to stable/11 due to path changes in HEAD. Diffs have been applied on top of their previous locations, with one minor adjustment as per the "MFC" note below: a include in libfdt_env.h h as been wrapped in an `#ifndef _STANDALONE` block to prevent build failures when built in the bootloader context. These issues are not present in HEAD, thus this differs from HEAD. libfdt highlights since 1.4.3: - fdt_property_placeholder added to create a property without specifying its value at creation time - stringlist helper functions added to libfdt - Improved overlay support - Various internal cleanup Also switch stand/fdt over to using libfdt for overlay support with this update. Our current overlay implementation works only for limited use cases with overlays generated only by some specific versions of our dtc(1). Swap it out for the libfdt implementation, which supports any properly generated overlay being applied to a properly generated base. This will be followed up fairly soon with an update to dtc(1) in tree to properly generate overlays. MFC note: the include this update introduces in libfdt_env.h is apparently not necessary in the context we use this in. It's not immediately clear to me the motivation for it being introduced, but it came in with overlay support. I've left it in for the sake of accuracy and because it's not harmful here on HEAD, but MFC'ing this to stable/11 will require wrapping the #include in an `#ifndef _STANDALONE` block or else it will cause build failures. Added: stable/11/sys/contrib/libfdt/fdt_addresses.c (contents, props changed) stable/11/sys/contrib/libfdt/fdt_overlay.c (contents, props changed) Deleted: stable/11/sys/boot/fdt/fdt_overlay.c stable/11/sys/boot/fdt/fdt_overlay.h Modified: stable/11/sys/boot/fdt/Makefile stable/11/sys/boot/fdt/fdt_loader_cmd.c stable/11/sys/contrib/libfdt/fdt.c stable/11/sys/contrib/libfdt/fdt.h stable/11/sys/contrib/libfdt/fdt_empty_tree.c stable/11/sys/contrib/libfdt/fdt_ro.c stable/11/sys/contrib/libfdt/fdt_rw.c stable/11/sys/contrib/libfdt/fdt_strerror.c stable/11/sys/contrib/libfdt/fdt_sw.c stable/11/sys/contrib/libfdt/fdt_wip.c stable/11/sys/contrib/libfdt/libfdt.h stable/11/sys/contrib/libfdt/libfdt_env.h stable/11/sys/contrib/libfdt/libfdt_internal.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/fdt/Makefile ============================================================================== --- stable/11/sys/boot/fdt/Makefile Sat Jan 27 05:08:44 2018 (r328458) +++ stable/11/sys/boot/fdt/Makefile Sat Jan 27 05:56:16 2018 (r328459) @@ -7,10 +7,10 @@ INTERNALLIB= # Vendor sources of libfdt. SRCS+= fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c \ - fdt_empty_tree.c + fdt_empty_tree.c fdt_addresses.c fdt_overlay.c # Loader's fdt commands extension sources. -SRCS+= fdt_loader_cmd.c fdt_overlay.c +SRCS+= fdt_loader_cmd.c CFLAGS+= -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/ Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- stable/11/sys/boot/fdt/fdt_loader_cmd.c Sat Jan 27 05:08:44 2018 (r328458) +++ stable/11/sys/boot/fdt/fdt_loader_cmd.c Sat Jan 27 05:56:16 2018 (r328459) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "fdt_platform.h" -#include "fdt_overlay.h" #ifdef DEBUG #define debugf(fmt, args...) do { printf("%s(): ", __func__); \ Modified: stable/11/sys/contrib/libfdt/fdt.c ============================================================================== --- stable/11/sys/contrib/libfdt/fdt.c Sat Jan 27 05:08:44 2018 (r328458) +++ stable/11/sys/contrib/libfdt/fdt.c Sat Jan 27 05:56:16 2018 (r328459) @@ -76,23 +76,24 @@ int fdt_check_header(const void *fdt) const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int len) { - const char *p; + unsigned absoffset = offset + fdt_off_dt_struct(fdt); + if ((absoffset < offset) + || ((absoffset + len) < absoffset) + || (absoffset + len) > fdt_totalsize(fdt)) + return NULL; + if (fdt_version(fdt) >= 0x11) if (((offset + len) < offset) || ((offset + len) > fdt_size_dt_struct(fdt))) return NULL; - p = _fdt_offset_ptr(fdt, offset); - - if (p + len < p) - return NULL; - return p; + return fdt_offset_ptr_(fdt, offset); } uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset) { - const uint32_t *tagp, *lenp; + const fdt32_t *tagp, *lenp; uint32_t tag; int offset = startoffset; const char *p; @@ -140,7 +141,7 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset return tag; } -int _fdt_check_node_offset(const void *fdt, int offset) +int fdt_check_node_offset_(const void *fdt, int offset) { if ((offset < 0) || (offset % FDT_TAGSIZE) || (fdt_next_tag(fdt, offset, &offset) != FDT_BEGIN_NODE)) @@ -149,7 +150,7 @@ int _fdt_check_node_offset(const void *fdt, int offset return offset; } -int _fdt_check_prop_offset(const void *fdt, int offset) +int fdt_check_prop_offset_(const void *fdt, int offset) { if ((offset < 0) || (offset % FDT_TAGSIZE) || (fdt_next_tag(fdt, offset, &offset) != FDT_PROP)) @@ -164,7 +165,7 @@ int fdt_next_node(const void *fdt, int offset, int *de uint32_t tag; if (offset >= 0) - if ((nextoffset = _fdt_check_node_offset(fdt, offset)) < 0) + if ((nextoffset = fdt_check_node_offset_(fdt, offset)) < 0) return nextoffset; do { @@ -198,7 +199,35 @@ int fdt_next_node(const void *fdt, int offset, int *de return offset; } -const char *_fdt_find_string(const char *strtab, int tabsize, const char *s) +int fdt_first_subnode(const void *fdt, int offset) +{ + int depth = 0; + + offset = fdt_next_node(fdt, offset, &depth); + if (offset < 0 || depth != 1) + return -FDT_ERR_NOTFOUND; + + return offset; +} + +int fdt_next_subnode(const void *fdt, int offset) +{ + int depth = 1; + + /* + * With respect to the parent, the depth of the next subnode will be + * the same as the last. + */ + do { + offset = fdt_next_node(fdt, offset, &depth); + if (offset < 0 || depth < 1) + return -FDT_ERR_NOTFOUND; + } while (depth > 1); + + return offset; +} + +const char *fdt_find_string_(const char *strtab, int tabsize, const char *s) { int len = strlen(s) + 1; const char *last = strtab + tabsize - len; Modified: stable/11/sys/contrib/libfdt/fdt.h ============================================================================== --- stable/11/sys/contrib/libfdt/fdt.h Sat Jan 27 05:08:44 2018 (r328458) +++ stable/11/sys/contrib/libfdt/fdt.h Sat Jan 27 05:56:16 2018 (r328459) @@ -1,48 +1,99 @@ -#ifndef _FDT_H -#define _FDT_H +#ifndef FDT_H +#define FDT_H +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. + * Copyright 2012 Kim Phillips, Freescale Semiconductor. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. + */ #ifndef __ASSEMBLY__ struct fdt_header { - uint32_t magic; /* magic word FDT_MAGIC */ - uint32_t totalsize; /* total size of DT block */ - uint32_t off_dt_struct; /* offset to structure */ - uint32_t off_dt_strings; /* offset to strings */ - uint32_t off_mem_rsvmap; /* offset to memory reserve map */ - uint32_t version; /* format version */ - uint32_t last_comp_version; /* last compatible version */ + fdt32_t magic; /* magic word FDT_MAGIC */ + fdt32_t totalsize; /* total size of DT block */ + fdt32_t off_dt_struct; /* offset to structure */ + fdt32_t off_dt_strings; /* offset to strings */ + fdt32_t off_mem_rsvmap; /* offset to memory reserve map */ + fdt32_t version; /* format version */ + fdt32_t last_comp_version; /* last compatible version */ /* version 2 fields below */ - uint32_t boot_cpuid_phys; /* Which physical CPU id we're + fdt32_t boot_cpuid_phys; /* Which physical CPU id we're booting on */ /* version 3 fields below */ - uint32_t size_dt_strings; /* size of the strings block */ + fdt32_t size_dt_strings; /* size of the strings block */ /* version 17 fields below */ - uint32_t size_dt_struct; /* size of the structure block */ + fdt32_t size_dt_struct; /* size of the structure block */ }; struct fdt_reserve_entry { - uint64_t address; - uint64_t size; + fdt64_t address; + fdt64_t size; }; struct fdt_node_header { - uint32_t tag; + fdt32_t tag; char name[0]; }; struct fdt_property { - uint32_t tag; - uint32_t len; - uint32_t nameoff; + fdt32_t tag; + fdt32_t len; + fdt32_t nameoff; char data[0]; }; #endif /* !__ASSEMBLY */ #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ -#define FDT_TAGSIZE sizeof(uint32_t) +#define FDT_TAGSIZE sizeof(fdt32_t) #define FDT_BEGIN_NODE 0x1 /* Start node: full name */ #define FDT_END_NODE 0x2 /* End node */ @@ -51,10 +102,10 @@ struct fdt_property { #define FDT_NOP 0x4 /* nop */ #define FDT_END 0x9 -#define FDT_V1_SIZE (7*sizeof(uint32_t)) -#define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(uint32_t)) -#define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(uint32_t)) +#define FDT_V1_SIZE (7*sizeof(fdt32_t)) +#define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(fdt32_t)) +#define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(fdt32_t)) #define FDT_V16_SIZE FDT_V3_SIZE -#define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(uint32_t)) +#define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(fdt32_t)) -#endif /* _FDT_H */ +#endif /* FDT_H */ Added: stable/11/sys/contrib/libfdt/fdt_addresses.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/contrib/libfdt/fdt_addresses.c Sat Jan 27 05:56:16 2018 (r328459) @@ -0,0 +1,96 @@ +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2014 David Gibson + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 "libfdt_env.h" + +#include +#include + +#include "libfdt_internal.h" + +int fdt_address_cells(const void *fdt, int nodeoffset) +{ + const fdt32_t *ac; + int val; + int len; + + ac = fdt_getprop(fdt, nodeoffset, "#address-cells", &len); + if (!ac) + return 2; + + if (len != sizeof(*ac)) + return -FDT_ERR_BADNCELLS; + + val = fdt32_to_cpu(*ac); + if ((val <= 0) || (val > FDT_MAX_NCELLS)) + return -FDT_ERR_BADNCELLS; + + return val; +} + +int fdt_size_cells(const void *fdt, int nodeoffset) +{ + const fdt32_t *sc; + int val; + int len; + + sc = fdt_getprop(fdt, nodeoffset, "#size-cells", &len); + if (!sc) + return 2; + + if (len != sizeof(*sc)) + return -FDT_ERR_BADNCELLS; + + val = fdt32_to_cpu(*sc); + if ((val < 0) || (val > FDT_MAX_NCELLS)) + return -FDT_ERR_BADNCELLS; + + return val; +} Modified: stable/11/sys/contrib/libfdt/fdt_empty_tree.c ============================================================================== --- stable/11/sys/contrib/libfdt/fdt_empty_tree.c Sat Jan 27 05:08:44 2018 (r328458) +++ stable/11/sys/contrib/libfdt/fdt_empty_tree.c Sat Jan 27 05:56:16 2018 (r328459) @@ -81,4 +81,3 @@ int fdt_create_empty_tree(void *buf, int bufsize) return fdt_open_into(buf, buf, bufsize); } - Added: stable/11/sys/contrib/libfdt/fdt_overlay.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/contrib/libfdt/fdt_overlay.c Sat Jan 27 05:56:16 2018 (r328459) @@ -0,0 +1,861 @@ +#include "libfdt_env.h" + +#include +#include + +#include "libfdt_internal.h" + +/** + * overlay_get_target_phandle - retrieves the target phandle of a fragment + * @fdto: pointer to the device tree overlay blob + * @fragment: node offset of the fragment in the overlay + * + * overlay_get_target_phandle() retrieves the target phandle of an + * overlay fragment when that fragment uses a phandle (target + * property) instead of a path (target-path property). + * + * returns: + * the phandle pointed by the target property + * 0, if the phandle was not found + * -1, if the phandle was malformed + */ +static uint32_t overlay_get_target_phandle(const void *fdto, int fragment) +{ + const fdt32_t *val; + int len; + + val = fdt_getprop(fdto, fragment, "target", &len); + if (!val) + return 0; + + if ((len != sizeof(*val)) || (fdt32_to_cpu(*val) == (uint32_t)-1)) + return (uint32_t)-1; + + return fdt32_to_cpu(*val); +} + +/** + * overlay_get_target - retrieves the offset of a fragment's target + * @fdt: Base device tree blob + * @fdto: Device tree overlay blob + * @fragment: node offset of the fragment in the overlay + * @pathp: pointer which receives the path of the target (or NULL) + * + * overlay_get_target() retrieves the target offset in the base + * device tree of a fragment, no matter how the actual targetting is + * done (through a phandle or a path) + * + * returns: + * the targetted node offset in the base device tree + * Negative error code on error + */ +static int overlay_get_target(const void *fdt, const void *fdto, + int fragment, char const **pathp) +{ + uint32_t phandle; + const char *path = NULL; + int path_len = 0, ret; + + /* Try first to do a phandle based lookup */ + phandle = overlay_get_target_phandle(fdto, fragment); + if (phandle == (uint32_t)-1) + return -FDT_ERR_BADPHANDLE; + + /* no phandle, try path */ + if (!phandle) { + /* And then a path based lookup */ + path = fdt_getprop(fdto, fragment, "target-path", &path_len); + if (path) + ret = fdt_path_offset(fdt, path); + else + ret = path_len; + } else + ret = fdt_node_offset_by_phandle(fdt, phandle); + + /* + * If we haven't found either a target or a + * target-path property in a node that contains a + * __overlay__ subnode (we wouldn't be called + * otherwise), consider it a improperly written + * overlay + */ + if (ret < 0 && path_len == -FDT_ERR_NOTFOUND) + ret = -FDT_ERR_BADOVERLAY; + + /* return on error */ + if (ret < 0) + return ret; + + /* return pointer to path (if available) */ + if (pathp) + *pathp = path ? path : NULL; + + return ret; +} + +/** + * overlay_phandle_add_offset - Increases a phandle by an offset + * @fdt: Base device tree blob + * @node: Device tree overlay blob + * @name: Name of the property to modify (phandle or linux,phandle) + * @delta: offset to apply + * + * overlay_phandle_add_offset() increments a node phandle by a given + * offset. + * + * returns: + * 0 on success. + * Negative error code on error + */ +static int overlay_phandle_add_offset(void *fdt, int node, + const char *name, uint32_t delta) +{ + const fdt32_t *val; + uint32_t adj_val; + int len; + + val = fdt_getprop(fdt, node, name, &len); + if (!val) + return len; + + if (len != sizeof(*val)) + return -FDT_ERR_BADPHANDLE; + + adj_val = fdt32_to_cpu(*val); + if ((adj_val + delta) < adj_val) + return -FDT_ERR_NOPHANDLES; + + adj_val += delta; + if (adj_val == (uint32_t)-1) + return -FDT_ERR_NOPHANDLES; + + return fdt_setprop_inplace_u32(fdt, node, name, adj_val); +} + +/** + * overlay_adjust_node_phandles - Offsets the phandles of a node + * @fdto: Device tree overlay blob + * @node: Offset of the node we want to adjust + * @delta: Offset to shift the phandles of + * + * overlay_adjust_node_phandles() adds a constant to all the phandles + * of a given node. This is mainly use as part of the overlay + * application process, when we want to update all the overlay + * phandles to not conflict with the overlays of the base device tree. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_adjust_node_phandles(void *fdto, int node, + uint32_t delta) +{ + int child; + int ret; + + ret = overlay_phandle_add_offset(fdto, node, "phandle", delta); + if (ret && ret != -FDT_ERR_NOTFOUND) + return ret; + + ret = overlay_phandle_add_offset(fdto, node, "linux,phandle", delta); + if (ret && ret != -FDT_ERR_NOTFOUND) + return ret; + + fdt_for_each_subnode(child, fdto, node) { + ret = overlay_adjust_node_phandles(fdto, child, delta); + if (ret) + return ret; + } + + return 0; +} + +/** + * overlay_adjust_local_phandles - Adjust the phandles of a whole overlay + * @fdto: Device tree overlay blob + * @delta: Offset to shift the phandles of + * + * overlay_adjust_local_phandles() adds a constant to all the + * phandles of an overlay. This is mainly use as part of the overlay + * application process, when we want to update all the overlay + * phandles to not conflict with the overlays of the base device tree. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_adjust_local_phandles(void *fdto, uint32_t delta) +{ + /* + * Start adjusting the phandles from the overlay root + */ + return overlay_adjust_node_phandles(fdto, 0, delta); +} + +/** + * overlay_update_local_node_references - Adjust the overlay references + * @fdto: Device tree overlay blob + * @tree_node: Node offset of the node to operate on + * @fixup_node: Node offset of the matching local fixups node + * @delta: Offset to shift the phandles of + * + * overlay_update_local_nodes_references() update the phandles + * pointing to a node within the device tree overlay by adding a + * constant delta. + * + * This is mainly used as part of a device tree application process, + * where you want the device tree overlays phandles to not conflict + * with the ones from the base device tree before merging them. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_update_local_node_references(void *fdto, + int tree_node, + int fixup_node, + uint32_t delta) +{ + int fixup_prop; + int fixup_child; + int ret; + + fdt_for_each_property_offset(fixup_prop, fdto, fixup_node) { + const fdt32_t *fixup_val; + const char *tree_val; + const char *name; + int fixup_len; + int tree_len; + int i; + + fixup_val = fdt_getprop_by_offset(fdto, fixup_prop, + &name, &fixup_len); + if (!fixup_val) + return fixup_len; + + if (fixup_len % sizeof(uint32_t)) + return -FDT_ERR_BADOVERLAY; + + tree_val = fdt_getprop(fdto, tree_node, name, &tree_len); + if (!tree_val) { + if (tree_len == -FDT_ERR_NOTFOUND) + return -FDT_ERR_BADOVERLAY; + + return tree_len; + } + + for (i = 0; i < (fixup_len / sizeof(uint32_t)); i++) { + fdt32_t adj_val; + uint32_t poffset; + + poffset = fdt32_to_cpu(fixup_val[i]); + + /* + * phandles to fixup can be unaligned. + * + * Use a memcpy for the architectures that do + * not support unaligned accesses. + */ + memcpy(&adj_val, tree_val + poffset, sizeof(adj_val)); + + adj_val = cpu_to_fdt32(fdt32_to_cpu(adj_val) + delta); + + ret = fdt_setprop_inplace_namelen_partial(fdto, + tree_node, + name, + strlen(name), + poffset, + &adj_val, + sizeof(adj_val)); + if (ret == -FDT_ERR_NOSPACE) + return -FDT_ERR_BADOVERLAY; + + if (ret) + return ret; + } + } + + fdt_for_each_subnode(fixup_child, fdto, fixup_node) { + const char *fixup_child_name = fdt_get_name(fdto, fixup_child, + NULL); + int tree_child; + + tree_child = fdt_subnode_offset(fdto, tree_node, + fixup_child_name); + if (tree_child == -FDT_ERR_NOTFOUND) + return -FDT_ERR_BADOVERLAY; + if (tree_child < 0) + return tree_child; + + ret = overlay_update_local_node_references(fdto, + tree_child, + fixup_child, + delta); + if (ret) + return ret; + } + + return 0; +} + +/** + * overlay_update_local_references - Adjust the overlay references + * @fdto: Device tree overlay blob + * @delta: Offset to shift the phandles of + * + * overlay_update_local_references() update all the phandles pointing + * to a node within the device tree overlay by adding a constant + * delta to not conflict with the base overlay. + * + * This is mainly used as part of a device tree application process, + * where you want the device tree overlays phandles to not conflict + * with the ones from the base device tree before merging them. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_update_local_references(void *fdto, uint32_t delta) +{ + int fixups; + + fixups = fdt_path_offset(fdto, "/__local_fixups__"); + if (fixups < 0) { + /* There's no local phandles to adjust, bail out */ + if (fixups == -FDT_ERR_NOTFOUND) + return 0; + + return fixups; + } + + /* + * Update our local references from the root of the tree + */ + return overlay_update_local_node_references(fdto, 0, fixups, + delta); +} + +/** + * overlay_fixup_one_phandle - Set an overlay phandle to the base one + * @fdt: Base Device Tree blob + * @fdto: Device tree overlay blob + * @symbols_off: Node offset of the symbols node in the base device tree + * @path: Path to a node holding a phandle in the overlay + * @path_len: number of path characters to consider + * @name: Name of the property holding the phandle reference in the overlay + * @name_len: number of name characters to consider + * @poffset: Offset within the overlay property where the phandle is stored + * @label: Label of the node referenced by the phandle + * + * overlay_fixup_one_phandle() resolves an overlay phandle pointing to + * a node in the base device tree. + * + * This is part of the device tree overlay application process, when + * you want all the phandles in the overlay to point to the actual + * base dt nodes. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_fixup_one_phandle(void *fdt, void *fdto, + int symbols_off, + const char *path, uint32_t path_len, + const char *name, uint32_t name_len, + int poffset, const char *label) +{ + const char *symbol_path; + uint32_t phandle; + fdt32_t phandle_prop; + int symbol_off, fixup_off; + int prop_len; + + if (symbols_off < 0) + return symbols_off; + + symbol_path = fdt_getprop(fdt, symbols_off, label, + &prop_len); + if (!symbol_path) + return prop_len; + + symbol_off = fdt_path_offset(fdt, symbol_path); + if (symbol_off < 0) + return symbol_off; + + phandle = fdt_get_phandle(fdt, symbol_off); + if (!phandle) + return -FDT_ERR_NOTFOUND; + + fixup_off = fdt_path_offset_namelen(fdto, path, path_len); + if (fixup_off == -FDT_ERR_NOTFOUND) + return -FDT_ERR_BADOVERLAY; + if (fixup_off < 0) + return fixup_off; + + phandle_prop = cpu_to_fdt32(phandle); + return fdt_setprop_inplace_namelen_partial(fdto, fixup_off, + name, name_len, poffset, + &phandle_prop, + sizeof(phandle_prop)); +}; + +/** + * overlay_fixup_phandle - Set an overlay phandle to the base one + * @fdt: Base Device Tree blob + * @fdto: Device tree overlay blob + * @symbols_off: Node offset of the symbols node in the base device tree + * @property: Property offset in the overlay holding the list of fixups + * + * overlay_fixup_phandle() resolves all the overlay phandles pointed + * to in a __fixups__ property, and updates them to match the phandles + * in use in the base device tree. + * + * This is part of the device tree overlay application process, when + * you want all the phandles in the overlay to point to the actual + * base dt nodes. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off, + int property) +{ + const char *value; + const char *label; + int len; + + value = fdt_getprop_by_offset(fdto, property, + &label, &len); + if (!value) { + if (len == -FDT_ERR_NOTFOUND) + return -FDT_ERR_INTERNAL; + + return len; + } + + do { + const char *path, *name, *fixup_end; + const char *fixup_str = value; + uint32_t path_len, name_len; + uint32_t fixup_len; + char *sep, *endptr; + int poffset, ret; + + fixup_end = memchr(value, '\0', len); + if (!fixup_end) + return -FDT_ERR_BADOVERLAY; + fixup_len = fixup_end - fixup_str; + + len -= fixup_len + 1; + value += fixup_len + 1; + + path = fixup_str; + sep = memchr(fixup_str, ':', fixup_len); + if (!sep || *sep != ':') + return -FDT_ERR_BADOVERLAY; + + path_len = sep - path; + if (path_len == (fixup_len - 1)) + return -FDT_ERR_BADOVERLAY; + + fixup_len -= path_len + 1; + name = sep + 1; + sep = memchr(name, ':', fixup_len); + if (!sep || *sep != ':') + return -FDT_ERR_BADOVERLAY; + + name_len = sep - name; + if (!name_len) + return -FDT_ERR_BADOVERLAY; + + poffset = strtoul(sep + 1, &endptr, 10); + if ((*endptr != '\0') || (endptr <= (sep + 1))) + return -FDT_ERR_BADOVERLAY; + + ret = overlay_fixup_one_phandle(fdt, fdto, symbols_off, + path, path_len, name, name_len, + poffset, label); + if (ret) + return ret; + } while (len > 0); + + return 0; +} + +/** + * overlay_fixup_phandles - Resolve the overlay phandles to the base + * device tree + * @fdt: Base Device Tree blob + * @fdto: Device tree overlay blob + * + * overlay_fixup_phandles() resolves all the overlay phandles pointing + * to nodes in the base device tree. + * + * This is one of the steps of the device tree overlay application + * process, when you want all the phandles in the overlay to point to + * the actual base dt nodes. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_fixup_phandles(void *fdt, void *fdto) +{ + int fixups_off, symbols_off; + int property; + + /* We can have overlays without any fixups */ + fixups_off = fdt_path_offset(fdto, "/__fixups__"); + if (fixups_off == -FDT_ERR_NOTFOUND) + return 0; /* nothing to do */ + if (fixups_off < 0) + return fixups_off; + + /* And base DTs without symbols */ + symbols_off = fdt_path_offset(fdt, "/__symbols__"); + if ((symbols_off < 0 && (symbols_off != -FDT_ERR_NOTFOUND))) + return symbols_off; + + fdt_for_each_property_offset(property, fdto, fixups_off) { + int ret; + + ret = overlay_fixup_phandle(fdt, fdto, symbols_off, property); + if (ret) + return ret; + } + + return 0; +} + +/** + * overlay_apply_node - Merges a node into the base device tree + * @fdt: Base Device Tree blob + * @target: Node offset in the base device tree to apply the fragment to + * @fdto: Device tree overlay blob + * @node: Node offset in the overlay holding the changes to merge + * + * overlay_apply_node() merges a node into a target base device tree + * node pointed. + * + * This is part of the final step in the device tree overlay + * application process, when all the phandles have been adjusted and + * resolved and you just have to merge overlay into the base device + * tree. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_apply_node(void *fdt, int target, + void *fdto, int node) +{ + int property; + int subnode; + + fdt_for_each_property_offset(property, fdto, node) { + const char *name; + const void *prop; + int prop_len; + int ret; + + prop = fdt_getprop_by_offset(fdto, property, &name, + &prop_len); + if (prop_len == -FDT_ERR_NOTFOUND) + return -FDT_ERR_INTERNAL; + if (prop_len < 0) + return prop_len; + + ret = fdt_setprop(fdt, target, name, prop, prop_len); + if (ret) + return ret; + } + + fdt_for_each_subnode(subnode, fdto, node) { + const char *name = fdt_get_name(fdto, subnode, NULL); + int nnode; + int ret; + + nnode = fdt_add_subnode(fdt, target, name); + if (nnode == -FDT_ERR_EXISTS) { + nnode = fdt_subnode_offset(fdt, target, name); + if (nnode == -FDT_ERR_NOTFOUND) + return -FDT_ERR_INTERNAL; + } + + if (nnode < 0) + return nnode; + + ret = overlay_apply_node(fdt, nnode, fdto, subnode); + if (ret) + return ret; + } + + return 0; +} + +/** + * overlay_merge - Merge an overlay into its base device tree + * @fdt: Base Device Tree blob + * @fdto: Device tree overlay blob + * + * overlay_merge() merges an overlay into its base device tree. + * + * This is the next to last step in the device tree overlay application + * process, when all the phandles have been adjusted and resolved and + * you just have to merge overlay into the base device tree. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_merge(void *fdt, void *fdto) +{ + int fragment; + + fdt_for_each_subnode(fragment, fdto, 0) { + int overlay; + int target; + int ret; + + /* + * Each fragments will have an __overlay__ node. If + * they don't, it's not supposed to be merged + */ + overlay = fdt_subnode_offset(fdto, fragment, "__overlay__"); + if (overlay == -FDT_ERR_NOTFOUND) + continue; + + if (overlay < 0) + return overlay; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Jan 27 06:10:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE0F1EDF5EE; Sat, 27 Jan 2018 06:10:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C1F7783A6; Sat, 27 Jan 2018 06:10:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6848626764; Sat, 27 Jan 2018 06:10:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R6ALR5071421; Sat, 27 Jan 2018 06:10:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R6AL5x071419; Sat, 27 Jan 2018 06:10:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801270610.w0R6AL5x071419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 06:10: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: r328460 - in stable/11: share/man/man4 sys/dev/usb/input X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/usb/input X-SVN-Commit-Revision: 328460 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 06:10:22 -0000 Author: kevans Date: Sat Jan 27 06:10:20 2018 New Revision: 328460 URL: https://svnweb.freebsd.org/changeset/base/328460 Log: MFC r314467,r328027: Add hw.usb.wsp.enable_single_tap_clicks sysctl MFC r314467 (imp): Make wsp process a single touchpad tap and interpret it as a left-click event. It can be disabled by setting the new hw.usb.wsp.enable_single_tap_clicks sysctl to 0. MFC r328027: wsp(4): Update to reflect new sysctl from r314467 r314467 introduced hw.usb.wsp.enable_single_tap_clicks to enable/disable single-tap left click behavior. Update the man page to reflect the new sysctl. PR: 196624 Modified: stable/11/share/man/man4/wsp.4 stable/11/sys/dev/usb/input/wsp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/wsp.4 ============================================================================== --- stable/11/share/man/man4/wsp.4 Sat Jan 27 05:56:16 2018 (r328459) +++ stable/11/share/man/man4/wsp.4 Sat Jan 27 06:10:20 2018 (r328460) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 7, 2014 +.Dd January 15, 2018 .Dt WSP 4 .Os .Sh NAME @@ -63,6 +63,9 @@ through nodes under .Nm hw.usb.wsp . Pointer sensitivity can be controlled using the sysctl tunable .Nm hw.usb.wsp.scale_factor . +Tap to left-click can be controlled using the sysctl tunable +.Nm hw.usb.wsp.enable_single_tap_clicks , +set to 0 to disable single tap clicks or 1 to enable them (default). .Sh FILES .Nm creates a blocking pseudo-device file, Modified: stable/11/sys/dev/usb/input/wsp.c ============================================================================== --- stable/11/sys/dev/usb/input/wsp.c Sat Jan 27 05:56:16 2018 (r328459) +++ stable/11/sys/dev/usb/input/wsp.c Sat Jan 27 06:10:20 2018 (r328460) @@ -87,6 +87,7 @@ static struct wsp_tuning { int pressure_untouch_threshold; int pressure_tap_threshold; int scr_hor_threshold; + int enable_single_tap_clicks; } wsp_tuning = { @@ -96,6 +97,7 @@ static struct wsp_tuning { .pressure_untouch_threshold = 10, .pressure_tap_threshold = 120, .scr_hor_threshold = 20, + .enable_single_tap_clicks = 1, }; static void @@ -107,6 +109,7 @@ wsp_runing_rangecheck(struct wsp_tuning *ptun) WSP_CLAMP(ptun->pressure_untouch_threshold, 1, 255); WSP_CLAMP(ptun->pressure_tap_threshold, 1, 255); WSP_CLAMP(ptun->scr_hor_threshold, 1, 255); + WSP_CLAMP(ptun->enable_single_tap_clicks, 0, 1); } SYSCTL_INT(_hw_usb_wsp, OID_AUTO, scale_factor, CTLFLAG_RWTUN, @@ -121,6 +124,8 @@ SYSCTL_INT(_hw_usb_wsp, OID_AUTO, pressure_tap_thresho &wsp_tuning.pressure_tap_threshold, 0, "tap pressure threshold"); SYSCTL_INT(_hw_usb_wsp, OID_AUTO, scr_hor_threshold, CTLFLAG_RWTUN, &wsp_tuning.scr_hor_threshold, 0, "horizontal scrolling threshold"); +SYSCTL_INT(_hw_usb_wsp, OID_AUTO, enable_single_tap_clicks, CTLFLAG_RWTUN, + &wsp_tuning.enable_single_tap_clicks, 0, "enable single tap clicks"); /* * Some tables, structures, definitions and constant values for the @@ -966,7 +971,7 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t e */ switch (sc->ntaps) { case 1: - if (!(params->caps & HAS_INTEGRATED_BUTTON)) { + if (!(params->caps & HAS_INTEGRATED_BUTTON) || tun.enable_single_tap_clicks) { wsp_add_to_queue(sc, 0, 0, 0, MOUSE_BUTTON1DOWN); DPRINTFN(WSP_LLEVEL_INFO, "LEFT CLICK!\n"); } From owner-svn-src-all@freebsd.org Sat Jan 27 06:31:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48B8FEE0048; Sat, 27 Jan 2018 06:31:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E9FCC78D94; Sat, 27 Jan 2018 06:31:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB7FC26BDA; Sat, 27 Jan 2018 06:31:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R6VE1d082081; Sat, 27 Jan 2018 06:31:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R6VEU2081903; Sat, 27 Jan 2018 06:31:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801270631.w0R6VEU2081903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 06:31: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: r328463 - in stable/11: etc/mtree usr.bin/hexdump usr.bin/hexdump/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: etc/mtree usr.bin/hexdump usr.bin/hexdump/tests X-SVN-Commit-Revision: 328463 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 06:31:15 -0000 Author: kevans Date: Sat Jan 27 06:31:14 2018 New Revision: 328463 URL: https://svnweb.freebsd.org/changeset/base/328463 Log: MFC r320930,r324286: Add tests for hexdump(1) MFC r320930: Add some basic tests for hexdump(1)'s various output flags. Formatting tests are omitted for this initial run as there are still some bugs to work out there. This covers -s flag testing on devices and non-devices that would have caught breakage found in PR 219173 as well as other subtle breakage caused locally. MFC r324286: hexdump: Remove expected test failures for now succeeding tests r323990 fixed the -s flag breakage reported by PR 219173. Mark the corresponding hexdump tests accordingly, since they should now both succeed. PR: 222781 Added: stable/11/usr.bin/hexdump/tests/ - copied from r320930, head/usr.bin/hexdump/tests/ Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/usr.bin/hexdump/Makefile stable/11/usr.bin/hexdump/tests/hexdump_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Sat Jan 27 06:20:27 2018 (r328462) +++ stable/11/etc/mtree/BSD.tests.dist Sat Jan 27 06:31:14 2018 (r328463) @@ -652,6 +652,8 @@ .. head .. + hexdump + .. ident .. join Modified: stable/11/usr.bin/hexdump/Makefile ============================================================================== --- stable/11/usr.bin/hexdump/Makefile Sat Jan 27 06:20:27 2018 (r328462) +++ stable/11/usr.bin/hexdump/Makefile Sat Jan 27 06:31:14 2018 (r328463) @@ -1,11 +1,17 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= hexdump SRCS= conv.c display.c hexdump.c hexsyntax.c odsyntax.c parse.c MAN= hexdump.1 od.1 MLINKS= hexdump.1 hd.1 LINKS= ${BINDIR}/hexdump ${BINDIR}/od LINKS+= ${BINDIR}/hexdump ${BINDIR}/hd + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Modified: stable/11/usr.bin/hexdump/tests/hexdump_test.sh ============================================================================== --- head/usr.bin/hexdump/tests/hexdump_test.sh Thu Jul 13 03:52:54 2017 (r320930) +++ stable/11/usr.bin/hexdump/tests/hexdump_test.sh Sat Jan 27 06:31:14 2018 (r328463) @@ -134,7 +134,6 @@ s_flag_head() } s_flag_body() { - atf_expect_fail "-s option is currently broken due to capsicum (PR 219173)" atf_check -o file:"$(atf_get_srcdir)/d_hexdump_sflag_a.out" \ hexdump -bs 4 "$(atf_get_srcdir)/d_hexdump_a.in" @@ -148,7 +147,6 @@ v_flag_head() } v_flag_body() { - atf_expect_fail "-s option is currently broken due to capsicum (PR 219173)" for i in $(seq 0 7); do atf_check -o match:"^\*$" \ hexdump -s ${i} "$(atf_get_srcdir)/d_hexdump_c.in" From owner-svn-src-all@freebsd.org Sat Jan 27 06:15:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D50CEDF988; Sat, 27 Jan 2018 06:15:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A2BD37872F; Sat, 27 Jan 2018 06:15:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D80426908; Sat, 27 Jan 2018 06:15:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R6FOSS075994; Sat, 27 Jan 2018 06:15:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R6FOGu075993; Sat, 27 Jan 2018 06:15:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801270615.w0R6FOGu075993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 06:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328461 - stable/11/usr.bin/grep/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep/tests X-SVN-Commit-Revision: 328461 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 06:15:25 -0000 Author: kevans Date: Sat Jan 27 06:15:24 2018 New Revision: 328461 URL: https://svnweb.freebsd.org/changeset/base/328461 Log: MFC r326483: grep test: Fix copyright notice The copyright notice was erroneously introduced as one from the NetBSD foundation due to it being copied from a file in the NetBSD test suite, but this file itself is not derived from or supplied with the NetBSD test suite. Modified: stable/11/usr.bin/grep/tests/grep_freebsd_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/tests/grep_freebsd_test.sh ============================================================================== --- stable/11/usr.bin/grep/tests/grep_freebsd_test.sh Sat Jan 27 06:10:20 2018 (r328460) +++ stable/11/usr.bin/grep/tests/grep_freebsd_test.sh Sat Jan 27 06:15:24 2018 (r328461) @@ -11,17 +11,17 @@ # 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. # # $FreeBSD$ From owner-svn-src-all@freebsd.org Sat Jan 27 05:08:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B39EEDD6AD; Sat, 27 Jan 2018 05:08:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E33F876770; Sat, 27 Jan 2018 05:08: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE20B25DA0; Sat, 27 Jan 2018 05:08:44 +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 w0R58i3W041519; Sat, 27 Jan 2018 05:08:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R58iNU041518; Sat, 27 Jan 2018 05:08:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801270508.w0R58iNU041518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 27 Jan 2018 05:08: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: r328458 - stable/11/sys/dev/wbwd X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/wbwd X-SVN-Commit-Revision: 328458 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 05:08:45 -0000 Author: mav Date: Sat Jan 27 05:08:44 2018 New Revision: 328458 URL: https://svnweb.freebsd.org/changeset/base/328458 Log: MFC r327925: Add IDs for Nuvoton NCT6793/NCT6795. Modified: stable/11/sys/dev/wbwd/wbwd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/wbwd/wbwd.c ============================================================================== --- stable/11/sys/dev/wbwd/wbwd.c Sat Jan 27 00:39:49 2018 (r328457) +++ stable/11/sys/dev/wbwd/wbwd.c Sat Jan 27 05:08:44 2018 (r328458) @@ -95,7 +95,7 @@ __FBSDID("$FreeBSD$"); enum chips { w83627hf, w83627s, w83697hf, w83697ug, w83637hf, w83627thf, w83687thf, w83627ehf, w83627dhg, w83627uhg, w83667hg, w83627dhg_p, w83667hg_b, nct6775, nct6776, nct6779, nct6791, - nct6792, nct6102 }; + nct6792, nct6793, nct6795, nct6102 }; struct wb_softc { device_t dev; @@ -250,6 +250,16 @@ struct winbond_vendor_device_id { .chip = nct6792, .descr = "Nuvoton NCT6792", }, + { + .device_id = 0xd1, + .chip = nct6793, + .descr = "Nuvoton NCT6793", + }, + { + .device_id = 0xd3, + .chip = nct6795, + .descr = "Nuvoton NCT6795", + }, }; static void @@ -808,6 +818,8 @@ wb_attach(device_t dev) case nct6779: case nct6791: case nct6792: + case nct6793: + case nct6795: case nct6102: /* * These chips have a fixed WDTO# output pin (W83627UHG), From owner-svn-src-all@freebsd.org Sat Jan 27 07:41:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 389E1E74510; Sat, 27 Jan 2018 07:41:32 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E2FB07B049; Sat, 27 Jan 2018 07:41:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDD7027736; Sat, 27 Jan 2018 07:41:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R7fV0L018160; Sat, 27 Jan 2018 07:41:31 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R7fV0u018159; Sat, 27 Jan 2018 07:41:31 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201801270741.w0R7fV0u018159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 27 Jan 2018 07:41:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328465 - head/sys/crypto/ccp X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/crypto/ccp X-SVN-Commit-Revision: 328465 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 07:41:32 -0000 Author: cem Date: Sat Jan 27 07:41:31 2018 New Revision: 328465 URL: https://svnweb.freebsd.org/changeset/base/328465 Log: ccp(4): Store IV in output buffer in GCM software fallback when requested Apply r328361 to duplicate copy of ccr_gcm_soft in ccp(4). Properly honor the lack of the CRD_F_IV_PRESENT flag in the GCM software fallback case for encryption requests. Modified: head/sys/crypto/ccp/ccp.c Modified: head/sys/crypto/ccp/ccp.c ============================================================================== --- head/sys/crypto/ccp/ccp.c Sat Jan 27 07:18:02 2018 (r328464) +++ head/sys/crypto/ccp/ccp.c Sat Jan 27 07:41:31 2018 (r328465) @@ -130,6 +130,9 @@ ccp_gcm_soft(struct ccp_session *s, struct cryptop *cr memcpy(iv, crde->crd_iv, 12); else arc4rand(iv, 12, 0); + if ((crde->crd_flags & CRD_F_IV_PRESENT) == 0) + crypto_copyback(crp->crp_flags, crp->crp_buf, + crde->crd_inject, 12, iv); } else { if (crde->crd_flags & CRD_F_IV_EXPLICIT) memcpy(iv, crde->crd_iv, 12); From owner-svn-src-all@freebsd.org Sat Jan 27 06:03:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54F78EDF07F; Sat, 27 Jan 2018 06:03:13 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-io0-f172.google.com (mail-io0-f172.google.com [209.85.223.172]) (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 DB4A078012; Sat, 27 Jan 2018 06:03:12 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-io0-f172.google.com with SMTP id 25so2609670ioj.9; Fri, 26 Jan 2018 22:03:12 -0800 (PST) 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=DflbTH1oLZuhHbUVDexamXBbf4iDhaG7GBxZIdrzu3k=; b=S3l3a++TS+iRSe6jj0PdE+O7zFk2C2Z4nU49EGHYgHdDhynN9wQUKqlmp+xC/+lqP2 uv74yiC9+EJNGcGPuKLazwTft9+1i8ll9TsF4kSjZDpzrnzUhGSSVbkx/b14XAWhEq4X MLAKEuLWwPXTZieuEr2Ofv8Tv2t4qBnB+dGulNErHJZKFzYGjmkbFrkuMJeqfQV/ggUx FS2tPvre/6QwwZHrkUJmiBmmr4lAYuO0CCPXMJrdHz98Js856mwBRz0R6rLmDQ32QU/8 TOliePEGdnwtDndtifAtymlJEyNl8162QBsU+3XFw8/XVvm0NH7GZ/jxm7dCdX3S4pGR nhGA== X-Gm-Message-State: AKwxytf9qexrO9/KEVHHM9nVYUXud0SGMzcTnseaYbvo2HP4H1oe4S/E DIr7DEsLs1j3JruEH0m2KxZ2HaiR X-Google-Smtp-Source: AH8x227tDPs3/oiWsKl6wzWwQZCuPpKnCugFUGJCEzQ67OBIqi/QZ/Kj7O3h7YnkNv1HYRbg3SsFeA== X-Received: by 10.107.52.73 with SMTP id b70mr19485400ioa.60.1517032986389; Fri, 26 Jan 2018 22:03:06 -0800 (PST) Received: from mail-it0-f52.google.com (mail-it0-f52.google.com. [209.85.214.52]) by smtp.gmail.com with ESMTPSA id h73sm2983409itb.21.2018.01.26.22.03.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 22:03:06 -0800 (PST) Received: by mail-it0-f52.google.com with SMTP id w14so4036932itc.3; Fri, 26 Jan 2018 22:03:05 -0800 (PST) X-Received: by 10.36.52.8 with SMTP id z8mr18646167itz.130.1517032985667; Fri, 26 Jan 2018 22:03:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.157.12 with HTTP; Fri, 26 Jan 2018 22:02:45 -0800 (PST) In-Reply-To: <201801262356.w0QNu796087146@repo.freebsd.org> References: <201801262356.w0QNu796087146@repo.freebsd.org> From: Kyle Evans Date: Sat, 27 Jan 2018 00:02:45 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328455 - in head/sys/cam: . scsi To: Scott Long 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.25 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: Sat, 27 Jan 2018 06:03:13 -0000 On Fri, Jan 26, 2018 at 5:56 PM, Scott Long wrote: > Author: scottl > Date: Fri Jan 26 23:56:07 2018 > New Revision: 328455 > URL: https://svnweb.freebsd.org/changeset/base/328455 > > Log: > Move CAM_PERIPH_PRINT() to cam_periph.h > > Modified: > head/sys/cam/cam_periph.h > head/sys/cam/scsi/scsi_da.c > Hi, This seems to have broken the build, because [1] still exists and conflicts with the definition now in cam_periph.h. See [2] for the build log. Thanks, Kyle Evans [1] https://svnweb.freebsd.org/base/head/sys/cam/scsi/scsi_da.c?view=markup&pathrev=328455#l1514 [2] https://ci.freebsd.org/job/FreeBSD-head-amd64-build/6960/console From owner-svn-src-all@freebsd.org Sat Jan 27 06:20:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30733EDFBA9; Sat, 27 Jan 2018 06:20:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D7C7378930; Sat, 27 Jan 2018 06:20:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2A9026916; Sat, 27 Jan 2018 06:20:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R6KRbn076425; Sat, 27 Jan 2018 06:20:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R6KR9p076424; Sat, 27 Jan 2018 06:20:27 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801270620.w0R6KR9p076424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 06:20: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: r328462 - stable/11/usr.bin/patch X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/patch X-SVN-Commit-Revision: 328462 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 06:20:28 -0000 Author: kevans Date: Sat Jan 27 06:20:27 2018 New Revision: 328462 URL: https://svnweb.freebsd.org/changeset/base/328462 Log: MFC r327826: patch(1): Don't check for NUL bytes in Plan A Plan A mmap()'s the entire input file and operates on it in memory. The map(2) call succeeded, so we shouldn't need to bother checking for the NUL byte as long as we're within our buffer space. This was clearly intentional to match "the behavior of the original code", but it creates a discrepancy between Plan A and Plan B that doesn't seem sensible and it's not inherently wrong to allow a NUL byte. This change was motivated by the gemspec in net/rubygem-grpc failing to patch, despite the patch being generated with diff, because a NUL byte was used as a delimiter in the header briefly in an otherwise text file. An alternative was considered: to fallback to plan B if plan A won't process the entire file due to a NUL byte, but I deemed this to be the better option since plan A isn't failing due to memory limitations and will fail later on if it's really dealing with a file it shouldn't be. Modified: stable/11/usr.bin/patch/inp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/patch/inp.c ============================================================================== --- stable/11/usr.bin/patch/inp.c Sat Jan 27 06:15:24 2018 (r328461) +++ stable/11/usr.bin/patch/inp.c Sat Jan 27 06:20:27 2018 (r328462) @@ -213,8 +213,11 @@ plan_a(const char *filename) /* now scan the buffer and build pointer array */ iline = 1; i_ptr[iline] = i_womp; - /* test for NUL too, to maintain the behavior of the original code */ - for (s = i_womp, i = 0; i < i_size && *s != '\0'; s++, i++) { + /* + * Testing for NUL here actively breaks files that innocently use NUL + * for other reasons. mmap(2) succeeded, just scan the whole buffer. + */ + for (s = i_womp, i = 0; i < i_size; s++, i++) { if (*s == '\n') { if (iline == lines_allocated) { if (!reallocate_lines(&lines_allocated)) From owner-svn-src-all@freebsd.org Sat Jan 27 07:18:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14313E64F24; Sat, 27 Jan 2018 07:18:03 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC8F67A39B; Sat, 27 Jan 2018 07:18:02 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1E3F272A7; Sat, 27 Jan 2018 07:18:02 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R7I2on006482; Sat, 27 Jan 2018 07:18:02 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R7I2Gv006481; Sat, 27 Jan 2018 07:18:02 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201801270718.w0R7I2Gv006481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sat, 27 Jan 2018 07:18:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328464 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 328464 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 07:18:03 -0000 Author: scottl Date: Sat Jan 27 07:18:02 2018 New Revision: 328464 URL: https://svnweb.freebsd.org/changeset/base/328464 Log: Finish the incomplete move of CAM_PERIPH_PRINT(). Reported by: kevans Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Sat Jan 27 06:31:14 2018 (r328463) +++ head/sys/cam/scsi/scsi_da.c Sat Jan 27 07:18:02 2018 (r328464) @@ -1510,8 +1510,10 @@ static const char *da_ref_text[] = { "max -- also bogus" }; +#define DA_PERIPH_PRINT(periph, msg, args...) \ + CAM_PERIPH_PRINT(periph, msg, ##args) #else -#define CAM_PERIPH_PRINT(p, msg, args...) +#define DA_PERIPH_PRINT(periph, msg, args...) #endif static inline void @@ -1527,7 +1529,7 @@ da_periph_hold(struct cam_periph *periph, int priority int err = cam_periph_hold(periph, priority); token_sanity(token); - CAM_PERIPH_PRINT(periph, "Holding device %s (%d): %d\n", + DA_PERIPH_PRINT(periph, "Holding device %s (%d): %d\n", da_ref_text[token], token, err); if (err == 0) { int cnt; @@ -1548,7 +1550,7 @@ da_periph_unhold(struct cam_periph *periph, da_ref_tok token_sanity(token); cam_periph_unhold(periph); - CAM_PERIPH_PRINT(periph, "Unholding device %s (%d)\n", + DA_PERIPH_PRINT(periph, "Unholding device %s (%d)\n", da_ref_text[token], token); cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1); if (cnt != 1) @@ -1561,7 +1563,7 @@ da_periph_acquire(struct cam_periph *periph, da_ref_to int err = cam_periph_acquire(periph); token_sanity(token); - CAM_PERIPH_PRINT(periph, "acquiring device %s (%d): %d\n", + DA_PERIPH_PRINT(periph, "acquiring device %s (%d): %d\n", da_ref_text[token], token, err); if (err == CAM_REQ_CMP) { int cnt; @@ -1582,7 +1584,7 @@ da_periph_release(struct cam_periph *periph, da_ref_to token_sanity(token); cam_periph_release(periph); - CAM_PERIPH_PRINT(periph, "releasing device %s (%d)\n", + DA_PERIPH_PRINT(periph, "releasing device %s (%d)\n", da_ref_text[token], token); cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1); if (cnt != 1) @@ -1597,7 +1599,7 @@ da_periph_release_locked(struct cam_periph *periph, da token_sanity(token); cam_periph_release_locked(periph); - CAM_PERIPH_PRINT(periph, "releasing device (locked) %s (%d)\n", + DA_PERIPH_PRINT(periph, "releasing device (locked) %s (%d)\n", da_ref_text[token], token); cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1); if (cnt != 1) From owner-svn-src-all@freebsd.org Sat Jan 27 09:49:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA64FE7B395; Sat, 27 Jan 2018 09:49:31 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (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 20B727F640; Sat, 27 Jan 2018 09:49:31 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wm0-x244.google.com with SMTP id 143so5485136wma.5; Sat, 27 Jan 2018 01:49:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=JSqZ7SGQFwW7SHzYm1RAepBQmpSqU09ZC/Rbsdu7t58=; b=Y/ZNIYut8yHvuKKZMTgiDDadnzAvNN2oglIUgcM3I7Bog/FDehdG6RN7+VVwbrhuTp n71gtyyudLfgSmTY6faVRTyUfDvHaAL0wl6XQ8Gulkt9l2DPzFn3vncAw4v3Ttp1If/W PH2gNixua+QL9EbABvAKinVsvBBLfh3He1F/BVQbDUpaQTTcuXmUi3h/FNvC3vHXaoMC p3wFVr2nmm36BG257YjxxkOzqdsTuyOYtsie9w92Bq6r4KSAr0fxfCtdTUTxBJxlMnbF PwYAv4vOBOYAILGSWI9D2hCMrY2KrZBWzJ/nwS6uMAboZjAhwvl7REnlE53nuIlCcmJZ W3JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=JSqZ7SGQFwW7SHzYm1RAepBQmpSqU09ZC/Rbsdu7t58=; b=J9m2mA3CwnCxKcMPUo2vEsUVcwKDopTdSe8Bs+p+FlfG+kU9/r94B5aXJ94Ppe2aBo qVRx3RlihNsYs0RzecZqDcit6tpWG8oT/typ389rggnUPknEEqPVAr+dl4ymSYL3EKLR uDyOCCeKkVIiOn2DyOijXOJhhfTBqYWluxY5ae/Xk5aujTj7kHMiiMYu6xA8UHwSYzVs R+XA9EoEUftKntFSmCupy/Iy72Kwsij+mplzfvY/QjYmVr5oYpf6/h9cFXgilvE4YFW8 MdNx6GlldEc4aRWQwyMbnmSWWZ8/kbHbelOT/ghJXjDohbX67efpDZBxjynzBwokZVnK GUug== X-Gm-Message-State: AKwxytfkG/7b+/Ezrx1v+R8AsJHz3EoKsctbbFjdLhhkEv5fZlATgoog yh42MAUSQ3ifo+VaM9GVO8xPsQ== X-Google-Smtp-Source: AH8x224cH/2/Y5JCKSnzSfZypUil5YbzOMuzPsv4cAyJpmKxGUpiX7AE3LIOB6k4mo3po/KE95dJ7A== X-Received: by 10.80.191.71 with SMTP id g7mr37933190edk.246.1517046569864; Sat, 27 Jan 2018 01:49:29 -0800 (PST) Received: from brick (cpc92302-cmbg19-2-0-cust461.5-4.cable.virginm.net. [82.1.209.206]) by smtp.gmail.com with ESMTPSA id b12sm3641768eda.81.2018.01.27.01.49.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Jan 2018 01:49:29 -0800 (PST) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Sat, 27 Jan 2018 09:49:26 +0000 From: Edward Tomasz Napierala To: Conrad Meyer Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328456 - head/share/man/man7 Message-ID: <20180127094926.GA14443@brick> Mail-Followup-To: Conrad Meyer , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801270009.w0R09hJK092045@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 09:49:31 -0000 Indeed - but that one has been documented earlier, in r326502, by markj@. On 0126T1633, Conrad Meyer wrote: > This isn't quite right — it's now located in src/stand. > > On Fri, Jan 26, 2018 at 4:09 PM, Edward Tomasz Napierala > wrote: > > Author: trasz > > Date: Sat Jan 27 00:09:43 2018 > > New Revision: 328456 > > URL: https://svnweb.freebsd.org/changeset/base/328456 > > > > Log: > > Remove mention of sys/boot/ from hier(7), it doesn't exist anymore. > > > > MFC after: 2 weeks > > > > Modified: > > head/share/man/man7/hier.7 > > > > Modified: head/share/man/man7/hier.7 > > ============================================================================== > > --- head/share/man/man7/hier.7 Fri Jan 26 23:56:07 2018 (r328455) > > +++ head/share/man/man7/hier.7 Sat Jan 27 00:09:43 2018 (r328456) > > @@ -28,7 +28,7 @@ > > .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 > > .\" $FreeBSD$ > > .\" > > -.Dd January 15, 2018 > > +.Dd January 27, 2018 > > .Dt HIER 7 > > .Os > > .Sh NAME > > @@ -660,8 +660,6 @@ AMD64 architecture support > > ARM architecture support > > .It Pa arm64/ > > ARMv8 architecture support > > -.It Pa boot/ > > -bootloader code > > .It Pa cam/ > > .Xr cam 4 > > and > > From owner-svn-src-all@freebsd.org Sat Jan 27 09:49:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8EDDE7B400; Sat, 27 Jan 2018 09:49:47 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9B6A67F75B; Sat, 27 Jan 2018 09:49:47 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 967ACB12; Sat, 27 Jan 2018 09:49:47 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R9nlCU080362; Sat, 27 Jan 2018 09:49:47 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R9nlIu080361; Sat, 27 Jan 2018 09:49:47 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201801270949.w0R9nlIu080361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 27 Jan 2018 09:49:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328466 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 328466 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 09:49:48 -0000 Author: mmel Date: Sat Jan 27 09:49:47 2018 New Revision: 328466 URL: https://svnweb.freebsd.org/changeset/base/328466 Log: Fix pmap_fault(). - special fault handling for break-before-make mechanism should be also applied for instruction translation faults, not only for data translation faults. - since arm64_address_translate_...() functions are not atomic, use these with disabled interrupts. Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sat Jan 27 07:41:31 2018 (r328465) +++ head/sys/arm64/arm64/pmap.c Sat Jan 27 09:49:47 2018 (r328466) @@ -4745,10 +4745,12 @@ int pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far) { #ifdef SMP + register_t intr; uint64_t par; -#endif switch (ESR_ELx_EXCEPTION(esr)) { + case EXCP_INSN_ABORT_L: + case EXCP_INSN_ABORT: case EXCP_DATA_ABORT_L: case EXCP_DATA_ABORT: break; @@ -4756,7 +4758,7 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far) return (KERN_FAILURE); } -#ifdef SMP + /* Data and insn aborts use same encoding for FCS field. */ PMAP_LOCK(pmap); switch (esr & ISS_DATA_DFSC_MASK) { case ISS_DATA_DFSC_TF_L0: @@ -4764,10 +4766,12 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far) case ISS_DATA_DFSC_TF_L2: case ISS_DATA_DFSC_TF_L3: /* Ask the MMU to check the address */ + intr = intr_disable(); if (pmap == kernel_pmap) par = arm64_address_translate_s1e1r(far); else par = arm64_address_translate_s1e0r(far); + intr_restore(intr); /* * If the translation was successful the address was invalid From owner-svn-src-all@freebsd.org Sat Jan 27 11:19:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16D5FE7F224; Sat, 27 Jan 2018 11:19:43 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BFECA830E2; Sat, 27 Jan 2018 11:19:42 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BAD2319C8; Sat, 27 Jan 2018 11:19:42 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RBJgI4027827; Sat, 27 Jan 2018 11:19:42 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RBJfD3027819; Sat, 27 Jan 2018 11:19:41 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201801271119.w0RBJfD3027819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 27 Jan 2018 11:19:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328467 - in head/sys/arm: arm include X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys/arm: arm include X-SVN-Commit-Revision: 328467 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 11:19:43 -0000 Author: mmel Date: Sat Jan 27 11:19:41 2018 New Revision: 328467 URL: https://svnweb.freebsd.org/changeset/base/328467 Log: Implement mitigation for Spectre version 2 attacks on ARMv7. Similarly as we already do for arm64, for mitigation is necessary to flush branch predictor when we: - do task switch - receive prefetch abort on non-userspace address The user can disable this mitigation by setting 'machdep.disable_bp_hardening' sysctl variable, or it can check actual system status by reading 'machdep.spectre_v2_safe' The situation is complicated by fact that: - for Cortex-A8, the BPIALL instruction is effectively NOP until the IBE bit in ACTLR is set. - for Cortex-A15, the BPIALL is always NOP. The branch predictor can be only flushed by doing ICIALLU with special bit (Enable invalidates of BTB) set in ACTLR. Since access to the ACTLR register is locked to secure monitor/firmware on most boards, they will also need update of firmware / U-boot. In worst case, when secure monitor is on-chip ROM (e.g. PandaBoard), the board is unfixable. MFC after: 2 weeks Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D13931 Modified: head/sys/arm/arm/cpuinfo.c head/sys/arm/arm/genassym.c head/sys/arm/arm/machdep.c head/sys/arm/arm/mp_machdep.c head/sys/arm/arm/swtch-v6.S head/sys/arm/arm/trap-v6.c head/sys/arm/include/cpuinfo.h head/sys/arm/include/pcpu.h Modified: head/sys/arm/arm/cpuinfo.c ============================================================================== --- head/sys/arm/arm/cpuinfo.c Sat Jan 27 09:49:47 2018 (r328466) +++ head/sys/arm/arm/cpuinfo.c Sat Jan 27 11:19:41 2018 (r328467) @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -40,6 +42,9 @@ __FBSDID("$FreeBSD$"); #if __ARM_ARCH >= 6 void reinit_mmu(uint32_t ttb, uint32_t aux_clr, uint32_t aux_set); + +int disable_bp_hardening; +int spectre_v2_safe = 1; #endif struct cpuinfo cpuinfo = @@ -255,6 +260,7 @@ cpuinfo_get_actlr_modifier(uint32_t *actlr_mask, uint3 if (cpuinfo.implementer == CPU_IMPLEMENTER_ARM) { switch (cpuinfo.part_number) { + case CPU_ARCH_CORTEX_A75: case CPU_ARCH_CORTEX_A73: case CPU_ARCH_CORTEX_A72: case CPU_ARCH_CORTEX_A57: @@ -337,5 +343,198 @@ cpuinfo_reinit_mmu(uint32_t ttb) actlr_set |= cpu_quirks_actlr_set; reinit_mmu(ttb, actlr_mask, actlr_set); } + +static bool +modify_actlr(uint32_t clear, uint32_t set) +{ + uint32_t reg, newreg; + + reg = cp15_actlr_get(); + newreg = reg; + newreg &= ~clear; + newreg |= set; + if (reg == newreg) + return (true); + cp15_actlr_set(newreg); + + reg = cp15_actlr_get(); + if (reg == newreg) + return (true); + return (false); +} + +/* Apply/restore BP hardening on current core. */ +static int +apply_bp_hardening(bool enable, int kind, bool actrl, uint32_t set_mask) +{ + if (enable) { + if (actrl && !modify_actlr(0, set_mask)) + return (-1); + PCPU_SET(bp_harden_kind, kind); + } else { + PCPU_SET(bp_harden_kind, PCPU_BP_HARDEN_KIND_NONE); + if (actrl) + modify_actlr(~0, PCPU_GET(original_actlr)); + spectre_v2_safe = 0; + } + return (0); +} + +static void +handle_bp_hardening(bool enable) +{ + int kind; + char *kind_str; + + kind = PCPU_BP_HARDEN_KIND_NONE; + /* + * Note: Access to ACTRL is locked to secure world on most boards. + * This means that full BP hardening depends on updated u-boot/firmware + * or is impossible at all (if secure monitor is in on-chip ROM). + */ + if (cpuinfo.implementer == CPU_IMPLEMENTER_ARM) { + switch (cpuinfo.part_number) { + case CPU_ARCH_CORTEX_A8: + /* + * For Cortex-A8, IBE bit must be set otherwise + * BPIALL is effectively NOP. + * Unfortunately, Cortex-A is also affected by + * ARM erratum 687067 which causes non-working + * BPIALL if IBE bit is set and 'Instruction L1 System + * Array Debug Register 0' is not 0. + * This register is not reset on power-up and is + * accessible only from secure world, so we cannot do + * nothing (nor detect) to fix this issue. + * I afraid that on chip ROM based secure monitor on + * AM335x (BeagleBone) doesn't reset this debug + * register. + */ + kind = PCPU_BP_HARDEN_KIND_BPIALL; + if (apply_bp_hardening(enable, kind, true, 1 << 6) != 0) + goto actlr_err; + break; + break; + + case CPU_ARCH_CORTEX_A9: + case CPU_ARCH_CORTEX_A12: + case CPU_ARCH_CORTEX_A17: + case CPU_ARCH_CORTEX_A57: + case CPU_ARCH_CORTEX_A72: + case CPU_ARCH_CORTEX_A73: + case CPU_ARCH_CORTEX_A75: + kind = PCPU_BP_HARDEN_KIND_BPIALL; + if (apply_bp_hardening(enable, kind, false, 0) != 0) + goto actlr_err; + break; + + case CPU_ARCH_CORTEX_A15: + /* + * For Cortex-A15, set 'Enable invalidates of BTB' bit. + * Despite this, the BPIALL is still effectively NOP, + * but with this bit set, the ICIALLU also flushes + * branch predictor as side effect. + */ + kind = PCPU_BP_HARDEN_KIND_ICIALLU; + if (apply_bp_hardening(enable, kind, true, 1 << 0) != 0) + goto actlr_err; + break; + + default: + break; + } + } else if (cpuinfo.implementer == CPU_IMPLEMENTER_QCOM) { + printf("!!!WARNING!!! CPU(%d) is vulnerable to speculative " + "branch attacks. !!!\n" + "Qualcomm Krait cores are known (or believed) to be " + "vulnerable to \n" + "speculative branch attacks, no mitigation exists yet.\n", + PCPU_GET(cpuid)); + goto unkonown_mitigation; + } else { + goto unkonown_mitigation; + } + + if (bootverbose) { + switch (kind) { + case PCPU_BP_HARDEN_KIND_NONE: + kind_str = "not necessary"; + break; + case PCPU_BP_HARDEN_KIND_BPIALL: + kind_str = "BPIALL"; + break; + case PCPU_BP_HARDEN_KIND_ICIALLU: + kind_str = "ICIALLU"; + break; + default: + panic("Unknown BP hardering kind (%d).", kind); + } + printf("CPU(%d) applied BP hardening: %s\n", PCPU_GET(cpuid), + kind_str); + } + + return; + +unkonown_mitigation: + PCPU_SET(bp_harden_kind, PCPU_BP_HARDEN_KIND_NONE); + spectre_v2_safe = 0; + return; + +actlr_err: + PCPU_SET(bp_harden_kind, PCPU_BP_HARDEN_KIND_NONE); + spectre_v2_safe = 0; + printf("!!!WARNING!!! CPU(%d) is vulnerable to speculative branch " + "attacks. !!!\n" + "We cannot enable required bit(s) in ACTRL register\n" + "because it's locked by secure monitor and/or firmware.\n", + PCPU_GET(cpuid)); +} + +void +cpuinfo_init_bp_hardening(void) +{ + + /* + * Store original unmodified ACTRL, so we can restore it when + * BP hardening is disabled by sysctl. + */ + PCPU_SET(original_actlr, cp15_actlr_get()); + handle_bp_hardening(true); +} + +static void +bp_hardening_action(void *arg) +{ + + handle_bp_hardening(disable_bp_hardening == 0); +} + +static int +sysctl_disable_bp_hardening(SYSCTL_HANDLER_ARGS) +{ + int rv; + + rv = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); + + if (!rv && req->newptr) { + spectre_v2_safe = 1; + dmb(); +#ifdef SMP + smp_rendezvous_cpus(all_cpus, smp_no_rendezvous_barrier, + bp_hardening_action, NULL, NULL); +#else + bp_hardening_action(NULL); +#endif + } + + return (rv); +} + +SYSCTL_PROC(_machdep, OID_AUTO, disable_bp_hardening, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + &disable_bp_hardening, 0, sysctl_disable_bp_hardening, "I", + "Disable BP hardening mitigation."); + +SYSCTL_INT(_machdep, OID_AUTO, spectre_v2_safe, CTLFLAG_RD, + &spectre_v2_safe, 0, "System is safe to Spectre Version 2 attacks"); #endif /* __ARM_ARCH >= 6 */ Modified: head/sys/arm/arm/genassym.c ============================================================================== --- head/sys/arm/arm/genassym.c Sat Jan 27 09:49:47 2018 (r328466) +++ head/sys/arm/arm/genassym.c Sat Jan 27 11:19:41 2018 (r328467) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -136,6 +137,10 @@ ASSYM(PCB_VFPSTATE, offsetof(struct pcb, pcb_vfpstate) #if __ARM_ARCH >= 6 ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap)); +ASSYM(PC_BP_HARDEN_KIND, offsetof(struct pcpu, pc_bp_harden_kind)); +ASSYM(PCPU_BP_HARDEN_KIND_NONE, PCPU_BP_HARDEN_KIND_NONE); +ASSYM(PCPU_BP_HARDEN_KIND_BPIALL, PCPU_BP_HARDEN_KIND_BPIALL); +ASSYM(PCPU_BP_HARDEN_KIND_ICIALLU, PCPU_BP_HARDEN_KIND_ICIALLU); #endif ASSYM(PAGE_SIZE, PAGE_SIZE); Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Sat Jan 27 09:49:47 2018 (r328466) +++ head/sys/arm/arm/machdep.c Sat Jan 27 11:19:41 2018 (r328467) @@ -1264,6 +1264,8 @@ initarm(struct arm_boot_params *abp) msgbufinit(msgbufp, msgbufsize); dbg_monitor_init(); kdb_init(); + /* Apply possible BP hardening. */ + cpuinfo_init_bp_hardening(); return ((void *)STACKALIGN(thread0.td_pcb)); } Modified: head/sys/arm/arm/mp_machdep.c ============================================================================== --- head/sys/arm/arm/mp_machdep.c Sat Jan 27 09:49:47 2018 (r328466) +++ head/sys/arm/arm/mp_machdep.c Sat Jan 27 11:19:41 2018 (r328467) @@ -201,6 +201,9 @@ init_secondary(int cpu) /* Configure the interrupt controller */ intr_pic_init_secondary(); + /* Apply possible BP hardening */ + cpuinfo_init_bp_hardening(); + mtx_lock_spin(&ap_boot_mtx); atomic_add_rel_32(&smp_cpus, 1); Modified: head/sys/arm/arm/swtch-v6.S ============================================================================== --- head/sys/arm/arm/swtch-v6.S Sat Jan 27 09:49:47 2018 (r328466) +++ head/sys/arm/arm/swtch-v6.S Sat Jan 27 11:19:41 2018 (r328467) @@ -145,7 +145,16 @@ ENTRY(cpu_context_switch) * predictors and Requirements for branch predictor maintenance * operations sections. */ - mcr CP15_BPIALL /* flush entire Branch Target Cache */ + /* + * Additionally, to mitigate mistrained branch predictor attack + * we must invalidate it on affected CPUs. Unfortunately, BPIALL + * is effectively NOP on Cortex-A15 so it needs special treatment. + */ + ldr r0, [r8, #PC_BP_HARDEN_KIND] + cmp r0, #PCPU_BP_HARDEN_KIND_ICIALLU + mcrne CP15_BPIALL /* Flush entire Branch Target Cache */ + mcreq CP15_ICIALLU /* This is the only way how to flush */ + /* Branch Target Cache on Cortex-A15. */ DSB mov pc, lr END(cpu_context_switch) Modified: head/sys/arm/arm/trap-v6.c ============================================================================== --- head/sys/arm/arm/trap-v6.c Sat Jan 27 09:49:47 2018 (r328466) +++ head/sys/arm/arm/trap-v6.c Sat Jan 27 11:19:41 2018 (r328467) @@ -287,6 +287,7 @@ abort_handler(struct trapframe *tf, int prefetch) struct vmspace *vm; vm_prot_t ftype; bool usermode; + int bp_harden; #ifdef INVARIANTS void *onfault; #endif @@ -303,6 +304,20 @@ abort_handler(struct trapframe *tf, int prefetch) idx = FSR_TO_FAULT(fsr); usermode = TRAPF_USERMODE(tf); /* Abort came from user mode? */ + + /* + * Apply BP hardening by flushing the branch prediction cache + * for prefaults on kernel addresses. + */ + if (__predict_false(prefetch && far > VM_MAXUSER_ADDRESS && + (idx == FAULT_TRAN_L2 || idx == FAULT_PERM_L2))) { + bp_harden = PCPU_GET(bp_harden_kind); + if (bp_harden == PCPU_BP_HARDEN_KIND_BPIALL) + _CP15_BPIALL(); + else if (bp_harden == PCPU_BP_HARDEN_KIND_ICIALLU) + _CP15_ICIALLU(); + } + if (usermode) td->td_frame = tf; Modified: head/sys/arm/include/cpuinfo.h ============================================================================== --- head/sys/arm/include/cpuinfo.h Sat Jan 27 09:49:47 2018 (r328466) +++ head/sys/arm/include/cpuinfo.h Sat Jan 27 11:19:41 2018 (r328467) @@ -49,6 +49,7 @@ #define CPU_ARCH_CORTEX_A57 0xD07 #define CPU_ARCH_CORTEX_A72 0xD08 #define CPU_ARCH_CORTEX_A73 0xD09 +#define CPU_ARCH_CORTEX_A75 0xD0A /* QCOM */ @@ -125,6 +126,7 @@ extern struct cpuinfo cpuinfo; void cpuinfo_init(void); #if __ARM_ARCH >= 6 +void cpuinfo_init_bp_hardening(void); void cpuinfo_reinit_mmu(uint32_t ttb); #endif #endif /* _MACHINE_CPUINFO_H_ */ Modified: head/sys/arm/include/pcpu.h ============================================================================== --- head/sys/arm/include/pcpu.h Sat Jan 27 09:49:47 2018 (r328466) +++ head/sys/arm/include/pcpu.h Sat Jan 27 11:19:41 2018 (r328467) @@ -44,6 +44,10 @@ struct vmspace; #endif /* _KERNEL */ #if __ARM_ARCH >= 6 +/* Branch predictor hardening method */ +#define PCPU_BP_HARDEN_KIND_NONE 0 +#define PCPU_BP_HARDEN_KIND_BPIALL 1 +#define PCPU_BP_HARDEN_KIND_ICIALLU 2 #define PCPU_MD_FIELDS \ unsigned int pc_vfpsid; \ @@ -59,7 +63,9 @@ struct vmspace; void *pc_qmap_pte2p; \ unsigned int pc_dbreg[32]; \ int pc_dbreg_cmd; \ - char __pad[155] + int pc_bp_harden_kind; \ + uint32_t pc_original_actlr; \ + char __pad[147] #else #define PCPU_MD_FIELDS \ char __pad[93] From owner-svn-src-all@freebsd.org Sat Jan 27 11:33:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02A09E7FB27; Sat, 27 Jan 2018 11:33:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9AA3D8398F; Sat, 27 Jan 2018 11:33:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FF181D09; Sat, 27 Jan 2018 11:33:21 +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 w0RBXL3u037451; Sat, 27 Jan 2018 11:33:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RBXLqs037450; Sat, 27 Jan 2018 11:33:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801271133.w0RBXLqs037450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 27 Jan 2018 11:33:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328468 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 328468 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 11:33:22 -0000 Author: kib Date: Sat Jan 27 11:33:21 2018 New Revision: 328468 URL: https://svnweb.freebsd.org/changeset/base/328468 Log: Fix native_lapic_ipi_alloc(). When PTI is enabled, empty IDT slots point to rsvd_pti. Reported by: Dexuan-BSD Cui Sponsored by: The FreeBSD Foundation MFC after: 5 days Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Sat Jan 27 11:19:41 2018 (r328467) +++ head/sys/x86/x86/local_apic.c Sat Jan 27 11:33:21 2018 (r328468) @@ -2117,7 +2117,8 @@ native_lapic_ipi_alloc(inthand_t *ipifunc) for (idx = IPI_DYN_FIRST; idx <= IPI_DYN_LAST; idx++) { ip = &idt[idx]; func = (ip->gd_hioffset << 16) | ip->gd_looffset; - if (func == (uintptr_t)&IDTVEC(rsvd)) { + if ((!pti && func == (uintptr_t)&IDTVEC(rsvd)) || + (pti && func == (uintptr_t)&IDTVEC(rsvd_pti))) { vector = idx; setidt(vector, ipifunc, SDT_APIC, SEL_KPL, GSEL_APIC); break; From owner-svn-src-all@freebsd.org Sat Jan 27 11:40:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8C03EB62AE; Sat, 27 Jan 2018 11:40:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B79C841B5; Sat, 27 Jan 2018 11:40: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 867141D27; Sat, 27 Jan 2018 11:40:46 +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 w0RBek6X039184; Sat, 27 Jan 2018 11:40:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RBek2K039181; Sat, 27 Jan 2018 11:40:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801271140.w0RBek2K039181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 27 Jan 2018 11:40: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: r328469 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 328469 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 11:40:47 -0000 Author: kib Date: Sat Jan 27 11:40:46 2018 New Revision: 328469 URL: https://svnweb.freebsd.org/changeset/base/328469 Log: MFC r328192: Assign map->header values to avoid boundary checks. Modified: stable/11/sys/vm/vm_map.c stable/11/sys/vm/vm_map.h stable/11/sys/vm/vm_mmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_map.c ============================================================================== --- stable/11/sys/vm/vm_map.c Sat Jan 27 11:33:21 2018 (r328468) +++ stable/11/sys/vm/vm_map.c Sat Jan 27 11:40:46 2018 (r328469) @@ -998,12 +998,10 @@ vm_map_entry_link(vm_map_t map, "vm_map_entry_link: map %p, nentries %d, entry %p, after %p", map, map->nentries, entry, after_where); VM_MAP_ASSERT_LOCKED(map); - KASSERT(after_where == &map->header || - after_where->end <= entry->start, + KASSERT(after_where->end <= entry->start, ("vm_map_entry_link: prev end %jx new start %jx overlap", (uintmax_t)after_where->end, (uintmax_t)entry->start)); - KASSERT(after_where->next == &map->header || - entry->end <= after_where->next->start, + KASSERT(entry->end <= after_where->next->start, ("vm_map_entry_link: new end %jx next start %jx overlap", (uintmax_t)entry->end, (uintmax_t)after_where->next->start)); @@ -1025,8 +1023,7 @@ vm_map_entry_link(vm_map_t map, entry->right = map->root; entry->left = NULL; } - entry->adj_free = (entry->next == &map->header ? map->max_offset : - entry->next->start) - entry->end; + entry->adj_free = entry->next->start - entry->end; vm_map_entry_set_max_free(entry); map->root = entry; } @@ -1045,8 +1042,7 @@ vm_map_entry_unlink(vm_map_t map, else { root = vm_map_entry_splay(entry->start, entry->left); root->right = entry->right; - root->adj_free = (entry->next == &map->header ? map->max_offset : - entry->next->start) - root->end; + root->adj_free = entry->next->start - root->end; vm_map_entry_set_max_free(root); } map->root = root; @@ -1082,8 +1078,7 @@ vm_map_entry_resize_free(vm_map_t map, vm_map_entry_t if (entry != map->root) map->root = vm_map_entry_splay(entry->start, map->root); - entry->adj_free = (entry->next == &map->header ? map->max_offset : - entry->next->start) - entry->end; + entry->adj_free = entry->next->start - entry->end; vm_map_entry_set_max_free(entry); } @@ -1213,7 +1208,7 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof /* * Assert that the next entry doesn't overlap the end point. */ - if (prev_entry->next != &map->header && prev_entry->next->start < end) + if (prev_entry->next->start < end) return (KERN_NO_SPACE); if ((cow & MAP_CREATE_GUARD) != 0 && (object != NULL || @@ -2032,8 +2027,7 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off /* * Make a first pass to check for protection violations. */ - for (current = entry; current != &map->header && current->start < end; - current = current->next) { + for (current = entry; current->start < end; current = current->next) { if ((current->eflags & MAP_ENTRY_GUARD) != 0) continue; if (current->eflags & MAP_ENTRY_IS_SUB_MAP) { @@ -2051,8 +2045,7 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off * now will do cow due to allowed write (e.g. debugger sets * breakpoint on text segment) */ - for (current = entry; current != &map->header && current->start < end; - current = current->next) { + for (current = entry; current->start < end; current = current->next) { vm_map_clip_end(map, current, end); @@ -2106,8 +2099,7 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off * Go back and fix up protections. [Note that clipping is not * necessary the second time.] */ - for (current = entry; current != &map->header && current->start < end; - current = current->next) { + for (current = entry; current->start < end; current = current->next) { if ((current->eflags & MAP_ENTRY_GUARD) != 0) continue; @@ -2216,10 +2208,8 @@ vm_map_madvise( * We clip the vm_map_entry so that behavioral changes are * limited to the specified address range. */ - for (current = entry; - (current != &map->header) && (current->start < end); - current = current->next - ) { + for (current = entry; current->start < end; + current = current->next) { if (current->eflags & MAP_ENTRY_IS_SUB_MAP) continue; @@ -2263,10 +2253,8 @@ vm_map_madvise( * Since we don't clip the vm_map_entry, we have to clip * the vm_object pindex and count. */ - for (current = entry; - (current != &map->header) && (current->start < end); - current = current->next - ) { + for (current = entry; current->start < end; + current = current->next) { vm_offset_t useEnd, useStart; if (current->eflags & MAP_ENTRY_IS_SUB_MAP) @@ -2362,7 +2350,7 @@ vm_map_inherit(vm_map_t map, vm_offset_t start, vm_off vm_map_clip_start(map, entry, start); } else entry = temp_entry->next; - while ((entry != &map->header) && (entry->start < end)) { + while (entry->start < end) { vm_map_clip_end(map, entry, end); if ((entry->eflags & MAP_ENTRY_GUARD) == 0 || new_inheritance != VM_INHERIT_ZERO) @@ -2404,7 +2392,7 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs } last_timestamp = map->timestamp; entry = first_entry; - while (entry != &map->header && entry->start < end) { + while (entry->start < end) { if (entry->eflags & MAP_ENTRY_IN_TRANSITION) { /* * We have not yet clipped the entry. @@ -2467,8 +2455,7 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs * If VM_MAP_WIRE_HOLESOK was specified, skip this check. */ if (((flags & VM_MAP_WIRE_HOLESOK) == 0) && - (entry->end < end && (entry->next == &map->header || - entry->next->start > entry->end))) { + (entry->end < end && entry->next->start > entry->end)) { end = entry->end; rv = KERN_INVALID_ADDRESS; goto done; @@ -2494,8 +2481,7 @@ done: else KASSERT(result, ("vm_map_unwire: lookup failed")); } - for (entry = first_entry; entry != &map->header && entry->start < end; - entry = entry->next) { + for (entry = first_entry; entry->start < end; entry = entry->next) { /* * If VM_MAP_WIRE_HOLESOK was specified, an empty * space in the unwired region could have been mapped @@ -2609,7 +2595,7 @@ vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset } last_timestamp = map->timestamp; entry = first_entry; - while (entry != &map->header && entry->start < end) { + while (entry->start < end) { if (entry->eflags & MAP_ENTRY_IN_TRANSITION) { /* * We have not yet clipped the entry. @@ -2746,8 +2732,7 @@ vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset */ next_entry: if ((flags & VM_MAP_WIRE_HOLESOK) == 0 && - entry->end < end && (entry->next == &map->header || - entry->next->start > entry->end)) { + entry->end < end && entry->next->start > entry->end) { end = entry->end; rv = KERN_INVALID_ADDRESS; goto done; @@ -2764,8 +2749,7 @@ done: else KASSERT(result, ("vm_map_wire: lookup failed")); } - for (entry = first_entry; entry != &map->header && entry->start < end; - entry = entry->next) { + for (entry = first_entry; entry->start < end; entry = entry->next) { /* * If VM_MAP_WIRE_HOLESOK was specified, an empty * space in the unwired region could have been mapped @@ -2869,15 +2853,13 @@ vm_map_sync( /* * Make a first pass to check for user-wired memory and holes. */ - for (current = entry; current != &map->header && current->start < end; - current = current->next) { + for (current = entry; current->start < end; current = current->next) { if (invalidate && (current->eflags & MAP_ENTRY_USER_WIRED)) { vm_map_unlock_read(map); return (KERN_INVALID_ARGUMENT); } if (end > current->end && - (current->next == &map->header || - current->end != current->next->start)) { + current->end != current->next->start) { vm_map_unlock_read(map); return (KERN_INVALID_ADDRESS); } @@ -2891,7 +2873,7 @@ vm_map_sync( * Make a second pass, cleaning/uncaching pages from the indicated * objects as we go. */ - for (current = entry; current != &map->header && current->start < end;) { + for (current = entry; current->start < end;) { offset = current->offset + (start - current->start); size = (end <= current->end ? end : current->end) - start; if (current->eflags & MAP_ENTRY_IS_SUB_MAP) { @@ -3068,7 +3050,7 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offs /* * Step through all entries in this region */ - while ((entry != &map->header) && (entry->start < end)) { + while (entry->start < end) { vm_map_entry_t next; /* @@ -3176,8 +3158,6 @@ vm_map_check_protection(vm_map_t map, vm_offset_t star entry = tmp_entry; while (start < end) { - if (entry == &map->header) - return (FALSE); /* * No holes allowed! */ @@ -3641,8 +3621,7 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, /* * If we can't accommodate max_ssize in the current mapping, no go. */ - if ((prev_entry->next != &map->header) && - (prev_entry->next->start < addrbos + max_ssize)) + if (prev_entry->next->start < addrbos + max_ssize) return (KERN_NO_SPACE); /* Modified: stable/11/sys/vm/vm_map.h ============================================================================== --- stable/11/sys/vm/vm_map.h Sat Jan 27 11:33:21 2018 (r328468) +++ stable/11/sys/vm/vm_map.h Sat Jan 27 11:40:46 2018 (r328469) @@ -172,15 +172,19 @@ vm_map_entry_system_wired_count(vm_map_entry_t entry) * A map is a set of map entries. These map entries are * organized both as a binary search tree and as a doubly-linked * list. Both structures are ordered based upon the start and - * end addresses contained within each map entry. Sleator and - * Tarjan's top-down splay algorithm is employed to control - * height imbalance in the binary search tree. + * end addresses contained within each map entry. The list + * header has max start value and min end value to act as + * sentinels for sequential search of the doubly-linked list. + * Sleator and Tarjan's top-down splay algorithm is employed to + * control height imbalance in the binary search tree. * * List of locks * (c) const until freed */ struct vm_map { struct vm_map_entry header; /* List of entries */ +#define min_offset header.end /* (c) */ +#define max_offset header.start /* (c) */ struct sx lock; /* Lock for map data */ struct mtx system_mtx; int nentries; /* Number of entries */ @@ -191,8 +195,6 @@ struct vm_map { vm_flags_t flags; /* flags for this vm_map */ vm_map_entry_t root; /* Root of a binary search tree */ pmap_t pmap; /* (c) Physical map */ -#define min_offset header.start /* (c) */ -#define max_offset header.end /* (c) */ int busy; }; Modified: stable/11/sys/vm/vm_mmap.c ============================================================================== --- stable/11/sys/vm/vm_mmap.c Sat Jan 27 11:33:21 2018 (r328468) +++ stable/11/sys/vm/vm_mmap.c Sat Jan 27 11:40:46 2018 (r328469) @@ -541,8 +541,7 @@ kern_munmap(struct thread *td, uintptr_t addr0, size_t */ pkm.pm_address = (uintptr_t) NULL; if (vm_map_lookup_entry(map, addr, &entry)) { - for (; - entry != &map->header && entry->start < addr + size; + for (; entry->start < addr + size; entry = entry->next) { if (vm_map_check_protection(map, entry->start, entry->end, VM_PROT_EXECUTE) == TRUE) { @@ -768,16 +767,12 @@ RestartScan: * up the pages elsewhere. */ lastvecindex = -1; - for (current = entry; - (current != &map->header) && (current->start < end); - current = current->next) { + for (current = entry; current->start < end; current = current->next) { /* * check for contiguity */ - if (current->end < end && - (entry->next == &map->header || - current->next->start > current->end)) { + if (current->end < end && current->next->start > current->end) { vm_map_unlock_read(map); return (ENOMEM); } From owner-svn-src-all@freebsd.org Sat Jan 27 08:56:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D800E7838F; Sat, 27 Jan 2018 08:56:51 +0000 (UTC) (envelope-from dexuan.bsd@gmail.com) Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) (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 67C997D6F6; Sat, 27 Jan 2018 08:56:50 +0000 (UTC) (envelope-from dexuan.bsd@gmail.com) Received: by mail-lf0-x243.google.com with SMTP id q194so3478789lfe.13; Sat, 27 Jan 2018 00:56:50 -0800 (PST) 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=zuOKqYpQcJL96POoQudADaOQp/x9tezPqtDsSk/AF88=; b=kxNyiBAYwTySRmZIfpOTt2OPAKaWVzhICF7BxhjQa7mlWiLRe5nGf6SOSufhzwHy8Y r472bvlVEZJiQdJ2yI9sPerE4UwtwG3Kkf9lUcCpADZibe9BWGv04pA8aB/QiQxG+AML nlP5aq7nN7Vum8U+/3I4biLvVqVe/s78d8XCsDyOQ8rZCQwz6EJfsGAK2U3LuU3jxpVn dMSB7FxA6I/M2jWnFsXuxI9rclG6b4Fp+Fwm+gSc1JwEy1DeqXa5nx05io4B2oZkHzGz dxpIqHsi4twxjIUIIrhhHa7sctBnv/+RgDaqNlP87OeS9glZC08RUJfv+/9lAFBOue/R s0QA== 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=zuOKqYpQcJL96POoQudADaOQp/x9tezPqtDsSk/AF88=; b=rvu6L2ShPzCybq5KGPhrUBKOA2c+iM46WhW+3R/zO865q/Kv4EYR8Nz11ePj+Tl/SM XnKoT4kQ7VSHxrlXzyzIUs7N0D8AyLVxOE2z6b5JpnXrlbR+yIo2ivN0yZUAJS2cZxrl bEPK3kEpomK1T6PRedWWN2muqa8mbGkESMFyk9ZRL536cn4raHHX5vAtnDQoVjxH9PBl 8Kw+Svbp7RvaObonJ3/N+D/vk2+lYF+4IsiEIjU6FaXhngOBSmg4k+hD1Xa2Ubchv/XO 1cEjvw8M6RAXj/ujkaX/vCMCuM6mVKLtQoM8CML/+4h595vvLuWDpDg0dfEolS0UyzHY raKg== X-Gm-Message-State: AKwxytfyUWeuTRLF/f5qMnn+9BVMj2RCwSB/2NmgqKClV456mDuWJnOK lSHvgSOeZtc4p/4grY3fWXaFckOjKWDO9bcFO6SGHmAf X-Google-Smtp-Source: AH8x224rVqXpTQrPksGb30vokvownXnfSGCVNpSnssf6uV7Rx9DemXL4ijKTIZ5o/Slwz1nE19kbOxC46DQBdu/kwBc= X-Received: by 10.46.65.154 with SMTP id d26mr3934341ljf.109.1517043408230; Sat, 27 Jan 2018 00:56:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.228.148 with HTTP; Sat, 27 Jan 2018 00:56:47 -0800 (PST) In-Reply-To: <201801191542.w0JFgY1Q070919@repo.freebsd.org> References: <201801191542.w0JFgY1Q070919@repo.freebsd.org> From: Dexuan-BSD Cui Date: Sat, 27 Jan 2018 00:56:47 -0800 Message-ID: Subject: Re: svn commit: r328166 - in head/sys: amd64/amd64 x86/include x86/x86 To: Ed Maste , markj@freebsd.org, kib@freebsd.org, cem@freebsd.org, mhorne063@gmail.com, gordon@freebsd.org, pho@freebsd.org, jeff@freebsd.org, jhb@freebsd.org, nullius@nym.zone, decui@microsoft.com, sephe@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Mailman-Approved-At: Sat, 27 Jan 2018 11:46:02 +0000 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 08:56:51 -0000 Hi, Today I found the KPTI patch broke FreeBSD VM running on Hyper-V: the VM can't boot due to: vmbus0: cannot find free IDT vector This is the related snippet: dev/hyperv/vmbus/vmbus.c: vmbus_intr_setup() -> lapic_ipi_alloc() fails: /* * All Hyper-V ISR required resources are setup, now let's find a * free IDT vector for Hyper-V ISR and set it up. */ sc->vmbus_idtvec = lapic_ipi_alloc(pti ? IDTVEC(vmbus_isr_pti) : IDTVEC(vmbus_isr)); if (sc->vmbus_idtvec < 0) { device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); return ENXIO; } Luckily for now I can work around this boot failure by adding vm.pmap.pti=0 into /boot/loader.conf. Any suggestion? Thanks! -- Dexuan On Fri, Jan 19, 2018 at 7:42 AM, Ed Maste wrote: > Author: emaste > Date: Fri Jan 19 15:42:34 2018 > New Revision: 328166 > URL: https://svnweb.freebsd.org/changeset/base/328166 > > Log: > Enable KPTI by default on amd64 for non-AMD CPUs > > Kernel Page Table Isolation (KPTI) was introduced in r328083 as a > mitigation for the 'Meltdown' vulnerability. AMD CPUs are not affected, > per https://www.amd.com/en/corporate/speculative-execution: > > We believe AMD processors are not susceptible due to our use of > privilege level protections within paging architecture and no > mitigation is required. > > Thus default KPTI to off for AMD CPUs, and to on for others. This may > be refined later as we obtain more specific information on the sets of > CPUs that are and are not affected. > > Submitted by: Mitchell Horne > Reviewed by: cem > Relnotes: Yes > Security: CVE-2017-5754 > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D13971 > > Modified: > head/sys/amd64/amd64/machdep.c > head/sys/x86/include/x86_var.h > head/sys/x86/x86/identcpu.c > > Modified: head/sys/amd64/amd64/machdep.c > ============================================================ > ================== > --- head/sys/amd64/amd64/machdep.c Fri Jan 19 15:32:27 2018 > (r328165) > +++ head/sys/amd64/amd64/machdep.c Fri Jan 19 15:42:34 2018 > (r328166) > @@ -1621,6 +1621,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > mtx_init(&dt_lock, "descriptor tables", NULL, MTX_DEF); > > /* exceptions */ > + pti = pti_get_default(); > TUNABLE_INT_FETCH("vm.pmap.pti", &pti); > > for (x = 0; x < NIDT; x++) > > Modified: head/sys/x86/include/x86_var.h > ============================================================ > ================== > --- head/sys/x86/include/x86_var.h Fri Jan 19 15:32:27 2018 > (r328165) > +++ head/sys/x86/include/x86_var.h Fri Jan 19 15:42:34 2018 > (r328166) > @@ -136,6 +136,7 @@ void nmi_call_kdb_smp(u_int type, struct > trapframe *fr > void nmi_handle_intr(u_int type, struct trapframe *frame); > void pagecopy(void *from, void *to); > void printcpuinfo(void); > +int pti_get_default(void); > int user_dbreg_trap(void); > int minidumpsys(struct dumperinfo *); > struct pcb *get_pcb_td(struct thread *td); > > Modified: head/sys/x86/x86/identcpu.c > ============================================================ > ================== > --- head/sys/x86/x86/identcpu.c Fri Jan 19 15:32:27 2018 (r328165) > +++ head/sys/x86/x86/identcpu.c Fri Jan 19 15:42:34 2018 (r328166) > @@ -1608,6 +1608,16 @@ finishidentcpu(void) > #endif > } > > +int > +pti_get_default(void) > +{ > + > + if (strcmp(cpu_vendor, AMD_VENDOR_ID) == 0) > + return (0); > + > + return (1); > +} > + > static u_int > find_cpu_vendor_id(void) > { > > From owner-svn-src-all@freebsd.org Sat Jan 27 11:34:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D604DE7FBBC for ; Sat, 27 Jan 2018 11:34:08 +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 1CAB383BAC for ; Sat, 27 Jan 2018 11:34:07 +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 w0RBXmZt007848 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 27 Jan 2018 13:33:51 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w0RBXmZt007848 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w0RBXmlN007847; Sat, 27 Jan 2018 13:33:48 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 27 Jan 2018 13:33:48 +0200 From: Konstantin Belousov To: Dexuan-BSD Cui Cc: Ed Maste , markj@freebsd.org, cem@freebsd.org, mhorne063@gmail.com, gordon@freebsd.org, pho@freebsd.org, jeff@freebsd.org, jhb@freebsd.org, nullius@nym.zone, decui@microsoft.com, sephe@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328166 - in head/sys: amd64/amd64 x86/include x86/x86 Message-ID: <20180127113348.GY55707@kib.kiev.ua> References: <201801191542.w0JFgY1Q070919@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) 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-Mailman-Approved-At: Sat, 27 Jan 2018 11:46:17 +0000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 11:34:09 -0000 On Sat, Jan 27, 2018 at 12:56:47AM -0800, Dexuan-BSD Cui wrote: > Hi, > Today I found the KPTI patch broke FreeBSD VM running on Hyper-V: the VM > can't boot due to: > > vmbus0: cannot find free IDT vector > > This is the related snippet: > > dev/hyperv/vmbus/vmbus.c: vmbus_intr_setup() -> lapic_ipi_alloc() fails: > > /* > * All Hyper-V ISR required resources are setup, now let's find a > * free IDT vector for Hyper-V ISR and set it up. > */ > sc->vmbus_idtvec = lapic_ipi_alloc(pti ? IDTVEC(vmbus_isr_pti) : > IDTVEC(vmbus_isr)); > if (sc->vmbus_idtvec < 0) { > device_printf(sc->vmbus_dev, "cannot find free IDT > vector\n"); > return ENXIO; > } > > Luckily for now I can work around this boot failure by adding vm.pmap.pti=0 > into /boot/loader.conf. > > Any suggestion? Try r328468. From owner-svn-src-all@freebsd.org Sat Jan 27 11:49:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9399CEB6A30; Sat, 27 Jan 2018 11:49:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F07184756; Sat, 27 Jan 2018 11:49:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 340D11EA5; Sat, 27 Jan 2018 11:49:39 +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 w0RBncol043367; Sat, 27 Jan 2018 11:49:38 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RBncdL043357; Sat, 27 Jan 2018 11:49:38 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801271149.w0RBncdL043357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 27 Jan 2018 11:49:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328470 - in head/sys: amd64/amd64 amd64/include i386/i386 x86/include x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include i386/i386 x86/include x86/x86 X-SVN-Commit-Revision: 328470 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 11:49:40 -0000 Author: kib Date: Sat Jan 27 11:49:37 2018 New Revision: 328470 URL: https://svnweb.freebsd.org/changeset/base/328470 Log: Use PCID to optimize PTI. Use PCID to avoid complete TLB shootdown when switching between user and kernel mode with PTI enabled. I use the model close to what I read about KAISER, user-mode PCID has 1:1 correspondence to the kernel-mode PCID, by setting bit 11 in PCID. Full kernel-mode TLB shootdown is performed on context switches, since KVA TLB invalidation only works in the current pmap. User-mode part of TLB is flushed on the pmap activations as well. Similarly, IPI TLB shootdowns must handle both kernel and user address spaces for each address. Note that machines which implement PCID but do not have INVPCID instructions, cause the usual complications in the IPI handlers, due to the need to switch to the target PCID temporary. This is racy, but because for PCID/no-INVPCID we disable the interrupts in pmap_activate_sw(), IPI handler cannot see inconsistent state of CPU PCID vs PCPU pmap/kcr3/ucr3 pointers. On the other hand, on kernel/user switches, CR3_PCID_SAVE bit is set and we do not clear TLB. I can imagine alternative use of PCID, where there is only one PCID allocated for the kernel pmap. Then, there is no need to shootdown kernel TLB entries on context switch. But copyout(3) would need to either use method similar to proc_rwmem() to access the userspace data, or (in reverse) provide a temporal mapping for the kernel buffer into user mode PCID and use trampoline for copy. Reviewed by: markj (previous version) Tested by: pho Discussed with: alc (some aspects) Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D13985 Modified: head/sys/amd64/amd64/apic_vector.S head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/pmap.c head/sys/amd64/amd64/support.S head/sys/amd64/include/pmap.h head/sys/amd64/include/smp.h head/sys/i386/i386/pmap.c head/sys/i386/i386/vm_machdep.c head/sys/x86/include/x86_smp.h head/sys/x86/x86/mp_x86.c Modified: head/sys/amd64/amd64/apic_vector.S ============================================================================== --- head/sys/amd64/amd64/apic_vector.S Sat Jan 27 11:40:46 2018 (r328469) +++ head/sys/amd64/amd64/apic_vector.S Sat Jan 27 11:49:37 2018 (r328470) @@ -184,10 +184,14 @@ invltlb_ret: call invltlb_pcid_handler jmp invltlb_ret - INTR_HANDLER invltlb_invpcid + INTR_HANDLER invltlb_invpcid_nopti call invltlb_invpcid_handler jmp invltlb_ret + INTR_HANDLER invltlb_invpcid_pti + call invltlb_invpcid_pti_handler + jmp invltlb_ret + /* * Single page TLB shootdown */ @@ -195,11 +199,27 @@ invltlb_ret: call invlpg_handler jmp invltlb_ret + INTR_HANDLER invlpg_invpcid + call invlpg_invpcid_handler + jmp invltlb_ret + + INTR_HANDLER invlpg_pcid + call invlpg_pcid_handler + jmp invltlb_ret + /* * Page range TLB shootdown. */ INTR_HANDLER invlrng call invlrng_handler + jmp invltlb_ret + + INTR_HANDLER invlrng_invpcid + call invlrng_invpcid_handler + jmp invltlb_ret + + INTR_HANDLER invlrng_pcid + call invlrng_pcid_handler jmp invltlb_ret /* Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Sat Jan 27 11:40:46 2018 (r328469) +++ head/sys/amd64/amd64/mp_machdep.c Sat Jan 27 11:49:37 2018 (r328470) @@ -133,20 +133,30 @@ cpu_mp_start(void) /* Install an inter-CPU IPI for TLB invalidation */ if (pmap_pcid_enabled) { if (invpcid_works) { - setidt(IPI_INVLTLB, pti ? IDTVEC(invltlb_invpcid_pti) : - IDTVEC(invltlb_invpcid), SDT_SYSIGT, SEL_KPL, 0); + setidt(IPI_INVLTLB, pti ? + IDTVEC(invltlb_invpcid_pti_pti) : + IDTVEC(invltlb_invpcid_nopti), SDT_SYSIGT, + SEL_KPL, 0); + setidt(IPI_INVLPG, pti ? IDTVEC(invlpg_invpcid_pti) : + IDTVEC(invlpg_invpcid), SDT_SYSIGT, SEL_KPL, 0); + setidt(IPI_INVLRNG, pti ? IDTVEC(invlrng_invpcid_pti) : + IDTVEC(invlrng_invpcid), SDT_SYSIGT, SEL_KPL, 0); } else { setidt(IPI_INVLTLB, pti ? IDTVEC(invltlb_pcid_pti) : IDTVEC(invltlb_pcid), SDT_SYSIGT, SEL_KPL, 0); + setidt(IPI_INVLPG, pti ? IDTVEC(invlpg_pcid_pti) : + IDTVEC(invlpg_pcid), SDT_SYSIGT, SEL_KPL, 0); + setidt(IPI_INVLRNG, pti ? IDTVEC(invlrng_pcid_pti) : + IDTVEC(invlrng_pcid), SDT_SYSIGT, SEL_KPL, 0); } } else { setidt(IPI_INVLTLB, pti ? IDTVEC(invltlb_pti) : IDTVEC(invltlb), SDT_SYSIGT, SEL_KPL, 0); + setidt(IPI_INVLPG, pti ? IDTVEC(invlpg_pti) : IDTVEC(invlpg), + SDT_SYSIGT, SEL_KPL, 0); + setidt(IPI_INVLRNG, pti ? IDTVEC(invlrng_pti) : IDTVEC(invlrng), + SDT_SYSIGT, SEL_KPL, 0); } - setidt(IPI_INVLPG, pti ? IDTVEC(invlpg_pti) : IDTVEC(invlpg), - SDT_SYSIGT, SEL_KPL, 0); - setidt(IPI_INVLRNG, pti ? IDTVEC(invlrng_pti) : IDTVEC(invlrng), - SDT_SYSIGT, SEL_KPL, 0); /* Install an inter-CPU IPI for cache invalidation. */ setidt(IPI_INVLCACHE, pti ? IDTVEC(invlcache_pti) : IDTVEC(invlcache), @@ -440,9 +450,43 @@ invltlb_invpcid_handler(void) } void -invltlb_pcid_handler(void) +invltlb_invpcid_pti_handler(void) { + struct invpcid_descr d; uint32_t generation; + +#ifdef COUNT_XINVLTLB_HITS + xhits_gbl[PCPU_GET(cpuid)]++; +#endif /* COUNT_XINVLTLB_HITS */ +#ifdef COUNT_IPIS + (*ipi_invltlb_counts[PCPU_GET(cpuid)])++; +#endif /* COUNT_IPIS */ + + generation = smp_tlb_generation; + d.pcid = smp_tlb_pmap->pm_pcids[PCPU_GET(cpuid)].pm_pcid; + d.pad = 0; + d.addr = 0; + if (smp_tlb_pmap == kernel_pmap) { + /* + * This invalidation actually needs to clear kernel + * mappings from the TLB in the current pmap, but + * since we were asked for the flush in the kernel + * pmap, achieve it by performing global flush. + */ + invpcid(&d, INVPCID_CTXGLOB); + } else { + invpcid(&d, INVPCID_CTX); + d.pcid |= PMAP_PCID_USER_PT; + invpcid(&d, INVPCID_CTX); + } + PCPU_SET(smp_tlb_done, generation); +} + +void +invltlb_pcid_handler(void) +{ + uint64_t kcr3, ucr3; + uint32_t generation, pcid; #ifdef COUNT_XINVLTLB_HITS xhits_gbl[PCPU_GET(cpuid)]++; @@ -463,9 +507,132 @@ invltlb_pcid_handler(void) * CPU. */ if (PCPU_GET(curpmap) == smp_tlb_pmap) { - load_cr3(smp_tlb_pmap->pm_cr3 | - smp_tlb_pmap->pm_pcids[PCPU_GET(cpuid)].pm_pcid); + pcid = smp_tlb_pmap->pm_pcids[PCPU_GET(cpuid)].pm_pcid; + kcr3 = smp_tlb_pmap->pm_cr3 | pcid; + ucr3 = smp_tlb_pmap->pm_ucr3; + if (ucr3 != PMAP_NO_CR3) { + ucr3 |= PMAP_PCID_USER_PT | pcid; + pmap_pti_pcid_invalidate(ucr3, kcr3); + } else + load_cr3(kcr3); } + } + PCPU_SET(smp_tlb_done, generation); +} + +void +invlpg_invpcid_handler(void) +{ + struct invpcid_descr d; + uint32_t generation; + +#ifdef COUNT_XINVLTLB_HITS + xhits_pg[PCPU_GET(cpuid)]++; +#endif /* COUNT_XINVLTLB_HITS */ +#ifdef COUNT_IPIS + (*ipi_invlpg_counts[PCPU_GET(cpuid)])++; +#endif /* COUNT_IPIS */ + + generation = smp_tlb_generation; /* Overlap with serialization */ + invlpg(smp_tlb_addr1); + if (smp_tlb_pmap->pm_ucr3 != PMAP_NO_CR3) { + d.pcid = smp_tlb_pmap->pm_pcids[PCPU_GET(cpuid)].pm_pcid | + PMAP_PCID_USER_PT; + d.pad = 0; + d.addr = smp_tlb_addr1; + invpcid(&d, INVPCID_ADDR); + } + PCPU_SET(smp_tlb_done, generation); +} + +void +invlpg_pcid_handler(void) +{ + uint64_t kcr3, ucr3; + uint32_t generation; + uint32_t pcid; + +#ifdef COUNT_XINVLTLB_HITS + xhits_pg[PCPU_GET(cpuid)]++; +#endif /* COUNT_XINVLTLB_HITS */ +#ifdef COUNT_IPIS + (*ipi_invlpg_counts[PCPU_GET(cpuid)])++; +#endif /* COUNT_IPIS */ + + generation = smp_tlb_generation; /* Overlap with serialization */ + invlpg(smp_tlb_addr1); + if (smp_tlb_pmap == PCPU_GET(curpmap) && + (ucr3 = smp_tlb_pmap->pm_ucr3) != PMAP_NO_CR3) { + pcid = smp_tlb_pmap->pm_pcids[PCPU_GET(cpuid)].pm_pcid; + kcr3 = smp_tlb_pmap->pm_cr3 | pcid | CR3_PCID_SAVE; + ucr3 |= pcid | PMAP_PCID_USER_PT | CR3_PCID_SAVE; + pmap_pti_pcid_invlpg(ucr3, kcr3, smp_tlb_addr1); + } + PCPU_SET(smp_tlb_done, generation); +} + +void +invlrng_invpcid_handler(void) +{ + struct invpcid_descr d; + vm_offset_t addr, addr2; + uint32_t generation; + +#ifdef COUNT_XINVLTLB_HITS + xhits_rng[PCPU_GET(cpuid)]++; +#endif /* COUNT_XINVLTLB_HITS */ +#ifdef COUNT_IPIS + (*ipi_invlrng_counts[PCPU_GET(cpuid)])++; +#endif /* COUNT_IPIS */ + + addr = smp_tlb_addr1; + addr2 = smp_tlb_addr2; + generation = smp_tlb_generation; /* Overlap with serialization */ + do { + invlpg(addr); + addr += PAGE_SIZE; + } while (addr < addr2); + if (smp_tlb_pmap->pm_ucr3 != PMAP_NO_CR3) { + d.pcid = smp_tlb_pmap->pm_pcids[PCPU_GET(cpuid)].pm_pcid | + PMAP_PCID_USER_PT; + d.pad = 0; + d.addr = smp_tlb_addr1; + do { + invpcid(&d, INVPCID_ADDR); + d.addr += PAGE_SIZE; + } while (d.addr < addr2); + } + PCPU_SET(smp_tlb_done, generation); +} + +void +invlrng_pcid_handler(void) +{ + vm_offset_t addr, addr2; + uint64_t kcr3, ucr3; + uint32_t generation; + uint32_t pcid; + +#ifdef COUNT_XINVLTLB_HITS + xhits_rng[PCPU_GET(cpuid)]++; +#endif /* COUNT_XINVLTLB_HITS */ +#ifdef COUNT_IPIS + (*ipi_invlrng_counts[PCPU_GET(cpuid)])++; +#endif /* COUNT_IPIS */ + + addr = smp_tlb_addr1; + addr2 = smp_tlb_addr2; + generation = smp_tlb_generation; /* Overlap with serialization */ + do { + invlpg(addr); + addr += PAGE_SIZE; + } while (addr < addr2); + if (smp_tlb_pmap == PCPU_GET(curpmap) && + (ucr3 = smp_tlb_pmap->pm_ucr3) != PMAP_NO_CR3) { + pcid = smp_tlb_pmap->pm_pcids[PCPU_GET(cpuid)].pm_pcid; + kcr3 = smp_tlb_pmap->pm_cr3 | pcid | CR3_PCID_SAVE; + ucr3 |= pcid | PMAP_PCID_USER_PT | CR3_PCID_SAVE; + pmap_pti_pcid_invlrng(ucr3, kcr3, smp_tlb_addr1, addr2); } PCPU_SET(smp_tlb_done, generation); } Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Jan 27 11:40:46 2018 (r328469) +++ head/sys/amd64/amd64/pmap.c Sat Jan 27 11:49:37 2018 (r328470) @@ -1060,6 +1060,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr) PMAP_LOCK_INIT(kernel_pmap); kernel_pmap->pm_pml4 = (pdp_entry_t *)PHYS_TO_DMAP(KPML4phys); kernel_pmap->pm_cr3 = KPML4phys; + kernel_pmap->pm_ucr3 = PMAP_NO_CR3; CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */ TAILQ_INIT(&kernel_pmap->pm_pvchunk); kernel_pmap->pm_flags = pmap_flags; @@ -1097,8 +1098,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr) pmap_init_pat(); /* Initialize TLB Context Id. */ - if (pti) - pmap_pcid_enabled = 0; TUNABLE_INT_FETCH("vm.pmap.pcid_enabled", &pmap_pcid_enabled); if ((cpu_feature2 & CPUID2_PCID) != 0 && pmap_pcid_enabled) { /* Check for INVPCID support */ @@ -1576,6 +1575,9 @@ void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { cpuset_t *mask; + struct invpcid_descr d; + uint64_t kcr3, ucr3; + uint32_t pcid; u_int cpuid, i; if (pmap_type_guest(pmap)) { @@ -1592,9 +1594,32 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va) mask = &all_cpus; } else { cpuid = PCPU_GET(cpuid); - if (pmap == PCPU_GET(curpmap)) + if (pmap == PCPU_GET(curpmap)) { invlpg(va); - else if (pmap_pcid_enabled) + if (pmap_pcid_enabled && pmap->pm_ucr3 != PMAP_NO_CR3) { + /* + * Disable context switching. pm_pcid + * is recalculated on switch, which + * might make us use wrong pcid below. + */ + critical_enter(); + pcid = pmap->pm_pcids[cpuid].pm_pcid; + + if (invpcid_works) { + d.pcid = pcid | PMAP_PCID_USER_PT; + d.pad = 0; + d.addr = va; + invpcid(&d, INVPCID_ADDR); + } else { + kcr3 = pmap->pm_cr3 | pcid | + CR3_PCID_SAVE; + ucr3 = pmap->pm_ucr3 | pcid | + PMAP_PCID_USER_PT | CR3_PCID_SAVE; + pmap_pti_pcid_invlpg(ucr3, kcr3, va); + } + critical_exit(); + } + } else if (pmap_pcid_enabled) pmap->pm_pcids[cpuid].pm_gen = 0; if (pmap_pcid_enabled) { CPU_FOREACH(i) { @@ -1604,7 +1629,7 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va) } mask = &pmap->pm_active; } - smp_masked_invlpg(*mask, va); + smp_masked_invlpg(*mask, va, pmap); sched_unpin(); } @@ -1615,7 +1640,10 @@ void pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { cpuset_t *mask; + struct invpcid_descr d; vm_offset_t addr; + uint64_t kcr3, ucr3; + uint32_t pcid; u_int cpuid, i; if (eva - sva >= PMAP_INVLPG_THRESHOLD) { @@ -1641,6 +1669,26 @@ pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm if (pmap == PCPU_GET(curpmap)) { for (addr = sva; addr < eva; addr += PAGE_SIZE) invlpg(addr); + if (pmap_pcid_enabled && pmap->pm_ucr3 != PMAP_NO_CR3) { + critical_enter(); + pcid = pmap->pm_pcids[cpuid].pm_pcid; + if (invpcid_works) { + d.pcid = pcid | PMAP_PCID_USER_PT; + d.pad = 0; + d.addr = sva; + for (; d.addr < eva; d.addr += + PAGE_SIZE) + invpcid(&d, INVPCID_ADDR); + } else { + kcr3 = pmap->pm_cr3 | pcid | + CR3_PCID_SAVE; + ucr3 = pmap->pm_ucr3 | pcid | + PMAP_PCID_USER_PT | CR3_PCID_SAVE; + pmap_pti_pcid_invlrng(ucr3, kcr3, sva, + eva); + } + critical_exit(); + } } else if (pmap_pcid_enabled) { pmap->pm_pcids[cpuid].pm_gen = 0; } @@ -1652,7 +1700,7 @@ pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm } mask = &pmap->pm_active; } - smp_masked_invlpg_range(*mask, sva, eva); + smp_masked_invlpg_range(*mask, sva, eva, pmap); sched_unpin(); } @@ -1661,6 +1709,8 @@ pmap_invalidate_all(pmap_t pmap) { cpuset_t *mask; struct invpcid_descr d; + uint64_t kcr3, ucr3; + uint32_t pcid; u_int cpuid, i; if (pmap_type_guest(pmap)) { @@ -1684,15 +1734,29 @@ pmap_invalidate_all(pmap_t pmap) cpuid = PCPU_GET(cpuid); if (pmap == PCPU_GET(curpmap)) { if (pmap_pcid_enabled) { + critical_enter(); + pcid = pmap->pm_pcids[cpuid].pm_pcid; if (invpcid_works) { - d.pcid = pmap->pm_pcids[cpuid].pm_pcid; + d.pcid = pcid; d.pad = 0; d.addr = 0; invpcid(&d, INVPCID_CTX); + if (pmap->pm_ucr3 != PMAP_NO_CR3) { + d.pcid |= PMAP_PCID_USER_PT; + invpcid(&d, INVPCID_CTX); + } } else { - load_cr3(pmap->pm_cr3 | pmap->pm_pcids - [PCPU_GET(cpuid)].pm_pcid); + kcr3 = pmap->pm_cr3 | pcid; + ucr3 = pmap->pm_ucr3; + if (ucr3 != PMAP_NO_CR3) { + ucr3 |= pcid | PMAP_PCID_USER_PT; + pmap_pti_pcid_invalidate(ucr3, + kcr3); + } else { + load_cr3(kcr3); + } } + critical_exit(); } else { invltlb(); } @@ -1797,6 +1861,9 @@ pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_ void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { + struct invpcid_descr d; + uint64_t kcr3, ucr3; + uint32_t pcid; if (pmap->pm_type == PT_RVI || pmap->pm_type == PT_EPT) { pmap->pm_eptgen++; @@ -1805,16 +1872,35 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va) KASSERT(pmap->pm_type == PT_X86, ("pmap_invalidate_range: unknown type %d", pmap->pm_type)); - if (pmap == kernel_pmap || pmap == PCPU_GET(curpmap)) + if (pmap == kernel_pmap || pmap == PCPU_GET(curpmap)) { invlpg(va); - else if (pmap_pcid_enabled) + if (pmap == PCPU_GET(curpmap) && pmap_pcid_enabled && + pmap->pm_ucr3 != PMAP_NO_CR3) { + critical_enter(); + pcid = pmap->pm_pcids[0].pm_pcid; + if (invpcid_works) { + d.pcid = pcid | PMAP_PCID_USER_PT; + d.pad = 0; + d.addr = va; + invpcid(&d, INVPCID_ADDR); + } else { + kcr3 = pmap->pm_cr3 | pcid | CR3_PCID_SAVE; + ucr3 = pmap->pm_ucr3 | pcid | + PMAP_PCID_USER_PT | CR3_PCID_SAVE; + pmap_pti_pcid_invlpg(ucr3, kcr3, va); + } + critical_exit(); + } + } else if (pmap_pcid_enabled) pmap->pm_pcids[0].pm_gen = 0; } void pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { + struct invpcid_descr d; vm_offset_t addr; + uint64_t kcr3, ucr3; if (pmap->pm_type == PT_RVI || pmap->pm_type == PT_EPT) { pmap->pm_eptgen++; @@ -1826,6 +1912,25 @@ pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm if (pmap == kernel_pmap || pmap == PCPU_GET(curpmap)) { for (addr = sva; addr < eva; addr += PAGE_SIZE) invlpg(addr); + if (pmap == PCPU_GET(curpmap) && pmap_pcid_enabled && + pmap->pm_ucr3 != PMAP_NO_CR3) { + critical_enter(); + if (invpcid_works) { + d.pcid = pmap->pm_pcids[0].pm_pcid | + PMAP_PCID_USER_PT; + d.pad = 0; + d.addr = sva; + for (; d.addr < eva; d.addr += PAGE_SIZE) + invpcid(&d, INVPCID_ADDR); + } else { + kcr3 = pmap->pm_cr3 | pmap->pm_pcids[0]. + pm_pcid | CR3_PCID_SAVE; + ucr3 = pmap->pm_ucr3 | pmap->pm_pcids[0]. + pm_pcid | PMAP_PCID_USER_PT | CR3_PCID_SAVE; + pmap_pti_pcid_invlrng(ucr3, kcr3, sva, eva); + } + critical_exit(); + } } else if (pmap_pcid_enabled) { pmap->pm_pcids[0].pm_gen = 0; } @@ -1835,6 +1940,7 @@ void pmap_invalidate_all(pmap_t pmap) { struct invpcid_descr d; + uint64_t kcr3, ucr3; if (pmap->pm_type == PT_RVI || pmap->pm_type == PT_EPT) { pmap->pm_eptgen++; @@ -1852,15 +1958,26 @@ pmap_invalidate_all(pmap_t pmap) } } else if (pmap == PCPU_GET(curpmap)) { if (pmap_pcid_enabled) { + critical_enter(); if (invpcid_works) { d.pcid = pmap->pm_pcids[0].pm_pcid; d.pad = 0; d.addr = 0; invpcid(&d, INVPCID_CTX); + if (pmap->pm_ucr3 != PMAP_NO_CR3) { + d.pcid |= PMAP_PCID_USER_PT; + invpcid(&d, INVPCID_CTX); + } } else { - load_cr3(pmap->pm_cr3 | pmap->pm_pcids[0]. - pm_pcid); + kcr3 = pmap->pm_cr3 | pmap->pm_pcids[0].pm_pcid; + if (pmap->pm_ucr3 != PMAP_NO_CR3) { + ucr3 = pmap->pm_ucr3 | pmap->pm_pcids[ + 0].pm_pcid | PMAP_PCID_USER_PT; + pmap_pti_pcid_invalidate(ucr3, kcr3); + } else + load_cr3(kcr3); } + critical_exit(); } else { invltlb(); } @@ -2398,7 +2515,8 @@ pmap_pinit0(pmap_t pmap) pmap->pm_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(KPML4phys); pmap->pm_pml4u = NULL; pmap->pm_cr3 = KPML4phys; - pmap->pm_ucr3 = ~0UL; + /* hack to keep pmap_pti_pcid_invalidate() alive */ + pmap->pm_ucr3 = PMAP_NO_CR3; pmap->pm_root.rt_root = 0; CPU_ZERO(&pmap->pm_active); TAILQ_INIT(&pmap->pm_pvchunk); @@ -2408,7 +2526,7 @@ pmap_pinit0(pmap_t pmap) pmap->pm_pcids[i].pm_pcid = PMAP_PCID_NONE; pmap->pm_pcids[i].pm_gen = 0; if (!pti) - __pcpu[i].pc_kcr3 = ~0ul; + __pcpu[i].pc_kcr3 = PMAP_NO_CR3; } PCPU_SET(curpmap, kernel_pmap); pmap_activate(curthread); @@ -2472,7 +2590,8 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, i pmap->pm_pcids[i].pm_pcid = PMAP_PCID_NONE; pmap->pm_pcids[i].pm_gen = 0; } - pmap->pm_cr3 = ~0l; /* initialize to an invalid value */ + pmap->pm_cr3 = PMAP_NO_CR3; /* initialize to an invalid value */ + pmap->pm_ucr3 = PMAP_NO_CR3; pmap->pm_pml4u = NULL; pmap->pm_type = pm_type; @@ -7134,13 +7253,15 @@ pmap_pcid_alloc(pmap_t pmap, u_int cpuid) CRITICAL_ASSERT(curthread); gen = PCPU_GET(pcid_gen); - if (pmap->pm_pcids[cpuid].pm_pcid == PMAP_PCID_KERN || - pmap->pm_pcids[cpuid].pm_gen == gen) + if (!pti && (pmap->pm_pcids[cpuid].pm_pcid == PMAP_PCID_KERN || + pmap->pm_pcids[cpuid].pm_gen == gen)) return (CR3_PCID_SAVE); pcid_next = PCPU_GET(pcid_next); - KASSERT(pcid_next <= PMAP_PCID_OVERMAX, ("cpu %d pcid_next %#x", - cpuid, pcid_next)); - if (pcid_next == PMAP_PCID_OVERMAX) { + KASSERT((!pti && pcid_next <= PMAP_PCID_OVERMAX) || + (pti && pcid_next <= PMAP_PCID_OVERMAX_KERN), + ("cpu %d pcid_next %#x", cpuid, pcid_next)); + if ((!pti && pcid_next == PMAP_PCID_OVERMAX) || + (pti && pcid_next == PMAP_PCID_OVERMAX_KERN)) { new_gen = gen + 1; if (new_gen == 0) new_gen = 1; @@ -7159,7 +7280,8 @@ void pmap_activate_sw(struct thread *td) { pmap_t oldpmap, pmap; - uint64_t cached, cr3; + struct invpcid_descr d; + uint64_t cached, cr3, kcr3, ucr3; register_t rflags; u_int cpuid; @@ -7215,6 +7337,32 @@ pmap_activate_sw(struct thread *td) PCPU_INC(pm_save_cnt); } PCPU_SET(curpmap, pmap); + if (pti) { + kcr3 = pmap->pm_cr3 | pmap->pm_pcids[cpuid].pm_pcid; + ucr3 = pmap->pm_ucr3 | pmap->pm_pcids[cpuid].pm_pcid | + PMAP_PCID_USER_PT; + + /* + * Manually invalidate translations cached + * from the user page table, which are not + * flushed by reload of cr3 with the kernel + * page table pointer above. + */ + if (pmap->pm_ucr3 != PMAP_NO_CR3) { + if (invpcid_works) { + d.pcid = PMAP_PCID_USER_PT | + pmap->pm_pcids[cpuid].pm_pcid; + d.pad = 0; + d.addr = 0; + invpcid(&d, INVPCID_CTX); + } else { + pmap_pti_pcid_invalidate(ucr3, kcr3); + } + } + + PCPU_SET(kcr3, kcr3 | CR3_PCID_SAVE); + PCPU_SET(ucr3, ucr3 | CR3_PCID_SAVE); + } if (!invpcid_works) intr_restore(rflags); } else if (cr3 != pmap->pm_cr3) { Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Sat Jan 27 11:40:46 2018 (r328469) +++ head/sys/amd64/amd64/support.S Sat Jan 27 11:49:37 2018 (r328470) @@ -802,3 +802,51 @@ msr_onfault: movl $EFAULT,%eax POP_FRAME_POINTER ret + +/* + * void pmap_pti_pcid_invalidate(uint64_t ucr3, uint64_t kcr3); + * Invalidates address space addressed by ucr3, then returns to kcr3. + * Done in assembler to ensure no other memory accesses happen while + * on ucr3. + */ + ALIGN_TEXT +ENTRY(pmap_pti_pcid_invalidate) + pushfq + cli + movq %rdi,%cr3 /* to user page table */ + movq %rsi,%cr3 /* back to kernel */ + popfq + retq + +/* + * void pmap_pti_pcid_invlpg(uint64_t ucr3, uint64_t kcr3, vm_offset_t va); + * Invalidates virtual address va in address space ucr3, then returns to kcr3. + */ + ALIGN_TEXT +ENTRY(pmap_pti_pcid_invlpg) + pushfq + cli + movq %rdi,%cr3 /* to user page table */ + invlpg (%rdx) + movq %rsi,%cr3 /* back to kernel */ + popfq + retq + +/* + * void pmap_pti_pcid_invlrng(uint64_t ucr3, uint64_t kcr3, vm_offset_t sva, + * vm_offset_t eva); + * Invalidates virtual addresses between sva and eva in address space ucr3, + * then returns to kcr3. + */ + ALIGN_TEXT +ENTRY(pmap_pti_pcid_invlrng) + pushfq + cli + movq %rdi,%cr3 /* to user page table */ +1: invlpg (%rdx) + addq $PAGE_SIZE,%rdx + cmpq %rdx,%rcx + ja 1b + movq %rsi,%cr3 /* back to kernel */ + popfq + retq Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Sat Jan 27 11:40:46 2018 (r328469) +++ head/sys/amd64/include/pmap.h Sat Jan 27 11:49:37 2018 (r328470) @@ -225,7 +225,11 @@ #define PMAP_PCID_NONE 0xffffffff #define PMAP_PCID_KERN 0 #define PMAP_PCID_OVERMAX 0x1000 +#define PMAP_PCID_OVERMAX_KERN 0x800 +#define PMAP_PCID_USER_PT 0x800 +#define PMAP_NO_CR3 (~0UL) + #ifndef LOCORE #include @@ -433,6 +437,10 @@ boolean_t pmap_map_io_transient(vm_page_t *, vm_offset void pmap_unmap_io_transient(vm_page_t *, vm_offset_t *, int, boolean_t); void pmap_pti_add_kva(vm_offset_t sva, vm_offset_t eva, bool exec); void pmap_pti_remove_kva(vm_offset_t sva, vm_offset_t eva); +void pmap_pti_pcid_invalidate(uint64_t ucr3, uint64_t kcr3); +void pmap_pti_pcid_invlpg(uint64_t ucr3, uint64_t kcr3, vm_offset_t va); +void pmap_pti_pcid_invlrng(uint64_t ucr3, uint64_t kcr3, vm_offset_t sva, + vm_offset_t eva); #endif /* _KERNEL */ /* Return various clipped indexes for a given VA */ Modified: head/sys/amd64/include/smp.h ============================================================================== --- head/sys/amd64/include/smp.h Sat Jan 27 11:40:46 2018 (r328469) +++ head/sys/amd64/include/smp.h Sat Jan 27 11:49:37 2018 (r328470) @@ -28,15 +28,23 @@ extern u_int32_t mptramp_pagetables; /* IPI handlers */ inthand_t - IDTVEC(invltlb_pcid), /* TLB shootdowns - global, pcid */ - IDTVEC(invltlb_invpcid),/* TLB shootdowns - global, invpcid */ IDTVEC(justreturn), /* interrupt CPU with minimum overhead */ - IDTVEC(invltlb_pcid_pti), - IDTVEC(invltlb_invpcid_pti), IDTVEC(justreturn1_pti), IDTVEC(invltlb_pti), + IDTVEC(invltlb_pcid_pti), + IDTVEC(invltlb_pcid), /* TLB shootdowns - global, pcid */ + IDTVEC(invltlb_invpcid_pti_pti), + IDTVEC(invltlb_invpcid_nopti), IDTVEC(invlpg_pti), + IDTVEC(invlpg_invpcid_pti), + IDTVEC(invlpg_invpcid), + IDTVEC(invlpg_pcid_pti), + IDTVEC(invlpg_pcid), IDTVEC(invlrng_pti), + IDTVEC(invlrng_invpcid_pti), + IDTVEC(invlrng_invpcid), + IDTVEC(invlrng_pcid_pti), + IDTVEC(invlrng_pcid), IDTVEC(invlcache_pti), IDTVEC(ipi_intr_bitmap_handler_pti), IDTVEC(cpustop_pti), @@ -45,6 +53,11 @@ inthand_t void invltlb_pcid_handler(void); void invltlb_invpcid_handler(void); +void invltlb_invpcid_pti_handler(void); +void invlpg_invpcid_handler(void); +void invlpg_pcid_handler(void); +void invlrng_invpcid_handler(void); +void invlrng_pcid_handler(void); int native_start_all_aps(void); #endif /* !LOCORE */ Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sat Jan 27 11:40:46 2018 (r328469) +++ head/sys/i386/i386/pmap.c Sat Jan 27 11:49:37 2018 (r328470) @@ -1045,7 +1045,7 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va) CPU_AND(&other_cpus, &pmap->pm_active); mask = &other_cpus; } - smp_masked_invlpg(*mask, va); + smp_masked_invlpg(*mask, va, pmap); sched_unpin(); } @@ -1079,7 +1079,7 @@ pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm CPU_AND(&other_cpus, &pmap->pm_active); mask = &other_cpus; } - smp_masked_invlpg_range(*mask, sva, eva); + smp_masked_invlpg_range(*mask, sva, eva, pmap); sched_unpin(); } Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Sat Jan 27 11:40:46 2018 (r328469) +++ head/sys/i386/i386/vm_machdep.c Sat Jan 27 11:49:37 2018 (r328470) @@ -768,7 +768,7 @@ sf_buf_shootdown(struct sf_buf *sf, int flags) CPU_NAND(&other_cpus, &sf->cpumask); if (!CPU_EMPTY(&other_cpus)) { CPU_OR(&sf->cpumask, &other_cpus); - smp_masked_invlpg(other_cpus, sf->kva); + smp_masked_invlpg(other_cpus, sf->kva, kernel_pmap); } } sched_unpin(); Modified: head/sys/x86/include/x86_smp.h ============================================================================== --- head/sys/x86/include/x86_smp.h Sat Jan 27 11:40:46 2018 (r328469) +++ head/sys/x86/include/x86_smp.h Sat Jan 27 11:49:37 2018 (r328470) @@ -39,6 +39,7 @@ extern int cpu_logical; extern int cpu_cores; extern volatile uint32_t smp_tlb_generation; extern struct pmap *smp_tlb_pmap; +extern vm_offset_t smp_tlb_addr1, smp_tlb_addr2; extern u_int xhits_gbl[]; extern u_int xhits_pg[]; extern u_int xhits_rng[]; @@ -97,9 +98,9 @@ void ipi_selected(cpuset_t cpus, u_int ipi); u_int mp_bootaddress(u_int); void set_interrupt_apic_ids(void); void smp_cache_flush(void); -void smp_masked_invlpg(cpuset_t mask, vm_offset_t addr); +void smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, struct pmap *pmap); void smp_masked_invlpg_range(cpuset_t mask, vm_offset_t startva, - vm_offset_t endva); + vm_offset_t endva, struct pmap *pmap); void smp_masked_invltlb(cpuset_t mask, struct pmap *pmap); void mem_range_AP_init(void); void topo_probe(void); Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Sat Jan 27 11:40:46 2018 (r328469) +++ head/sys/x86/x86/mp_x86.c Sat Jan 27 11:49:37 2018 (r328470) @@ -1506,7 +1506,7 @@ SYSINIT(mp_ipi_intrcnt, SI_SUB_INTR, SI_ORDER_MIDDLE, */ /* Variables needed for SMP tlb shootdown. */ -static vm_offset_t smp_tlb_addr1, smp_tlb_addr2; +vm_offset_t smp_tlb_addr1, smp_tlb_addr2; pmap_t smp_tlb_pmap; volatile uint32_t smp_tlb_generation; @@ -1583,11 +1583,11 @@ smp_masked_invltlb(cpuset_t mask, pmap_t pmap) } void -smp_masked_invlpg(cpuset_t mask, vm_offset_t addr) +smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, pmap_t pmap) { if (smp_started) { - smp_targeted_tlb_shootdown(mask, IPI_INVLPG, NULL, addr, 0); + smp_targeted_tlb_shootdown(mask, IPI_INVLPG, pmap, addr, 0); #ifdef COUNT_XINVLTLB_HITS ipi_page++; #endif @@ -1595,11 +1595,12 @@ smp_masked_invlpg(cpuset_t mask, vm_offset_t addr) } void -smp_masked_invlpg_range(cpuset_t mask, vm_offset_t addr1, vm_offset_t addr2) +smp_masked_invlpg_range(cpuset_t mask, vm_offset_t addr1, vm_offset_t addr2, + pmap_t pmap) { if (smp_started) { - smp_targeted_tlb_shootdown(mask, IPI_INVLRNG, NULL, + smp_targeted_tlb_shootdown(mask, IPI_INVLRNG, pmap, addr1, addr2); #ifdef COUNT_XINVLTLB_HITS ipi_range++; From owner-svn-src-all@freebsd.org Sat Jan 27 11:54:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D593EEB6EEF; Sat, 27 Jan 2018 11:54:51 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8631584BF4; Sat, 27 Jan 2018 11:54:51 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 811682045; Sat, 27 Jan 2018 11:54:51 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RBspUP048346; Sat, 27 Jan 2018 11:54:51 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RBsphk048344; Sat, 27 Jan 2018 11:54:51 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201801271154.w0RBsphk048344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 27 Jan 2018 11:54:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328471 - head/lib/libcasper/services/cap_grp X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_grp X-SVN-Commit-Revision: 328471 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 11:54:52 -0000 Author: oshogbo Date: Sat Jan 27 11:54:51 2018 New Revision: 328471 URL: https://svnweb.freebsd.org/changeset/base/328471 Log: Document the grp Casper service. Reviewed by: brueffer@, bcr@ Differential Revision: https://reviews.freebsd.org/D13821 Added: head/lib/libcasper/services/cap_grp/cap_grp.3 (contents, props changed) Modified: head/lib/libcasper/services/cap_grp/Makefile Modified: head/lib/libcasper/services/cap_grp/Makefile ============================================================================== --- head/lib/libcasper/services/cap_grp/Makefile Sat Jan 27 11:49:37 2018 (r328470) +++ head/lib/libcasper/services/cap_grp/Makefile Sat Jan 27 11:54:51 2018 (r328471) @@ -24,4 +24,20 @@ CFLAGS+=-I${.CURDIR} HAS_TESTS= SUBDIR.${MK_TESTS}+= tests +MAN+= cap_grp.3 + +MLINKS+=cap_grp.3 libcap_grp.3 +MLINKS+=cap_grp.3 cap_getgrent.3 +MLINKS+=cap_grp.3 cap_getgrnam.3 +MLINKS+=cap_grp.3 cap_getgrgid.3 +MLINKS+=cap_grp.3 cap_getgrent_r.3 +MLINKS+=cap_grp.3 cap_getgrnam_r.3 +MLINKS+=cap_grp.3 cap_getgrgid_r.3 +MLINKS+=cap_grp.3 cap_setgroupent.3 +MLINKS+=cap_grp.3 cap_setgrent.3 +MLINKS+=cap_grp.3 cap_endgrent.3 +MLINKS+=cap_grp.3 cap_grp_limit_cmds.3 +MLINKS+=cap_grp.3 cap_grp_limit_fields.3 +MLINKS+=cap_grp.3 cap_grp_limit_groups.3 + .include Added: head/lib/libcasper/services/cap_grp/cap_grp.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_grp/cap_grp.3 Sat Jan 27 11:54:51 2018 (r328471) @@ -0,0 +1,228 @@ +.\" Copyright (c) 2018 Mariusz Zaborski +.\" 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 AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 27, 2018 +.Dt CAP_GRP 3 +.Os +.Sh NAME +.Nm cap_getgrent , +.Nm cap_getgrnam , +.Nm cap_getgrgid , +.Nm cap_getgrent_r , +.Nm cap_getgrnam_r , +.Nm cap_getgrgid_r , +.Nm cap_setgroupent , +.Nm cap_setgrent , +.Nm cap_endgrent , +.Nm cap_grp_limit_cmds , +.Nm cap_grp_limit_fields , +.Nm cap_grp_limit_groups +.Nd "library for group database operations in capability mode" +.Sh LIBRARY +.Lb libcap_grp +.Sh SYNOPSIS +.In sys/nv.h +.In libcasper.h +.In casper/cap_grp.h +.Ft "struct group *" +.Fn cap_getgrent "cap_channel_t *chan" +.Ft "struct group *" +.Fn cap_getgrnam "cap_channel_t *chan" "const char *name" +.Ft "struct group *" +.Fn cap_getgrgid "cap_channel_t *chan" "gid_t gid" +.Ft "int" +.Fn cap_getgrent_r "cap_channel_t *chan" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result" +.Ft "int" +.Fn cap_getgrnam_r "cap_channel_t *chan" "const char *name" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result" +.Ft int +.Fn cap_getgrgid_r "cap_channel_t *chan" "gid_t gid" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result" +.Ft int +.Fn cap_setgroupent "cap_channel_t *chan" "int stayopen" +.Ft int +.Fn cap_setgrent "cap_channel_t *chan" +.Ft void +.Fn cap_endgrent "cap_channel_t *chan" +.Ft int +.Fn cap_grp_limit_cmds "cap_channel_t *chan" "const char * const *cmds" "size_t ncmds" +.Ft int +.Fn cap_grp_limit_fields "cap_channel_t *chan" "const char * const *fields" "size_t nfields" +.Ft int +.Fn cap_grp_limit_groups "cap_channel_t *chan" "const char * const *names" "size_t nnames" "gid_t *gids" "size_t ngids" +.Sh DESCRIPTION +The functions +.Fn cap_getgrent , +.Fn cap_getgrnam , +.Fn cap_getgrgid , +.Fn cap_getgrent_r , +.Fn cap_getgrnam_r , +.Fn cap_getgrgid_r , +.Fn cap_setgroupent , +.Fn cap_setgrent , +and +.Fn cap_endgrent +are respectively equivalent to +.Xr getgrent 3 , +.Xr getgrnam 3 , +.Xr getgrgid 3 , +.Xr getgrent_r 3 , +.Xr getgrnam_r 3 , +.Xr getgrgid_r 3 , +.Xr setgroupent 3 , +.Xr setgrent 3 , +and +.Xr endgrent 3 +except that the connection to the +.Nm system.grp +service needs to be provided. +.Pp +The +.Fn cap_grp_limit_cmds +function limits the functions allowed in the service. +The +.Fa cmds +vriable can be set to +.Dv getgrent , +.Dv getgrnam , +.Dv getgrgid , +.Dv getgrent_r , +.Dv getgrnam_r , +.Dv getgrgid_r , +.Dv setgroupent , +.Dv setgrent , +or +.Dv endgrent +which will allow to use the function associated with the name. +The +.Fa ncmds +variable contains the number of +.Fa cmds +provided. +.Pp +The +.Fn cap_grp_limit_fields +function allows limit fields returned in the structure +.Vt group . +The +.Fa fields +variable can be set to +.Dv gr_name +.Dv gr_passwd +.Dv gr_gid +or +.Dv gr_mem . +The field which was set as the limit will be returned, while the rest of the +values not set this way will have default values. +The +.Fa nfields +variable contains the number of +.Fa fields +provided. +.Pp +The +.Fn cap_grp_limit_groups +function allows to limit access to groups. +The +.Fa names +variable allows to limit groups by name and the +.Fa gids +variable by the group number. +The +.Fa nnames +and +.Fa ngids +variables provide numbers of limited names and gids. +.Sh EXAMPLES +The following example first opens a capability to casper and then uses this +capability to create the +.Nm system.grp +casper service and uses it to get a group name. +.Bd -literal +cap_channel_t *capcas, *capgrp; +const char *cmds[] = { "getgrgid" }; +const char *fields[] = { "gr_name" }; +gid_t gid[] = { 1 }; +struct group *group; + +/* Open capability to Casper. */ +capcas = cap_init(); +if (capcas == NULL) + err(1, "Unable to contact Casper"); + +/* Enter capability mode sandbox. */ +if (cap_enter() < 0 && errno != ENOSYS) + err(1, "Unable to enter capability mode"); + +/* Use Casper capability to create capability to the system.grp service. */ +capgrp = cap_service_open(capcas, "system.grp"); +if (capgrp == NULL) + err(1, "Unable to open system.grp service"); + +/* Close Casper capability, we don't need it anymore. */ +cap_close(capcas); + +/* Limit service to one single function. */ +if (cap_grp_limit_cmds(capgrp, cmds, nitems(cmds))) + err(1, "Unable to limit access to system.grp service"); + +/* Limit service to one field as we only need name of the group. */ +if (cap_grp_limit_fields(capgrp, fields, nitems(fields))) + err(1, "Unable to limit access to system.grp service"); + +/* Limit service to one gid. */ +if (cap_grp_limit_groups(capgrp, NULL, 0, gid, nitems(gid))) + err(1, "Unable to limit access to system.grp service"); + +group = cap_getgrgid(capgrp, gid[0]); +if (group == NULL) + err(1, "Unable to get name of group"); + +printf("GID %d is associated with name %s.\\n", gid[0], group->gr_name); + +cap_close(capgrp); +.Ed +.Sh SEE ALSO +.Xr cap_enter 2 , +.Xr endgrent 3 , +.Xr err 3 , +.Xr getgrent 3 , +.Xr getgrent_r 3 , +.Xr getgrgid 3 , +.Xr getgrgid_r 3 , +.Xr getgrnam 3 , +.Xr getgrnam_r 3 , +.Xr nv 3 , +.Xr setgrent 3 , +.Xr setgroupent 3 , +.Xr capsicum 4 +.Sh AUTHORS +The +.Nm cap_grp +service was implemented by +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net +under sponsorship from the FreeBSD Foundation. +.Pp +This manual page was written by +.An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org . From owner-svn-src-all@freebsd.org Sat Jan 27 12:13:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38957EB9591; Sat, 27 Jan 2018 12:13:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 7DEE885B4F; Sat, 27 Jan 2018 12:12:58 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id E8263103984; Sat, 27 Jan 2018 23:12:50 +1100 (AEDT) Date: Sat, 27 Jan 2018 23:12:50 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pedro Giffuni cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs In-Reply-To: <10edbded-b2b5-07e8-b527-b9b4c46d0bae@FreeBSD.org> Message-ID: <20180127214500.I925@besplex.bde.org> References: <201801241758.w0OHwm26063524@repo.freebsd.org> <20180126020540.B2181@besplex.bde.org> <8d5ddd06-14b2-e7e1-14dd-5e9d42f9b33c@FreeBSD.org> <20180126053133.R3207@besplex.bde.org> <21b6bdda-65b7-89da-4dd6-bed64978eba8@FreeBSD.org> <20180126214948.C1040@besplex.bde.org> <10edbded-b2b5-07e8-b527-b9b4c46d0bae@FreeBSD.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=YbvN30Zf c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=nlC_4_pT8q9DhB4Ho9EA:9 a=EXLln4MnoMlu6O24mmsA:9 a=45ClL6m2LaAA:10 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 12:13:00 -0000 On Fri, 26 Jan 2018, Pedro Giffuni wrote: > On 01/26/18 06:36, Bruce Evans wrote: >> On Thu, 25 Jan 2018, Pedro Giffuni wrote: >>=20 >>> On 25/01/2018 14:24, Bruce Evans wrote: >>>> ... >>>> This code only works because (if?) nfs is the only caller and nfs neve= r >>>> passes insane values. >>>>=20 >>>=20 >>> I am starting to think that we should simply match uio_resid and set it= to=20 >>> ssize_t. >>> Returning the value to int is certainly not the solution. >>=20 >> Of course using the correct type (int) is part of the solution. >>=20 > int *was* the correct type, now it doesn't cover all the range. int is the correct type. The range is small after range checking. u_int is an incorrect type. It can only hold SSIZE_MAX on __LP32_ arches, and that only after half-baked range checking for the lower limit only. ssize_t is an incorrect type. It can hold SSIZE_MAX on all arches, but that doesn't prevent various overflow bugs or requests to malloc() SSIZE_MAX (plus a little more for rounding up) bytes unless there is some range checking. > Our problem is not really uio_*, our problem is ncookies and we only test= =20 > that it is >0. Our problem is lack of understanding of lectures on C types and range check= ing. > I think the attached patch, still keeping the unsigned ncookies, is=20 > sufficient. X Index: sys/fs/ext2fs/ext2_lookup.c X =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 X --- sys/fs/ext2fs/ext2_lookup.c=09(revision 328443) X +++ sys/fs/ext2fs/ext2_lookup.c=09(working copy) X @@ -153,7 +153,10 @@ X =09=09return (EINVAL); X =09ip =3D VTOI(vp); X =09if (ap->a_ncookies !=3D NULL) { X -=09=09ncookies =3D uio->uio_resid; X +=09=09if (uio->uio_resid < 0) X +=09=09=09ncookies =3D 0; X +=09=09else X +=09=09=09ncookies =3D uio->uio_resid; This only avoids overflow for negative values. It doesn't limit uio_resid from above, so overflow on this assignment can occur on __LP64__ arches. Even on __LP32__ systems, SSIZE_MAX =3D 2G is too large to work. My patch limits uio_resid to avoid this and many other bugs. When overflow occurs, this gives the same bugs as before, but they are larger than I noticed before. E.g., uio->uio_resid =3D=3D 1ULL << 32, then the overflow is to 0. There is no problem allocating a cookies array with 0 elements, but since you didn't adjust uio_resid it is inconsistent with ncookies. Without INVARIANTS, buffer overrun occurs when the first dirent is read and cookies[0] is modified to point to the dirent; then ncookies was decremented from 0 to -1, but after you broke its type it is decremented from 0 to UINT_MAX. With INVARIANTS, the bug is detected by a KASSERT() that ncookies > 0. X =09=09if (uio->uio_offset >=3D ip->i_size) X =09=09=09ncookies =3D 0; X =09=09else if (ip->i_size - uio->uio_offset < ncookies) When uio_resid is huge, that isn't usually a problem unless assigning it to ncookies gives a small value. Otherwise, ncookies is at least large here. Then it is usually larger than the residual file size, so it gets replaced by the residual file size. This is only too large to fit in memory if the residual file size is large. >> The bounds checking is something like: >> [... context lost to corruption of spaces to binary (UTF-8)) >> This checks for negative values for all cases and converts to 0 (EOF) to >> preserve historical behaviour for the syscall case and to avoid overflow >> for the cookies case (in case the caller is buggy).=C2=A0 The correct ha= ndling >> is to return EINVAL, but EOF is good enough. >>=20 > This also touches uio_resid which is probably not good as it is used late= r=20 > on. > Our job is not to "fix" the caller but only to apply a reasonable behavio= r. This indeed too fragile. I had throught that syscalls adjusted uio_resid at the end (so could adjust it at the beginning too). They actually just calculate nbytes =3D initial_uio_resid - final_uio_resid. But if you don't adjust uio_resid, then you get buffer overruns when there are more dirents than cookies. dirents are not malloc()ed, so there is no limit on them except uio_resid, the size that can be malloc()ed for cookies= , and the residual file size. >> In the syscall case, uio_resid can be up to SSIZE_MAX, so don't check it >> or corrupt it by assigning it to an int or u_int. > > The minimal type conversion does not really involve corruption: ncookies = is=20 > local > and the caller will not perceive any change. The value is corrupted by blind assignmemt to an unrelated type. Bruce From owner-svn-src-all@freebsd.org Sat Jan 27 12:28:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4A51EBD765; Sat, 27 Jan 2018 12:28:53 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5796F863F4; Sat, 27 Jan 2018 12:28:53 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DB86251F; Sat, 27 Jan 2018 12:28:53 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RCSro3063093; Sat, 27 Jan 2018 12:28:53 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RCSrTl063092; Sat, 27 Jan 2018 12:28:53 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201801271228.w0RCSrTl063092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 27 Jan 2018 12:28:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328472 - head/sys/geom/label X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sys/geom/label X-SVN-Commit-Revision: 328472 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 12:28:53 -0000 Author: oshogbo Date: Sat Jan 27 12:28:52 2018 New Revision: 328472 URL: https://svnweb.freebsd.org/changeset/base/328472 Log: Don't truncate name of glabel. If it's to long just report that. Reviewed by: trasz@ Differential Revision: https://reviews.freebsd.org/D13746 Modified: head/sys/geom/label/g_label.c Modified: head/sys/geom/label/g_label.c ============================================================================== --- head/sys/geom/label/g_label.c Sat Jan 27 11:54:51 2018 (r328471) +++ head/sys/geom/label/g_label.c Sat Jan 27 12:28:52 2018 (r328472) @@ -200,6 +200,7 @@ g_label_create(struct gctl_req *req, struct g_class *m struct g_provider *pp2; struct g_consumer *cp; char name[64]; + int n; g_topology_assert(); @@ -213,7 +214,12 @@ g_label_create(struct gctl_req *req, struct g_class *m } gp = NULL; cp = NULL; - snprintf(name, sizeof(name), "%s/%s", dir, label); + n = snprintf(name, sizeof(name), "%s/%s", dir, label); + if (n >= sizeof(name)) { + if (req != NULL) + gctl_error(req, "Label name %s is too long.", label); + return (NULL); + } LIST_FOREACH(gp, &mp->geom, geom) { pp2 = LIST_FIRST(&gp->provider); if (pp2 == NULL) From owner-svn-src-all@freebsd.org Sat Jan 27 12:55:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19418EBEC9E; Sat, 27 Jan 2018 12:55:37 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B7E6C876DA; Sat, 27 Jan 2018 12:55:36 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B17A829F8; Sat, 27 Jan 2018 12:55:36 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RCtahK078551; Sat, 27 Jan 2018 12:55:36 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RCtYhA078531; Sat, 27 Jan 2018 12:55:34 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201801271255.w0RCtYhA078531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 27 Jan 2018 12:55:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328473 - in head/lib/libcasper: libcasper services/cap_dns services/cap_dns/tests services/cap_grp services/cap_grp/tests services/cap_pwd services/cap_pwd/tests services/cap_random se... X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in head/lib/libcasper: libcasper services/cap_dns services/cap_dns/tests services/cap_grp services/cap_grp/tests services/cap_pwd services/cap_pwd/tests services/cap_random services/cap_sysctl service... X-SVN-Commit-Revision: 328473 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 12:55:37 -0000 Author: oshogbo Date: Sat Jan 27 12:55:34 2018 New Revision: 328473 URL: https://svnweb.freebsd.org/changeset/base/328473 Log: Add SPDX tags for libcasper(3) and services. MFC after: 2 weeks Modified: head/lib/libcasper/libcasper/libcasper.c head/lib/libcasper/libcasper/libcasper.h head/lib/libcasper/libcasper/libcasper_impl.c head/lib/libcasper/libcasper/libcasper_impl.h head/lib/libcasper/libcasper/libcasper_service.c head/lib/libcasper/libcasper/libcasper_service.h head/lib/libcasper/libcasper/service.c head/lib/libcasper/libcasper/zygote.c head/lib/libcasper/libcasper/zygote.h head/lib/libcasper/services/cap_dns/cap_dns.c head/lib/libcasper/services/cap_dns/tests/dns_test.c head/lib/libcasper/services/cap_grp/cap_grp.c head/lib/libcasper/services/cap_grp/tests/grp_test.c head/lib/libcasper/services/cap_pwd/cap_pwd.c head/lib/libcasper/services/cap_pwd/tests/pwd_test.c head/lib/libcasper/services/cap_random/cap_random.c head/lib/libcasper/services/cap_sysctl/cap_sysctl.c head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c head/lib/libcasper/services/cap_syslog/cap_syslog.c Modified: head/lib/libcasper/libcasper/libcasper.c ============================================================================== --- head/lib/libcasper/libcasper/libcasper.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/libcasper/libcasper.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012-2013 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski * All rights reserved. Modified: head/lib/libcasper/libcasper/libcasper.h ============================================================================== --- head/lib/libcasper/libcasper/libcasper.h Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/libcasper/libcasper.h Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012-2013 The FreeBSD Foundation * Copyright (c) 2015-2017 Mariusz Zaborski * All rights reserved. Modified: head/lib/libcasper/libcasper/libcasper_impl.c ============================================================================== --- head/lib/libcasper/libcasper/libcasper_impl.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/libcasper/libcasper_impl.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski * All rights reserved. Modified: head/lib/libcasper/libcasper/libcasper_impl.h ============================================================================== --- head/lib/libcasper/libcasper/libcasper_impl.h Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/libcasper/libcasper_impl.h Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski * All rights reserved. Modified: head/lib/libcasper/libcasper/libcasper_service.c ============================================================================== --- head/lib/libcasper/libcasper/libcasper_service.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/libcasper/libcasper_service.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski * Copyright (c) 2017 Robert N. M. Watson Modified: head/lib/libcasper/libcasper/libcasper_service.h ============================================================================== --- head/lib/libcasper/libcasper/libcasper_service.h Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/libcasper/libcasper_service.h Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski * All rights reserved. Modified: head/lib/libcasper/libcasper/service.c ============================================================================== --- head/lib/libcasper/libcasper/service.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/libcasper/service.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski * All rights reserved. Modified: head/lib/libcasper/libcasper/zygote.c ============================================================================== --- head/lib/libcasper/libcasper/zygote.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/libcasper/zygote.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski * Copyright (c) 2017 Robert N. M. Watson Modified: head/lib/libcasper/libcasper/zygote.h ============================================================================== --- head/lib/libcasper/libcasper/zygote.h Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/libcasper/zygote.h Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski * All rights reserved. Modified: head/lib/libcasper/services/cap_dns/cap_dns.c ============================================================================== --- head/lib/libcasper/services/cap_dns/cap_dns.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/services/cap_dns/cap_dns.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012-2013 The FreeBSD Foundation * All rights reserved. * Modified: head/lib/libcasper/services/cap_dns/tests/dns_test.c ============================================================================== --- head/lib/libcasper/services/cap_dns/tests/dns_test.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/services/cap_dns/tests/dns_test.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * Modified: head/lib/libcasper/services/cap_grp/cap_grp.c ============================================================================== --- head/lib/libcasper/services/cap_grp/cap_grp.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/services/cap_grp/cap_grp.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * Modified: head/lib/libcasper/services/cap_grp/tests/grp_test.c ============================================================================== --- head/lib/libcasper/services/cap_grp/tests/grp_test.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/services/cap_grp/tests/grp_test.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * Modified: head/lib/libcasper/services/cap_pwd/cap_pwd.c ============================================================================== --- head/lib/libcasper/services/cap_pwd/cap_pwd.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/services/cap_pwd/cap_pwd.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * Modified: head/lib/libcasper/services/cap_pwd/tests/pwd_test.c ============================================================================== --- head/lib/libcasper/services/cap_pwd/tests/pwd_test.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/services/cap_pwd/tests/pwd_test.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * Modified: head/lib/libcasper/services/cap_random/cap_random.c ============================================================================== --- head/lib/libcasper/services/cap_random/cap_random.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/services/cap_random/cap_random.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * Modified: head/lib/libcasper/services/cap_sysctl/cap_sysctl.c ============================================================================== --- head/lib/libcasper/services/cap_sysctl/cap_sysctl.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/services/cap_sysctl/cap_sysctl.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * Modified: head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c ============================================================================== --- head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * Modified: head/lib/libcasper/services/cap_syslog/cap_syslog.c ============================================================================== --- head/lib/libcasper/services/cap_syslog/cap_syslog.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/services/cap_syslog/cap_syslog.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2017 Mariusz Zaborski * All rights reserved. * From owner-svn-src-all@freebsd.org Sat Jan 27 12:58:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A6EAEBEEE7; Sat, 27 Jan 2018 12:58:23 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E1797879B9; Sat, 27 Jan 2018 12:58:22 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC5B22A0F; Sat, 27 Jan 2018 12:58:22 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RCwMXS078839; Sat, 27 Jan 2018 12:58:22 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RCwMl0078832; Sat, 27 Jan 2018 12:58:22 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201801271258.w0RCwMl0078832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 27 Jan 2018 12:58:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328474 - head/sys/contrib/libnv X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sys/contrib/libnv X-SVN-Commit-Revision: 328474 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 12:58:23 -0000 Author: oshogbo Date: Sat Jan 27 12:58:21 2018 New Revision: 328474 URL: https://svnweb.freebsd.org/changeset/base/328474 Log: Add SPDX tags for nv(9). MFC after: 2 weeks Modified: head/sys/contrib/libnv/cnvlist.c head/sys/contrib/libnv/dnvlist.c head/sys/contrib/libnv/nv_impl.h head/sys/contrib/libnv/nvlist.c head/sys/contrib/libnv/nvlist_impl.h head/sys/contrib/libnv/nvpair.c head/sys/contrib/libnv/nvpair_impl.h Modified: head/sys/contrib/libnv/cnvlist.c ============================================================================== --- head/sys/contrib/libnv/cnvlist.c Sat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/cnvlist.c Sat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 Adam Starak * All rights reserved. * Modified: head/sys/contrib/libnv/dnvlist.c ============================================================================== --- head/sys/contrib/libnv/dnvlist.c Sat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/dnvlist.c Sat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * Modified: head/sys/contrib/libnv/nv_impl.h ============================================================================== --- head/sys/contrib/libnv/nv_impl.h Sat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/nv_impl.h Sat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * Copyright (c) 2013-2015 Mariusz Zaborski * All rights reserved. Modified: head/sys/contrib/libnv/nvlist.c ============================================================================== --- head/sys/contrib/libnv/nvlist.c Sat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/nvlist.c Sat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009-2013 The FreeBSD Foundation * Copyright (c) 2013-2015 Mariusz Zaborski * All rights reserved. Modified: head/sys/contrib/libnv/nvlist_impl.h ============================================================================== --- head/sys/contrib/libnv/nvlist_impl.h Sat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/nvlist_impl.h Sat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * Copyright (c) 2013-2015 Mariusz Zaborski * All rights reserved. Modified: head/sys/contrib/libnv/nvpair.c ============================================================================== --- head/sys/contrib/libnv/nvpair.c Sat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/nvpair.c Sat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009-2013 The FreeBSD Foundation * Copyright (c) 2013-2015 Mariusz Zaborski * All rights reserved. Modified: head/sys/contrib/libnv/nvpair_impl.h ============================================================================== --- head/sys/contrib/libnv/nvpair_impl.h Sat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/nvpair_impl.h Sat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009-2013 The FreeBSD Foundation * Copyright (c) 2013-2015 Mariusz Zaborski * All rights reserved. From owner-svn-src-all@freebsd.org Sat Jan 27 13:29:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 010E3EC15FC; Sat, 27 Jan 2018 13:29:57 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6BF568AC9; Sat, 27 Jan 2018 13:29:56 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A16E92F31; Sat, 27 Jan 2018 13:29:56 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RDTuub093853; Sat, 27 Jan 2018 13:29:56 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RDTtOM093844; Sat, 27 Jan 2018 13:29:55 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201801271329.w0RDTtOM093844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Sat, 27 Jan 2018 13:29: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: r328475 - stable/11/contrib/tzdata X-SVN-Group: stable-11 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/11/contrib/tzdata X-SVN-Commit-Revision: 328475 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 13:29:57 -0000 Author: philip Date: Sat Jan 27 13:29:55 2018 New Revision: 328475 URL: https://svnweb.freebsd.org/changeset/base/328475 Log: MFC r328055: Import tzdata 2018a MFC r328318: Import tzdata 2018c Replaced: stable/11/contrib/tzdata/pacificnew - copied unchanged from r328318, head/contrib/tzdata/pacificnew Modified: stable/11/contrib/tzdata/Makefile stable/11/contrib/tzdata/NEWS stable/11/contrib/tzdata/README stable/11/contrib/tzdata/africa stable/11/contrib/tzdata/asia stable/11/contrib/tzdata/australasia stable/11/contrib/tzdata/backzone stable/11/contrib/tzdata/europe stable/11/contrib/tzdata/leap-seconds.list stable/11/contrib/tzdata/leapseconds stable/11/contrib/tzdata/northamerica stable/11/contrib/tzdata/southamerica stable/11/contrib/tzdata/theory.html stable/11/contrib/tzdata/version stable/11/contrib/tzdata/zishrink.awk stable/11/contrib/tzdata/zone.tab stable/11/contrib/tzdata/zone1970.tab Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/tzdata/Makefile ============================================================================== --- stable/11/contrib/tzdata/Makefile Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/Makefile Sat Jan 27 13:29:55 2018 (r328475) @@ -42,37 +42,64 @@ POSIXRULES= America/New_York # Also see TZDEFRULESTRING below, which takes effect only # if the time zone files cannot be accessed. -# Everything gets put in subdirectories of. . . -TOPDIR= /usr/local +# Installation locations. +# +# The defaults are suitable for Debian, except that if REDO is +# posix_right or right_posix then files that Debian puts under +# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead +# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, +# respectively. Problems with the Debian approach are discussed in +# the commentary for the right_posix rule (below). +# Destination directory, which can be used for staging. +# 'make DESTDIR=/stage install' installs under /stage (e.g., to +# /stage/etc/localtime instead of to /etc/localtime). Files under +# /stage are not intended to work as-is, but can be copied by hand to +# the root directory later. If DESTDIR is empty, 'make install' does +# not stage, but installs directly into production locations. +DESTDIR = + +# Everything is installed into subdirectories of TOPDIR, and used there. +# TOPDIR should be empty (meaning the root directory), +# or a directory name that does not end in "/". +# TOPDIR should be empty or an absolute name unless you're just testing. +TOPDIR = + +# The default local time zone is taken from the file TZDEFAULT. +TZDEFAULT = $(TOPDIR)/etc/localtime + +# The subdirectory containing installed program and data files, and +# likewise for installed files that can be shared among architectures. +# These should be relative file names. +USRDIR = usr +USRSHAREDIR = $(USRDIR)/share + # "Compiled" time zone information is placed in the "TZDIR" directory # (and subdirectories). -# Use an absolute path name for TZDIR unless you're just testing the software. # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. - TZDIR_BASENAME= zoneinfo -TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME) +TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) -# Types to try, as an alternative to time_t. int64_t should be first. -TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t +# The "tzselect" and (if you do "make INSTALL") "date" commands go in: +BINDIR = $(TOPDIR)/$(USRDIR)/bin -# The "tzselect", "zic", and "zdump" commands get installed in. . . +# The "zdump" command goes in: +ZDUMPDIR = $(BINDIR) -ETCDIR= $(TOPDIR)/etc +# The "zic" command goes in: +ZICDIR = $(TOPDIR)/$(USRDIR)/sbin -# If you "make INSTALL", the "date" command gets installed in. . . - -BINDIR= $(TOPDIR)/bin - # Manual pages go in subdirectories of. . . +MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man -MANDIR= $(TOPDIR)/man - # Library functions are put in an archive in LIBDIR. +LIBDIR = $(TOPDIR)/$(USRDIR)/lib -LIBDIR= $(TOPDIR)/lib +# Types to try, as an alternative to time_t. int64_t should be first. +TIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t + # If you want only POSIX time, with time values interpreted as # seconds since the epoch (not counting leap seconds), use # REDO= posix_only @@ -105,11 +132,14 @@ REDO= posix_right TZDATA_TEXT= leapseconds tzdata.zi # For backward-compatibility links for old zone names, use +# BACKWARD= backward +# If you also want the link US/Pacific-New, even though it is confusing +# and is planned to be removed from the database eventually, use # BACKWARD= backward pacificnew # To omit these links, use # BACKWARD= -BACKWARD= backward pacificnew +BACKWARD= backward # If you want out-of-scope and often-wrong data from the file 'backzone', use # PACKRATDATA= backzone @@ -313,7 +343,7 @@ ZFLAGS= # How to use zic to install tz binary files. -ZIC_INSTALL= $(ZIC) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS) +ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) # The name of a Posix-compliant 'awk' on your system. AWK= awk @@ -341,8 +371,8 @@ SGML_CATALOG_FILES= \ VALIDATE = nsgmls VALIDATE_FLAGS = -s -B -wall -wno-unused-param VALIDATE_ENV = \ - SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \ - SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \ + SGML_CATALOG_FILES='$(SGML_CATALOG_FILES)' \ + SGML_SEARCH_PATH='$(SGML_SEARCH_PATH)' \ SP_CHARSET_FIXED=YES \ SP_ENCODING=UTF-8 @@ -396,7 +426,7 @@ GZIPFLAGS= -9n #MAKE= make cc= cc -CC= $(cc) -DTZDIR=\"$(TZDIR)\" +CC= $(cc) -DTZDIR='"$(TZDIR)"' AR= ar @@ -421,18 +451,19 @@ MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.t date.1.txt COMMON= calendars CONTRIBUTING LICENSE Makefile \ NEWS README theory.html version -WEB_PAGES= tz-art.htm tz-how-to.html tz-link.htm +WEB_PAGES= tz-art.html tz-how-to.html tz-link.html DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) PRIMARY_YDATA= africa antarctica asia australasia \ europe northamerica southamerica -YDATA= $(PRIMARY_YDATA) etcetera $(BACKWARD) +YDATA= $(PRIMARY_YDATA) etcetera NDATA= systemv factory -TDATA= $(YDATA) $(NDATA) +TDATA_TO_CHECK= $(YDATA) $(NDATA) backward pacificnew +TDATA= $(YDATA) $(NDATA) $(BACKWARD) ZONETABLES= zone1970.tab zone.tab TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) LEAP_DEPS= leapseconds.awk leap-seconds.list -TZDATA_ZI_DEPS= zishrink.awk $(TDATA) $(PACKRATDATA) -DATA= $(YDATA) $(NDATA) backzone iso3166.tab leap-seconds.list \ +TZDATA_ZI_DEPS= zishrink.awk version $(TDATA) $(PACKRATDATA) +DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ leapseconds yearistype.sh $(ZONETABLES) AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk zishrink.awk MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl @@ -457,7 +488,7 @@ VERSION_DEPS= \ newctime.3 newstrftime.3 newtzset.3 northamerica \ pacificnew private.h \ southamerica strftime.c systemv theory.html \ - time2posix.3 tz-art.htm tz-how-to.html tz-link.htm \ + time2posix.3 tz-art.html tz-how-to.html tz-link.html \ tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ workman.sh yearistype.sh \ zdump.8 zdump.c zic.8 zic.c \ @@ -473,35 +504,41 @@ all: tzselect yearistype zic zdump libtz.a $(TABDATA) ALL: all date $(ENCHILADA) install: all $(DATA) $(REDO) $(MANS) - mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \ - $(DESTDIR)$(LIBDIR) \ - $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \ - $(DESTDIR)$(MANDIR)/man8 - $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) - cp -f $(TABDATA) $(DESTDIR)$(TZDIR)/. - cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/. - cp libtz.a $(DESTDIR)$(LIBDIR)/. - $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a - cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/. - cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/. - cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/. + mkdir -p '$(DESTDIR)$(BINDIR)' \ + '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ + '$(DESTDIR)$(LIBDIR)' \ + '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ + '$(DESTDIR)$(MANDIR)/man8' + $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) \ + -t '$(DESTDIR)$(TZDEFAULT)' + cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' + cp tzselect '$(DESTDIR)$(BINDIR)/.' + cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' + cp zic '$(DESTDIR)$(ZICDIR)/.' + cp libtz.a '$(DESTDIR)$(LIBDIR)/.' + $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' + cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' + cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' + cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' INSTALL: ALL install date.1 - mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 - cp date $(DESTDIR)$(BINDIR)/. - cp -f date.1 $(DESTDIR)$(MANDIR)/man1/. + mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' + cp date '$(DESTDIR)$(BINDIR)/.' + cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' version: $(VERSION_DEPS) { (type git) >/dev/null 2>&1 && \ V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ --abbrev=7 --dirty` || \ - V=$(VERSION); } && \ + V='$(VERSION)'; } && \ printf '%s\n' "$$V" >$@.out mv $@.out $@ # This file can be tailored by setting BACKWARD, PACKRATDATA, etc. tzdata.zi: $(TZDATA_ZI_DEPS) - LC_ALL=C $(AWK) -f zishrink.awk $(TDATA) $(PACKRATDATA) >$@.out + version=`sed 1q version` && \ + LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \ + $(TDATA) $(PACKRATDATA) >$@.out mv $@.out $@ version.h: version @@ -529,12 +566,13 @@ leapseconds: $(LEAP_DEPS) # Arguments to pass to submakes of install_data. # They can be overridden by later submake arguments. INSTALLARGS = \ - BACKWARD=$(BACKWARD) \ - DESTDIR=$(DESTDIR) \ + BACKWARD='$(BACKWARD)' \ + DESTDIR='$(DESTDIR)' \ LEAPSECONDS='$(LEAPSECONDS)' \ PACKRATDATA='$(PACKRATDATA)' \ - TZDIR=$(TZDIR) \ - YEARISTYPE=$(YEARISTYPE) \ + TZDEFAULT='$(TZDEFAULT)' \ + TZDIR='$(TZDIR)' \ + YEARISTYPE='$(YEARISTYPE)' \ ZIC='$(ZIC)' # 'make install_data' installs one set of tz binary files. @@ -558,16 +596,16 @@ right_only: # You must replace all of $(TZDIR) to switch from not using leap seconds # to using them, or vice versa. right_posix: right_only - rm -fr $(DESTDIR)$(TZDIR)-leaps - ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \ - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only + rm -fr '$(DESTDIR)$(TZDIR)-leaps' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only posix_right: posix_only - rm -fr $(DESTDIR)$(TZDIR)-posix - ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \ - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only + rm -fr '$(DESTDIR)$(TZDIR)-posix' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only # This obsolescent rule is present for backwards compatibility with # tz releases 2014g through 2015g. It should go away eventually. @@ -633,7 +671,7 @@ check_character_set: $(ENCHILADA) $(MISC) $(SOURCES) $(WEB_PAGES) \ CONTRIBUTING LICENSE Makefile README \ version tzdata.zi && \ - ! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ leapseconds yearistype.sh zone.tab && \ ! grep -Env $(OK_LINE) $(ENCHILADA); \ } @@ -641,14 +679,16 @@ check_character_set: $(ENCHILADA) check_white_space: $(ENCHILADA) patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ ! grep -En "$$pat" $(ENCHILADA) - ! grep -n '[[:space:]]$$' $(ENCHILADA) + ! grep -n '[[:space:]]$$' \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+ FILE_NAME_COMPONENT_TOO_LONG = \ $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15} -check_name_lengths: $(TDATA) backzone - ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' $(TDATA) backzone +check_name_lengths: $(TDATA_TO_CHECK) backzone + ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ + $(TDATA_TO_CHECK) backzone CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } @@ -662,8 +702,8 @@ check_sorted: backward backzone iso3166.tab zone.tab z $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \ LC_ALL=C sort -cu -check_links: checklinks.awk $(TDATA) - $(AWK) -f checklinks.awk $(TDATA) +check_links: checklinks.awk $(TDATA_TO_CHECK) + $(AWK) -f checklinks.awk $(TDATA_TO_CHECK) $(AWK) -f checklinks.awk tzdata.zi check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES) @@ -764,12 +804,12 @@ set-timestamps.out: $(ENCHILADA) check_public: $(MAKE) maintainer-clean - $(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL + $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL mkdir -p public.dir - for i in $(TDATA) tzdata.zi; do \ + for i in $(TDATA_TO_CHECK) tzdata.zi; do \ $(zic) -v -d public.dir $$i 2>&1 || exit; \ done - $(zic) -v -d public.dir $(TDATA) + $(zic) -v -d public.dir $(TDATA_TO_CHECK) rm -fr public.dir # Check that the code works under various alternative @@ -790,8 +830,11 @@ check_time_t_alternatives: REDO='$(REDO)' \ install && \ diff $$quiet_option -r \ - time_t.dir/int64_t/etc/zoneinfo \ - time_t.dir/$$type/etc/zoneinfo && \ + time_t.dir/int64_t/etc \ + time_t.dir/$$type/etc && \ + diff $$quiet_option -r \ + time_t.dir/int64_t/usr/share \ + time_t.dir/$$type/usr/share && \ case $$type in \ int32_t) range=-2147483648,2147483647;; \ uint32_t) range=0,4294967296;; \ @@ -800,9 +843,9 @@ check_time_t_alternatives: *) range=-10000000000,10000000000;; \ esac && \ echo checking $$type zones ... && \ - time_t.dir/int64_t/etc/zdump -V -t $$range $$zones \ + time_t.dir/int64_t/usr/bin/zdump -V -t $$range $$zones \ >time_t.dir/int64_t.out && \ - time_t.dir/$$type/etc/zdump -V -t $$range $$zones \ + time_t.dir/$$type/usr/bin/zdump -V -t $$range $$zones \ >time_t.dir/$$type.out && \ diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \ || exit; \ Modified: stable/11/contrib/tzdata/NEWS ============================================================================== --- stable/11/contrib/tzdata/NEWS Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/NEWS Sat Jan 27 13:29:55 2018 (r328475) @@ -1,5 +1,147 @@ News for the tz database +Release 2018c - 2018-01-22 23:00:44 -0800 + + Briefly: + Revert Irish changes that relied on negative DST offsets. + + Changes to tm_isdst + + Revert the 2018a change to Europe/Dublin. As before, this change + does not affect UT offsets or abbreviations; it affects only + whether timestamps are considered to be standard time or + daylight-saving time, as expressed in the tm_isdst flag of C's + struct tm type. This reversion is intended to be a temporary + workaround for problems discovered with downstream uses of + releases 2018a and 2018b, which implemented Irish time by using + negative DST offsets in the Eire rules of the 'europe' file. + Although negative DST offsets have been part of tzcode for many + years and are supported by many platforms, they were not + documented before 2018a and ICU and OpenJDK do not currently + support them. A mechanism to export data to platforms lacking + support for negative DST is planned to be developed before the + change is reapplied. (Problems reported by Deborah Goldsmith and + Stephen Colebourne.) + + Changes to past time stamps + + Japanese DST transitions (1948-1951) were Sundays at 00:00, not + Saturdays or Sundays at 02:00. (Thanks to Takayuki Nikai.) + + Changes to build procedure + + The build procedure now works around mawk 1.3.3's lack of support + for character class expressions. (Problem reported by Ohyama.) + + +Release 2018b - 2018-01-17 23:24:48 -0800 + + Briefly: + Fix a packaging problem in tz2018a, which was missing 'pacificnew'. + + Changes to build procedure + + The distribution now contains the file 'pacificnew' again. + This file was inadvertantly omitted in the 2018a distribution. + (Problem reported by Matias Fonzo.) + + +Release 2018a - 2018-01-12 22:29:21 -0800 + + Briefly: + São Tomé and Príncipe switched from +00 to +01. + Brazil's DST will now start on November's first Sunday. + Ireland's standard time is now in the summer, not the winter. + Use Debian-style installation locations, instead of 4.3BSD-style. + New zic option -t. + + Changes to past and future time stamps + + São Tomé and Príncipe switched from +00 to +01 on 2018-01-01 at + 01:00. (Thanks to Steffen Thorsen and Michael Deckers.) + + Changes to future time stamps + + Starting in 2018 southern Brazil will begin DST on November's + first Sunday instead of October's third Sunday. (Thanks to + Steffen Thorsen.) + + Changes to past time stamps + + A discrepancy of 4 s in timestamps before 1931 in South Sudan has + been corrected. The 'backzone' and 'zone.tab' files did not agree + with the 'africa' and 'zone1970.tab' files. (Problem reported by + Michael Deckers.) + + The abbreviation invented for Bolivia Summer Time (1931-2) is now + BST instead of BOST, to be more consistent with the convention + used for Latvian Summer Time (1918-9) and for British Summer Time. + + Changes to tm_isdst + + Change Europe/Dublin so that it observes Irish Standard Time (UT + +01) in summer and GMT (as negative daylight-saving) in winter, + instead of observing standard time (GMT) in winter and Irish + Summer Time (UT +01) in summer. This change does not affect UT + offsets or abbreviations; it affects only whether timestamps are + considered to be standard time or daylight-saving time, as + expressed in the tm_isdst flag of C's struct tm type. + (Discrepancy noted by Derick Rethans.) + + Changes to build procedure + + The default installation locations have been changed to mostly + match Debian circa 2017, instead of being designed as an add-on to + 4.3BSD circa 1986. This affects the Makefile macros TOPDIR, + TZDIR, MANDIR, and LIBDIR. New Makefile macros TZDEFAULT, USRDIR, + USRSHAREDIR, BINDIR, ZDUMPDIR, and ZICDIR let installers tailor + locations more precisely. (This responds to suggestions from + Brian Inglis and from Steve Summit.) + + The default installation procedure no longer creates the + backward-compatibility link US/Pacific-New, which causes + confusion during user setup (e.g., see Debian bug 815200). + Use 'make BACKWARD="backward pacificnew"' to create the link + anyway, for now. Eventually we plan to remove the link entirely. + + tzdata.zi now contains a version-number comment. + (Suggested by Tom Lane.) + + The Makefile now quotes values like BACKWARD more carefully when + passing them to the shell. (Problem reported by Zefram.) + + Builders no longer need to specify -DHAVE_SNPRINTF on platforms + that have snprintf and use pre-C99 compilers. (Problem reported + by Jon Skeet.) + + Changes to code + + zic has a new option -t FILE that specifies the location of the + file that determines local time when TZ is unset. The default for + this location can be configured via the new TZDEFAULT makefile + macro, which defaults to /etc/localtime. + + Diagnostics and commentary now distinguish UT from UTC more + carefully; see theory.html for more information about UT vs UTC. + + zic has been ported to GCC 8's -Wstringop-truncation option. + (Problem reported by Martin Sebor.) + + Changes to documentation and commentary + + The zic man page now documents the longstanding behavior that + times and years can be out of the usual range, with negative times + counting backwards from midnight and with year 0 preceding year 1. + (Problem reported by Michael Deckers.) + + The theory.html file now mentions the POSIX limit of six chars + per abbreviation, and lists alphabetic abbreviations used. + + The files tz-art.htm and tz-link.htm have been renamed to + tz-art.html and tz-link.html, respectively, for consistency with + other file names and to simplify web server configuration. + + Release 2017c - 2017-10-20 14:49:34 -0700 Briefly: @@ -895,8 +1037,8 @@ Release 2015f - 2015-08-10 18:06:56 -0700 (Thanks to Jon Skeet and Arthur David Olson.) Constraints on simultaneity are now documented. - The two characters '%z' in a zone format now stand for the UTC - offset, e.g., '-07' for seven hours behind UTC and '+0530' for + The two characters '%z' in a zone format now stand for the UT + offset, e.g., '-07' for seven hours behind UT and '+0530' for five hours and thirty minutes ahead. This better supports time zone abbreviations conforming to POSIX.1-2001 and later. @@ -1019,13 +1161,13 @@ Release 2015c - 2015-04-11 08:55:55 -0700 The spring 1988 transition was 1988-10-09, not 1988-10-02. The fall 1990 transition was 1990-03-11, not 1990-03-18. - Assume no UTC offset change for Pacific/Easter on 1890-01-01, + Assume no UT offset change for Pacific/Easter on 1890-01-01, and omit all transitions on Pacific/Easter from 1942 through 1946 since we have no data suggesting that they existed. One more zone has been turned into a link, as it differed from an existing zone only for older time stamps. As usual, - this change affects UTC offsets in pre-1970 time stamps only. + this change affects UT offsets in pre-1970 time stamps only. The zone's old contents have been moved to the 'backzone' file. The affected zone is America/Montreal. @@ -1055,7 +1197,7 @@ Release 2015b - 2015-03-19 23:28:11 -0700 Some more zones have been turned into links, when they differed from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. + these changes affect UT offsets in pre-1970 time stamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: America/Antigua, America/Cayman, Pacific/Midway, and Pacific/Saipan. @@ -1107,7 +1249,7 @@ Release 2015a - 2015-01-29 22:35:20 -0800 Some more zones have been turned into links, when they differed from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. + these changes affect UT offsets in pre-1970 time stamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Asia/Aden, Asia/Bahrain, Asia/Kuwait, and Asia/Muscat. @@ -1154,7 +1296,7 @@ Release 2014j - 2014-11-10 17:37:11 -0800 Some more zones have been turned into links, when they differed from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. + these changes affect UT offsets in pre-1970 time stamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Africa/Addis_Ababa, Africa/Asmara, Africa/Dar_es_Salaam, Africa/Djibouti, Africa/Kampala, @@ -1244,7 +1386,7 @@ Release 2014h - 2014-09-25 18:59:03 -0700 Some more zones have been turned into links, when they differed from existing zones only for older timestamps. As usual, - these changes affect UTC offsets in pre-1970 timestamps only. + these changes affect UT offsets in pre-1970 timestamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Africa/Blantyre, Africa/Bujumbura, Africa/Gaborone, Africa/Harare, Africa/Kigali, Africa/Lubumbashi, @@ -1329,7 +1471,7 @@ Release 2014g - 2014-08-28 12:31:23 -0700 Some more zones have been turned into links, when they differed from existing zones only for older timestamps. As usual, - these changes affect UTC offsets in pre-1970 timestamps only. + these changes affect UT offsets in pre-1970 timestamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Africa/Bangui, Africa/Brazzaville, Africa/Douala, Africa/Kinshasa, Africa/Libreville, Africa/Luanda, @@ -1479,7 +1621,7 @@ Release 2014f - 2014-08-05 17:42:36 -0700 standard and daylight saving time the abbreviations are AEST and AEDT instead of the former EST for both; similarly, ACST/ACDT, ACWST/ACWDT, and AWST/AWDT are now used instead of the former CST, CWST, and WST. - This change does not affect UTC offsets, only time zone abbreviations. + This change does not affect UT offsets, only time zone abbreviations. (Thanks to Rich Tibbett and many others.) Asia/Novokuznetsk shifts from NOVT to KRAT (remaining on UT +07) @@ -1516,8 +1658,8 @@ Release 2014f - 2014-08-05 17:42:36 -0700 Treindl sent helpful translations of two papers by Guo Qingsheng.) Some zones have been turned into links, when they differed from existing - zones only for older UTC offsets where data entries were likely invented. - These changes affect UTC offsets in pre-1970 timestamps only. This is + zones only for older UT offsets where data entries were likely invented. + These changes affect UT offsets in pre-1970 timestamps only. This is similar to the change in release 2013e, except this time for western Africa. The affected zones are: Africa/Bamako, Africa/Banjul, Africa/Conakry, Africa/Dakar, Africa/Freetown, Africa/Lome, Modified: stable/11/contrib/tzdata/README ============================================================================== --- stable/11/contrib/tzdata/README Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/README Sat Jan 27 13:29:55 2018 (r328475) @@ -11,14 +11,14 @@ changes made by political bodies to time zone boundari and daylight-saving rules. See or the -file tz-link.htm for how to acquire the code and data. Once acquired, +file tz-link.html for how to acquire the code and data. Once acquired, read the comments in the file 'Makefile' and make any changes needed to make things right for your system, especially if you are using some platform other than GNU/Linux. Then run the following commands, substituting your desired installation directory for "$HOME/tzdir": make TOPDIR=$HOME/tzdir install - $HOME/tzdir/etc/zdump -v America/Los_Angeles + $HOME/tzdir/usr/bin/zdump -v America/Los_Angeles Historical local time information has been included here to: Modified: stable/11/contrib/tzdata/africa ============================================================================== --- stable/11/contrib/tzdata/africa Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/africa Sat Jan 27 13:29:55 2018 (r328475) @@ -158,7 +158,6 @@ Link Africa/Abidjan Africa/Freetown # Sierra Leone Link Africa/Abidjan Africa/Lome # Togo Link Africa/Abidjan Africa/Nouakchott # Mauritania Link Africa/Abidjan Africa/Ouagadougou # Burkina Faso -Link Africa/Abidjan Africa/Sao_Tome # São Tomé and Príncipe Link Africa/Abidjan Atlantic/St_Helena # St Helena # Djibouti @@ -425,7 +424,7 @@ Link Africa/Nairobi Indian/Mayotte # # The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30. # -# In 1972 Liberia was the last country to switch from a UTC offset +# In 1972 Liberia was the last country to switch from a UT offset # that was not a multiple of 15 or 20 minutes. The 1972 change was on # 1972-01-07, according to an entry dated 1972-01-04 on p 330 of: # Presidential Papers: First year of the administration of @@ -1037,6 +1036,19 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Den # Inaccessible, Nightingale: uninhabited # São Tomé and Príncipe + +# From Steffen Thorsen (2018-01-08): +# Multiple sources tell that São Tomé changed from UTC to UTC+1 as +# they entered the year 2018. +# From Michael Deckers (2018-01-08): +# the switch is from 01:00 to 02:00 ... [Decree No. 25/2017] +# http://www.mnec.gov.st/index.php/publicacoes/documentos/file/90-decreto-lei-n-25-2017 + +Zone Africa/Sao_Tome 0:26:56 - LMT 1884 + -0:36:45 - LMT 1912 # Lisbon Mean Time + 0:00 - GMT 2018 Jan 1 01:00 + 1:00 - WAT + # Senegal # See Africa/Abidjan. Modified: stable/11/contrib/tzdata/asia ============================================================================== --- stable/11/contrib/tzdata/asia Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/asia Sat Jan 27 13:29:55 2018 (r328475) @@ -50,7 +50,7 @@ # 9:00 KST KDT Korea when at +09 # 9:30 ACST Australian Central Standard Time # Otherwise, these tables typically use numeric abbreviations like +03 -# and +0330 for integer hour and minute UTC offsets. Although earlier +# and +0330 for integer hour and minute UT offsets. Although earlier # editions invented alphabetic time zone abbreviations for every # offset, this did not reflect common practice. # @@ -647,17 +647,17 @@ Zone Asia/Hong_Kong 7:36:42 - LMT 1904 Oct 30 # time", in which abolished the adoption of Western Standard Time in # western islands (listed above), which means the whole Japan # territory, including later occupations, adopt Japan Central Time -# (UTC+9). The adoption began on Oct 1, 1937. The original text can +# (UT+9). The adoption began on Oct 1, 1937. The original text can # be found on Wikisource: # https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件 # -# That is, the time zone of Taipei switched to UTC+9 on Oct 1, 1937. +# That is, the time zone of Taipei switched to UT+9 on Oct 1, 1937. # From Yu-Cheng Chuang (2014-07-02): -# I've found more evidence about when the time zone was switched from UTC+9 -# back to UTC+8 after WW2. I believe it was on Sep 21, 1945. In a document +# I've found more evidence about when the time zone was switched from UT+9 +# back to UT+8 after WW2. I believe it was on Sep 21, 1945. In a document # during Japanese era [1] in which the officer told the staff to change time -# zone back to Western Standard Time (UTC+8) on Sep 21. And in another +# zone back to Western Standard Time (UT+8) on Sep 21. And in another # history page of National Cheng Kung University [2], on Sep 21 there is a # note "from today, switch back to Western Standard Time". From these two # materials, I believe that the time zone change happened on Sep 21. And @@ -1464,17 +1464,17 @@ Zone Asia/Jerusalem 2:20:54 - LMT 1880 # of the Japanese wanted to scrap daylight-saving time, as opposed to 30% who # wanted to keep it.) -# From Paul Eggert (2006-03-22): -# Shanks & Pottenger write that DST in Japan during those years was as follows: +# From Takayuki Nikai (2018-01-19): +# The source of information is Japanese law. +# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00219480428029.htm +# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00719500331039.htm +# ... In summary, it is written as follows. From 24:00 on the first Saturday +# in May, until 0:00 on the day after the second Saturday in September. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Japan 1948 only - May Sun>=1 2:00 1:00 D -Rule Japan 1948 1951 - Sep Sat>=8 2:00 0 S -Rule Japan 1949 only - Apr Sun>=1 2:00 1:00 D -Rule Japan 1950 1951 - May Sun>=1 2:00 1:00 D -# but the only locations using it (for birth certificates, presumably, since -# their audience is astrologers) were US military bases. For now, assume -# that for most purposes daylight-saving time was observed; otherwise, what -# would have been the point of the 1951 poll? +Rule Japan 1948 only - May Sat>=1 24:00 1:00 D +Rule Japan 1948 1951 - Sep Sun>=9 0:00 0 S +Rule Japan 1949 only - Apr Sat>=1 24:00 1:00 D +Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D # From Hideyuki Suzuki (1998-11-09): # 'Tokyo' usually stands for the former location of Tokyo Astronomical @@ -1505,7 +1505,7 @@ Rule Japan 1950 1951 - May Sun>=1 2:00 1:00 D # # ...the Showa Emperor announced Ordinance No. 529 of Showa Year 12 ... which # means the whole Japan territory, including later occupations, adopt Japan -# Central Time (UTC+9). The adoption began on Oct 1, 1937. +# Central Time (UT+9). The adoption began on Oct 1, 1937. # https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件 # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2066,8 +2066,8 @@ Zone Asia/Kuching 7:21:20 - LMT 1926 Mar # Maldives # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Maldives 4:54:00 - LMT 1880 # Male - 4:54:00 - MMT 1960 # Male Mean Time +Zone Indian/Maldives 4:54:00 - LMT 1880 # Malé + 4:54:00 - MMT 1960 # Malé Mean Time 5:00 - +05 # Mongolia Modified: stable/11/contrib/tzdata/australasia ============================================================================== --- stable/11/contrib/tzdata/australasia Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/australasia Sat Jan 27 13:29:55 2018 (r328475) @@ -683,8 +683,8 @@ Zone Pacific/Guadalcanal 10:39:48 - LMT 1912 Oct # Hon # From Steffen Thorsen (2012-07-25) # ... we double checked by calling hotels and offices based in Tokelau asking # about the time there, and they all told a time that agrees with UTC+13.... -# Shanks says UTC-10 from 1901 [but] ... there is a good chance the change -# actually was to UTC-11 back then. +# Shanks says UT-10 from 1901 [but] ... there is a good chance the change +# actually was to UT-11 back then. # # From Paul Eggert (2012-07-25) # A Google Books snippet of Appendix to the Journals of the House of @@ -1450,7 +1450,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # # From Paul Eggert (2006-03-22): # The Department of Internal Affairs (DIA) maintains a brief history, -# as does Carol Squires; see tz-link.htm for the full references. +# as does Carol Squires; see tz-link.html for the full references. # Use these sources in preference to Shanks & Pottenger. # # For Chatham, IATA SSIM (1991/1999) gives the NZ rules but with Modified: stable/11/contrib/tzdata/backzone ============================================================================== --- stable/11/contrib/tzdata/backzone Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/backzone Sat Jan 27 13:29:55 2018 (r328475) @@ -145,11 +145,6 @@ Zone Africa/Gaborone 1:43:40 - LMT 1885 Zone Africa/Harare 2:04:12 - LMT 1903 Mar 2:00 - CAT -# South Sudan -Zone Africa/Juba 2:06:24 - LMT 1931 - 2:00 Sudan CA%sT 2000 Jan 15 12:00 - 3:00 - EAT - # Uganda Zone Africa/Kampala 2:09:40 - LMT 1928 Jul 3:00 - EAT 1930 @@ -241,11 +236,6 @@ Zone Africa/Ouagadougou -0:06:04 - LMT 1912 Zone Africa/Porto-Novo 0:10:28 - LMT 1912 Jan 1 0:00 - GMT 1934 Feb 26 1:00 - WAT - -# São Tomé and Príncipe -Zone Africa/Sao_Tome 0:26:56 - LMT 1884 - -0:36:32 - LMT 1912 # Lisbon Mean Time - 0:00 - GMT # Mali (northern) Zone Africa/Timbuktu -0:12:04 - LMT 1912 Modified: stable/11/contrib/tzdata/europe ============================================================================== --- stable/11/contrib/tzdata/europe Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/europe Sat Jan 27 13:29:55 2018 (r328475) @@ -68,14 +68,15 @@ # 0:00 WET WEST WEMT Western Europe # 0:19:32.13 AMT* NST* Amsterdam, Netherlands Summer (1835-1937) # 1:00 BST British Standard (1968-1971) +# 1:00 IST GMT Irish Standard (1968-) with winter DST # 1:00 CET CEST CEMT Central Europe # 1:00:14 SET Swedish (1879-1899) # 1:36:34 RMT* LST* Riga, Latvian Summer (1880-1926)* # 2:00 EET EEST Eastern Europe # 3:00 MSK MSD MDST* Moscow -# From Peter Ilieve (1994-12-04), -# The original six [EU members]: Belgium, France, (West) Germany, Italy, +# From Peter Ilieve (1994-12-04), re EEC/EC/EU members: +# The original six: Belgium, France, (West) Germany, Italy, # Luxembourg, the Netherlands. # Plus, from 1 Jan 73: Denmark, Ireland, United Kingdom. # Plus, from 1 Jan 81: Greece. @@ -278,16 +279,31 @@ # The following claim by Shanks & Pottenger is possible though doubtful; # we'll ignore it for now. # * Dublin's 1971-10-31 switch was at 02:00, even though London's was 03:00. + +# From Paul Eggert (2017-12-04): # +# Dunsink Observatory (8 km NW of Dublin's center) was to Dublin as +# Greenwich was to London. For example: # -# Whitman says Dublin Mean Time was -0:25:21, which is more precise than -# Shanks & Pottenger. -# Perhaps this was Dunsink Observatory Time, as Dunsink Observatory -# (8 km NW of Dublin's center) seemingly was to Dublin as Greenwich was -# to London. For example: -# # "Timeball on the ballast office is down. Dunsink time." # -- James Joyce, Ulysses +# +# The abbreviation DMT stood for "Dublin Mean Time" or "Dunsink Mean Time"; +# this being Ireland, opinions differed. +# +# Whitman says Dublin/Dunsink Mean Time was UT-00:25:21, which agrees +# with measurements of recent visitors to the Meridian Room of Dunsink +# Observatory; see Malone D. Dunsink and timekeeping. 2016-01-24. +# . Malone +# writes that the Nautical Almanac listed UT-00:25:22 until 1896, when +# it moved to UT-00:25:21.1 (I confirmed that the 1893 edition used +# the former and the 1896 edition used the latter). Evidently the +# news of this change propagated slowly, as Milne 1899 still lists +# UT-00:25:22 and cites the International Telegraph Bureau. As it is +# not clear that there was any practical significance to the change +# from UT-00:25:22 to UT-00:25:21.1 in civil timekeeping, omit this +# transition for now and just use the latter value, omitting its +# fraction since our format cannot represent fractions. # "Countess Markievicz ... claimed that the [1916] abolition of Dublin Mean Time # was among various actions undertaken by the 'English' government that @@ -347,12 +363,28 @@ # regulations. I spoke this morning with the Secretary of the Department of # Justice (tel +353 1 678 9711) who confirmed to me that the correct name is # "Irish Summer Time", abbreviated to "IST". +# +# From Paul Eggert (2017-12-07): +# The 1996 anonymous contributor's goal was to determine the correct +# abbreviation for summer time in Dublin and so the contributor +# focused on the "IST", not on the "Irish Summer Time". Though the +# "IST" was correct, the "Irish Summer Time" appears to have been an +# error, as Ireland's Standard Time (Amendment) Act, 1971 states that +# standard time in Ireland remains at UT +01 and is observed in +# summer, and that Greenwich mean time is observed in winter. (Thanks +# to Derick Rethans for pointing out the error.) That is, when +# Ireland amended the 1968 act that established UT +01 as Irish +# Standard Time, it left standard time unchanged and established GMT +# as a negative daylight saving time in winter. So, in this database +# IST stands for Irish Summer Time for timestamps before 1968, and for +# Irish Standard Time after that. See: +# http://www.irishstatutebook.ie/eli/1971/act/17/enacted/en/print # Michael Deckers (2017-06-01) gave the following URLs for Ireland's # Summer Time Act, 1925 and Summer Time Orders, 1926 and 1947: -# http://www.irishstatutebook.ie/eli/1925/act/8/enacted/en/print.html -# http://www.irishstatutebook.ie/eli/1926/sro/919/made/en/print.html -# http://www.irishstatutebook.ie/eli/1947/sro/71/made/en/print.html +# http://www.irishstatutebook.ie/eli/1925/act/8/enacted/en/print +# http://www.irishstatutebook.ie/eli/1926/sro/919/made/en/print +# http://www.irishstatutebook.ie/eli/1947/sro/71/made/en/print # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Summer Time Act, 1916 @@ -476,9 +508,23 @@ Link Europe/London Europe/Jersey Link Europe/London Europe/Guernsey Link Europe/London Europe/Isle_of_Man +# From Paul Eggert (2018-01-19): +# The following is like GB-Eire and EU, except with standard time in +# summer and negative daylight saving time in winter. +# Although currently commented out, this will need to become uncommented +# once the ICU/OpenJDK workaround is removed; see below. +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +#Rule Eire 1971 only - Oct 31 2:00u -1:00 GMT +#Rule Eire 1972 1980 - Mar Sun>=16 2:00u 0 IST +#Rule Eire 1972 1980 - Oct Sun>=23 2:00u -1:00 GMT +#Rule Eire 1981 max - Mar lastSun 1:00u 0 IST +#Rule Eire 1981 1989 - Oct Sun>=23 1:00u -1:00 GMT +#Rule Eire 1990 1995 - Oct Sun>=22 1:00u -1:00 GMT +#Rule Eire 1996 max - Oct lastSun 1:00u -1:00 GMT + # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 - -0:25:21 - DMT 1916 May 21 2:00s # Dublin MT + -0:25:21 - DMT 1916 May 21 2:00s -0:25:21 1:00 IST 1916 Oct 1 2:00s 0:00 GB-Eire %s 1921 Dec 6 # independence 0:00 GB-Eire GMT/IST 1940 Feb 25 2:00s @@ -487,16 +533,33 @@ Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 0:00 1:00 IST 1947 Nov 2 2:00s 0:00 - GMT 1948 Apr 18 2:00s 0:00 GB-Eire GMT/IST 1968 Oct 27 +# From Paul Eggert (2018-01-18): +# The next line should look like this: +# 1:00 Eire IST/GMT +# However, in January 2018 we discovered that the Eire rules cause +# problems with tests for ICU: +# https://mm.icann.org/pipermail/tz/2018-January/025825.html +# and with tests for OpenJDK: +# https://mm.icann.org/pipermail/tz/2018-January/025822.html +# To work around this problem, use a traditional approximation for +# time stamps after 1971-10-31 02:00 UTC, to give ICU and OpenJDK +# developers breathing room to fix bugs. This approximation has +# correct UTC offsets, but results in tm_isdst flags are the reverse +# of what they should be. This workaround is temporary and should be +# removed reasonably soon. 1:00 - IST 1971 Oct 31 2:00u 0:00 GB-Eire GMT/IST 1996 0:00 EU GMT/IST +# End of workaround for ICU and OpenJDK bugs. + ############################################################################### # Europe -# EU rules are for the European Union, previously known as the EC, EEC, -# Common Market, etc. +# The following rules are for the European Union and for its +# predecessor organization, the European Communities. +# For brevity they are called "EU rules" elsewhere in this file. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EU 1977 1980 - Apr Sun>=1 1:00u 1:00 S @@ -929,7 +992,7 @@ Zone Europe/Prague 0:57:44 - LMT 1850 # The page http://www.retsinfo.dk/_GETDOCI_/ACCN/A18930008330-REGL # confirms this, and states that the law was put forth 1893-03-29. # -# The EU treaty with effect from 1973: +# The EU [actually, EEC and Euratom] treaty with effect from 1973: # http://www.retsinfo.dk/_GETDOCI_/ACCN/A19722110030-REGL # # This provoked a new law from 1974 to make possible summer time changes @@ -985,9 +1048,10 @@ Zone Atlantic/Faroe -0:27:04 - LMT 1908 Jan 11 # Tórs # East Greenland and Franz Josef Land, but we don't know their time zones. # My source for this is Wilhelm Dege's book mentioned under Svalbard. # -# From Paul Eggert (2006-03-22): -# Greenland joined the EU as part of Denmark, obtained home rule on 1979-05-01, -# and left the EU on 1985-02-01. It therefore should have been using EU +# From Paul Eggert (2017-12-10): +# Greenland joined the European Communities as part of Denmark, +# obtained home rule on 1979-05-01, and left the European Communities +# on 1985-02-01. It therefore should have been using EU # rules at least through 1984. Shanks & Pottenger say Scoresbysund and Godthåb # used C-Eur rules after 1980, but IATA SSIM (1991/1996) says they use EU # rules since at least 1991. Assume EU rules since 1980. @@ -1301,7 +1365,7 @@ Zone Europe/Paris 0:09:21 - LMT 1891 Mar 15 0:01 # From Markus Kuhn (1998-09-29): # The German time zone web site by the Physikalisch-Technische # Bundesanstalt contains DST information back to 1916. -# [See tz-link.htm for the URL.] +# [See tz-link.html for the URL.] # From Jörg Schilling (2002-10-23): # In 1945, Berlin was switched to Moscow Summer time (GMT+4) by @@ -1398,7 +1462,7 @@ Zone Europe/Athens 1:34:52 - LMT 1895 Sep 14 1:00 Greece CE%sT 1944 Apr 4 2:00 Greece EE%sT 1981 # Shanks & Pottenger say it switched to C-Eur in 1981; - # go with EU instead, since Greece joined it on Jan 1. + # go with EU rules instead, since Greece joined Jan 1. 2:00 EU EE%sT # Hungary @@ -2097,7 +2161,7 @@ Zone Europe/Warsaw 1:24:00 - LMT 1880 # IATA SSIM (1991/1992) reports that the Azores were at -1:00. # IATA SSIM (1993-02) says +0:00; later issues (through 1996-09) say -1:00. # Guess that the Azores changed to EU rules in 1992 (since that's when Portugal -# harmonized with the EU), and that they stayed +0:00 that winter. +# harmonized with EU rules), and that they stayed +0:00 that winter. # # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # DSH writes that despite Decree 1,469 (1915), the change to the clocks was not @@ -2772,9 +2836,9 @@ Zone Asia/Omsk 4:53:30 - LMT 1919 Nov 14 # # https://regnum.ru/news/society/1957270.html # has some historical data for Altai Krai: -# before 1957: west part on UTC+6, east on UTC+7 -# after 1957: UTC+7 -# since 1995: UTC+6 +# before 1957: west part on UT+6, east on UT+7 +# after 1957: UT+7 +# since 1995: UT+6 # http://barnaul.rusplt.ru/index/pochemu_altajskij_kraj_okazalsja_v_neprivychnom_chasovom_pojase-17648.html # confirms that and provides more details including 1995-05-28 transition date. @@ -3581,6 +3645,17 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See abo # From Paul Eggert (2016-09-07): # The change is permanent, so this is the new standard time in Turkey. # It takes effect today, which is not much notice. + +# From Kıvanç Yazan (2017-10-28): +# Turkey will go back to Daylight Saving Time starting 2018-10. +# http://www.resmigazete.gov.tr/eskiler/2017/10/20171028-5.pdf +# +# From Even Scharning (2017-11-08): *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Jan 27 13:34:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5061AEC1B2F; Sat, 27 Jan 2018 13:34:16 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E249469005; Sat, 27 Jan 2018 13:34:15 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCE9330C1; Sat, 27 Jan 2018 13:34:15 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RDYFR2098697; Sat, 27 Jan 2018 13:34:15 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RDYFVX098688; Sat, 27 Jan 2018 13:34:15 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201801271334.w0RDYFVX098688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Sat, 27 Jan 2018 13:34:15 +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: r328476 - stable/10/contrib/tzdata X-SVN-Group: stable-10 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/10/contrib/tzdata X-SVN-Commit-Revision: 328476 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 13:34:16 -0000 Author: philip Date: Sat Jan 27 13:34:14 2018 New Revision: 328476 URL: https://svnweb.freebsd.org/changeset/base/328476 Log: MFC r328055: Import tzdata 2018a MFC r328318: Import tzdata 2018c Replaced: stable/10/contrib/tzdata/pacificnew - copied unchanged from r328318, head/contrib/tzdata/pacificnew Modified: stable/10/contrib/tzdata/Makefile stable/10/contrib/tzdata/NEWS stable/10/contrib/tzdata/README stable/10/contrib/tzdata/africa stable/10/contrib/tzdata/asia stable/10/contrib/tzdata/australasia stable/10/contrib/tzdata/backzone stable/10/contrib/tzdata/europe stable/10/contrib/tzdata/leap-seconds.list stable/10/contrib/tzdata/leapseconds stable/10/contrib/tzdata/northamerica stable/10/contrib/tzdata/southamerica stable/10/contrib/tzdata/theory.html stable/10/contrib/tzdata/version stable/10/contrib/tzdata/zishrink.awk stable/10/contrib/tzdata/zone.tab stable/10/contrib/tzdata/zone1970.tab Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/tzdata/Makefile ============================================================================== --- stable/10/contrib/tzdata/Makefile Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/Makefile Sat Jan 27 13:34:14 2018 (r328476) @@ -42,37 +42,64 @@ POSIXRULES= America/New_York # Also see TZDEFRULESTRING below, which takes effect only # if the time zone files cannot be accessed. -# Everything gets put in subdirectories of. . . -TOPDIR= /usr/local +# Installation locations. +# +# The defaults are suitable for Debian, except that if REDO is +# posix_right or right_posix then files that Debian puts under +# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead +# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, +# respectively. Problems with the Debian approach are discussed in +# the commentary for the right_posix rule (below). +# Destination directory, which can be used for staging. +# 'make DESTDIR=/stage install' installs under /stage (e.g., to +# /stage/etc/localtime instead of to /etc/localtime). Files under +# /stage are not intended to work as-is, but can be copied by hand to +# the root directory later. If DESTDIR is empty, 'make install' does +# not stage, but installs directly into production locations. +DESTDIR = + +# Everything is installed into subdirectories of TOPDIR, and used there. +# TOPDIR should be empty (meaning the root directory), +# or a directory name that does not end in "/". +# TOPDIR should be empty or an absolute name unless you're just testing. +TOPDIR = + +# The default local time zone is taken from the file TZDEFAULT. +TZDEFAULT = $(TOPDIR)/etc/localtime + +# The subdirectory containing installed program and data files, and +# likewise for installed files that can be shared among architectures. +# These should be relative file names. +USRDIR = usr +USRSHAREDIR = $(USRDIR)/share + # "Compiled" time zone information is placed in the "TZDIR" directory # (and subdirectories). -# Use an absolute path name for TZDIR unless you're just testing the software. # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. - TZDIR_BASENAME= zoneinfo -TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME) +TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) -# Types to try, as an alternative to time_t. int64_t should be first. -TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t +# The "tzselect" and (if you do "make INSTALL") "date" commands go in: +BINDIR = $(TOPDIR)/$(USRDIR)/bin -# The "tzselect", "zic", and "zdump" commands get installed in. . . +# The "zdump" command goes in: +ZDUMPDIR = $(BINDIR) -ETCDIR= $(TOPDIR)/etc +# The "zic" command goes in: +ZICDIR = $(TOPDIR)/$(USRDIR)/sbin -# If you "make INSTALL", the "date" command gets installed in. . . - -BINDIR= $(TOPDIR)/bin - # Manual pages go in subdirectories of. . . +MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man -MANDIR= $(TOPDIR)/man - # Library functions are put in an archive in LIBDIR. +LIBDIR = $(TOPDIR)/$(USRDIR)/lib -LIBDIR= $(TOPDIR)/lib +# Types to try, as an alternative to time_t. int64_t should be first. +TIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t + # If you want only POSIX time, with time values interpreted as # seconds since the epoch (not counting leap seconds), use # REDO= posix_only @@ -105,11 +132,14 @@ REDO= posix_right TZDATA_TEXT= leapseconds tzdata.zi # For backward-compatibility links for old zone names, use +# BACKWARD= backward +# If you also want the link US/Pacific-New, even though it is confusing +# and is planned to be removed from the database eventually, use # BACKWARD= backward pacificnew # To omit these links, use # BACKWARD= -BACKWARD= backward pacificnew +BACKWARD= backward # If you want out-of-scope and often-wrong data from the file 'backzone', use # PACKRATDATA= backzone @@ -313,7 +343,7 @@ ZFLAGS= # How to use zic to install tz binary files. -ZIC_INSTALL= $(ZIC) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS) +ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) # The name of a Posix-compliant 'awk' on your system. AWK= awk @@ -341,8 +371,8 @@ SGML_CATALOG_FILES= \ VALIDATE = nsgmls VALIDATE_FLAGS = -s -B -wall -wno-unused-param VALIDATE_ENV = \ - SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \ - SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \ + SGML_CATALOG_FILES='$(SGML_CATALOG_FILES)' \ + SGML_SEARCH_PATH='$(SGML_SEARCH_PATH)' \ SP_CHARSET_FIXED=YES \ SP_ENCODING=UTF-8 @@ -396,7 +426,7 @@ GZIPFLAGS= -9n #MAKE= make cc= cc -CC= $(cc) -DTZDIR=\"$(TZDIR)\" +CC= $(cc) -DTZDIR='"$(TZDIR)"' AR= ar @@ -421,18 +451,19 @@ MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.t date.1.txt COMMON= calendars CONTRIBUTING LICENSE Makefile \ NEWS README theory.html version -WEB_PAGES= tz-art.htm tz-how-to.html tz-link.htm +WEB_PAGES= tz-art.html tz-how-to.html tz-link.html DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) PRIMARY_YDATA= africa antarctica asia australasia \ europe northamerica southamerica -YDATA= $(PRIMARY_YDATA) etcetera $(BACKWARD) +YDATA= $(PRIMARY_YDATA) etcetera NDATA= systemv factory -TDATA= $(YDATA) $(NDATA) +TDATA_TO_CHECK= $(YDATA) $(NDATA) backward pacificnew +TDATA= $(YDATA) $(NDATA) $(BACKWARD) ZONETABLES= zone1970.tab zone.tab TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) LEAP_DEPS= leapseconds.awk leap-seconds.list -TZDATA_ZI_DEPS= zishrink.awk $(TDATA) $(PACKRATDATA) -DATA= $(YDATA) $(NDATA) backzone iso3166.tab leap-seconds.list \ +TZDATA_ZI_DEPS= zishrink.awk version $(TDATA) $(PACKRATDATA) +DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ leapseconds yearistype.sh $(ZONETABLES) AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk zishrink.awk MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl @@ -457,7 +488,7 @@ VERSION_DEPS= \ newctime.3 newstrftime.3 newtzset.3 northamerica \ pacificnew private.h \ southamerica strftime.c systemv theory.html \ - time2posix.3 tz-art.htm tz-how-to.html tz-link.htm \ + time2posix.3 tz-art.html tz-how-to.html tz-link.html \ tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ workman.sh yearistype.sh \ zdump.8 zdump.c zic.8 zic.c \ @@ -473,35 +504,41 @@ all: tzselect yearistype zic zdump libtz.a $(TABDATA) ALL: all date $(ENCHILADA) install: all $(DATA) $(REDO) $(MANS) - mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \ - $(DESTDIR)$(LIBDIR) \ - $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \ - $(DESTDIR)$(MANDIR)/man8 - $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) - cp -f $(TABDATA) $(DESTDIR)$(TZDIR)/. - cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/. - cp libtz.a $(DESTDIR)$(LIBDIR)/. - $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a - cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/. - cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/. - cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/. + mkdir -p '$(DESTDIR)$(BINDIR)' \ + '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ + '$(DESTDIR)$(LIBDIR)' \ + '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ + '$(DESTDIR)$(MANDIR)/man8' + $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) \ + -t '$(DESTDIR)$(TZDEFAULT)' + cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' + cp tzselect '$(DESTDIR)$(BINDIR)/.' + cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' + cp zic '$(DESTDIR)$(ZICDIR)/.' + cp libtz.a '$(DESTDIR)$(LIBDIR)/.' + $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' + cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' + cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' + cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' INSTALL: ALL install date.1 - mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 - cp date $(DESTDIR)$(BINDIR)/. - cp -f date.1 $(DESTDIR)$(MANDIR)/man1/. + mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' + cp date '$(DESTDIR)$(BINDIR)/.' + cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' version: $(VERSION_DEPS) { (type git) >/dev/null 2>&1 && \ V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ --abbrev=7 --dirty` || \ - V=$(VERSION); } && \ + V='$(VERSION)'; } && \ printf '%s\n' "$$V" >$@.out mv $@.out $@ # This file can be tailored by setting BACKWARD, PACKRATDATA, etc. tzdata.zi: $(TZDATA_ZI_DEPS) - LC_ALL=C $(AWK) -f zishrink.awk $(TDATA) $(PACKRATDATA) >$@.out + version=`sed 1q version` && \ + LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \ + $(TDATA) $(PACKRATDATA) >$@.out mv $@.out $@ version.h: version @@ -529,12 +566,13 @@ leapseconds: $(LEAP_DEPS) # Arguments to pass to submakes of install_data. # They can be overridden by later submake arguments. INSTALLARGS = \ - BACKWARD=$(BACKWARD) \ - DESTDIR=$(DESTDIR) \ + BACKWARD='$(BACKWARD)' \ + DESTDIR='$(DESTDIR)' \ LEAPSECONDS='$(LEAPSECONDS)' \ PACKRATDATA='$(PACKRATDATA)' \ - TZDIR=$(TZDIR) \ - YEARISTYPE=$(YEARISTYPE) \ + TZDEFAULT='$(TZDEFAULT)' \ + TZDIR='$(TZDIR)' \ + YEARISTYPE='$(YEARISTYPE)' \ ZIC='$(ZIC)' # 'make install_data' installs one set of tz binary files. @@ -558,16 +596,16 @@ right_only: # You must replace all of $(TZDIR) to switch from not using leap seconds # to using them, or vice versa. right_posix: right_only - rm -fr $(DESTDIR)$(TZDIR)-leaps - ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \ - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only + rm -fr '$(DESTDIR)$(TZDIR)-leaps' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only posix_right: posix_only - rm -fr $(DESTDIR)$(TZDIR)-posix - ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \ - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only + rm -fr '$(DESTDIR)$(TZDIR)-posix' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only # This obsolescent rule is present for backwards compatibility with # tz releases 2014g through 2015g. It should go away eventually. @@ -633,7 +671,7 @@ check_character_set: $(ENCHILADA) $(MISC) $(SOURCES) $(WEB_PAGES) \ CONTRIBUTING LICENSE Makefile README \ version tzdata.zi && \ - ! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ leapseconds yearistype.sh zone.tab && \ ! grep -Env $(OK_LINE) $(ENCHILADA); \ } @@ -641,14 +679,16 @@ check_character_set: $(ENCHILADA) check_white_space: $(ENCHILADA) patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ ! grep -En "$$pat" $(ENCHILADA) - ! grep -n '[[:space:]]$$' $(ENCHILADA) + ! grep -n '[[:space:]]$$' \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+ FILE_NAME_COMPONENT_TOO_LONG = \ $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15} -check_name_lengths: $(TDATA) backzone - ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' $(TDATA) backzone +check_name_lengths: $(TDATA_TO_CHECK) backzone + ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ + $(TDATA_TO_CHECK) backzone CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } @@ -662,8 +702,8 @@ check_sorted: backward backzone iso3166.tab zone.tab z $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \ LC_ALL=C sort -cu -check_links: checklinks.awk $(TDATA) - $(AWK) -f checklinks.awk $(TDATA) +check_links: checklinks.awk $(TDATA_TO_CHECK) + $(AWK) -f checklinks.awk $(TDATA_TO_CHECK) $(AWK) -f checklinks.awk tzdata.zi check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES) @@ -764,12 +804,12 @@ set-timestamps.out: $(ENCHILADA) check_public: $(MAKE) maintainer-clean - $(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL + $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL mkdir -p public.dir - for i in $(TDATA) tzdata.zi; do \ + for i in $(TDATA_TO_CHECK) tzdata.zi; do \ $(zic) -v -d public.dir $$i 2>&1 || exit; \ done - $(zic) -v -d public.dir $(TDATA) + $(zic) -v -d public.dir $(TDATA_TO_CHECK) rm -fr public.dir # Check that the code works under various alternative @@ -790,8 +830,11 @@ check_time_t_alternatives: REDO='$(REDO)' \ install && \ diff $$quiet_option -r \ - time_t.dir/int64_t/etc/zoneinfo \ - time_t.dir/$$type/etc/zoneinfo && \ + time_t.dir/int64_t/etc \ + time_t.dir/$$type/etc && \ + diff $$quiet_option -r \ + time_t.dir/int64_t/usr/share \ + time_t.dir/$$type/usr/share && \ case $$type in \ int32_t) range=-2147483648,2147483647;; \ uint32_t) range=0,4294967296;; \ @@ -800,9 +843,9 @@ check_time_t_alternatives: *) range=-10000000000,10000000000;; \ esac && \ echo checking $$type zones ... && \ - time_t.dir/int64_t/etc/zdump -V -t $$range $$zones \ + time_t.dir/int64_t/usr/bin/zdump -V -t $$range $$zones \ >time_t.dir/int64_t.out && \ - time_t.dir/$$type/etc/zdump -V -t $$range $$zones \ + time_t.dir/$$type/usr/bin/zdump -V -t $$range $$zones \ >time_t.dir/$$type.out && \ diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \ || exit; \ Modified: stable/10/contrib/tzdata/NEWS ============================================================================== --- stable/10/contrib/tzdata/NEWS Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/NEWS Sat Jan 27 13:34:14 2018 (r328476) @@ -1,5 +1,147 @@ News for the tz database +Release 2018c - 2018-01-22 23:00:44 -0800 + + Briefly: + Revert Irish changes that relied on negative DST offsets. + + Changes to tm_isdst + + Revert the 2018a change to Europe/Dublin. As before, this change + does not affect UT offsets or abbreviations; it affects only + whether timestamps are considered to be standard time or + daylight-saving time, as expressed in the tm_isdst flag of C's + struct tm type. This reversion is intended to be a temporary + workaround for problems discovered with downstream uses of + releases 2018a and 2018b, which implemented Irish time by using + negative DST offsets in the Eire rules of the 'europe' file. + Although negative DST offsets have been part of tzcode for many + years and are supported by many platforms, they were not + documented before 2018a and ICU and OpenJDK do not currently + support them. A mechanism to export data to platforms lacking + support for negative DST is planned to be developed before the + change is reapplied. (Problems reported by Deborah Goldsmith and + Stephen Colebourne.) + + Changes to past time stamps + + Japanese DST transitions (1948-1951) were Sundays at 00:00, not + Saturdays or Sundays at 02:00. (Thanks to Takayuki Nikai.) + + Changes to build procedure + + The build procedure now works around mawk 1.3.3's lack of support + for character class expressions. (Problem reported by Ohyama.) + + +Release 2018b - 2018-01-17 23:24:48 -0800 + + Briefly: + Fix a packaging problem in tz2018a, which was missing 'pacificnew'. + + Changes to build procedure + + The distribution now contains the file 'pacificnew' again. + This file was inadvertantly omitted in the 2018a distribution. + (Problem reported by Matias Fonzo.) + + +Release 2018a - 2018-01-12 22:29:21 -0800 + + Briefly: + São Tomé and Príncipe switched from +00 to +01. + Brazil's DST will now start on November's first Sunday. + Ireland's standard time is now in the summer, not the winter. + Use Debian-style installation locations, instead of 4.3BSD-style. + New zic option -t. + + Changes to past and future time stamps + + São Tomé and Príncipe switched from +00 to +01 on 2018-01-01 at + 01:00. (Thanks to Steffen Thorsen and Michael Deckers.) + + Changes to future time stamps + + Starting in 2018 southern Brazil will begin DST on November's + first Sunday instead of October's third Sunday. (Thanks to + Steffen Thorsen.) + + Changes to past time stamps + + A discrepancy of 4 s in timestamps before 1931 in South Sudan has + been corrected. The 'backzone' and 'zone.tab' files did not agree + with the 'africa' and 'zone1970.tab' files. (Problem reported by + Michael Deckers.) + + The abbreviation invented for Bolivia Summer Time (1931-2) is now + BST instead of BOST, to be more consistent with the convention + used for Latvian Summer Time (1918-9) and for British Summer Time. + + Changes to tm_isdst + + Change Europe/Dublin so that it observes Irish Standard Time (UT + +01) in summer and GMT (as negative daylight-saving) in winter, + instead of observing standard time (GMT) in winter and Irish + Summer Time (UT +01) in summer. This change does not affect UT + offsets or abbreviations; it affects only whether timestamps are + considered to be standard time or daylight-saving time, as + expressed in the tm_isdst flag of C's struct tm type. + (Discrepancy noted by Derick Rethans.) + + Changes to build procedure + + The default installation locations have been changed to mostly + match Debian circa 2017, instead of being designed as an add-on to + 4.3BSD circa 1986. This affects the Makefile macros TOPDIR, + TZDIR, MANDIR, and LIBDIR. New Makefile macros TZDEFAULT, USRDIR, + USRSHAREDIR, BINDIR, ZDUMPDIR, and ZICDIR let installers tailor + locations more precisely. (This responds to suggestions from + Brian Inglis and from Steve Summit.) + + The default installation procedure no longer creates the + backward-compatibility link US/Pacific-New, which causes + confusion during user setup (e.g., see Debian bug 815200). + Use 'make BACKWARD="backward pacificnew"' to create the link + anyway, for now. Eventually we plan to remove the link entirely. + + tzdata.zi now contains a version-number comment. + (Suggested by Tom Lane.) + + The Makefile now quotes values like BACKWARD more carefully when + passing them to the shell. (Problem reported by Zefram.) + + Builders no longer need to specify -DHAVE_SNPRINTF on platforms + that have snprintf and use pre-C99 compilers. (Problem reported + by Jon Skeet.) + + Changes to code + + zic has a new option -t FILE that specifies the location of the + file that determines local time when TZ is unset. The default for + this location can be configured via the new TZDEFAULT makefile + macro, which defaults to /etc/localtime. + + Diagnostics and commentary now distinguish UT from UTC more + carefully; see theory.html for more information about UT vs UTC. + + zic has been ported to GCC 8's -Wstringop-truncation option. + (Problem reported by Martin Sebor.) + + Changes to documentation and commentary + + The zic man page now documents the longstanding behavior that + times and years can be out of the usual range, with negative times + counting backwards from midnight and with year 0 preceding year 1. + (Problem reported by Michael Deckers.) + + The theory.html file now mentions the POSIX limit of six chars + per abbreviation, and lists alphabetic abbreviations used. + + The files tz-art.htm and tz-link.htm have been renamed to + tz-art.html and tz-link.html, respectively, for consistency with + other file names and to simplify web server configuration. + + Release 2017c - 2017-10-20 14:49:34 -0700 Briefly: @@ -895,8 +1037,8 @@ Release 2015f - 2015-08-10 18:06:56 -0700 (Thanks to Jon Skeet and Arthur David Olson.) Constraints on simultaneity are now documented. - The two characters '%z' in a zone format now stand for the UTC - offset, e.g., '-07' for seven hours behind UTC and '+0530' for + The two characters '%z' in a zone format now stand for the UT + offset, e.g., '-07' for seven hours behind UT and '+0530' for five hours and thirty minutes ahead. This better supports time zone abbreviations conforming to POSIX.1-2001 and later. @@ -1019,13 +1161,13 @@ Release 2015c - 2015-04-11 08:55:55 -0700 The spring 1988 transition was 1988-10-09, not 1988-10-02. The fall 1990 transition was 1990-03-11, not 1990-03-18. - Assume no UTC offset change for Pacific/Easter on 1890-01-01, + Assume no UT offset change for Pacific/Easter on 1890-01-01, and omit all transitions on Pacific/Easter from 1942 through 1946 since we have no data suggesting that they existed. One more zone has been turned into a link, as it differed from an existing zone only for older time stamps. As usual, - this change affects UTC offsets in pre-1970 time stamps only. + this change affects UT offsets in pre-1970 time stamps only. The zone's old contents have been moved to the 'backzone' file. The affected zone is America/Montreal. @@ -1055,7 +1197,7 @@ Release 2015b - 2015-03-19 23:28:11 -0700 Some more zones have been turned into links, when they differed from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. + these changes affect UT offsets in pre-1970 time stamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: America/Antigua, America/Cayman, Pacific/Midway, and Pacific/Saipan. @@ -1107,7 +1249,7 @@ Release 2015a - 2015-01-29 22:35:20 -0800 Some more zones have been turned into links, when they differed from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. + these changes affect UT offsets in pre-1970 time stamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Asia/Aden, Asia/Bahrain, Asia/Kuwait, and Asia/Muscat. @@ -1154,7 +1296,7 @@ Release 2014j - 2014-11-10 17:37:11 -0800 Some more zones have been turned into links, when they differed from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. + these changes affect UT offsets in pre-1970 time stamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Africa/Addis_Ababa, Africa/Asmara, Africa/Dar_es_Salaam, Africa/Djibouti, Africa/Kampala, @@ -1244,7 +1386,7 @@ Release 2014h - 2014-09-25 18:59:03 -0700 Some more zones have been turned into links, when they differed from existing zones only for older timestamps. As usual, - these changes affect UTC offsets in pre-1970 timestamps only. + these changes affect UT offsets in pre-1970 timestamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Africa/Blantyre, Africa/Bujumbura, Africa/Gaborone, Africa/Harare, Africa/Kigali, Africa/Lubumbashi, @@ -1329,7 +1471,7 @@ Release 2014g - 2014-08-28 12:31:23 -0700 Some more zones have been turned into links, when they differed from existing zones only for older timestamps. As usual, - these changes affect UTC offsets in pre-1970 timestamps only. + these changes affect UT offsets in pre-1970 timestamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Africa/Bangui, Africa/Brazzaville, Africa/Douala, Africa/Kinshasa, Africa/Libreville, Africa/Luanda, @@ -1479,7 +1621,7 @@ Release 2014f - 2014-08-05 17:42:36 -0700 standard and daylight saving time the abbreviations are AEST and AEDT instead of the former EST for both; similarly, ACST/ACDT, ACWST/ACWDT, and AWST/AWDT are now used instead of the former CST, CWST, and WST. - This change does not affect UTC offsets, only time zone abbreviations. + This change does not affect UT offsets, only time zone abbreviations. (Thanks to Rich Tibbett and many others.) Asia/Novokuznetsk shifts from NOVT to KRAT (remaining on UT +07) @@ -1516,8 +1658,8 @@ Release 2014f - 2014-08-05 17:42:36 -0700 Treindl sent helpful translations of two papers by Guo Qingsheng.) Some zones have been turned into links, when they differed from existing - zones only for older UTC offsets where data entries were likely invented. - These changes affect UTC offsets in pre-1970 timestamps only. This is + zones only for older UT offsets where data entries were likely invented. + These changes affect UT offsets in pre-1970 timestamps only. This is similar to the change in release 2013e, except this time for western Africa. The affected zones are: Africa/Bamako, Africa/Banjul, Africa/Conakry, Africa/Dakar, Africa/Freetown, Africa/Lome, Modified: stable/10/contrib/tzdata/README ============================================================================== --- stable/10/contrib/tzdata/README Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/README Sat Jan 27 13:34:14 2018 (r328476) @@ -11,14 +11,14 @@ changes made by political bodies to time zone boundari and daylight-saving rules. See or the -file tz-link.htm for how to acquire the code and data. Once acquired, +file tz-link.html for how to acquire the code and data. Once acquired, read the comments in the file 'Makefile' and make any changes needed to make things right for your system, especially if you are using some platform other than GNU/Linux. Then run the following commands, substituting your desired installation directory for "$HOME/tzdir": make TOPDIR=$HOME/tzdir install - $HOME/tzdir/etc/zdump -v America/Los_Angeles + $HOME/tzdir/usr/bin/zdump -v America/Los_Angeles Historical local time information has been included here to: Modified: stable/10/contrib/tzdata/africa ============================================================================== --- stable/10/contrib/tzdata/africa Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/africa Sat Jan 27 13:34:14 2018 (r328476) @@ -158,7 +158,6 @@ Link Africa/Abidjan Africa/Freetown # Sierra Leone Link Africa/Abidjan Africa/Lome # Togo Link Africa/Abidjan Africa/Nouakchott # Mauritania Link Africa/Abidjan Africa/Ouagadougou # Burkina Faso -Link Africa/Abidjan Africa/Sao_Tome # São Tomé and Príncipe Link Africa/Abidjan Atlantic/St_Helena # St Helena # Djibouti @@ -425,7 +424,7 @@ Link Africa/Nairobi Indian/Mayotte # # The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30. # -# In 1972 Liberia was the last country to switch from a UTC offset +# In 1972 Liberia was the last country to switch from a UT offset # that was not a multiple of 15 or 20 minutes. The 1972 change was on # 1972-01-07, according to an entry dated 1972-01-04 on p 330 of: # Presidential Papers: First year of the administration of @@ -1037,6 +1036,19 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Den # Inaccessible, Nightingale: uninhabited # São Tomé and Príncipe + +# From Steffen Thorsen (2018-01-08): +# Multiple sources tell that São Tomé changed from UTC to UTC+1 as +# they entered the year 2018. +# From Michael Deckers (2018-01-08): +# the switch is from 01:00 to 02:00 ... [Decree No. 25/2017] +# http://www.mnec.gov.st/index.php/publicacoes/documentos/file/90-decreto-lei-n-25-2017 + +Zone Africa/Sao_Tome 0:26:56 - LMT 1884 + -0:36:45 - LMT 1912 # Lisbon Mean Time + 0:00 - GMT 2018 Jan 1 01:00 + 1:00 - WAT + # Senegal # See Africa/Abidjan. Modified: stable/10/contrib/tzdata/asia ============================================================================== --- stable/10/contrib/tzdata/asia Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/asia Sat Jan 27 13:34:14 2018 (r328476) @@ -50,7 +50,7 @@ # 9:00 KST KDT Korea when at +09 # 9:30 ACST Australian Central Standard Time # Otherwise, these tables typically use numeric abbreviations like +03 -# and +0330 for integer hour and minute UTC offsets. Although earlier +# and +0330 for integer hour and minute UT offsets. Although earlier # editions invented alphabetic time zone abbreviations for every # offset, this did not reflect common practice. # @@ -647,17 +647,17 @@ Zone Asia/Hong_Kong 7:36:42 - LMT 1904 Oct 30 # time", in which abolished the adoption of Western Standard Time in # western islands (listed above), which means the whole Japan # territory, including later occupations, adopt Japan Central Time -# (UTC+9). The adoption began on Oct 1, 1937. The original text can +# (UT+9). The adoption began on Oct 1, 1937. The original text can # be found on Wikisource: # https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件 # -# That is, the time zone of Taipei switched to UTC+9 on Oct 1, 1937. +# That is, the time zone of Taipei switched to UT+9 on Oct 1, 1937. # From Yu-Cheng Chuang (2014-07-02): -# I've found more evidence about when the time zone was switched from UTC+9 -# back to UTC+8 after WW2. I believe it was on Sep 21, 1945. In a document +# I've found more evidence about when the time zone was switched from UT+9 +# back to UT+8 after WW2. I believe it was on Sep 21, 1945. In a document # during Japanese era [1] in which the officer told the staff to change time -# zone back to Western Standard Time (UTC+8) on Sep 21. And in another +# zone back to Western Standard Time (UT+8) on Sep 21. And in another # history page of National Cheng Kung University [2], on Sep 21 there is a # note "from today, switch back to Western Standard Time". From these two # materials, I believe that the time zone change happened on Sep 21. And @@ -1464,17 +1464,17 @@ Zone Asia/Jerusalem 2:20:54 - LMT 1880 # of the Japanese wanted to scrap daylight-saving time, as opposed to 30% who # wanted to keep it.) -# From Paul Eggert (2006-03-22): -# Shanks & Pottenger write that DST in Japan during those years was as follows: +# From Takayuki Nikai (2018-01-19): +# The source of information is Japanese law. +# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00219480428029.htm +# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00719500331039.htm +# ... In summary, it is written as follows. From 24:00 on the first Saturday +# in May, until 0:00 on the day after the second Saturday in September. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Japan 1948 only - May Sun>=1 2:00 1:00 D -Rule Japan 1948 1951 - Sep Sat>=8 2:00 0 S -Rule Japan 1949 only - Apr Sun>=1 2:00 1:00 D -Rule Japan 1950 1951 - May Sun>=1 2:00 1:00 D -# but the only locations using it (for birth certificates, presumably, since -# their audience is astrologers) were US military bases. For now, assume -# that for most purposes daylight-saving time was observed; otherwise, what -# would have been the point of the 1951 poll? +Rule Japan 1948 only - May Sat>=1 24:00 1:00 D +Rule Japan 1948 1951 - Sep Sun>=9 0:00 0 S +Rule Japan 1949 only - Apr Sat>=1 24:00 1:00 D +Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D # From Hideyuki Suzuki (1998-11-09): # 'Tokyo' usually stands for the former location of Tokyo Astronomical @@ -1505,7 +1505,7 @@ Rule Japan 1950 1951 - May Sun>=1 2:00 1:00 D # # ...the Showa Emperor announced Ordinance No. 529 of Showa Year 12 ... which # means the whole Japan territory, including later occupations, adopt Japan -# Central Time (UTC+9). The adoption began on Oct 1, 1937. +# Central Time (UT+9). The adoption began on Oct 1, 1937. # https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件 # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2066,8 +2066,8 @@ Zone Asia/Kuching 7:21:20 - LMT 1926 Mar # Maldives # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Maldives 4:54:00 - LMT 1880 # Male - 4:54:00 - MMT 1960 # Male Mean Time +Zone Indian/Maldives 4:54:00 - LMT 1880 # Malé + 4:54:00 - MMT 1960 # Malé Mean Time 5:00 - +05 # Mongolia Modified: stable/10/contrib/tzdata/australasia ============================================================================== --- stable/10/contrib/tzdata/australasia Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/australasia Sat Jan 27 13:34:14 2018 (r328476) @@ -683,8 +683,8 @@ Zone Pacific/Guadalcanal 10:39:48 - LMT 1912 Oct # Hon # From Steffen Thorsen (2012-07-25) # ... we double checked by calling hotels and offices based in Tokelau asking # about the time there, and they all told a time that agrees with UTC+13.... -# Shanks says UTC-10 from 1901 [but] ... there is a good chance the change -# actually was to UTC-11 back then. +# Shanks says UT-10 from 1901 [but] ... there is a good chance the change +# actually was to UT-11 back then. # # From Paul Eggert (2012-07-25) # A Google Books snippet of Appendix to the Journals of the House of @@ -1450,7 +1450,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # # From Paul Eggert (2006-03-22): # The Department of Internal Affairs (DIA) maintains a brief history, -# as does Carol Squires; see tz-link.htm for the full references. +# as does Carol Squires; see tz-link.html for the full references. # Use these sources in preference to Shanks & Pottenger. # # For Chatham, IATA SSIM (1991/1999) gives the NZ rules but with Modified: stable/10/contrib/tzdata/backzone ============================================================================== --- stable/10/contrib/tzdata/backzone Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/backzone Sat Jan 27 13:34:14 2018 (r328476) @@ -145,11 +145,6 @@ Zone Africa/Gaborone 1:43:40 - LMT 1885 Zone Africa/Harare 2:04:12 - LMT 1903 Mar 2:00 - CAT -# South Sudan -Zone Africa/Juba 2:06:24 - LMT 1931 - 2:00 Sudan CA%sT 2000 Jan 15 12:00 - 3:00 - EAT - # Uganda Zone Africa/Kampala 2:09:40 - LMT 1928 Jul 3:00 - EAT 1930 @@ -241,11 +236,6 @@ Zone Africa/Ouagadougou -0:06:04 - LMT 1912 Zone Africa/Porto-Novo 0:10:28 - LMT 1912 Jan 1 0:00 - GMT 1934 Feb 26 1:00 - WAT - -# São Tomé and Príncipe -Zone Africa/Sao_Tome 0:26:56 - LMT 1884 - -0:36:32 - LMT 1912 # Lisbon Mean Time - 0:00 - GMT # Mali (northern) Zone Africa/Timbuktu -0:12:04 - LMT 1912 Modified: stable/10/contrib/tzdata/europe ============================================================================== --- stable/10/contrib/tzdata/europe Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/europe Sat Jan 27 13:34:14 2018 (r328476) @@ -68,14 +68,15 @@ # 0:00 WET WEST WEMT Western Europe # 0:19:32.13 AMT* NST* Amsterdam, Netherlands Summer (1835-1937) # 1:00 BST British Standard (1968-1971) +# 1:00 IST GMT Irish Standard (1968-) with winter DST # 1:00 CET CEST CEMT Central Europe # 1:00:14 SET Swedish (1879-1899) # 1:36:34 RMT* LST* Riga, Latvian Summer (1880-1926)* # 2:00 EET EEST Eastern Europe # 3:00 MSK MSD MDST* Moscow -# From Peter Ilieve (1994-12-04), -# The original six [EU members]: Belgium, France, (West) Germany, Italy, +# From Peter Ilieve (1994-12-04), re EEC/EC/EU members: +# The original six: Belgium, France, (West) Germany, Italy, # Luxembourg, the Netherlands. # Plus, from 1 Jan 73: Denmark, Ireland, United Kingdom. # Plus, from 1 Jan 81: Greece. @@ -278,16 +279,31 @@ # The following claim by Shanks & Pottenger is possible though doubtful; # we'll ignore it for now. # * Dublin's 1971-10-31 switch was at 02:00, even though London's was 03:00. + +# From Paul Eggert (2017-12-04): # +# Dunsink Observatory (8 km NW of Dublin's center) was to Dublin as +# Greenwich was to London. For example: # -# Whitman says Dublin Mean Time was -0:25:21, which is more precise than -# Shanks & Pottenger. -# Perhaps this was Dunsink Observatory Time, as Dunsink Observatory -# (8 km NW of Dublin's center) seemingly was to Dublin as Greenwich was -# to London. For example: -# # "Timeball on the ballast office is down. Dunsink time." # -- James Joyce, Ulysses +# +# The abbreviation DMT stood for "Dublin Mean Time" or "Dunsink Mean Time"; +# this being Ireland, opinions differed. +# +# Whitman says Dublin/Dunsink Mean Time was UT-00:25:21, which agrees +# with measurements of recent visitors to the Meridian Room of Dunsink +# Observatory; see Malone D. Dunsink and timekeeping. 2016-01-24. +# . Malone +# writes that the Nautical Almanac listed UT-00:25:22 until 1896, when +# it moved to UT-00:25:21.1 (I confirmed that the 1893 edition used +# the former and the 1896 edition used the latter). Evidently the +# news of this change propagated slowly, as Milne 1899 still lists +# UT-00:25:22 and cites the International Telegraph Bureau. As it is +# not clear that there was any practical significance to the change +# from UT-00:25:22 to UT-00:25:21.1 in civil timekeeping, omit this +# transition for now and just use the latter value, omitting its +# fraction since our format cannot represent fractions. # "Countess Markievicz ... claimed that the [1916] abolition of Dublin Mean Time # was among various actions undertaken by the 'English' government that @@ -347,12 +363,28 @@ # regulations. I spoke this morning with the Secretary of the Department of # Justice (tel +353 1 678 9711) who confirmed to me that the correct name is # "Irish Summer Time", abbreviated to "IST". +# +# From Paul Eggert (2017-12-07): +# The 1996 anonymous contributor's goal was to determine the correct +# abbreviation for summer time in Dublin and so the contributor +# focused on the "IST", not on the "Irish Summer Time". Though the +# "IST" was correct, the "Irish Summer Time" appears to have been an +# error, as Ireland's Standard Time (Amendment) Act, 1971 states that +# standard time in Ireland remains at UT +01 and is observed in +# summer, and that Greenwich mean time is observed in winter. (Thanks +# to Derick Rethans for pointing out the error.) That is, when +# Ireland amended the 1968 act that established UT +01 as Irish +# Standard Time, it left standard time unchanged and established GMT +# as a negative daylight saving time in winter. So, in this database +# IST stands for Irish Summer Time for timestamps before 1968, and for +# Irish Standard Time after that. See: +# http://www.irishstatutebook.ie/eli/1971/act/17/enacted/en/print # Michael Deckers (2017-06-01) gave the following URLs for Ireland's # Summer Time Act, 1925 and Summer Time Orders, 1926 and 1947: -# http://www.irishstatutebook.ie/eli/1925/act/8/enacted/en/print.html -# http://www.irishstatutebook.ie/eli/1926/sro/919/made/en/print.html -# http://www.irishstatutebook.ie/eli/1947/sro/71/made/en/print.html +# http://www.irishstatutebook.ie/eli/1925/act/8/enacted/en/print +# http://www.irishstatutebook.ie/eli/1926/sro/919/made/en/print +# http://www.irishstatutebook.ie/eli/1947/sro/71/made/en/print # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Summer Time Act, 1916 @@ -476,9 +508,23 @@ Link Europe/London Europe/Jersey Link Europe/London Europe/Guernsey Link Europe/London Europe/Isle_of_Man +# From Paul Eggert (2018-01-19): +# The following is like GB-Eire and EU, except with standard time in +# summer and negative daylight saving time in winter. +# Although currently commented out, this will need to become uncommented +# once the ICU/OpenJDK workaround is removed; see below. +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +#Rule Eire 1971 only - Oct 31 2:00u -1:00 GMT +#Rule Eire 1972 1980 - Mar Sun>=16 2:00u 0 IST +#Rule Eire 1972 1980 - Oct Sun>=23 2:00u -1:00 GMT +#Rule Eire 1981 max - Mar lastSun 1:00u 0 IST +#Rule Eire 1981 1989 - Oct Sun>=23 1:00u -1:00 GMT +#Rule Eire 1990 1995 - Oct Sun>=22 1:00u -1:00 GMT +#Rule Eire 1996 max - Oct lastSun 1:00u -1:00 GMT + # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 - -0:25:21 - DMT 1916 May 21 2:00s # Dublin MT + -0:25:21 - DMT 1916 May 21 2:00s -0:25:21 1:00 IST 1916 Oct 1 2:00s 0:00 GB-Eire %s 1921 Dec 6 # independence 0:00 GB-Eire GMT/IST 1940 Feb 25 2:00s @@ -487,16 +533,33 @@ Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 0:00 1:00 IST 1947 Nov 2 2:00s 0:00 - GMT 1948 Apr 18 2:00s 0:00 GB-Eire GMT/IST 1968 Oct 27 +# From Paul Eggert (2018-01-18): +# The next line should look like this: +# 1:00 Eire IST/GMT +# However, in January 2018 we discovered that the Eire rules cause +# problems with tests for ICU: +# https://mm.icann.org/pipermail/tz/2018-January/025825.html +# and with tests for OpenJDK: +# https://mm.icann.org/pipermail/tz/2018-January/025822.html +# To work around this problem, use a traditional approximation for +# time stamps after 1971-10-31 02:00 UTC, to give ICU and OpenJDK +# developers breathing room to fix bugs. This approximation has +# correct UTC offsets, but results in tm_isdst flags are the reverse +# of what they should be. This workaround is temporary and should be +# removed reasonably soon. 1:00 - IST 1971 Oct 31 2:00u 0:00 GB-Eire GMT/IST 1996 0:00 EU GMT/IST +# End of workaround for ICU and OpenJDK bugs. + ############################################################################### # Europe -# EU rules are for the European Union, previously known as the EC, EEC, -# Common Market, etc. +# The following rules are for the European Union and for its +# predecessor organization, the European Communities. +# For brevity they are called "EU rules" elsewhere in this file. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EU 1977 1980 - Apr Sun>=1 1:00u 1:00 S @@ -929,7 +992,7 @@ Zone Europe/Prague 0:57:44 - LMT 1850 # The page http://www.retsinfo.dk/_GETDOCI_/ACCN/A18930008330-REGL # confirms this, and states that the law was put forth 1893-03-29. # -# The EU treaty with effect from 1973: +# The EU [actually, EEC and Euratom] treaty with effect from 1973: # http://www.retsinfo.dk/_GETDOCI_/ACCN/A19722110030-REGL # # This provoked a new law from 1974 to make possible summer time changes @@ -985,9 +1048,10 @@ Zone Atlantic/Faroe -0:27:04 - LMT 1908 Jan 11 # Tórs # East Greenland and Franz Josef Land, but we don't know their time zones. # My source for this is Wilhelm Dege's book mentioned under Svalbard. # -# From Paul Eggert (2006-03-22): -# Greenland joined the EU as part of Denmark, obtained home rule on 1979-05-01, -# and left the EU on 1985-02-01. It therefore should have been using EU +# From Paul Eggert (2017-12-10): +# Greenland joined the European Communities as part of Denmark, +# obtained home rule on 1979-05-01, and left the European Communities +# on 1985-02-01. It therefore should have been using EU # rules at least through 1984. Shanks & Pottenger say Scoresbysund and Godthåb # used C-Eur rules after 1980, but IATA SSIM (1991/1996) says they use EU # rules since at least 1991. Assume EU rules since 1980. @@ -1301,7 +1365,7 @@ Zone Europe/Paris 0:09:21 - LMT 1891 Mar 15 0:01 # From Markus Kuhn (1998-09-29): # The German time zone web site by the Physikalisch-Technische # Bundesanstalt contains DST information back to 1916. -# [See tz-link.htm for the URL.] +# [See tz-link.html for the URL.] # From Jörg Schilling (2002-10-23): # In 1945, Berlin was switched to Moscow Summer time (GMT+4) by @@ -1398,7 +1462,7 @@ Zone Europe/Athens 1:34:52 - LMT 1895 Sep 14 1:00 Greece CE%sT 1944 Apr 4 2:00 Greece EE%sT 1981 # Shanks & Pottenger say it switched to C-Eur in 1981; - # go with EU instead, since Greece joined it on Jan 1. + # go with EU rules instead, since Greece joined Jan 1. 2:00 EU EE%sT # Hungary @@ -2097,7 +2161,7 @@ Zone Europe/Warsaw 1:24:00 - LMT 1880 # IATA SSIM (1991/1992) reports that the Azores were at -1:00. # IATA SSIM (1993-02) says +0:00; later issues (through 1996-09) say -1:00. # Guess that the Azores changed to EU rules in 1992 (since that's when Portugal -# harmonized with the EU), and that they stayed +0:00 that winter. +# harmonized with EU rules), and that they stayed +0:00 that winter. # # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # DSH writes that despite Decree 1,469 (1915), the change to the clocks was not @@ -2772,9 +2836,9 @@ Zone Asia/Omsk 4:53:30 - LMT 1919 Nov 14 # # https://regnum.ru/news/society/1957270.html # has some historical data for Altai Krai: -# before 1957: west part on UTC+6, east on UTC+7 -# after 1957: UTC+7 -# since 1995: UTC+6 +# before 1957: west part on UT+6, east on UT+7 +# after 1957: UT+7 +# since 1995: UT+6 # http://barnaul.rusplt.ru/index/pochemu_altajskij_kraj_okazalsja_v_neprivychnom_chasovom_pojase-17648.html # confirms that and provides more details including 1995-05-28 transition date. @@ -3581,6 +3645,17 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See abo # From Paul Eggert (2016-09-07): # The change is permanent, so this is the new standard time in Turkey. # It takes effect today, which is not much notice. + +# From Kıvanç Yazan (2017-10-28): +# Turkey will go back to Daylight Saving Time starting 2018-10. +# http://www.resmigazete.gov.tr/eskiler/2017/10/20171028-5.pdf +# +# From Even Scharning (2017-11-08): *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Jan 27 13:43:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5585EC222E; Sat, 27 Jan 2018 13:43:03 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 99845695A7; Sat, 27 Jan 2018 13:43:03 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BB92324F; Sat, 27 Jan 2018 13:43:03 +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 w0RDh3pY004031; Sat, 27 Jan 2018 13:43:03 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RDh3vW004030; Sat, 27 Jan 2018 13:43:03 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201801271343.w0RDh3vW004030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 27 Jan 2018 13:43:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328477 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 328477 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 13:43:04 -0000 Author: tuexen Date: Sat Jan 27 13:43:03 2018 New Revision: 328477 URL: https://svnweb.freebsd.org/changeset/base/328477 Log: Update references in comments, since the IDs have become an RFC long time ago. Also cleanup whitespaces. No functional change. MFC after: 1 week Modified: head/sys/netinet/sctp_constants.h Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Sat Jan 27 13:34:14 2018 (r328476) +++ head/sys/netinet/sctp_constants.h Sat Jan 27 13:43:03 2018 (r328477) @@ -400,43 +400,32 @@ __FBSDID("$FreeBSD$"); #define SCTP_HOSTNAME_ADDRESS 0x000b #define SCTP_SUPPORTED_ADDRTYPE 0x000c -/* draft-ietf-stewart-tsvwg-strreset-xxx */ +/* RFC 6525 */ #define SCTP_STR_RESET_OUT_REQUEST 0x000d #define SCTP_STR_RESET_IN_REQUEST 0x000e #define SCTP_STR_RESET_TSN_REQUEST 0x000f #define SCTP_STR_RESET_RESPONSE 0x0010 #define SCTP_STR_RESET_ADD_OUT_STREAMS 0x0011 -#define SCTP_STR_RESET_ADD_IN_STREAMS 0x0012 +#define SCTP_STR_RESET_ADD_IN_STREAMS 0x0012 #define SCTP_MAX_RESET_PARAMS 2 -#define SCTP_STREAM_RESET_TSN_DELTA 0x1000 +#define SCTP_STREAM_RESET_TSN_DELTA 0x1000 /*************0x4000 series*************/ /*************0x8000 series*************/ #define SCTP_ECN_CAPABLE 0x8000 -/* draft-ietf-tsvwg-auth-xxx */ +/* RFC 4895 */ #define SCTP_RANDOM 0x8002 #define SCTP_CHUNK_LIST 0x8003 #define SCTP_HMAC_LIST 0x8004 -/* - * draft-ietf-tsvwg-addip-sctp-xx param=0x8008 len=0xNNNN Byte | Byte | Byte - * | Byte Byte | Byte ... - * - * Where each byte is a chunk type extension supported. For example, to support - * all chunks one would have (in hex): - * - * 80 01 00 09 C0 C1 80 81 82 00 00 00 - * - * Has the parameter. C0 = PR-SCTP (RFC3758) C1, 80 = ASCONF (addip draft) 81 - * = Packet Drop 82 = Stream Reset 83 = Authentication - */ -#define SCTP_SUPPORTED_CHUNK_EXT 0x8008 +/* RFC 5061 */ +#define SCTP_SUPPORTED_CHUNK_EXT 0x8008 /*************0xC000 series*************/ #define SCTP_PRSCTP_SUPPORTED 0xc000 -/* draft-ietf-tsvwg-addip-sctp */ +/* RFC 5061 */ #define SCTP_ADD_IP_ADDRESS 0xc001 #define SCTP_DEL_IP_ADDRESS 0xc002 #define SCTP_ERROR_CAUSE_IND 0xc003 @@ -444,8 +433,8 @@ __FBSDID("$FreeBSD$"); #define SCTP_SUCCESS_REPORT 0xc005 #define SCTP_ULP_ADAPTATION 0xc006 /* behave-nat-draft */ -#define SCTP_HAS_NAT_SUPPORT 0xc007 -#define SCTP_NAT_VTAGS 0xc008 +#define SCTP_HAS_NAT_SUPPORT 0xc007 +#define SCTP_NAT_VTAGS 0xc008 /* bits for TOS field */ #define SCTP_ECT0_BIT 0x02 @@ -624,7 +613,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_RTO_INITIAL (3000) /* 3 sec in ms */ -#define SCTP_INP_KILL_TIMEOUT 20/* number of ms to retry kill of inpcb */ +#define SCTP_INP_KILL_TIMEOUT 20 /* number of ms to retry kill of inpcb */ #define SCTP_ASOC_KILL_TIMEOUT 10 /* number of ms to retry kill of inpcb */ #define SCTP_DEF_MAX_INIT 8 From owner-svn-src-all@freebsd.org Sat Jan 27 13:46:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FF39EC24C8; Sat, 27 Jan 2018 13:46:56 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3416B69848; Sat, 27 Jan 2018 13:46:56 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F14D3252; Sat, 27 Jan 2018 13:46:56 +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 w0RDkula004354; Sat, 27 Jan 2018 13:46:56 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RDkutN004353; Sat, 27 Jan 2018 13:46:56 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201801271346.w0RDkutN004353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 27 Jan 2018 13:46:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328478 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 328478 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 13:46:56 -0000 Author: tuexen Date: Sat Jan 27 13:46:55 2018 New Revision: 328478 URL: https://svnweb.freebsd.org/changeset/base/328478 Log: Add constant for the PAD chunk as defined in RFC 4820. This will be used by traceroute and traceroute6 soon. MFC after: 1 week Modified: head/sys/netinet/sctp_constants.h Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Sat Jan 27 13:43:03 2018 (r328477) +++ head/sys/netinet/sctp_constants.h Sat Jan 27 13:46:55 2018 (r328478) @@ -420,6 +420,8 @@ __FBSDID("$FreeBSD$"); #define SCTP_RANDOM 0x8002 #define SCTP_CHUNK_LIST 0x8003 #define SCTP_HMAC_LIST 0x8004 +/* RFC 4820 */ +#define SCTP_PAD 0x8005 /* RFC 5061 */ #define SCTP_SUPPORTED_CHUNK_EXT 0x8008 From owner-svn-src-all@freebsd.org Sat Jan 27 15:17:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 221D5EC6994 for ; Sat, 27 Jan 2018 15:17:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic317-41.consmr.mail.bf2.yahoo.com (sonic317-41.consmr.mail.bf2.yahoo.com [74.6.129.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB6326C652 for ; Sat, 27 Jan 2018 15:17:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1517066214; bh=cYDrBZIeYAfPMc9HTVfIf/uFNYC5EYFoYG0wcI7h758=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=MuXLhhTyQ2cDJA0jf2ZdV+UwyYgwOF511Ce//KSKjW3ghUJTU/kGI83B66aux+2cECDeUsd3+mOdYiFA7FirYUjZeB55KTgyHunTr3IkEiWDbv3pG5/rAIDhJsn0EEHQcRRz0quuI671dpAsKX+wUMe9hwYqqzWgYQV2QrPvZMRKGAtnB8UYLN+jeo50DQ6LA6CgEBoiqUx5MckDDIEoxnWDNYkmXKq158/OMnXFVpECf44CVECHqaeZXpnN4Q1wpsfruGSx8qwklJpcOBp2YYONPsZzXyWLz1VQOPPIwTda4Gny2oBx4ok9X1dJwGnL9kC7Gg3ZONHysVWpV05mDg== X-YMail-OSG: cTFeXBcVM1lEJvg2gcbCALACblaz7q4FhCSjMLGawfPSO7QOiLL.nmXn8S1fbZ8 cTXdgC1d1oAUZGySgz96JWszhpTvHzBFiNcTXH4WtU6yXhj.qh2KrEKhHvxWkC5F6Bms_Sw5A_qu GAyDjrcDo56HSvLxJr6KWp0OPnGawQG5fAceMJQr6eivWdCLnb94Nnoah_hDNJGvw.TTyoIp5o9h j6q5zztMHrQ1vVpLrSM_6Xg.9DipocHqWT79EO_FLKLqUCLxs.DqulXb4RM5F9WLIKUZm4Jf1u7d IN9sIqEjGEB3FqAQg0ViQ6B2chBX08MUNk71rGsf.7M1YA39pY3gYImZOfxix5qZg89McJdcO.r6 90nBAY9swt6rGibFUnFo2UukPlK3TPdLHOq6qM4L7IZ3w.WRdnFztCu3PWdGF9NzyTlWKFgLO7n5 yPfW4hfhDGsqbVcIEZ8u.naQnl6299XxSZegjvBaVOA1KhbN3Pe3aGlO1NBwPBTfmmzYtzu2Bk4n MXuEMZYsU8A-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.bf2.yahoo.com with HTTP; Sat, 27 Jan 2018 15:16:54 +0000 Received: from smtpgate102.mail.bf1.yahoo.com (EHLO [192.168.0.8]) ([72.30.28.113]) by smtp409.mail.bf1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID cc52141bb3269490e20db846c836f906; Sat, 27 Jan 2018 15:16:52 +0000 (UTC) Subject: Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801241758.w0OHwm26063524@repo.freebsd.org> <20180126020540.B2181@besplex.bde.org> <8d5ddd06-14b2-e7e1-14dd-5e9d42f9b33c@FreeBSD.org> <20180126053133.R3207@besplex.bde.org> <21b6bdda-65b7-89da-4dd6-bed64978eba8@FreeBSD.org> <20180126214948.C1040@besplex.bde.org> From: Pedro Giffuni Message-ID: <11937120-bbb4-5da1-f48c-240a6aeafbd9@FreeBSD.org> Date: Sat, 27 Jan 2018 10:16:53 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180126214948.C1040@besplex.bde.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 15:17:01 -0000 On 01/26/18 06:36, Bruce Evans wrote: > On Thu, 25 Jan 2018, Pedro Giffuni wrote: > >> On 25/01/2018 14:24, Bruce Evans wrote: >>> ... >>> This code only works because (if?) nfs is the only caller and nfs never >>> passes insane values. >>> >> >> I am starting to think that we should simply match uio_resid and set >> it to ssize_t. >> Returning the value to int is certainly not the solution. > > Of course using the correct type (int) is part of the solution. > > uio_must be checked before it is used for cookies, and after checking > it, it > is small so it fits easily in an int.  It must also checked to be > nonnegative, > so that it doesn't suffer unsigned poisoning when it is promoted, so > it would > also fit in a u_int, but using u_int to store it is silly as using 1U > instead > of 1 for a count of 1. > > The bounds checking is something like: > >     if (ap->uio_resid < 0) >         ap->uio_resid = 0; >     if (ap->a_ncookies != NULL) { >         if (ap->uio_resid >= 64 * 1024) >             ap->uio_resid = 64 * 1024; >         ncookies = ap->uio_resid; >     } > > This checks for negative values for all cases and converts to 0 (EOF) to > preserve historical behaviour for the syscall case and to avoid overflow > for the cookies case (in case the caller is buggy).  The correct handling > is to return EINVAL, but EOF is good enough. > > In the syscall case, uio_resid can be up to SSIZE_MAX, so don't check it > or corrupt it by assigning it to an int or u_int. > > Limit uio_resid from above only in the cookies case.  The final limit > should > be about 128K (whatever nfs uses) or maybe 1M.  Don't return EINVAL above > the limit, since nfs probably wouldn't know how to handle that (by > retrying > with a smaller size).  Test its handling of short counts instead. It is > expected than nfs asks for 128K and we supply at most 64K.  The supply is > always reduced at EOF.  Hopefully nfs doesn't treat the short count as > EOF. > It should retry until we supply 0. > Hmm ... We have never checked the upper bound there, which doesn't mean it was right. I found MAXPHYS, which seems a more reasonable limit used in the kernel for uio_resid. I am checking the patch compiles and doesn't give surprises. Pedro. > After limiting uio_resid, assign it to the int ncookies. > > This doesn't fix the abuse of the ncookies counter to hold the size of > the > cookies array in bytes for this and the next couple of statements. > > Normally the bounds checking should be at the top level, with at most > KASSERT()s at lower levels, but here the levels are mixed, and it isn't > clear if kernel callers have already checked, and it doesn't cost much > to do much the same checking for the kernel callers as for the syscall > callers. > > Perhaps the 128K limit is good for all cases (this depends on callers not > having buggy short count handling).  Directories of this size are very > rare (don't forget to create very large ones when you test this). Doing > anything with directories of this size tends to be slow anyway, and the > slowness has nothing to do with reading only 128K instead of SSIZE_MAX > bytes at a time. > > readdir() in FreeBSD seems to use a read size of only PAGE_SIZE, except > in the unionfs case it seems to try to read the whole direction. It > malloc()s the buffer in both cases.  Blindy malloc()ing or mmap()ing > a buffer large enough for a whole file or directory is no good, since > in theory even directory sizes can be much larger than memory. > > Bruce > From owner-svn-src-all@freebsd.org Sat Jan 27 15:32:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D33C3EC7598; Sat, 27 Jan 2018 15:32:49 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 399BE6CEC6; Sat, 27 Jan 2018 15:32:48 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with ESMTPA id fSTAeG8RjS7BpfSTBemKHr; Sat, 27 Jan 2018 08:32:42 -0700 X-Authority-Analysis: v=2.2 cv=NKylwwyg c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=RgaUWeydRksA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=h37J54NPBX62MaF4gAgA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 1591C1484; Sat, 27 Jan 2018 07:32:40 -0800 (PST) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w0RFWdmF035357; Sat, 27 Jan 2018 07:32:39 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w0RFWdYS035354; Sat, 27 Jan 2018 07:32:39 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201801271532.w0RFWdYS035354@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mariusz Zaborski cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328474 - head/sys/contrib/libnv In-Reply-To: Message from Mariusz Zaborski of "Sat, 27 Jan 2018 12:58:22 +0000." <201801271258.w0RCwMl0078832@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 27 Jan 2018 07:32:39 -0800 X-CMAE-Envelope: MS4wfMJ6D5AzSfoOn2E/ocaGBUbqRLVD+y+H18Qg1sBLdzpPFv+nBWFoz+3SCpBh+pR+yF609YG4RtNGzqKMrCNqUDz33z4yyv0HfIVUAbsZyXm/RNdCr+De wJZKLtPkYv7asNOSSrj7Spbev6r17zA+snDkWZYwawwbC1R3vBS3qnBnSvNqcO+z5WrNrtz2Pd8yI1jSQ5suwVRW00C/MwfnX34Uv1VT9k6oGjc71iyykZEZ QNretXGi80kI9+PIuDHIIKCOEtK91rvMgIiXR3WdKsmjJxS2WBxnxoh+zLcMCELV X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 15:32:50 -0000 In message <201801271258.w0RCwMl0078832@repo.freebsd.org>, Mariusz Zaborski wri tes: > Author: oshogbo > Date: Sat Jan 27 12:58:21 2018 > New Revision: 328474 > URL: https://svnweb.freebsd.org/changeset/base/328474 > > Log: > Add SPDX tags for nv(9). > > MFC after: 2 weeks > > Modified: > head/sys/contrib/libnv/cnvlist.c > head/sys/contrib/libnv/dnvlist.c > head/sys/contrib/libnv/nv_impl.h > head/sys/contrib/libnv/nvlist.c > head/sys/contrib/libnv/nvlist_impl.h > head/sys/contrib/libnv/nvpair.c > head/sys/contrib/libnv/nvpair_impl.h > When was it decided to add SPDX to contrib? -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sat Jan 27 15:33:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B41BEC76A0; Sat, 27 Jan 2018 15:33:53 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D0546D025; Sat, 27 Jan 2018 15:33:53 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37ACE4881; Sat, 27 Jan 2018 15:33:53 +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 w0RFXqxf057923; Sat, 27 Jan 2018 15:33:52 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RFXq0K057921; Sat, 27 Jan 2018 15:33:52 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801271533.w0RFXq0K057921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 27 Jan 2018 15:33:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328479 - in head/sys: fs/ext2fs ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in head/sys: fs/ext2fs ufs/ufs X-SVN-Commit-Revision: 328479 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 15:33:53 -0000 Author: pfg Date: Sat Jan 27 15:33:52 2018 New Revision: 328479 URL: https://svnweb.freebsd.org/changeset/base/328479 Log: {ext2|ufs}_readdir: Set limit on valid ncookies values. Sanitize the values that will be assigned to ncookies so that we ensure they are sane and we can handle them. Let ncookies signed as it was before r328346. The valid range is such that unsigned values are not required and we are not able to avoid at least one cast anyways. Hinted by: bde Modified: head/sys/fs/ext2fs/ext2_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 13:46:55 2018 (r328478) +++ head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 15:33:52 2018 (r328479) @@ -145,14 +145,18 @@ ext2_readdir(struct vop_readdir_args *ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - u_int ncookies; + int ncookies; int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; if (uio->uio_offset < 0) return (EINVAL); ip = VTOI(vp); + if (uio->uio_resid < 0) + uio->uio_resid = 0; if (ap->a_ncookies != NULL) { + if (uio->uio_resid > MAXPHYS) + uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 13:46:55 2018 (r328478) +++ head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 15:33:52 2018 (r328479) @@ -2170,7 +2170,7 @@ ufs_readdir(ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - u_int ncookies; + int ncookies; int error; if (uio->uio_offset < 0) @@ -2178,7 +2178,11 @@ ufs_readdir(ap) ip = VTOI(vp); if (ip->i_effnlink == 0) return (0); + if (uio->uio_resid < 0) + uio->uio_resid = 0; if (ap->a_ncookies != NULL) { + if (uio->uio_resid > MAXPHYS) + uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; From owner-svn-src-all@freebsd.org Sat Jan 27 15:50:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88821EC800F for ; Sat, 27 Jan 2018 15:50:25 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic315-27.consmr.mail.bf2.yahoo.com (sonic315-27.consmr.mail.bf2.yahoo.com [74.6.134.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 346F16D716 for ; Sat, 27 Jan 2018 15:50:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1517068224; bh=xsuGjwuaLGwmdjdrmW6VOcmGxdFT7kVvuWkx+keV40I=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=toEW6GjbZypnoo/vQA+p3XS7Urej2QLCDHJplfAGOIdc2DN1u78YbhLs98Xr1AbKhzIS3L9CCiddBlgdS/x8RcM/KAsU57YNriAP7o3OWmXhNB68vXf+nGf/Jbb5dkS5VfUzmPjkHiUy3qws8Hi+k8s+t7g0kwKOZf9qoA2wnsTCFOMurlGkiwpeMBxfL1dQ94IxeZzbd1ZMSXy5bvohGBNsvee2CE0cvmQs6Hfcrx6AzVZWy1pTa9GlBpfgV3dbgsFKDdcwMBR+ZQYEZva0ElvTDwtnssgFOmLagts/4EHtlg7HvVOE2C1Wc4thmuj8F9m3hblF7j4cEoU70/LETQ== X-YMail-OSG: d8bx4a4VM1lrTV4jqKmeVUnzrx6uCK5zaIPGS4ZqIFZdiVlwEdjyHkHhadwlrRT QfRG0c_5ywjl7xdqyZ0ilj8SP6ZZRpS4J9rTAmHL7B6OELxTBHB5Y6z_kF_drVJ5OnxjL3daLqpx lPDZsJxllEoX_AT9R2oaosq4LjNplMIWQFFBT_SY6b_llH4Z7TSUf7osQiadongh8etOi7n4zAAz ui8xmRpZIgUuOQ6RhuEMoNbqnYi68B_TiQOjNrrG7kvJPUa9.tn_cq7XEb1n3.Wngl.WyCkqRZE6 mqPmIs_KJtfUyUhoReSEGK3H4TmkNOI9ZniansZDwUco2fo46ZpwuvRy_fX02PAOMqupbEzVzmfV 3ekJ4s_KpXNEqVw.84AL3W75_SFvM13PeSYskToWYHOMNGWXcbfKGEtc_dKpery2noF24Utl4Mx4 PqEJ4WiSajBHKgtsLtTtBfenxN3oL2zdNASS21Ti8l2iVVap0ci7ApFnPigG_sjgVj7TTRDYVHBb HgiAPKJK6Yw-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.bf2.yahoo.com with HTTP; Sat, 27 Jan 2018 15:50:24 +0000 Received: from smtpgate101.mail.bf1.yahoo.com (EHLO [192.168.0.8]) ([72.30.28.45]) by smtp409.mail.bf1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID eb42a70e9ffe6679f2b56dbcf670a550; Sat, 27 Jan 2018 15:40:17 +0000 (UTC) Subject: Re: svn commit: r328474 - head/sys/contrib/libnv To: Cy Schubert , Mariusz Zaborski Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801271532.w0RFWdYS035354@slippy.cwsent.com> From: Pedro Giffuni Message-ID: <42144a69-25f3-395d-a722-513e8bb428e4@FreeBSD.org> Date: Sat, 27 Jan 2018 10:40:16 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801271532.w0RFWdYS035354@slippy.cwsent.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 15:50:25 -0000 On 01/27/18 10:32, Cy Schubert wrote: > In message <201801271258.w0RCwMl0078832@repo.freebsd.org>, Mariusz Zaborski > wri > tes: >> Author: oshogbo >> Date: Sat Jan 27 12:58:21 2018 >> New Revision: 328474 >> URL: https://svnweb.freebsd.org/changeset/base/328474 >> >> Log: >> Add SPDX tags for nv(9). >> >> MFC after: 2 weeks >> >> Modified: >> head/sys/contrib/libnv/cnvlist.c >> head/sys/contrib/libnv/dnvlist.c >> head/sys/contrib/libnv/nv_impl.h >> head/sys/contrib/libnv/nvlist.c >> head/sys/contrib/libnv/nvlist_impl.h >> head/sys/contrib/libnv/nvpair.c >> head/sys/contrib/libnv/nvpair_impl.h >> > When was it decided to add SPDX to contrib? > > We didn't, it's up to upstream, but being the author (of at least part of it) he can do what he wants ;). Pedro. From owner-svn-src-all@freebsd.org Sat Jan 27 16:03:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A87F1EC8D5D; Sat, 27 Jan 2018 16:03:48 +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 2B7146E1AF; Sat, 27 Jan 2018 16:03:48 +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 w0RG3exF069554 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 27 Jan 2018 18:03:43 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w0RG3exF069554 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w0RG3e6q069553; Sat, 27 Jan 2018 18:03:40 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 27 Jan 2018 18:03:40 +0200 From: Konstantin Belousov To: "Pedro F. Giffuni" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328479 - in head/sys: fs/ext2fs ufs/ufs Message-ID: <20180127160340.GB55707@kib.kiev.ua> References: <201801271533.w0RFXq0K057921@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201801271533.w0RFXq0K057921@repo.freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) 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.25 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: Sat, 27 Jan 2018 16:03:48 -0000 On Sat, Jan 27, 2018 at 03:33:52PM +0000, Pedro F. Giffuni wrote: > Author: pfg > Date: Sat Jan 27 15:33:52 2018 > New Revision: 328479 > URL: https://svnweb.freebsd.org/changeset/base/328479 > > Log: > {ext2|ufs}_readdir: Set limit on valid ncookies values. > > Sanitize the values that will be assigned to ncookies so that we ensure > they are sane and we can handle them. > > Let ncookies signed as it was before r328346. The valid range is such > that unsigned values are not required and we are not able to avoid at > least one cast anyways. > > Hinted by: bde > > Modified: > head/sys/fs/ext2fs/ext2_lookup.c > head/sys/ufs/ufs/ufs_vnops.c > > Modified: head/sys/fs/ext2fs/ext2_lookup.c > ============================================================================== > --- head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 13:46:55 2018 (r328478) > +++ head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 15:33:52 2018 (r328479) > @@ -145,14 +145,18 @@ ext2_readdir(struct vop_readdir_args *ap) > off_t offset, startoffset; > size_t readcnt, skipcnt; > ssize_t startresid; > - u_int ncookies; > + int ncookies; > int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; > int error; > > if (uio->uio_offset < 0) > return (EINVAL); > ip = VTOI(vp); > + if (uio->uio_resid < 0) > + uio->uio_resid = 0; > if (ap->a_ncookies != NULL) { > + if (uio->uio_resid > MAXPHYS) > + uio->uio_resid = MAXPHYS; > ncookies = uio->uio_resid; > if (uio->uio_offset >= ip->i_size) > ncookies = 0; > > Modified: head/sys/ufs/ufs/ufs_vnops.c > ============================================================================== > --- head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 13:46:55 2018 (r328478) > +++ head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 15:33:52 2018 (r328479) > @@ -2170,7 +2170,7 @@ ufs_readdir(ap) > off_t offset, startoffset; > size_t readcnt, skipcnt; > ssize_t startresid; > - u_int ncookies; > + int ncookies; > int error; > > if (uio->uio_offset < 0) > @@ -2178,7 +2178,11 @@ ufs_readdir(ap) > ip = VTOI(vp); > if (ip->i_effnlink == 0) > return (0); > + if (uio->uio_resid < 0) > + uio->uio_resid = 0; > if (ap->a_ncookies != NULL) { > + if (uio->uio_resid > MAXPHYS) > + uio->uio_resid = MAXPHYS; You just break nfs server. Look at nfsrvd_readdir() call to VOP_READDIR. Almost all code which calls VOP_READDIR() memoize the value of uio_resid before and after the call and interpret the difference as the amount of data returned. I said above that only nfs server is broken, because only the server uses cookies, otherwise your patch would break everything. > ncookies = uio->uio_resid; > if (uio->uio_offset >= ip->i_size) > ncookies = 0; From owner-svn-src-all@freebsd.org Sat Jan 27 16:14:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5F42EC9553 for ; Sat, 27 Jan 2018 16:14:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x241.google.com (mail-it0-x241.google.com [IPv6:2607:f8b0:4001:c0b::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 3A8AC6E70F for ; Sat, 27 Jan 2018 16:14:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x241.google.com with SMTP id k131so3741773ith.4 for ; Sat, 27 Jan 2018 08:14:14 -0800 (PST) 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=qsxt3V3oPqVbCKWYnMyHaTw2Zp4bd7rO/muXpG4hxYk=; b=jk+AZSwISYxGA/CtPTJySx+BZbYr0fp2dSuXZhc37JjhpCFgU9HuPpueuaL+8Cap36 vgrDU5HxT/G++HzdkqFy203BezRjYdTUYhGmCzgMWTiKFxG10c+qHmwMlEf2PInWvczI 8TZb3xatV1WgPXsfo4samzl7u3JgYic7BwaHqwN2B3PEnxdIoYg3zeAIIb6IPtNcVvws NsvLYJVDYUyiVYnIxVqlJPHF5a6V9yYV7wK5ZUkDfk43lg1O3iSmfqE6CADx1qz4HIoV Q0L49znPha1iIktxLgMEbpm2mikT1moPNl3w3/4dcIeQHlu1wzdVGXJvjomnaoduYs14 HIQQ== 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=qsxt3V3oPqVbCKWYnMyHaTw2Zp4bd7rO/muXpG4hxYk=; b=XATpnKcIk8PWohVkQ5yeG8C+pb3VkbF90w9wIsqrj//waEG8ncUethAtxrT3DsmUpb PmLwbIZcz9IsEcGCX2ML6FeSXuG6JR0zJT52PP4de+O/zjvHJcq5kMTb3+E7qGxyrdpE pwuqCqYshQlFMrlILXa5lHuly/qJz2BN0FUhe405ngcy//Tr76boRL7h0YsJkjh+So0u wUsLfMilNMp76O6a7yGGZvWPYOIThoMoaXvWW4ybh36bPnN7Zj/qDgl5JQbY9KNdTyKH zOoJHi6XKCxASXe2O5jTDmtzNZN1EY9TIX5gIsdpHUWnhA6eaL2MW1RXYmeA7O4K8IyL Hf2w== X-Gm-Message-State: AKwxyte08u4lyzes1SLyIm0sb/7LYEuKHiixiGUq6qtQ7EWfT8Ig99sR /InJRkpNSBk5iUad1+WWBxihhR6PykC7GkxyMpIUsw== X-Google-Smtp-Source: AH8x224wILiU9Z5iDXhN+CnVwlIRGPZy0OAGF77N1gk67dfOsAiI/4OGLKYuvbMW5TGtl14EKqwLfzJekSYwIJQAso0= X-Received: by 10.36.146.196 with SMTP id l187mr21723386itd.115.1517069653304; Sat, 27 Jan 2018 08:14:13 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Sat, 27 Jan 2018 08:14:11 -0800 (PST) X-Originating-IP: [2607:fb90:6e36:93d6:c84:a4d3:7333:a790] Received: by 10.79.201.67 with HTTP; Sat, 27 Jan 2018 08:14:11 -0800 (PST) In-Reply-To: <11937120-bbb4-5da1-f48c-240a6aeafbd9@FreeBSD.org> References: <201801241758.w0OHwm26063524@repo.freebsd.org> <20180126020540.B2181@besplex.bde.org> <8d5ddd06-14b2-e7e1-14dd-5e9d42f9b33c@FreeBSD.org> <20180126053133.R3207@besplex.bde.org> <21b6bdda-65b7-89da-4dd6-bed64978eba8@FreeBSD.org> <20180126214948.C1040@besplex.bde.org> <11937120-bbb4-5da1-f48c-240a6aeafbd9@FreeBSD.org> From: Warner Losh Date: Sat, 27 Jan 2018 09:14:11 -0700 X-Google-Sender-Auth: bZvLvykL6lFGkfwiu-p6P0M0bt0 Message-ID: Subject: Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs To: Pedro Giffuni Cc: Bruce Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 16:14:14 -0000 On Jan 27, 2018 8:17 AM, "Pedro Giffuni" wrote: On 01/26/18 06:36, Bruce Evans wrote: > On Thu, 25 Jan 2018, Pedro Giffuni wrote: > > On 25/01/2018 14:24, Bruce Evans wrote: >> >>> ... >>> This code only works because (if?) nfs is the only caller and nfs never >>> passes insane values. >>> >>> >> I am starting to think that we should simply match uio_resid and set it >> to ssize_t. >> Returning the value to int is certainly not the solution. >> > > Of course using the correct type (int) is part of the solution. > > uio_must be checked before it is used for cookies, and after checking it, > it > is small so it fits easily in an int. It must also checked to be > nonnegative, > so that it doesn't suffer unsigned poisoning when it is promoted, so it > would > also fit in a u_int, but using u_int to store it is silly as using 1U > instead > of 1 for a count of 1. > > The bounds checking is something like: > > if (ap->uio_resid < 0) > ap->uio_resid = 0; > if (ap->a_ncookies != NULL) { > if (ap->uio_resid >= 64 * 1024) > ap->uio_resid = 64 * 1024; > ncookies = ap->uio_resid; > } > > This checks for negative values for all cases and converts to 0 (EOF) to > preserve historical behaviour for the syscall case and to avoid overflow > for the cookies case (in case the caller is buggy). The correct handling > is to return EINVAL, but EOF is good enough. > > In the syscall case, uio_resid can be up to SSIZE_MAX, so don't check it > or corrupt it by assigning it to an int or u_int. > > Limit uio_resid from above only in the cookies case. The final limit > should > be about 128K (whatever nfs uses) or maybe 1M. Don't return EINVAL above > the limit, since nfs probably wouldn't know how to handle that (by retrying > with a smaller size). Test its handling of short counts instead. It is > expected than nfs asks for 128K and we supply at most 64K. The supply is > always reduced at EOF. Hopefully nfs doesn't treat the short count as EOF. > It should retry until we supply 0. > > Hmm ... We have never checked the upper bound there, which doesn't mean it was right. I found MAXPHYS, which seems a more reasonable limit used in the kernel for uio_resid. I am checking the patch compiles and doesn't give surprises. MAXPHYS is almost the right thing to check. There's per device limits for normal I/O, but that doesn't seem to be a strict limit for readdir. Warner Pedro. After limiting uio_resid, assign it to the int ncookies. > > This doesn't fix the abuse of the ncookies counter to hold the size of the > cookies array in bytes for this and the next couple of statements. > > Normally the bounds checking should be at the top level, with at most > KASSERT()s at lower levels, but here the levels are mixed, and it isn't > clear if kernel callers have already checked, and it doesn't cost much to > do much the same checking for the kernel callers as for the syscall callers. > > Perhaps the 128K limit is good for all cases (this depends on callers not > having buggy short count handling). Directories of this size are very > rare (don't forget to create very large ones when you test this). Doing > anything with directories of this size tends to be slow anyway, and the > slowness has nothing to do with reading only 128K instead of SSIZE_MAX > bytes at a time. > > readdir() in FreeBSD seems to use a read size of only PAGE_SIZE, except > in the unionfs case it seems to try to read the whole direction. It > malloc()s the buffer in both cases. Blindy malloc()ing or mmap()ing > a buffer large enough for a whole file or directory is no good, since > in theory even directory sizes can be much larger than memory. > > Bruce > > From owner-svn-src-all@freebsd.org Sat Jan 27 16:21:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B679EC9C67 for ; Sat, 27 Jan 2018 16:21:59 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::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 8EF826EB6C for ; Sat, 27 Jan 2018 16:21:58 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22e.google.com with SMTP id b198so3418236iof.6 for ; Sat, 27 Jan 2018 08:21:58 -0800 (PST) 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=yPJ1LX0FqLxiWvUD5LMtZGhW4sGneGHvilM7C0tcH8w=; b=CafwDRr1N0EryaJNOie8ovW7f8vGe9HfwnN+mCVX5CqHjDBL1CDi1E5yfVbfhGy0KZ CskZKSEeq9IWsRVGxrbdUOrpiy/ko30PJKKw9m5VUtJyo5dnqW+O3RED3YhZ6TD0Mn3z 4omv+LEZh1vMnQv1gYIwFCW+dWhs6pT36XW30d7CjNFNMLhDLr3UAUHlNHRxc3lzsDQt ZbWDSClXlhxZ4Eu6W1kgPctHQbqxvhg7OgdfDWBSq0a+GKIXNV6qxyFsRBHXRmD611Js mJ/IlG6/mQ8n+xTyDB+cySYR9vNdb8p0zqmYvViMACte0qZ3MaRZoK+k4s+yiOhdQI4Q RZCQ== 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=yPJ1LX0FqLxiWvUD5LMtZGhW4sGneGHvilM7C0tcH8w=; b=SdlOrQnqctWQ0/Nb8oHvv15VaHl7Gz4AcKN7+so00i7FDB2b+9uHCTWgfYmUbQAESC 1QdA7HNDuwJi1VWyiYH6Q6kirod3Mw0hFagfDW+K4HmzdX9RkrGVP4JZgLUI1m3EKODH Vi03niyNVIiKSNGGOGUDmuou4MJVJAJDMP9zn0JOTR+pKHpW0h6SBLr9Bo7f30n77q/i GksMmdt5JUIKGHa7i+5zAVAREBwUJPqggADV8JpecBVgD64V+4X0b85WBTQwDz39ezOw kwKQpQ/mESCo8I4Tq9qqdGLNBkPpQ1s3/qV0DKXrZIvKUndGKzDQrF0vaoaEza3E3K/q 4Zbg== X-Gm-Message-State: AKwxytc/aOEi3SVuN/ozBvDrDsFcqoxCDPEc4OcrnJ2/g/r8NnLWgjqi eb7S0TiL5BlCAvMv68GAdtIak0AlTqndfHyeLBOnXA== X-Google-Smtp-Source: AH8x227a+50PLwV4Uhy5iuU6YoVfyilSy2BDJLVN3SUN4tamQS1aklj5RI6vx4WMZEbdzmVfXG/C3FEilT94Sgm5SRM= X-Received: by 10.107.88.12 with SMTP id m12mr18641881iob.136.1517070117858; Sat, 27 Jan 2018 08:21:57 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Sat, 27 Jan 2018 08:21:57 -0800 (PST) X-Originating-IP: [2607:fb90:6e36:93d6:c84:a4d3:7333:a790] Received: by 10.79.201.67 with HTTP; Sat, 27 Jan 2018 08:21:57 -0800 (PST) In-Reply-To: <201801271533.w0RFXq0K057921@repo.freebsd.org> References: <201801271533.w0RFXq0K057921@repo.freebsd.org> From: Warner Losh Date: Sat, 27 Jan 2018 09:21:57 -0700 X-Google-Sender-Auth: uRqVFu8_g-hNXHygsPOOv0_mVtw Message-ID: Subject: Re: svn commit: r328479 - in head/sys: fs/ext2fs ufs/ufs To: Pedro Giffuni Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 16:21:59 -0000 You aren't allowed to set resid like this. Changes in resid indicate amount of I/O done. If you think it's bogus, you need to either return EINVAL or use a smaller value to figure out your buffer sizes. Thi s is bogus, please back it out. Warner On Jan 27, 2018 8:34 AM, "Pedro F. Giffuni" wrote: > Author: pfg > Date: Sat Jan 27 15:33:52 2018 > New Revision: 328479 > URL: https://svnweb.freebsd.org/changeset/base/328479 > > Log: > {ext2|ufs}_readdir: Set limit on valid ncookies values. > > Sanitize the values that will be assigned to ncookies so that we ensure > they are sane and we can handle them. > > Let ncookies signed as it was before r328346. The valid range is such > that unsigned values are not required and we are not able to avoid at > least one cast anyways. > > Hinted by: bde > > Modified: > head/sys/fs/ext2fs/ext2_lookup.c > head/sys/ufs/ufs/ufs_vnops.c > > Modified: head/sys/fs/ext2fs/ext2_lookup.c > ============================================================ > ================== > --- head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 13:46:55 2018 > (r328478) > +++ head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 15:33:52 2018 > (r328479) > @@ -145,14 +145,18 @@ ext2_readdir(struct vop_readdir_args *ap) > off_t offset, startoffset; > size_t readcnt, skipcnt; > ssize_t startresid; > - u_int ncookies; > + int ncookies; > int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; > int error; > > if (uio->uio_offset < 0) > return (EINVAL); > ip = VTOI(vp); > + if (uio->uio_resid < 0) > + uio->uio_resid = 0; > if (ap->a_ncookies != NULL) { > + if (uio->uio_resid > MAXPHYS) > + uio->uio_resid = MAXPHYS; > ncookies = uio->uio_resid; > if (uio->uio_offset >= ip->i_size) > ncookies = 0; > > Modified: head/sys/ufs/ufs/ufs_vnops.c > ============================================================ > ================== > --- head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 13:46:55 2018 > (r328478) > +++ head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 15:33:52 2018 > (r328479) > @@ -2170,7 +2170,7 @@ ufs_readdir(ap) > off_t offset, startoffset; > size_t readcnt, skipcnt; > ssize_t startresid; > - u_int ncookies; > + int ncookies; > int error; > > if (uio->uio_offset < 0) > @@ -2178,7 +2178,11 @@ ufs_readdir(ap) > ip = VTOI(vp); > if (ip->i_effnlink == 0) > return (0); > + if (uio->uio_resid < 0) > + uio->uio_resid = 0; > if (ap->a_ncookies != NULL) { > + if (uio->uio_resid > MAXPHYS) > + uio->uio_resid = MAXPHYS; > ncookies = uio->uio_resid; > if (uio->uio_offset >= ip->i_size) > ncookies = 0; > > From owner-svn-src-all@freebsd.org Sat Jan 27 16:34:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9BD5ECA556; Sat, 27 Jan 2018 16:34:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 790C76F3EC; Sat, 27 Jan 2018 16:34:00 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72C6D5237; Sat, 27 Jan 2018 16:34:00 +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 w0RGY0di087569; Sat, 27 Jan 2018 16:34:00 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RGY0gO087567; Sat, 27 Jan 2018 16:34:00 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801271634.w0RGY0gO087567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 27 Jan 2018 16:34:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328480 - in head/sys: fs/ext2fs ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in head/sys: fs/ext2fs ufs/ufs X-SVN-Commit-Revision: 328480 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 16:34:01 -0000 Author: pfg Date: Sat Jan 27 16:34:00 2018 New Revision: 328480 URL: https://svnweb.freebsd.org/changeset/base/328480 Log: Revert r328479: {ext2|ufs}_readdir: Set limit on valid ncookies values. We aren't allowed to set resid like this. Pointed out by: kib, imp Modified: head/sys/fs/ext2fs/ext2_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 15:33:52 2018 (r328479) +++ head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 16:34:00 2018 (r328480) @@ -145,18 +145,14 @@ ext2_readdir(struct vop_readdir_args *ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - int ncookies; + u_int ncookies; int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; if (uio->uio_offset < 0) return (EINVAL); ip = VTOI(vp); - if (uio->uio_resid < 0) - uio->uio_resid = 0; if (ap->a_ncookies != NULL) { - if (uio->uio_resid > MAXPHYS) - uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 15:33:52 2018 (r328479) +++ head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 16:34:00 2018 (r328480) @@ -2170,7 +2170,7 @@ ufs_readdir(ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - int ncookies; + u_int ncookies; int error; if (uio->uio_offset < 0) @@ -2178,11 +2178,7 @@ ufs_readdir(ap) ip = VTOI(vp); if (ip->i_effnlink == 0) return (0); - if (uio->uio_resid < 0) - uio->uio_resid = 0; if (ap->a_ncookies != NULL) { - if (uio->uio_resid > MAXPHYS) - uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; From owner-svn-src-all@freebsd.org Sat Jan 27 16:36:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAE44ECA6F7; Sat, 27 Jan 2018 16:36:07 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C5896F592; Sat, 27 Jan 2018 16:36:07 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CCF5523B; Sat, 27 Jan 2018 16:36:07 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RGa7BF087686; Sat, 27 Jan 2018 16:36:07 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RGa7lc087685; Sat, 27 Jan 2018 16:36:07 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201801271636.w0RGa7lc087685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Date: Sat, 27 Jan 2018 16:36:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328481 - stable/11/sys/dev/atkbdc X-SVN-Group: stable-11 X-SVN-Commit-Author: dumbbell X-SVN-Commit-Paths: stable/11/sys/dev/atkbdc X-SVN-Commit-Revision: 328481 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 16:36:08 -0000 Author: dumbbell Date: Sat Jan 27 16:36:06 2018 New Revision: 328481 URL: https://svnweb.freebsd.org/changeset/base/328481 Log: psm: Skip sync check when `PSM_CONFIG_NOCHECKSYNC` is set In psmprobe(), we set the initial `syncmask` to the vendor default value if the `PSM_CONFIG_NOCHECKSYNC` bit is unset. However, we currently only set it for the Elantech touchpad later in psmattach(), thus `syncmask` is always configured. Now, we check `PSM_CONFIG_NOCHECKSYNC` and skip sync check if it is set. This fixes Elantech touchpad support for units which have `hascrc` set. To clarify that, when we log the `syncmask` and `syncbits` fields, also mention if they are actually used. Finally, when we set `PSM_CONFIG_NOCHECKSYNC`, clear `PSM_NEED_SYNCBITS` flag. PR: 225338 MFC of: r328190 Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:34:00 2018 (r328480) +++ stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:36:06 2018 (r328481) @@ -1947,8 +1947,10 @@ psmattach(device_t dev) /* Elantech trackpad`s sync bit differs from touchpad`s one */ if (sc->hw.model == MOUSE_MODEL_ELANTECH && - (sc->elanhw.hascrc || sc->elanhw.hastrackpoint)) + (sc->elanhw.hascrc || sc->elanhw.hastrackpoint)) { sc->config |= PSM_CONFIG_NOCHECKSYNC; + sc->flags &= ~PSM_NEED_SYNCBITS; + } if (!verbose) printf("psm%d: model %s, device ID %d\n", @@ -1959,8 +1961,9 @@ psmattach(device_t dev) sc->hw.hwid >> 8, sc->hw.buttons); printf("psm%d: config:%08x, flags:%08x, packet size:%d\n", unit, sc->config, sc->flags, sc->mode.packetsize); - printf("psm%d: syncmask:%02x, syncbits:%02x\n", - unit, sc->mode.syncmask[0], sc->mode.syncmask[1]); + printf("psm%d: syncmask:%02x, syncbits:%02x%s\n", + unit, sc->mode.syncmask[0], sc->mode.syncmask[1], + sc->config & PSM_CONFIG_NOCHECKSYNC ? " (sync not checked)" : ""); } if (bootverbose) @@ -2976,7 +2979,8 @@ psmintr(void *arg) VLOG(2, (LOG_DEBUG, "psmintr: Sync bytes now %04x,%04x\n", sc->mode.syncmask[0], sc->mode.syncmask[0])); - } else if ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { + } else if ((sc->config & PSM_CONFIG_NOCHECKSYNC) == 0 && + (c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { VLOG(3, (LOG_DEBUG, "psmintr: out of sync " "(%04x != %04x) %d cmds since last error.\n", c & sc->mode.syncmask[0], sc->mode.syncmask[1], From owner-svn-src-all@freebsd.org Sat Jan 27 16:43:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5ED03ECAC1D for ; Sat, 27 Jan 2018 16:43:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic302-35.consmr.mail.gq1.yahoo.com (sonic302-35.consmr.mail.gq1.yahoo.com [98.137.68.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCF446FA04 for ; Sat, 27 Jan 2018 16:43:23 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1517071397; bh=mVkWvQ48KAXzKIiSk47WHQLKM52aigLEW0XCqiOX8uU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=XcnXrNS1G5Q04QRq898ZjgCYhewQR1q2MZHcFv3j0IBiDvgsT0hs15tO8eX/ZwmWtUrobehXFnVk4BpyfZain8jLexYYmDAKML5oSwXKKhwGWmQwQb5ttn3KdAIWbFSGH7hfkWMFqPfIHP1cG0NKHDBnMJfkwguTnsyQFF4F1NymqGtv8jQE+k+7fXzLtpiekmmhPohSJo9IxI9Tuflrki2i2A/WqJ2ulHTzptAXCHrF0PgCacRvM0BDcZTquL/+TtZMRvH0Kx8ND/UkHokaOAxSYaum2o+Z5vfOFvILpDGGgfQJMJVpoOYW70lv5SwNKXweMHxe7dnlhZAlsDLzlA== X-YMail-OSG: sLogx1EVM1ln1SLXmsLwP9ITW_35W7OcNFxGPORuWXzsNGVsYsflJonE1AUtzLU mSPvBmDnJDNvgu9Fe1Hm6wygnIx8IyBrvXbHiYG9rOSns6UjR2fGhs05gboFOD9hxbASUO8NeB97 ufIjrjI._Jy3m9LLLbvuFuao_BC7wzC3fTjLNGzefVHvy_Dd1h00g9e98XpFPzZh_OvcimhxG6GR 4LmLpe1S0.XmJCujJJr9TSrTl35UKoHTcFoig_FvAafhfr.i2IDesV.M.5nrqm0n17kJ5JQPW7gR BXge..CYwNJjlW5XWz1SClrqnXPHeHtI.XmDnAcQP3G5xcAR8PKQUJ_R9yaH3oWNlUq6va4EgUep ohyr5ouhTOMlOcY44QkyL6lVgsiRFopB1x1q.Z4.13z_Yhx4Hced4fXVBNkliF9l7AsLB6ym0TsD O_D0uaTS9BJhLj2Zv5V4cI4531uiYayN0neaS4oK9FFg5RFTtVq89g75xuzN31lYOqerhROnWqpo LhZw_izJztg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Sat, 27 Jan 2018 16:43:17 +0000 Received: from smtp103.rhel.mail.gq1.yahoo.com (EHLO [192.168.0.8]) ([68.180.227.11]) by smtp402.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID bc32d8913b75c14c896760960170103e; Sat, 27 Jan 2018 16:43:14 +0000 (UTC) Subject: Re: svn commit: r328479 - in head/sys: fs/ext2fs ufs/ufs To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801271533.w0RFXq0K057921@repo.freebsd.org> <20180127160340.GB55707@kib.kiev.ua> From: Pedro Giffuni Message-ID: <5335b45b-f527-c388-91fc-243d67511534@FreeBSD.org> Date: Sat, 27 Jan 2018 11:43:13 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180127160340.GB55707@kib.kiev.ua> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 16:43:24 -0000 On 01/27/18 11:03, Konstantin Belousov wrote: > On Sat, Jan 27, 2018 at 03:33:52PM +0000, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Sat Jan 27 15:33:52 2018 >> New Revision: 328479 >> URL: https://svnweb.freebsd.org/changeset/base/328479 >> >> Log: >> {ext2|ufs}_readdir: Set limit on valid ncookies values. >> >> Sanitize the values that will be assigned to ncookies so that we ensure >> they are sane and we can handle them. >> >> Let ncookies signed as it was before r328346. The valid range is such >> that unsigned values are not required and we are not able to avoid at >> least one cast anyways. >> >> Hinted by: bde >> >> Modified: >> head/sys/fs/ext2fs/ext2_lookup.c >> head/sys/ufs/ufs/ufs_vnops.c >> >> Modified: head/sys/fs/ext2fs/ext2_lookup.c >> ============================================================================== >> --- head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 13:46:55 2018 (r328478) >> +++ head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 15:33:52 2018 (r328479) >> @@ -145,14 +145,18 @@ ext2_readdir(struct vop_readdir_args *ap) >> off_t offset, startoffset; >> size_t readcnt, skipcnt; >> ssize_t startresid; >> - u_int ncookies; >> + int ncookies; >> int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; >> int error; >> >> if (uio->uio_offset < 0) >> return (EINVAL); >> ip = VTOI(vp); >> + if (uio->uio_resid < 0) >> + uio->uio_resid = 0; >> if (ap->a_ncookies != NULL) { >> + if (uio->uio_resid > MAXPHYS) >> + uio->uio_resid = MAXPHYS; >> ncookies = uio->uio_resid; >> if (uio->uio_offset >= ip->i_size) >> ncookies = 0; >> >> Modified: head/sys/ufs/ufs/ufs_vnops.c >> ============================================================================== >> --- head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 13:46:55 2018 (r328478) >> +++ head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 15:33:52 2018 (r328479) >> @@ -2170,7 +2170,7 @@ ufs_readdir(ap) >> off_t offset, startoffset; >> size_t readcnt, skipcnt; >> ssize_t startresid; >> - u_int ncookies; >> + int ncookies; >> int error; >> >> if (uio->uio_offset < 0) >> @@ -2178,7 +2178,11 @@ ufs_readdir(ap) >> ip = VTOI(vp); >> if (ip->i_effnlink == 0) >> return (0); >> + if (uio->uio_resid < 0) >> + uio->uio_resid = 0; >> if (ap->a_ncookies != NULL) { >> + if (uio->uio_resid > MAXPHYS) >> + uio->uio_resid = MAXPHYS; > You just break nfs server. > > Look at nfsrvd_readdir() call to VOP_READDIR. Almost all code which calls > VOP_READDIR() memoize the value of uio_resid before and after the call and > interpret the difference as the amount of data returned. > > I said above that only nfs server is broken, because only the server uses > cookies, otherwise your patch would break everything. Ugh, yes .. I completely missed the fact that uio is a pointer to the real thing, not a local copy. This still should never go off limits but it is certainly wrong. I reverted it sorry. Pedro. From owner-svn-src-all@freebsd.org Sat Jan 27 16:48:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98858ECAEB5; Sat, 27 Jan 2018 16:48:30 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4827B6FC07; Sat, 27 Jan 2018 16:48:30 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 418F253CE; Sat, 27 Jan 2018 16:48:30 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RGmUmf092724; Sat, 27 Jan 2018 16:48:30 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RGmUCL092723; Sat, 27 Jan 2018 16:48:30 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201801271648.w0RGmUCL092723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Date: Sat, 27 Jan 2018 16:48: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: r328482 - stable/11/sys/dev/atkbdc X-SVN-Group: stable-11 X-SVN-Commit-Author: dumbbell X-SVN-Commit-Paths: stable/11/sys/dev/atkbdc X-SVN-Commit-Revision: 328482 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 16:48:30 -0000 Author: dumbbell Date: Sat Jan 27 16:48:29 2018 New Revision: 328482 URL: https://svnweb.freebsd.org/changeset/base/328482 Log: psm: Don't try to detect trackpoint packets if the Elantech device has none This fixes a panic when `EVDEV_SUPPORT` is enabled: if a trackpoint packet was detected but there was no trackpoint, we still tried to emit an evdev event even though the associated relative evdev device (`evdev_r`) was not initialized. PR: 225339 MFC of: r328191 Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:36:06 2018 (r328481) +++ stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:48:29 2018 (r328482) @@ -4187,7 +4187,7 @@ proc_elantech(struct psm_softc *sc, packetbuf_t *pb, m /* Determine packet format and do a sanity check for out of sync packets. */ if (ELANTECH_PKT_IS_DEBOUNCE(pb, sc->elanhw.hwversion)) pkt = ELANTECH_PKT_NOP; - else if (ELANTECH_PKT_IS_TRACKPOINT(pb)) + else if (sc->elanhw.hastrackpoint && ELANTECH_PKT_IS_TRACKPOINT(pb)) pkt = ELANTECH_PKT_TRACKPOINT; else switch (sc->elanhw.hwversion) { From owner-svn-src-all@freebsd.org Sat Jan 27 16:56:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E981ECB6DB; Sat, 27 Jan 2018 16:56:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 117D970522; Sat, 27 Jan 2018 16:56:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A9DA5567; Sat, 27 Jan 2018 16:56:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RGusGB097698; Sat, 27 Jan 2018 16:56:54 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RGuslR097697; Sat, 27 Jan 2018 16:56:54 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801271656.w0RGuslR097697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 27 Jan 2018 16:56: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: r328483 - stable/11/share/termcap X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/termcap X-SVN-Commit-Revision: 328483 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 16:56:55 -0000 Author: eadler Date: Sat Jan 27 16:56:54 2018 New Revision: 328483 URL: https://svnweb.freebsd.org/changeset/base/328483 Log: MFC r328209: termcap: add xterm-termite Modified: stable/11/share/termcap/termcap Directory Properties: stable/11/ (props changed) Modified: stable/11/share/termcap/termcap ============================================================================== --- stable/11/share/termcap/termcap Sat Jan 27 16:48:29 2018 (r328482) +++ stable/11/share/termcap/termcap Sat Jan 27 16:56:54 2018 (r328483) @@ -4662,6 +4662,27 @@ Eterm|Eterm Terminal Emulator (X11 Window System):\ :us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:\ :ac=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~: +# Termcap for xterm-termite +xterm-termite|VTE-based terminal:\ + :NP:am:hs:mi:ms:ut:xn:\ + :Co#256:co#80:it#8:li#24:pa#32767:\ + :@7=\EOF:@8=\EOM:AB=\E[48;5;%dm:AF=\E[38;5;%dm:AL=\E[%dL:\ + :DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:F1=\E[23~:F2=\E[24~:\ + :IC=\E[%d@:K2=\EOE:Km=\E[M:LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:\ + :SA=\E[?7h:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ZH=\E[3m:\ + :ZR=\E[23m:al=\E[L:bl=^G:bt=\E[Z:cb=\E[1K:cd=\E[J:ce=\E[K:\ + :ch=\E[%i%dG:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ + :cs=\E[%i%d;%dr:cv=\E[%i%dd:dc=\E[P:dl=\E[M:do=^J:\ + :ds=\E]2;\007:ec=\E[%dX:ei=\E[4l:fs=^G:ho=\E[H:im=\E[4h:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\ + :k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:kB=\E[Z:kD=\E[3~:\ + :kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:kd=\EOB:ke=\E[?1l:\ + :kh=\EOH:kl=\EOD:kr=\EOC:ks=\E[?1h:ku=\EOA:le=^H:md=\E[1m:\ + :me=\E[m:mr=\E[7m:nd=\E[C:op=\E[39;49m:r1=\Ec:rc=\E8:\ + :sc=\E7:se=\E[27m:sf=^J:so=\E[7m:sr=\EM:ta=^I:te=\E[?1049l:\ + :ti=\E[?1049h:ts=\E]2;:u6=\E[%i%d;%dR:u7=\E[6n:ue=\E[24m:\ + :up=\E[A:us=\E[4m:ve=\E[?25h:vi=\E[?25l: + # # END OF TERMCAP # ------------------------ From owner-svn-src-all@freebsd.org Sat Jan 27 17:11:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66909ECC38B; Sat, 27 Jan 2018 17:11:23 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id A0FED70DD2; Sat, 27 Jan 2018 17:11:22 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id BFB2F430B3A; Sun, 28 Jan 2018 04:11:14 +1100 (AEDT) Date: Sun, 28 Jan 2018 04:11:13 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: "Pedro F. Giffuni" , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r328479 - in head/sys: fs/ext2fs ufs/ufs In-Reply-To: <20180127160340.GB55707@kib.kiev.ua> Message-ID: <20180128031737.B2618@besplex.bde.org> References: <201801271533.w0RFXq0K057921@repo.freebsd.org> <20180127160340.GB55707@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=LKgWeNe9 c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=2CwwexBGHmdeohTiNo0A:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 17:11:23 -0000 On Sat, 27 Jan 2018, Konstantin Belousov wrote: > On Sat, Jan 27, 2018 at 03:33:52PM +0000, Pedro F. Giffuni wrote: >> Log: >> {ext2|ufs}_readdir: Set limit on valid ncookies values. >> >> Sanitize the values that will be assigned to ncookies so that we ensure >> they are sane and we can handle them. >> >> Let ncookies signed as it was before r328346. The valid range is such >> that unsigned values are not required and we are not able to avoid at >> least one cast anyways. >> >> Hinted by: bde >> >> Modified: >> head/sys/fs/ext2fs/ext2_lookup.c >> head/sys/ufs/ufs/ufs_vnops.c >> >> Modified: head/sys/fs/ext2fs/ext2_lookup.c >> ============================================================================== >> --- head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 13:46:55 2018 (r328478) >> +++ head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 15:33:52 2018 (r328479) >> @@ -145,14 +145,18 @@ ext2_readdir(struct vop_readdir_args *ap) >> off_t offset, startoffset; >> size_t readcnt, skipcnt; >> ssize_t startresid; >> - u_int ncookies; >> + int ncookies; >> int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; >> int error; >> >> if (uio->uio_offset < 0) >> return (EINVAL); >> ip = VTOI(vp); >> + if (uio->uio_resid < 0) >> + uio->uio_resid = 0; >> if (ap->a_ncookies != NULL) { >> + if (uio->uio_resid > MAXPHYS) >> + uio->uio_resid = MAXPHYS; >> ncookies = uio->uio_resid; >> if (uio->uio_offset >= ip->i_size) >> ncookies = 0; >> >> Modified: head/sys/ufs/ufs/ufs_vnops.c >> ... > You just break nfs server. > > Look at nfsrvd_readdir() call to VOP_READDIR. Almost all code which calls > VOP_READDIR() memoize the value of uio_resid before and after the call and > interpret the difference as the amount of data returned. We noticed in further discussion that there is likely to be a problem like that. Also, the instructions for testing this said to test nfs with a value of 64K and perhaps with smaller values, to see if its error handling can handle reduction of uio_resid. Any testing would have shown the problem. > I said above that only nfs server is broken, because only the server uses > cookies, otherwise your patch would break everything. My original patch have broke syscalls slightly too. In the syscall case, it only modifies uio_resid when that is negative. Spelling 0 as negative would be silly, but it has always worked, and fixing it up to 0 would break callers which memoized the negative value. I think we have use a local variable to hold a reduced resid. uio_resid can be updated just before returning. Or maybe just return EINVAL in the cookies case if uio_resid < 0 || uio_resid > MAX_SIZE_NOW_USED_BY_NFS (thiss essentially a check that nfs is the only caller and that it never asks for large sizes). I was trying to avoid the extra complexity. There are at about 13 file systems under sys/fs, and zfs under sys/cddl to fix. zfs_readdir() is quite broken (if there are any untrusted callers). It always malloc()s approx. (size_t)(int)uio_resid bytes. The casts can overflow in various ways. Some other file systems resuce this to the residual file size which tends to be small enough to fit in memory. zfs detects overrun (using KASSERT()) _after_ the overrun has occurred. The subsystems under sys/fs which mention ncookies are: - autofs: just for layering - cd9660: like zfs, except it has the wrong type (u_int) for the cookie count, and it has no KASSERT() at all, and it counts down the residual cookies quite differently - devfs: doesn't support cookies, but fakes them a little. No problem. - fdesc: doesn't support cookies. No problem. - fuse: doesn't support cookies. Doesn't even return a cookie count of 0 to advertize this like fdesc does. - msdosfs: like cd9660, except it counts down the residual cookies normally - smbfs: doesn't support cookies. Has some code to return EOPNOTSUPP if cookies are requested, but this is ifdefed out, so it is like fuse. - tmpfs: tmpfs_subr.c writes cookies and depends on the caller passing sane cookie pointer and count args. tmpfs_readdir() creates a cookie array with a size that seems to be for a whole directory (not limited by uio_resid). So nfs's saneness doesn't help here. I don't know how large tmpfs directories can be (can it be swap-backed with directories larger than memory?). - udf: like cd9660. - unionfs: does both layering and a malloc() to merge cookies. The size of this malloc() is unclear. Bruce From owner-svn-src-all@freebsd.org Sat Jan 27 17:21:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9AF85ECC9A8 for ; Sat, 27 Jan 2018 17:21:03 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic302-36.consmr.mail.gq1.yahoo.com (sonic302-36.consmr.mail.gq1.yahoo.com [98.137.68.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23393711F7 for ; Sat, 27 Jan 2018 17:21:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1517073661; bh=MMvKlmA8m5hUSiGJ7l87J7GCoxk48Om4Ow1ILIxgFnY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=ktSuWAJDrbUWmC6Vugkq8dP9c6WVJUZWmTUW6fKA3p99jAYNabr34imCxh5n0tzLUDlbxrp0br3KgK6qDneJx/J/Hnaus0eKsaJIfT6oNfMTfcZPSWLSvcUqsXa7dxKsw4SOynADulJAqeT5UlZdBMpErYzc8IwwMSOKIh7O+pyzOOY9v2duWywa4HBzURLiJ5tUe1xf3o+VvxLudYiIZdeiK5ypL4cUhNSJ4wHULOJI9JPfSUg52Tar4Nwf9CQO9UUmdyiYEH2e58VF8mYvzw3C5Bsof7S+bUfcwqG88D2F+buHfP6kq385b/ElwhDZ6FFYjTi2g+uAFTjb9YZchQ== X-YMail-OSG: 6oP_3ngVM1mRP1nXlSJn.ae1t0AZlUO7LqqBfcarN9NvBnngt1FI1p.isvasBkc uXW8Won8VdNhsZ_dvU90h7uwCTzspSgR5B6s2uxr75AQm.R9RFHeK1zSVhgERdu0FaGyz.PfolfQ Lzzh234lpIw625oFE4tqYkwKCvOskL2pf4yOke4X7X_3xyuqytdt76Tsm2LGvG_2BwqtLK7GQjyk 05K5ig1ODeaP0DNqANnS4mpLKb6zO0.gqv6UiF91oe3nP.YzRIqVZBwnrwy1RH2hdSp1nb1kts0k ezp4eb7Z1TFjj4Djea0Is8QP8VxDVJIpysQ227AJOiKbgSbTkWUvMLN5glzOuzzlhWsODdioAMk1 SPqQbONolu1tWAPwrulN3Odc77tA4x3cZb3R0q7irQ25BcwuYeZye6dmt0fTkVRyNIEDwMHvwMzO u1w3uKCg7r40o4RNSxXlI1nXO8THvFp24TDl3KAHVmpBBUhgQEDpNEZcBLs4IIa9xxKhHcSZhAx9 JH.ZzQYJiZg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Sat, 27 Jan 2018 17:21:01 +0000 Received: from smtpgate104.mail.gq1.yahoo.com (EHLO [192.168.0.8]) ([10.215.136.172]) by smtp404.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 90ce1c4058cfe7e5be6e72abf2723b02; Sat, 27 Jan 2018 17:00:45 +0000 (UTC) Subject: Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs To: Warner Losh Cc: Bruce Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801241758.w0OHwm26063524@repo.freebsd.org> <20180126020540.B2181@besplex.bde.org> <8d5ddd06-14b2-e7e1-14dd-5e9d42f9b33c@FreeBSD.org> <20180126053133.R3207@besplex.bde.org> <21b6bdda-65b7-89da-4dd6-bed64978eba8@FreeBSD.org> <20180126214948.C1040@besplex.bde.org> <11937120-bbb4-5da1-f48c-240a6aeafbd9@FreeBSD.org> From: Pedro Giffuni Message-ID: Date: Sat, 27 Jan 2018 12:00:44 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------F212627EF6FB157D50797727" Content-Language: en-US X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 17:21:03 -0000 This is a multi-part message in MIME format. --------------F212627EF6FB157D50797727 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 01/27/18 11:14, Warner Losh wrote: > > > On Jan 27, 2018 8:17 AM, "Pedro Giffuni" > wrote: > > > > On 01/26/18 06:36, Bruce Evans wrote: > > On Thu, 25 Jan 2018, Pedro Giffuni wrote: > > On 25/01/2018 14:24, Bruce Evans wrote: > > ... > This code only works because (if?) nfs is the only > caller and nfs never > passes insane values. > > > I am starting to think that we should simply match > uio_resid and set it to ssize_t. > Returning the value to int is certainly not the solution. > > > Of course using the correct type (int) is part of the solution. > > uio_must be checked before it is used for cookies, and after > checking it, it > is small so it fits easily in an int.  It must also checked to > be nonnegative, > so that it doesn't suffer unsigned poisoning when it is > promoted, so it would > also fit in a u_int, but using u_int to store it is silly as > using 1U instead > of 1 for a count of 1. > > The bounds checking is something like: > >     if (ap->uio_resid < 0) >         ap->uio_resid = 0; >     if (ap->a_ncookies != NULL) { >         if (ap->uio_resid >= 64 * 1024) >             ap->uio_resid = 64 * 1024; >         ncookies = ap->uio_resid; >     } > > This checks for negative values for all cases and converts to > 0 (EOF) to > preserve historical behaviour for the syscall case and to > avoid overflow > for the cookies case (in case the caller is buggy). The > correct handling > is to return EINVAL, but EOF is good enough. > > In the syscall case, uio_resid can be up to SSIZE_MAX, so > don't check it > or corrupt it by assigning it to an int or u_int. > > Limit uio_resid from above only in the cookies case.  The > final limit should > be about 128K (whatever nfs uses) or maybe 1M. Don't return > EINVAL above > the limit, since nfs probably wouldn't know how to handle that > (by retrying > with a smaller size).  Test its handling of short counts > instead. It is > expected than nfs asks for 128K and we supply at most 64K.  > The supply is > always reduced at EOF.  Hopefully nfs doesn't treat the short > count as EOF. > It should retry until we supply 0. > > Hmm ... > > We have never checked the upper bound there, which doesn't mean it > was right. > I found MAXPHYS, which seems a more reasonable limit used in the > kernel for uio_resid. > > I am checking the patch compiles and doesn't give surprises. > > > MAXPHYS is almost the right thing to check. There's per device limits > for normal I/O, but that doesn't seem to be a strict limit for readdir. > OK... new patch, this time again trying to sanitize only ncookies (which can be int or u_int, doesn't matter to me). Pedro. --------------F212627EF6FB157D50797727 Content-Type: text/x-patch; name="ufs_ncookies.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ufs_ncookies.diff" Index: sys/fs/ext2fs/ext2_lookup.c =================================================================== --- sys/fs/ext2fs/ext2_lookup.c (revision 328478) +++ sys/fs/ext2fs/ext2_lookup.c (working copy) @@ -145,7 +145,7 @@ off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - u_int ncookies; + int ncookies; int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; @@ -152,7 +152,11 @@ if (uio->uio_offset < 0) return (EINVAL); ip = VTOI(vp); + if (uio->uio_resid < 0) + uio->uio_resid = 0; if (ap->a_ncookies != NULL) { + if (uio->uio_resid > MAXPHYS) + uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; Index: sys/ufs/ufs/ufs_vnops.c =================================================================== --- sys/ufs/ufs/ufs_vnops.c (revision 328478) +++ sys/ufs/ufs/ufs_vnops.c (working copy) @@ -2170,7 +2170,7 @@ off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - u_int ncookies; + int ncookies; int error; if (uio->uio_offset < 0) @@ -2178,7 +2178,11 @@ ip = VTOI(vp); if (ip->i_effnlink == 0) return (0); + if (uio->uio_resid < 0) + uio->uio_resid = 0; if (ap->a_ncookies != NULL) { + if (uio->uio_resid > MAXPHYS) + uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; --------------F212627EF6FB157D50797727-- From owner-svn-src-all@freebsd.org Sat Jan 27 17:24:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8337BECCDB4; Sat, 27 Jan 2018 17:24:28 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3533271653; Sat, 27 Jan 2018 17:24:28 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 301DA5A40; Sat, 27 Jan 2018 17:24:28 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RHOS2U012544; Sat, 27 Jan 2018 17:24:28 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RHOSmc012543; Sat, 27 Jan 2018 17:24:28 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201801271724.w0RHOSmc012543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Date: Sat, 27 Jan 2018 17:24:28 +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: r328484 - stable/11/sys/dev/atkbdc X-SVN-Group: stable-11 X-SVN-Commit-Author: dumbbell X-SVN-Commit-Paths: stable/11/sys/dev/atkbdc X-SVN-Commit-Revision: 328484 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 17:24:28 -0000 Author: dumbbell Date: Sat Jan 27 17:24:27 2018 New Revision: 328484 URL: https://svnweb.freebsd.org/changeset/base/328484 Log: psm: Log syncmask[1], not syncmask[0] twice MFC of: r328208 Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:56:54 2018 (r328483) +++ stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 17:24:27 2018 (r328484) @@ -2978,7 +2978,7 @@ psmintr(void *arg) sc->flags &= ~PSM_NEED_SYNCBITS; VLOG(2, (LOG_DEBUG, "psmintr: Sync bytes now %04x,%04x\n", - sc->mode.syncmask[0], sc->mode.syncmask[0])); + sc->mode.syncmask[0], sc->mode.syncmask[1])); } else if ((sc->config & PSM_CONFIG_NOCHECKSYNC) == 0 && (c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { VLOG(3, (LOG_DEBUG, "psmintr: out of sync " From owner-svn-src-all@freebsd.org Sat Jan 27 17:25:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 460B4ECCE22; Sat, 27 Jan 2018 17:25:00 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E608F71770; Sat, 27 Jan 2018 17:24:59 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0DE95A42; Sat, 27 Jan 2018 17:24:59 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RHOxKu012604; Sat, 27 Jan 2018 17:24:59 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RHOxog012603; Sat, 27 Jan 2018 17:24:59 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201801271724.w0RHOxog012603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Date: Sat, 27 Jan 2018 17:24:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328485 - stable/10/sys/dev/atkbdc X-SVN-Group: stable-10 X-SVN-Commit-Author: dumbbell X-SVN-Commit-Paths: stable/10/sys/dev/atkbdc X-SVN-Commit-Revision: 328485 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 17:25:00 -0000 Author: dumbbell Date: Sat Jan 27 17:24:59 2018 New Revision: 328485 URL: https://svnweb.freebsd.org/changeset/base/328485 Log: psm: Log syncmask[1], not syncmask[0] twice MFC of: r328208 Modified: stable/10/sys/dev/atkbdc/psm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/atkbdc/psm.c ============================================================================== --- stable/10/sys/dev/atkbdc/psm.c Sat Jan 27 17:24:27 2018 (r328484) +++ stable/10/sys/dev/atkbdc/psm.c Sat Jan 27 17:24:59 2018 (r328485) @@ -2411,7 +2411,7 @@ psmintr(void *arg) sc->flags &= ~PSM_NEED_SYNCBITS; VLOG(2, (LOG_DEBUG, "psmintr: Sync bytes now %04x,%04x\n", - sc->mode.syncmask[0], sc->mode.syncmask[0])); + sc->mode.syncmask[0], sc->mode.syncmask[1])); } else if ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { VLOG(3, (LOG_DEBUG, "psmintr: out of sync " "(%04x != %04x) %d cmds since last error.\n", From owner-svn-src-all@freebsd.org Sat Jan 27 17:43:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA138ECDC27; Sat, 27 Jan 2018 17:43:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 691F872542; Sat, 27 Jan 2018 17:43:09 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6403E5D71; Sat, 27 Jan 2018 17:43:09 +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 w0RHh9MW022620; Sat, 27 Jan 2018 17:43:09 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RHh9io022619; Sat, 27 Jan 2018 17:43:09 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801271743.w0RHh9io022619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 27 Jan 2018 17:43:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328486 - head/usr.bin/fortune/fortune X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/usr.bin/fortune/fortune X-SVN-Commit-Revision: 328486 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 17:43:09 -0000 Author: pfg Date: Sat Jan 27 17:43:09 2018 New Revision: 328486 URL: https://svnweb.freebsd.org/changeset/base/328486 Log: fortune(6): Fix gcc80 -Wbool-operation warnings. Hinted by: Dragonfly (git 4d1086765752f0569497d06460d95117c74f33ac) Modified: head/usr.bin/fortune/fortune/fortune.c Modified: head/usr.bin/fortune/fortune/fortune.c ============================================================================== --- head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:24:59 2018 (r328485) +++ head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:43:09 2018 (r328486) @@ -289,35 +289,35 @@ getargs(int argc, char *argv[]) #endif /* DEBUG */ switch(ch) { case 'a': /* any fortune */ - All_forts++; + All_forts = TRUE; break; #ifdef DEBUG case 'D': Debug++; break; #endif /* DEBUG */ - case 'e': - Equal_probs++; /* scatter un-allocted prob equally */ + case 'e': /* scatter un-allocted prob equally */ + Equal_probs = TRUE; break; case 'f': /* find fortune files */ - Find_files++; + Find_files = TRUE; break; case 'l': /* long ones only */ - Long_only++; + Long_only = TRUE; Short_only = FALSE; break; case 'o': /* offensive ones only */ - Offend++; + Offend = TRUE; break; case 's': /* short ones only */ - Short_only++; + Short_only = TRUE; Long_only = FALSE; break; case 'w': /* give time to read */ - Wait++; + Wait = TRUE; break; case 'm': /* dump out the fortunes */ - Match++; + Match = TRUE; pat = optarg; break; case 'i': /* case-insensitive match */ From owner-svn-src-all@freebsd.org Sat Jan 27 18:24:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADE8EED0033; Sat, 27 Jan 2018 18:24:13 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6382773EEB; Sat, 27 Jan 2018 18:24: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E6CC63F8; Sat, 27 Jan 2018 18:24: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 w0RIODcc042565; Sat, 27 Jan 2018 18:24:13 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RIODQc042564; Sat, 27 Jan 2018 18:24:13 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801271824.w0RIODQc042564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 27 Jan 2018 18:24:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328487 - head/bin/pax X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/bin/pax X-SVN-Commit-Revision: 328487 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 18:24:13 -0000 Author: pfg Date: Sat Jan 27 18:24:13 2018 New Revision: 328487 URL: https://svnweb.freebsd.org/changeset/base/328487 Log: pax(1): Honour the restrict in sigaction(). Use a setup_sig() helper and make it fail when either of sigaction fails. While there, do not leak fds for "." + minor cleanup. Obtained from: OpenBSD (through DragonFly git eca362d0f9bd086cc56d6b5bc4f03f09e040b9db) Modified: head/bin/pax/pax.c Modified: head/bin/pax/pax.c ============================================================================== --- head/bin/pax/pax.c Sat Jan 27 17:43:09 2018 (r328486) +++ head/bin/pax/pax.c Sat Jan 27 18:24:13 2018 (r328487) @@ -109,7 +109,7 @@ char *tempbase; /* basename of tempfile to use for mk /* * PAX - Portable Archive Interchange * - * A utility to read, write, and write lists of the members of archive + * A utility to read, write, and write lists of the members of archive * files and copy directory hierarchies. A variety of archive formats * are supported (some are described in POSIX 1003.1 10.1): * @@ -237,7 +237,7 @@ main(int argc, char *argv[]) /* * Keep a reference to cwd, so we can always come back home. */ - cwdfd = open(".", O_RDONLY); + cwdfd = open(".", O_RDONLY | O_CLOEXEC); if (cwdfd < 0) { syswarn(0, errno, "Can't open current working directory."); return(exit_val); @@ -249,7 +249,7 @@ main(int argc, char *argv[]) if ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0') tmpdir = _PATH_TMP; tdlen = strlen(tmpdir); - while(tdlen > 0 && tmpdir[tdlen - 1] == '/') + while (tdlen > 0 && tmpdir[tdlen - 1] == '/') tdlen--; tempfile = malloc(tdlen + 1 + sizeof(_TFILE_BASE)); if (tempfile == NULL) { @@ -271,7 +271,7 @@ main(int argc, char *argv[]) /* * select a primary operation mode */ - switch(act) { + switch (act) { case EXTRACT: extract(); break; @@ -325,6 +325,25 @@ sig_cleanup(int which_sig) } /* + * setup_sig() + * set a signal to be caught, but only if it isn't being ignored already + */ + +static int +setup_sig(int sig, const struct sigaction *n_hand) +{ + struct sigaction o_hand; + + if (sigaction(sig, NULL, &o_hand) < 0) + return (-1); + + if (o_hand.sa_handler == SIG_IGN) + return (0); + + return (sigaction(sig, n_hand, NULL)); +} + +/* * gen_init() * general setup routines. Not all are required, but they really help * when dealing with a medium to large sized archives. @@ -335,7 +354,6 @@ gen_init(void) { struct rlimit reslimit; struct sigaction n_hand; - struct sigaction o_hand; /* * Really needed to handle large archives. We can run out of memory for @@ -389,34 +407,16 @@ gen_init(void) n_hand.sa_flags = 0; n_hand.sa_handler = sig_cleanup; - if ((sigaction(SIGHUP, &n_hand, &o_hand) < 0) && - (o_hand.sa_handler == SIG_IGN) && - (sigaction(SIGHUP, &o_hand, &o_hand) < 0)) + if (setup_sig(SIGHUP, &n_hand) || + setup_sig(SIGTERM, &n_hand) || + setup_sig(SIGINT, &n_hand) || + setup_sig(SIGQUIT, &n_hand) || + setup_sig(SIGXCPU, &n_hand)) goto out; - if ((sigaction(SIGTERM, &n_hand, &o_hand) < 0) && - (o_hand.sa_handler == SIG_IGN) && - (sigaction(SIGTERM, &o_hand, &o_hand) < 0)) - goto out; - - if ((sigaction(SIGINT, &n_hand, &o_hand) < 0) && - (o_hand.sa_handler == SIG_IGN) && - (sigaction(SIGINT, &o_hand, &o_hand) < 0)) - goto out; - - if ((sigaction(SIGQUIT, &n_hand, &o_hand) < 0) && - (o_hand.sa_handler == SIG_IGN) && - (sigaction(SIGQUIT, &o_hand, &o_hand) < 0)) - goto out; - - if ((sigaction(SIGXCPU, &n_hand, &o_hand) < 0) && - (o_hand.sa_handler == SIG_IGN) && - (sigaction(SIGXCPU, &o_hand, &o_hand) < 0)) - goto out; - n_hand.sa_handler = SIG_IGN; - if ((sigaction(SIGPIPE, &n_hand, &o_hand) < 0) || - (sigaction(SIGXFSZ, &n_hand, &o_hand) < 0)) + if ((sigaction(SIGPIPE, &n_hand, NULL) < 0) || + (sigaction(SIGXFSZ, &n_hand, NULL) < 0)) goto out; return(0); From owner-svn-src-all@freebsd.org Sat Jan 27 19:23:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28683ED2DB1; Sat, 27 Jan 2018 19:23:43 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B823976150; Sat, 27 Jan 2018 19:23:42 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2DE66DC0; Sat, 27 Jan 2018 19:23:42 +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 w0RJNg1l072631; Sat, 27 Jan 2018 19:23:42 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RJNgDR072628; Sat, 27 Jan 2018 19:23:42 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201801271923.w0RJNgDR072628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 27 Jan 2018 19:23:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328488 - in head: contrib/traceroute usr.sbin/traceroute6 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head: contrib/traceroute usr.sbin/traceroute6 X-SVN-Commit-Revision: 328488 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 19:23:43 -0000 Author: tuexen Date: Sat Jan 27 19:23:42 2018 New Revision: 328488 URL: https://svnweb.freebsd.org/changeset/base/328488 Log: When using SCTP for sending probe packets, use INIT chunks for payloads larger than or equal to 32 bytes. For smaller probe packets, keep using SHUTDOWN-ACK chunks, possibly bundled with a PAD chunk. Packets with INIT chunks more likely pass through firewalls. Therefore, use them when possible. MFC after: 1 week Modified: head/contrib/traceroute/traceroute.c head/usr.sbin/traceroute6/traceroute6.8 head/usr.sbin/traceroute6/traceroute6.c Modified: head/contrib/traceroute/traceroute.c ============================================================================== --- head/contrib/traceroute/traceroute.c Sat Jan 27 18:24:13 2018 (r328487) +++ head/contrib/traceroute/traceroute.c Sat Jan 27 19:23:42 2018 (r328488) @@ -221,6 +221,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -1570,26 +1571,71 @@ sctp_prep(struct outdata *outdata) { struct sctphdr *const sctp = (struct sctphdr *) outp; struct sctp_chunkhdr *chk; + struct sctp_init_chunk *init; + struct sctp_paramhdr *param; sctp->src_port = htons(ident); sctp->dest_port = htons(port + (fixedPort ? 0 : outdata->seq)); - sctp->v_tag = (sctp->src_port << 16) | sctp->dest_port; + if (protlen >= (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk))) { + sctp->v_tag = 0; + } else { + sctp->v_tag = (sctp->src_port << 16) | sctp->dest_port; + } sctp->checksum = htonl(0); - if (protlen >= - (int)(sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))) { - chk = (struct sctp_chunkhdr *)(sctp + 1); - chk->chunk_type = SCTP_SHUTDOWN_ACK; - chk->chunk_flags = 0; - chk->chunk_length = htons(4); + if (protlen >= (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk))) { + /* + * Send a packet containing an INIT chunk. This works + * better in case of firewalls on the path, but + * results in a probe packet containing at least + * 32 bytes of payload. For shorter payloads, use + * SHUTDOWN-ACK chunks. + */ + init = (struct sctp_init_chunk *)(sctp + 1); + init->ch.chunk_type = SCTP_INITIATION; + init->ch.chunk_flags = 0; + init->ch.chunk_length = htons((u_int16_t)(protlen - + sizeof(struct sctphdr))); + init->init.initiate_tag = (sctp->src_port << 16) | + sctp->dest_port; + init->init.a_rwnd = htonl(1500); + init->init.num_outbound_streams = htons(1); + init->init.num_inbound_streams = htons(1); + init->init.initial_tsn = htonl(0); + if (protlen >= (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk) + + sizeof(struct sctp_paramhdr))) { + param = (struct sctp_paramhdr *)(init + 1); + param->param_type = htons(SCTP_PAD); + param->param_length = + htons((u_int16_t)(protlen - + sizeof(struct sctphdr) - + sizeof(struct sctp_init_chunk))); + } + } else { + /* + * Send a packet containing a SHUTDOWN-ACK chunk, + * possibly followed by a PAD chunk. + */ + if (protlen >= + (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr))) { + chk = (struct sctp_chunkhdr *)(sctp + 1); + chk->chunk_type = SCTP_SHUTDOWN_ACK; + chk->chunk_flags = 0; + chk->chunk_length = htons(4); + } + if (protlen >= + (int)(sizeof(struct sctphdr) + + 2 * sizeof(struct sctp_chunkhdr))) { + chk = chk + 1; + chk->chunk_type = SCTP_PAD_CHUNK; + chk->chunk_flags = 0; + chk->chunk_length = htons(protlen - + (sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))); + } } - if (protlen >= - (int)(sizeof(struct sctphdr) + 2 * sizeof(struct sctp_chunkhdr))) { - chk = chk + 1; - chk->chunk_type = SCTP_PAD_CHUNK; - chk->chunk_flags = 0; - chk->chunk_length = htons(protlen - - (sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))); - } if (doipcksum) { sctp->checksum = sctp_crc32c(sctp, protlen); } @@ -1600,10 +1646,20 @@ sctp_check(const u_char *data, int seq) { struct sctphdr *const sctp = (struct sctphdr *) data; - return (ntohs(sctp->src_port) == ident - && ntohs(sctp->dest_port) == port + (fixedPort ? 0 : seq) - && sctp->v_tag == - (u_int32_t)((sctp->src_port << 16) | sctp->dest_port)); + if (ntohs(sctp->src_port) != ident || + ntohs(sctp->dest_port) != port + (fixedPort ? 0 : seq)) + return (0); + if (protlen < (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk))) { + return (sctp->v_tag == + (u_int32_t)((sctp->src_port << 16) | sctp->dest_port)); + } else { + /* + * Don't verify the initiate_tag, since it is not available, + * most of the time. + */ + return (sctp->v_tag == 0); + } } void Modified: head/usr.sbin/traceroute6/traceroute6.8 ============================================================================== --- head/usr.sbin/traceroute6/traceroute6.8 Sat Jan 27 18:24:13 2018 (r328487) +++ head/usr.sbin/traceroute6/traceroute6.8 Sat Jan 27 19:23:42 2018 (r328488) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 30, 2017 +.Dd January 27, 2018 .Dt TRACEROUTE6 8 .Os .\" @@ -140,6 +140,11 @@ that has no route through it specifies the source IPv6 address to be used. .It Fl S Use SCTP packets for the probes. +The size of probe packets must be a multiple of 4. +If +.Ar datalen +is up to 28, probe packets consist of a SHUTDOWN-ACK chunk possibly bundled +with a PAD chunk. For larger probe packets, an INIT chunk is used. .It Fl T Use TCP segments for the probes. .It Fl U Modified: head/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- head/usr.sbin/traceroute6/traceroute6.c Sat Jan 27 18:24:13 2018 (r328487) +++ head/usr.sbin/traceroute6/traceroute6.c Sat Jan 27 19:23:42 2018 (r328488) @@ -274,6 +274,7 @@ static const char rcsid[] = #include #include #include +#include #include #include @@ -678,6 +679,11 @@ main(int argc, char *argv[]) } if (useproto == IPPROTO_UDP) datalen -= sizeof(struct udphdr); + if ((useproto == IPPROTO_SCTP) && (datalen & 3)) { + fprintf(stderr, + "traceroute6: packet size must be a multiple of 4.\n"); + exit(1); + } outpacket = malloc(datalen); if (!outpacket) { perror("malloc"); @@ -1051,6 +1057,8 @@ send_probe(int seq, u_long hops) struct icmp6_hdr *icp; struct sctphdr *sctp; struct sctp_chunkhdr *chk; + struct sctp_init_chunk *init; + struct sctp_paramhdr *param; struct tcphdr *tcp; int i; @@ -1082,23 +1090,64 @@ send_probe(int seq, u_long hops) sctp->src_port = htons(ident); sctp->dest_port = htons(port + seq); - sctp->v_tag = (sctp->src_port << 16) | sctp->dest_port; - sctp->checksum = htonl(0); if (datalen >= (u_long)(sizeof(struct sctphdr) + - sizeof(struct sctp_chunkhdr))) { - chk = (struct sctp_chunkhdr *)(sctp + 1); - chk->chunk_type = SCTP_SHUTDOWN_ACK; - chk->chunk_flags = 0; - chk->chunk_length = htons(4); + sizeof(struct sctp_init_chunk))) { + sctp->v_tag = 0; + } else { + sctp->v_tag = (sctp->src_port << 16) | sctp->dest_port; } + sctp->checksum = htonl(0); if (datalen >= (u_long)(sizeof(struct sctphdr) + - 2 * sizeof(struct sctp_chunkhdr))) { - chk = chk + 1; - chk->chunk_type = SCTP_PAD_CHUNK; - chk->chunk_flags = 0; - chk->chunk_length = htons((u_int16_t)(datalen - - sizeof(struct sctphdr) - - sizeof(struct sctp_chunkhdr))); + sizeof(struct sctp_init_chunk))) { + /* + * Send a packet containing an INIT chunk. This works + * better in case of firewalls on the path, but + * results in a probe packet containing at least + * 32 bytes of payload. For shorter payloads, use + * SHUTDOWN-ACK chunks. + */ + init = (struct sctp_init_chunk *)(sctp + 1); + init->ch.chunk_type = SCTP_INITIATION; + init->ch.chunk_flags = 0; + init->ch.chunk_length = htons((u_int16_t)(datalen - + sizeof(struct sctphdr))); + init->init.initiate_tag = (sctp->src_port << 16) | + sctp->dest_port; + init->init.a_rwnd = htonl(1500); + init->init.num_outbound_streams = htons(1); + init->init.num_inbound_streams = htons(1); + init->init.initial_tsn = htonl(0); + if (datalen >= (u_long)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk) + + sizeof(struct sctp_paramhdr))) { + param = (struct sctp_paramhdr *)(init + 1); + param->param_type = htons(SCTP_PAD); + param->param_length = + htons((u_int16_t)(datalen - + sizeof(struct sctphdr) - + sizeof(struct sctp_init_chunk))); + } + } else { + /* + * Send a packet containing a SHUTDOWN-ACK chunk, + * possibly followed by a PAD chunk. + */ + if (datalen >= (u_long)(sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr))) { + chk = (struct sctp_chunkhdr *)(sctp + 1); + chk->chunk_type = SCTP_SHUTDOWN_ACK; + chk->chunk_flags = 0; + chk->chunk_length = htons(4); + } + if (datalen >= (u_long)(sizeof(struct sctphdr) + + 2 * sizeof(struct sctp_chunkhdr))) { + chk = chk + 1; + chk->chunk_type = SCTP_PAD_CHUNK; + chk->chunk_flags = 0; + chk->chunk_length = htons((u_int16_t)(datalen - + sizeof(struct sctphdr) - + sizeof(struct sctp_chunkhdr))); + } } sctp->checksum = sctp_crc32c(outpacket, datalen); break; @@ -1291,6 +1340,7 @@ packet_ok(struct msghdr *mhdr, int cc, int seq) || type == ICMP6_DST_UNREACH) { struct ip6_hdr *hip; struct icmp6_hdr *icmp; + struct sctp_init_chunk *init; struct sctphdr *sctp; struct tcphdr *tcp; struct udphdr *udp; @@ -1319,12 +1369,34 @@ packet_ok(struct msghdr *mhdr, int cc, int seq) break; case IPPROTO_SCTP: sctp = (struct sctphdr *)up; - if (sctp->src_port == htons(ident) && - sctp->dest_port == htons(port + seq) && - sctp->v_tag == - (u_int32_t)((sctp->src_port << 16) | sctp->dest_port)) - return (type == ICMP6_TIME_EXCEEDED ? - -1 : code + 1); + if (sctp->src_port != htons(ident) || + sctp->dest_port != htons(port + seq)) { + break; + } + if (datalen >= (u_long)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk))) { + if (sctp->v_tag != 0) { + break; + } + init = (struct sctp_init_chunk *)(sctp + 1); + /* Check the initiate tag, if available. */ + if ((char *)&init->init.a_rwnd > buf + cc) { + return (type == ICMP6_TIME_EXCEEDED ? + -1 : code + 1); + } + if (init->init.initiate_tag == (u_int32_t) + ((sctp->src_port << 16) | sctp->dest_port)) { + return (type == ICMP6_TIME_EXCEEDED ? + -1 : code + 1); + } + } else { + if (sctp->v_tag == + (u_int32_t)((sctp->src_port << 16) | + sctp->dest_port)) { + return (type == ICMP6_TIME_EXCEEDED ? + -1 : code + 1); + } + } break; case IPPROTO_TCP: tcp = (struct tcphdr *)up; From owner-svn-src-all@freebsd.org Sat Jan 27 19:56:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 086EFEB64D6; Sat, 27 Jan 2018 19:56:23 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f47.google.com (mail-it0-f47.google.com [209.85.214.47]) (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 82E577733A; Sat, 27 Jan 2018 19:56:22 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f47.google.com with SMTP id u62so4090041ita.2; Sat, 27 Jan 2018 11:56:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=jxbfkdCdD2cCD/KPb5wZhDPvVw/Wr3kwMAhAMS/Sf+o=; b=j7++6BpGj62KI+9Ddp1BrIX75BAdnTV5PrSkMVzb5bI7cKKd+6ELe+23XT60u/IcvA eBu7NUCGO7eNRQMxIgeOW7ev7hEAz3kHDduMKWckNjOV4ljxslK85fxxC4rbKkbR9OGF AB4XlPCxgxoLBIvyD+fnzHxypeETCTxPh9VkgZ7It0JD0Rdxh8FuqGhGYzoh/DBf1gwr ODx7/tZuw0ZU/wY5gTdShsZiDpjCe8vLnEMatjahdIPsKkf1Lf1a/Jn0x4PIpsrTj4IZ 7H4yJ13maIclp26ZltdMecJvb1DCjdgkQn3kmgkyxo6owHwDXnQtFn1EJuGVjnhpXRX2 W57g== X-Gm-Message-State: AKwxytfBQN7UKc3DaUkb4Ptp1obsk/RMUgkEPMMHQB3bwIQ5HK1CwHjp IhrxRboKUX27NQOvfmvAH/3OXGZh X-Google-Smtp-Source: AH8x225C2CWMakGlMp1rntfdLgsF7S0bGZZvNcdwk6QDlh3gnMZ6TMgRFfAw96BDlkoCP6djCd6Teg== X-Received: by 10.36.93.20 with SMTP id w20mr21668896ita.101.1517082975821; Sat, 27 Jan 2018 11:56:15 -0800 (PST) Received: from mail-io0-f180.google.com (mail-io0-f180.google.com. [209.85.223.180]) by smtp.gmail.com with ESMTPSA id r203sm2076855itb.38.2018.01.27.11.56.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Jan 2018 11:56:15 -0800 (PST) Received: by mail-io0-f180.google.com with SMTP id 25so3737553ioj.9; Sat, 27 Jan 2018 11:56:14 -0800 (PST) X-Received: by 10.107.174.196 with SMTP id n65mr21189279ioo.256.1517082974612; Sat, 27 Jan 2018 11:56:14 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.95.152 with HTTP; Sat, 27 Jan 2018 11:56:14 -0800 (PST) In-Reply-To: <201801271743.w0RHh9io022619@repo.freebsd.org> References: <201801271743.w0RHh9io022619@repo.freebsd.org> From: Conrad Meyer Date: Sat, 27 Jan 2018 11:56:14 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328486 - head/usr.bin/fortune/fortune To: "Pedro F. Giffuni" 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.25 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: Sat, 27 Jan 2018 19:56:23 -0000 We can use 'true' and 'false' now. (style(9) also suggests using the C99 names instead of TRUE/FALSE.) On Sat, Jan 27, 2018 at 9:43 AM, Pedro F. Giffuni wrote: > Author: pfg > Date: Sat Jan 27 17:43:09 2018 > New Revision: 328486 > URL: https://svnweb.freebsd.org/changeset/base/328486 > > Log: > fortune(6): Fix gcc80 -Wbool-operation warnings. > > Hinted by: Dragonfly (git 4d1086765752f0569497d06460d95117c74f33ac) > > Modified: > head/usr.bin/fortune/fortune/fortune.c > > Modified: head/usr.bin/fortune/fortune/fortune.c > ============================================================================== > --- head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:24:59 2018 (r328485) > +++ head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:43:09 2018 (r328486) > @@ -289,35 +289,35 @@ getargs(int argc, char *argv[]) > #endif /* DEBUG */ > switch(ch) { > case 'a': /* any fortune */ > - All_forts++; > + All_forts = TRUE; > break; > #ifdef DEBUG > case 'D': > Debug++; > break; > #endif /* DEBUG */ > - case 'e': > - Equal_probs++; /* scatter un-allocted prob equally */ > + case 'e': /* scatter un-allocted prob equally */ > + Equal_probs = TRUE; > break; > case 'f': /* find fortune files */ > - Find_files++; > + Find_files = TRUE; > break; > case 'l': /* long ones only */ > - Long_only++; > + Long_only = TRUE; > Short_only = FALSE; > break; > case 'o': /* offensive ones only */ > - Offend++; > + Offend = TRUE; > break; > case 's': /* short ones only */ > - Short_only++; > + Short_only = TRUE; > Long_only = FALSE; > break; > case 'w': /* give time to read */ > - Wait++; > + Wait = TRUE; > break; > case 'm': /* dump out the fortunes */ > - Match++; > + Match = TRUE; > pat = optarg; > break; > case 'i': /* case-insensitive match */ > From owner-svn-src-all@freebsd.org Sat Jan 27 20:08:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B7E0EB6E93; Sat, 27 Jan 2018 20:08:11 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id C753D779C9; Sat, 27 Jan 2018 20:08:10 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 57135f44; Sat, 27 Jan 2018 21:08:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=LBYW7FDTczNmR32XccB7/7H//00=; b=YdeG3lH4cDYVQWIfFg1UrMViwRoe YlcomAsx9/TRdUl8beaA3Fd/HXBJZr4CXjXZTN9lJx6S4HhUnq34cPk6QeikYLto HiXBUb64ZrIoTN95kRvhU/N3pwqzVmtuS8NNCr7ZKgXi4JLiGE/Y8bujnCKnB+qB s11TR9abv7zIUwE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=qN4HeGZFwTfn0Ngrf+cyF+9YKJJSVS/BuL4HzlZLCVH/wN8MMXJITJzi 78pdG5imzNJsQuoYR8ehQjA8SAhosBrw3VxjPrVWU6SmgUyA/kObbYFDzkh78JWn gexSBc3SvxuWD0Ql6ZGeF2TYmjLRdQQ/dk/tFFsAdK0MPAS78Bo= Received: from arcadia.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id aafb9562 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Sat, 27 Jan 2018 21:08:03 +0100 (CET) Date: Sat, 27 Jan 2018 21:08:01 +0100 From: Emmanuel Vadot To: "Poul-Henning Kamp" Cc: Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-Id: <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> In-Reply-To: <93949.1516733748@critter.freebsd.dk> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 20:08:11 -0000 So, almost a week after this commit, let's recap. - phk@ commit an hack to allow the pwm driver on rpi to always attach even if it's not enabled in the dts. - I say to him that it's a really bad move and that he should use dtb overlays (which thanks to kevans@ are in a really better state now). - His answer is that as long as you don't set the pwm sysctls you will be fine (which is true) and that he want to be able to load dtb overlays without rebooting (or a way to modify the existing dtb loaded in the kernel). - I reply that changing the dtb should go with overlays and that nobody is working on loading overlays at runtime. - His reply starts with "That doesn't make *any* UX sense." - The "problem" is we (FreeBSD) choose to followed the standard that is Flattened Device Tree and stick to it for arm (at least) platform. - phk@ says that if a user kldload the pwm driver on a rpi the pwm subsystem should be in a usable state. And doesn't want to talk anymore ("Over&Out). - jhb@ and imp@ talk about ways to improve the fdt subsystem. - ian@ point to phk@ that the 'status' line in the dts control more than a device but also pinmuxing (switching pins on the SoC to the correct function) and that is it done at startup and not at the driver attach. And that the rpi platform needs some love as it doesn't have a proper pinmux driver. - phk@ points out that there is no doc about doing a pinmux driver (which is true, unless you consider code as documentation or even help/advice from other arm developpers). But. - We still have this driver that doesn't follow the standard we said we want to adhere to. - Nobody except me explicitly request phk@ to revert his commit (which he didn't do). - One day after everything was back to normal and everybody forgot about this. So. - We have a commiter that commited something for his own need: he wanted to use the pwm on his rpi, coded a driver (this part is good) but feel that the standard we were using was crap and commited his work without talking with arm developper on what the proper way to do it was. - Even after some developpers point out that it wasn't the way to go he didn't revert his commit. And even he didn't say that he won't, his mail suggest that he will not. - Now we have a crappy driver in the tree. What's next ? Cheers, -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Sat Jan 27 20:13:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F9C6EB7557; Sat, 27 Jan 2018 20:13:37 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 019A278025; Sat, 27 Jan 2018 20:13:37 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEEBA761E; Sat, 27 Jan 2018 20:13:36 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RKDaW4098201; Sat, 27 Jan 2018 20:13:36 GMT (envelope-from jah@FreeBSD.org) Received: (from jah@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RKDaMU098200; Sat, 27 Jan 2018 20:13:36 GMT (envelope-from jah@FreeBSD.org) Message-Id: <201801272013.w0RKDaMU098200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jah set sender to jah@FreeBSD.org using -f From: "Jason A. Harmening" Date: Sat, 27 Jan 2018 20:13:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328489 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: jah X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 328489 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 20:13:37 -0000 Author: jah Date: Sat Jan 27 20:13:36 2018 New Revision: 328489 URL: https://svnweb.freebsd.org/changeset/base/328489 Log: Remove system makefile path directives from env passed to PORTS_MODULES step Previously, MAKESYSPATH as well as '-m' directives in MAKEFLAGS would cause any port rebuilt during the PORTS_MODULES stage to consume system makefiles from $(SRCROOT)/share/mk instead of those installed under /usr/share/mk. For kernel modules that need to build against an updated src tree this makes sense; less so for or any userspace library or utility the port may also happen to install. Before 11.0, this probably didn't matter much in practice. But the addition of src.libnames.mk under $(SRCROOT)/share/mk in 11.0 breaks any consumer of bsd.prog.mk and DPADD/LDADD during PORTS_MODULES. Address the build breakage by removing MAKESYSPATH and any occurrence of '-m' from MAKEFLAGS in the environment created for the port build. Instead set SYSDIR so that any kmod built by the port will still consume conf/kmod.mk from the updated src tree, assuming it uses Reviewed by: bdrewery MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D13053 Modified: head/sys/conf/kern.post.mk Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Sat Jan 27 19:23:42 2018 (r328488) +++ head/sys/conf/kern.post.mk Sat Jan 27 20:13:36 2018 (r328489) @@ -69,6 +69,9 @@ PORTSMODULESENV=\ -u CC \ -u CXX \ -u CPP \ + -u MAKESYSPATH \ + MAKEFLAGS="${MAKEFLAGS:M*:tW:S/^-m /-m_/g:S/ -m / -m_/g:tw:N-m_*}" \ + SYSDIR=${SYSDIR} \ PATH=${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \ SRC_BASE=${SRC_BASE} \ OSVERSION=${OSRELDATE} \ From owner-svn-src-all@freebsd.org Sat Jan 27 20:14:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 713C5EB75E6; Sat, 27 Jan 2018 20:14:01 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wr0-x236.google.com (mail-wr0-x236.google.com [IPv6:2a00:1450:400c:c0c::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 DCB1578162; Sat, 27 Jan 2018 20:14:00 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wr0-x236.google.com with SMTP id w50so3297428wrc.2; Sat, 27 Jan 2018 12:14:00 -0800 (PST) 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=+36yQ3maWABYpwAXRoXK2N2seovdDri7hcPiVDvn9Ao=; b=NJaZ1vFSKTDifmjXRvTg7/A+VK2zK3oBnS2+JEZUhYIbgO+gk3gvm0kqA/Rg+rD8fs dPcpB79J2v0yG7/PEW6ialYa4u6L88Q+jhBkBAJwTpPX1LX/tl+HUajZl0j5cA9oChJD XySxRhNEPZHr9xQjz5fn/SqcA72QetU9JX5rXcVyYjX4TvkbEukGO6ep1aasrlwkf2Sz 5/0jDMSvaiFZL8OoFwFSBcTbY2+gAXT7uk4gLmglQm1kQ7bpptuuA8jUC9RsaF2xhAI+ iGHx+Kspqmv3wK+2VaDKMg+XKYa2NgEunBv5uFgwyWaqyLhWOj2dMk7jbQ/ziN6nohyZ nCFg== 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=+36yQ3maWABYpwAXRoXK2N2seovdDri7hcPiVDvn9Ao=; b=IQdiZYyLjXF9UYOD2EwXA+bVBGqbJfbZxmVaWWcQKFdSPZ2fvPAwoBEAPgcddjB6ky fQQ8TKLeZnJA3sGypiaVS+qAW1+9nnepRog/lcCbmh89k/QwIaOxHUtdTSYLZR2MJjqd /+yYki8I2BuiG2IY+U2y59ItfydSnJPRcDe82YdD0A2VfvPySWsT9IPl/fSXbCj6y01K Z0Xnu74Vv5Pw7auMQwlrx+4O0eYx44ciDOFcPQPj8vC9W/hJ8XybCDbjU8lMe0+Wz2Ax htv8XXA26eBX/4Wedvt8LOu0MUY5y6TG6vvDuexB4npNz4OBDT9oaVbGB0jP40OzndWL cgRw== X-Gm-Message-State: AKwxytevzMgapi7udp0GfXFAMt3uF2yTzdN/BMNjLC9xgV6LE18k2w07 Or9v451zutvBblP43LcCy8EpA9k7V05+Jz6jY98= X-Google-Smtp-Source: AH8x2242f3WsebyWGnxyP8u+Yj2U7ZL7kZXNcSJPRZgjPGEiV25xuPU+AoJA99J6HRzPyxsT7I6hVTq3ZKJmFrRMXjw= X-Received: by 10.223.186.129 with SMTP id p1mr15013596wrg.183.1517084038956; Sat, 27 Jan 2018 12:13:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.181.3 with HTTP; Sat, 27 Jan 2018 12:13:57 -0800 (PST) In-Reply-To: <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> From: Adrian Chadd Date: Sat, 27 Jan 2018 12:13:57 -0800 Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: Emmanuel Vadot Cc: Poul-Henning Kamp , Warner Losh , John Baldwin , Ravi Pokala , 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.25 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: Sat, 27 Jan 2018 20:14:01 -0000 Hi, Find the middle ground. Don't dissuade the developer too much. Here's an example: Make the driver follow DTS, allow a tunable/kenv check for it to override whether it needs to be in the DTS or not (the "keep phk happy for now" compromise) and have it default to obeying the device tree. That way phk is kept happy and the defaults are the same as normal-ish ARM /and/ you have a springboard to experiment with extending FDT overlays at runtime for people who wish to do so. (I personally hate having to edit the dts/recompile/reboot for every test hardware change; it makes breadboarding things up kinda hilariously annoying.) -adrian From owner-svn-src-all@freebsd.org Sat Jan 27 20:48:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61289EC15DC; Sat, 27 Jan 2018 20:48:25 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C7208791B4; Sat, 27 Jan 2018 20:48:24 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from thor.intern.walstatt.dynvpn.de ([92.229.130.206]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LjLwB-1fC7zd3B1z-00dYXP; Sat, 27 Jan 2018 21:48:22 +0100 Date: Sat, 27 Jan 2018 21:47:48 +0100 From: "O. Hartmann" To: "Jason A. Harmening" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328489 - head/sys/conf Message-ID: <20180127214755.3c59661e@thor.intern.walstatt.dynvpn.de> In-Reply-To: <201801272013.w0RKDaMU098200@repo.freebsd.org> References: <201801272013.w0RKDaMU098200@repo.freebsd.org> Organization: WALSTATT User-Agent: OutScare 3.1415926 X-Operating-System: ImNotAnOperatingSystem 3.141592527 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/sA+P+_lPY2npag1RR.K74Kv"; protocol="application/pgp-signature" X-Provags-ID: V03:K0:F8XNVbeGZXo1qXFbuy1EUkQjr1AhzVyK0A0GAR6QptYR1LZMmAN V/mTAQ8s8XMnZbhfajSNx245P9EPFn5O1ad5TAb44ZSELxGCWDlUatQkDzM+TjY0kRFFHTm 36lIZahRc8hauOZlIce1TBLdVfINxN7DNy5eDc1F5ekyxI129XZlXQF4MuBHiF59dGyrEK8 rj4NwsDWhr69VO7Q2Nykw== X-UI-Out-Filterresults: notjunk:1;V01:K0:y4Cl8yevqGE=:Znx9HldMlrw5XqIsuWIzs2 VSO6kX74QKKPxEhGIWROUGIE4DYzgr8s4dYkRODDIH0JVOwvR5gTSyqBv59/CAxqzGzriz8vl U9PaZEt/kQWXXfd+bbLwxYcmMJSMnH/CZ1XC/vHk5BatlIKbKi6qSKMqSKKbYUhR/xvsDwfO3 Q1sd/pojbmXl0PVhC0P9pkKpmWjLsAspYsufdFYB/U3eU2xt8p/pUc9jdwFzIt336mSVvkXPy jNg80abX+EEG3SHf28NBuWXcWTSOZ3esDiLy2fLj/J0TaW9DBTN30u3GGdrnyX7qi+KBK7i3k 13pcYFSqP3Hdkixxrmh2WknAlhpHOFD3tmRsfBp2JxP1mmqyx4NbLIob6zhmilXsXbayyeZhp FyN92Ny9NQtTmwM+tbYmai1rpkr563WWjYVcIm5HHrG1akDDdyjpIbykJhPPzsQDgBwJXY+un NkOEfqdWrewAKeyFuaoA5AyQ9EFnvKPkt8yOn/EqwhCQ1Gp/v1bxAXXMIGdiV5ra0GNQHO1Ax 56Nb56CilnhFabn0pO/sU9NueDaEI2ZjjVzdnT+XTYyutpe/t88KG+bDcfHsRqu9aaYEANPeS tWMXeaiJUEjJEGFXV8Apb2eEua/345iX4y46oo6LqpzQMWJrw0u64LtWussnEWKhWbaCq8j+s UWax1TsmVIUIj2C6JFkPKhLPnG8frWxptFlpznfVZh1nBjUU+N3kC+HECUH/FYNXPEhfxddYp yoBTLCoD9jOa1Bv3a8k6AEBHtSy3GopNipCoThyLXsJRXaRQ5H7/zok8ypMFTp5B0dRR9wICk XBBYtKIZEga/Wq6+HZ+gxLuvki97w== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 20:48:25 -0000 --Sig_/sA+P+_lPY2npag1RR.K74Kv Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am Sat, 27 Jan 2018 20:13:36 +0000 (UTC) "Jason A. Harmening" schrieb: > Author: jah > Date: Sat Jan 27 20:13:36 2018 > New Revision: 328489 > URL: https://svnweb.freebsd.org/changeset/base/328489 >=20 > Log: > Remove system makefile path directives from env passed to PORTS_MODULES= step > =20 > Previously, MAKESYSPATH as well as '-m' directives in MAKEFLAGS would c= ause > any port rebuilt during the PORTS_MODULES stage to consume system makef= iles > from $(SRCROOT)/share/mk instead of those installed under /usr/share/mk. > For kernel modules that need to build against an updated src tree this > makes sense; less so for or any userspace library or uti= lity > the port may also happen to install. > =20 > Before 11.0, this probably didn't matter much in practice. But the add= ition > of src.libnames.mk under $(SRCROOT)/share/mk in 11.0 breaks any consume= r of > bsd.prog.mk and DPADD/LDADD during PORTS_MODULES. > =20 > Address the build breakage by removing MAKESYSPATH and any occurrence of > '-m' from MAKEFLAGS in the environment created for the port build. > Instead set SYSDIR so that any kmod built by the port will still consume > conf/kmod.mk from the updated src tree, assuming it uses > =20 > Reviewed by: bdrewery > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D13053 >=20 > Modified: > head/sys/conf/kern.post.mk >=20 > Modified: head/sys/conf/kern.post.mk > =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/sys/conf/kern.post.mk Sat Jan 27 19:23:42 2018 (r328488) > +++ head/sys/conf/kern.post.mk Sat Jan 27 20:13:36 2018 (r328489) > @@ -69,6 +69,9 @@ PORTSMODULESENV=3D\ > -u CC \ > -u CXX \ > -u CPP \ > + -u MAKESYSPATH \ > + MAKEFLAGS=3D"${MAKEFLAGS:M*:tW:S/^-m /-m_/g:S/ -m / -m_/g:tw:N-m_*}" \ > + SYSDIR=3D${SYSDIR} \ > PATH=3D${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \ > SRC_BASE=3D${SRC_BASE} \ > OSVERSION=3D${OSRELDATE} \ > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" This happens now if PORTS_MODULE=3Dx11/nvidia-driver is defined in /etc/src= .conf: [...] --- kernel-install --- mkdir -p /boot/kernel install -p -m 555 -o root -g wheel kernel /boot/kernel/ --- ports-install --- Variable OBJTOP is recursive. make[8]: stopped in /usr/obj/usr/src/amd64.amd64/sys/FY/usr/ports/x11/nvidia-driver/work/NVI= DIA-FreeBSD-x86_64-387.34/src/nvidia *** Error code 2 Stop. make[7]: stopped in /usr/obj/usr/src/amd64.amd64/sys/THOR/usr/ports/x11/nvidia-driver/work/N= VIDIA-FreeBSD-x86_64-387.34/src *** Error code 1 --=20 O. Hartmann Ich widerspreche der Nutzung oder =C3=9Cbermittlung meiner Daten f=C3=BCr Werbezwecke oder f=C3=BCr die Markt- oder Meinungsforschung (=C2=A7 28 Abs.= 4 BDSG). --Sig_/sA+P+_lPY2npag1RR.K74Kv Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iLUEARMKAB0WIQQZVZMzAtwC2T/86TrS528fyFhYlAUCWmzlkAAKCRDS528fyFhY lHERAgCnZqrBzG2NQwN6yYC6zhPafKltGMg/n0A2CBuXOMcxE7UHUG1Mx5bw09WD P7iGob0X/GJah3VnKa31NgqEKebDAf4oSxgCC6FgymSDlqREDKxxuvx/HZbXoWhX x8GpBN53mLreslFdXqUriBQ1ZePYTN8IkHMSc1UkWeITCahnhcon =47Zy -----END PGP SIGNATURE----- --Sig_/sA+P+_lPY2npag1RR.K74Kv-- From owner-svn-src-all@freebsd.org Sat Jan 27 20:48:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6353AEC165E; Sat, 27 Jan 2018 20:48:45 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id A710E792CD; Sat, 27 Jan 2018 20:48:44 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 18b70aef; Sat, 27 Jan 2018 21:48:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=UKOWarcINVngJ2j2j9/PfzUQexI=; b=qGiVWbN6rHzH8cpouWCYYTaBcRPU FHvQ4vhwTT1aJAeHDq8k8j14ENpntkfr3lv95GnqSpmrcM2sPAQooOFs0E7PIUBc 0Ows6Cxy1NpLCD6QVwtNM2HebQolm/z2ZiXmzNEBaX1B0bdfwNKRDWN9szBlLwRX m1CXycaqnS82PR4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=NyNkajQD1Kl4LsaWe5qtb82wpTmhPALwLy+bxdLWdQqz0QuxVvdzWpPx BzDJMdaxlWqXP2oDUCbMvtR4HiXT+HmQG+xapYWV/OKKPrK5D9oiLRLIchqkO+pS b/ZZKlLv4zK5MSj4voqoYOElmci2apA9jhilwN+RGFxEixNpWC4= Received: from arcadia.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 394df92a TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Sat, 27 Jan 2018 21:48:41 +0100 (CET) Date: Sat, 27 Jan 2018 21:48:40 +0100 From: Emmanuel Vadot To: Adrian Chadd Cc: Poul-Henning Kamp , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-Id: <20180127214840.dc033d582696ff7b51f6d7e6@bidouilliste.com> In-Reply-To: References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 20:48:45 -0000 On Sat, 27 Jan 2018 12:13:57 -0800 Adrian Chadd wrote: > Hi, > > Find the middle ground. Don't dissuade the developer too much. This is what happened two years ago when I started hacking on the allwinner SoCs : - I asked what should be done for bringing a new board - andrew@ told me that we first need to switch to upstream dts and update drivers. - Guess what, I did that. > Here's an example: > > Make the driver follow DTS, allow a tunable/kenv check for it to > override whether it needs to be in the DTS or not (the "keep phk happy > for now" compromise) and have it default to obeying the device tree. > > That way phk is kept happy and the defaults are the same as normal-ish > ARM /and/ you have a springboard to experiment with extending FDT > overlays at runtime for people who wish to do so. I don't care about keeping phk@ (or any other developer) happy, we have a standard, let's stick to it. > (I personally hate having to edit the dts/recompile/reboot for every > test hardware change; it makes breadboarding things up kinda > hilariously annoying.) Use overlays then. And if you don't want to reboot provide patch for loading overlays at runtime. > -adrian -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Sat Jan 27 21:12:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9AF8CEC2A1C; Sat, 27 Jan 2018 21:12:37 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (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 2FB3D7A016; Sat, 27 Jan 2018 21:12:36 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from localhost ([127.0.0.1] helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89 (FreeBSD)) (envelope-from ) id 1efXly-0009hZ-Av; Sat, 27 Jan 2018 13:12:26 -0800 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id w0RLCNpW037295; Sat, 27 Jan 2018 13:12:23 -0800 (PST) (envelope-from gonzo@bluezbox.com) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@bluezbox.com using -f Date: Sat, 27 Jan 2018 13:12:22 -0800 From: Oleksandr Tymoshenko To: Adrian Chadd Cc: Emmanuel Vadot , Poul-Henning Kamp , Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules Message-ID: <20180127211222.GA36907@bluezbox.com> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD/11.1-RELEASE-p4 (amd64) User-Agent: Mutt/1.9.1 (2017-09-22) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Adrian Chadd (adrian.chadd@gmail.com) wrote: > Hi, > > Find the middle ground. Don't dissuade the developer too much. > > Here's an example: > > Make the driver follow DTS, allow a tunable/kenv check [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 21:12:37 -0000 Adrian Chadd (adrian.chadd@gmail.com) wrote: > Hi, > > Find the middle ground. Don't dissuade the developer too much. > > Here's an example: > > Make the driver follow DTS, allow a tunable/kenv check for it to > override whether it needs to be in the DTS or not (the "keep phk happy > for now" compromise) and have it default to obeying the device tree. > > That way phk is kept happy and the defaults are the same as normal-ish > ARM /and/ you have a springboard to experiment with extending FDT > overlays at runtime for people who wish to do so. This doesn't sound right. I'm 100% with manu@ on this: driver needs to be modified to follow DTS. A lot of work was spent to get FreeBSD FDT support consistent over multiple platforms and to make sure it conforms standard. When it comes to FDT support Pi port is inferior to the majority of platforms that have been added later. I bear a fair share of responsibility for this mess and it makes me appreciate all the effort spent on correcting the situation even more. Adding changes that violate standard and undermine all that work for the convenience of a single developer is plain wrong. If current framework is not good enough the way to go is to improve it, not hack around its limitations -- gonzo From owner-svn-src-all@freebsd.org Sat Jan 27 21:22:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 711B9EC315C; Sat, 27 Jan 2018 21:22:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CFA47A4F2; Sat, 27 Jan 2018 21:22:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17CD210135; Sat, 27 Jan 2018 21:22:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RLMAJZ032976; Sat, 27 Jan 2018 21:22:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RLMAec032972; Sat, 27 Jan 2018 21:22:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801272122.w0RLMAec032972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 21:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r328490 - vendor-sys/libfdt/dist X-SVN-Group: vendor-sys X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: vendor-sys/libfdt/dist X-SVN-Commit-Revision: 328490 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 21:22:11 -0000 Author: kevans Date: Sat Jan 27 21:22:10 2018 New Revision: 328490 URL: https://svnweb.freebsd.org/changeset/base/328490 Log: Update libfdt to github:f1879e1 Pulls in a patch, now upstreamed, from nwhitehorn to add limited read-only support for older (v2 and v3) FDT blobs. Modified: vendor-sys/libfdt/dist/fdt.c vendor-sys/libfdt/dist/fdt_overlay.c vendor-sys/libfdt/dist/fdt_ro.c vendor-sys/libfdt/dist/libfdt.h Modified: vendor-sys/libfdt/dist/fdt.c ============================================================================== --- vendor-sys/libfdt/dist/fdt.c Sat Jan 27 20:13:36 2018 (r328489) +++ vendor-sys/libfdt/dist/fdt.c Sat Jan 27 21:22:10 2018 (r328490) @@ -123,6 +123,9 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset /* skip-name offset, length and value */ offset += sizeof(struct fdt_property) - FDT_TAGSIZE + fdt32_to_cpu(*lenp); + if (fdt_version(fdt) < 0x10 && fdt32_to_cpu(*lenp) >= 8 && + ((offset - fdt32_to_cpu(*lenp)) % 8) != 0) + offset += 4; break; case FDT_END: Modified: vendor-sys/libfdt/dist/fdt_overlay.c ============================================================================== --- vendor-sys/libfdt/dist/fdt_overlay.c Sat Jan 27 20:13:36 2018 (r328489) +++ vendor-sys/libfdt/dist/fdt_overlay.c Sat Jan 27 21:22:10 2018 (r328490) @@ -1,3 +1,54 @@ +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2016 Free Electrons + * Copyright (C) 2016 NextThing Co. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 "libfdt_env.h" #include Modified: vendor-sys/libfdt/dist/fdt_ro.c ============================================================================== --- vendor-sys/libfdt/dist/fdt_ro.c Sat Jan 27 20:13:36 2018 (r328489) +++ vendor-sys/libfdt/dist/fdt_ro.c Sat Jan 27 21:22:10 2018 (r328490) @@ -58,9 +58,10 @@ static int fdt_nodename_eq_(const void *fdt, int offset, const char *s, int len) { - const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1); + int olen; + const char *p = fdt_get_name(fdt, offset, &olen); - if (!p) + if (!p || olen < len) /* short match */ return 0; @@ -233,16 +234,34 @@ int fdt_path_offset(const void *fdt, const char *path) const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) { const struct fdt_node_header *nh = fdt_offset_ptr_(fdt, nodeoffset); + const char *nameptr; int err; if (((err = fdt_check_header(fdt)) != 0) || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0)) goto fail; + nameptr = nh->name; + + if (fdt_version(fdt) < 0x10) { + /* + * For old FDT versions, match the naming conventions of V16: + * give only the leaf name (after all /). The actual tree + * contents are loosely checked. + */ + const char *leaf; + leaf = strrchr(nameptr, '/'); + if (leaf == NULL) { + err = -FDT_ERR_BADSTRUCTURE; + goto fail; + } + nameptr = leaf+1; + } + if (len) - *len = strlen(nh->name); + *len = strlen(nameptr); - return nh->name; + return nameptr; fail: if (len) @@ -268,9 +287,9 @@ int fdt_next_property_offset(const void *fdt, int offs return nextprop_(fdt, offset); } -const struct fdt_property *fdt_get_property_by_offset(const void *fdt, - int offset, - int *lenp) +static const struct fdt_property *fdt_get_property_by_offset_(const void *fdt, + int offset, + int *lenp) { int err; const struct fdt_property *prop; @@ -289,23 +308,44 @@ const struct fdt_property *fdt_get_property_by_offset( return prop; } -const struct fdt_property *fdt_get_property_namelen(const void *fdt, - int offset, - const char *name, - int namelen, int *lenp) +const struct fdt_property *fdt_get_property_by_offset(const void *fdt, + int offset, + int *lenp) { + /* Prior to version 16, properties may need realignment + * and this API does not work. fdt_getprop_*() will, however. */ + + if (fdt_version(fdt) < 0x10) { + if (lenp) + *lenp = -FDT_ERR_BADVERSION; + return NULL; + } + + return fdt_get_property_by_offset_(fdt, offset, lenp); +} + +static const struct fdt_property *fdt_get_property_namelen_(const void *fdt, + int offset, + const char *name, + int namelen, + int *lenp, + int *poffset) +{ for (offset = fdt_first_property_offset(fdt, offset); (offset >= 0); (offset = fdt_next_property_offset(fdt, offset))) { const struct fdt_property *prop; - if (!(prop = fdt_get_property_by_offset(fdt, offset, lenp))) { + if (!(prop = fdt_get_property_by_offset_(fdt, offset, lenp))) { offset = -FDT_ERR_INTERNAL; break; } if (fdt_string_eq_(fdt, fdt32_to_cpu(prop->nameoff), - name, namelen)) + name, namelen)) { + if (poffset) + *poffset = offset; return prop; + } } if (lenp) @@ -313,6 +353,25 @@ const struct fdt_property *fdt_get_property_namelen(co return NULL; } + +const struct fdt_property *fdt_get_property_namelen(const void *fdt, + int offset, + const char *name, + int namelen, int *lenp) +{ + /* Prior to version 16, properties may need realignment + * and this API does not work. fdt_getprop_*() will, however. */ + if (fdt_version(fdt) < 0x10) { + if (lenp) + *lenp = -FDT_ERR_BADVERSION; + return NULL; + } + + return fdt_get_property_namelen_(fdt, offset, name, namelen, lenp, + NULL); +} + + const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset, const char *name, int *lenp) @@ -324,12 +383,18 @@ const struct fdt_property *fdt_get_property(const void const void *fdt_getprop_namelen(const void *fdt, int nodeoffset, const char *name, int namelen, int *lenp) { + int poffset; const struct fdt_property *prop; - prop = fdt_get_property_namelen(fdt, nodeoffset, name, namelen, lenp); + prop = fdt_get_property_namelen_(fdt, nodeoffset, name, namelen, lenp, + &poffset); if (!prop) return NULL; + /* Handle realignment */ + if (fdt_version(fdt) < 0x10 && (poffset + sizeof(*prop)) % 8 && + fdt32_to_cpu(prop->len) >= 8) + return prop->data + 4; return prop->data; } @@ -338,11 +403,16 @@ const void *fdt_getprop_by_offset(const void *fdt, int { const struct fdt_property *prop; - prop = fdt_get_property_by_offset(fdt, offset, lenp); + prop = fdt_get_property_by_offset_(fdt, offset, lenp); if (!prop) return NULL; if (namep) *namep = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); + + /* Handle realignment */ + if (fdt_version(fdt) < 0x10 && (offset + sizeof(*prop)) % 8 && + fdt32_to_cpu(prop->len) >= 8) + return prop->data + 4; return prop->data; } Modified: vendor-sys/libfdt/dist/libfdt.h ============================================================================== --- vendor-sys/libfdt/dist/libfdt.h Sat Jan 27 20:13:36 2018 (r328489) +++ vendor-sys/libfdt/dist/libfdt.h Sat Jan 27 21:22:10 2018 (r328490) @@ -54,7 +54,7 @@ #include #include -#define FDT_FIRST_SUPPORTED_VERSION 0x10 +#define FDT_FIRST_SUPPORTED_VERSION 0x02 #define FDT_LAST_SUPPORTED_VERSION 0x11 /* Error codes: informative error codes */ @@ -526,6 +526,9 @@ int fdt_next_property_offset(const void *fdt, int offs * fdt_property structure within the device tree blob at the given * offset. If lenp is non-NULL, the length of the property value is * also returned, in the integer pointed to by lenp. + * + * Note that this code only works on device tree versions >= 16. fdt_getprop() + * works on all versions. * * returns: * pointer to the structure representing the property From owner-svn-src-all@freebsd.org Sat Jan 27 21:25:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3883EC33E9; Sat, 27 Jan 2018 21:25:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A1DA27A6C2; Sat, 27 Jan 2018 21:25:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E8A310156; Sat, 27 Jan 2018 21:25:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RLPk29033152; Sat, 27 Jan 2018 21:25:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RLPkm8033148; Sat, 27 Jan 2018 21:25:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801272125.w0RLPkm8033148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 21:25:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328491 - head/sys/contrib/libfdt X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/contrib/libfdt X-SVN-Commit-Revision: 328491 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 21:25:47 -0000 Author: kevans Date: Sat Jan 27 21:25:45 2018 New Revision: 328491 URL: https://svnweb.freebsd.org/changeset/base/328491 Log: MFV r328490: Update libfdt to github:f1879e1 Pulls in a patch, now upstreamed, from nwhitehorn to add limited read-only support for older (v2 and v3) FDT blobs. MFC after: 1 week Modified: head/sys/contrib/libfdt/fdt.c head/sys/contrib/libfdt/fdt_overlay.c head/sys/contrib/libfdt/fdt_ro.c head/sys/contrib/libfdt/libfdt.h Directory Properties: head/sys/contrib/libfdt/ (props changed) Modified: head/sys/contrib/libfdt/fdt.c ============================================================================== --- head/sys/contrib/libfdt/fdt.c Sat Jan 27 21:22:10 2018 (r328490) +++ head/sys/contrib/libfdt/fdt.c Sat Jan 27 21:25:45 2018 (r328491) @@ -123,6 +123,9 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset /* skip-name offset, length and value */ offset += sizeof(struct fdt_property) - FDT_TAGSIZE + fdt32_to_cpu(*lenp); + if (fdt_version(fdt) < 0x10 && fdt32_to_cpu(*lenp) >= 8 && + ((offset - fdt32_to_cpu(*lenp)) % 8) != 0) + offset += 4; break; case FDT_END: Modified: head/sys/contrib/libfdt/fdt_overlay.c ============================================================================== --- head/sys/contrib/libfdt/fdt_overlay.c Sat Jan 27 21:22:10 2018 (r328490) +++ head/sys/contrib/libfdt/fdt_overlay.c Sat Jan 27 21:25:45 2018 (r328491) @@ -1,3 +1,54 @@ +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2016 Free Electrons + * Copyright (C) 2016 NextThing Co. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 "libfdt_env.h" #include Modified: head/sys/contrib/libfdt/fdt_ro.c ============================================================================== --- head/sys/contrib/libfdt/fdt_ro.c Sat Jan 27 21:22:10 2018 (r328490) +++ head/sys/contrib/libfdt/fdt_ro.c Sat Jan 27 21:25:45 2018 (r328491) @@ -58,9 +58,10 @@ static int fdt_nodename_eq_(const void *fdt, int offset, const char *s, int len) { - const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1); + int olen; + const char *p = fdt_get_name(fdt, offset, &olen); - if (!p) + if (!p || olen < len) /* short match */ return 0; @@ -233,16 +234,34 @@ int fdt_path_offset(const void *fdt, const char *path) const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) { const struct fdt_node_header *nh = fdt_offset_ptr_(fdt, nodeoffset); + const char *nameptr; int err; if (((err = fdt_check_header(fdt)) != 0) || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0)) goto fail; + nameptr = nh->name; + + if (fdt_version(fdt) < 0x10) { + /* + * For old FDT versions, match the naming conventions of V16: + * give only the leaf name (after all /). The actual tree + * contents are loosely checked. + */ + const char *leaf; + leaf = strrchr(nameptr, '/'); + if (leaf == NULL) { + err = -FDT_ERR_BADSTRUCTURE; + goto fail; + } + nameptr = leaf+1; + } + if (len) - *len = strlen(nh->name); + *len = strlen(nameptr); - return nh->name; + return nameptr; fail: if (len) @@ -268,9 +287,9 @@ int fdt_next_property_offset(const void *fdt, int offs return nextprop_(fdt, offset); } -const struct fdt_property *fdt_get_property_by_offset(const void *fdt, - int offset, - int *lenp) +static const struct fdt_property *fdt_get_property_by_offset_(const void *fdt, + int offset, + int *lenp) { int err; const struct fdt_property *prop; @@ -289,23 +308,44 @@ const struct fdt_property *fdt_get_property_by_offset( return prop; } -const struct fdt_property *fdt_get_property_namelen(const void *fdt, - int offset, - const char *name, - int namelen, int *lenp) +const struct fdt_property *fdt_get_property_by_offset(const void *fdt, + int offset, + int *lenp) { + /* Prior to version 16, properties may need realignment + * and this API does not work. fdt_getprop_*() will, however. */ + + if (fdt_version(fdt) < 0x10) { + if (lenp) + *lenp = -FDT_ERR_BADVERSION; + return NULL; + } + + return fdt_get_property_by_offset_(fdt, offset, lenp); +} + +static const struct fdt_property *fdt_get_property_namelen_(const void *fdt, + int offset, + const char *name, + int namelen, + int *lenp, + int *poffset) +{ for (offset = fdt_first_property_offset(fdt, offset); (offset >= 0); (offset = fdt_next_property_offset(fdt, offset))) { const struct fdt_property *prop; - if (!(prop = fdt_get_property_by_offset(fdt, offset, lenp))) { + if (!(prop = fdt_get_property_by_offset_(fdt, offset, lenp))) { offset = -FDT_ERR_INTERNAL; break; } if (fdt_string_eq_(fdt, fdt32_to_cpu(prop->nameoff), - name, namelen)) + name, namelen)) { + if (poffset) + *poffset = offset; return prop; + } } if (lenp) @@ -313,6 +353,25 @@ const struct fdt_property *fdt_get_property_namelen(co return NULL; } + +const struct fdt_property *fdt_get_property_namelen(const void *fdt, + int offset, + const char *name, + int namelen, int *lenp) +{ + /* Prior to version 16, properties may need realignment + * and this API does not work. fdt_getprop_*() will, however. */ + if (fdt_version(fdt) < 0x10) { + if (lenp) + *lenp = -FDT_ERR_BADVERSION; + return NULL; + } + + return fdt_get_property_namelen_(fdt, offset, name, namelen, lenp, + NULL); +} + + const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset, const char *name, int *lenp) @@ -324,12 +383,18 @@ const struct fdt_property *fdt_get_property(const void const void *fdt_getprop_namelen(const void *fdt, int nodeoffset, const char *name, int namelen, int *lenp) { + int poffset; const struct fdt_property *prop; - prop = fdt_get_property_namelen(fdt, nodeoffset, name, namelen, lenp); + prop = fdt_get_property_namelen_(fdt, nodeoffset, name, namelen, lenp, + &poffset); if (!prop) return NULL; + /* Handle realignment */ + if (fdt_version(fdt) < 0x10 && (poffset + sizeof(*prop)) % 8 && + fdt32_to_cpu(prop->len) >= 8) + return prop->data + 4; return prop->data; } @@ -338,11 +403,16 @@ const void *fdt_getprop_by_offset(const void *fdt, int { const struct fdt_property *prop; - prop = fdt_get_property_by_offset(fdt, offset, lenp); + prop = fdt_get_property_by_offset_(fdt, offset, lenp); if (!prop) return NULL; if (namep) *namep = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); + + /* Handle realignment */ + if (fdt_version(fdt) < 0x10 && (offset + sizeof(*prop)) % 8 && + fdt32_to_cpu(prop->len) >= 8) + return prop->data + 4; return prop->data; } Modified: head/sys/contrib/libfdt/libfdt.h ============================================================================== --- head/sys/contrib/libfdt/libfdt.h Sat Jan 27 21:22:10 2018 (r328490) +++ head/sys/contrib/libfdt/libfdt.h Sat Jan 27 21:25:45 2018 (r328491) @@ -54,7 +54,7 @@ #include #include -#define FDT_FIRST_SUPPORTED_VERSION 0x10 +#define FDT_FIRST_SUPPORTED_VERSION 0x02 #define FDT_LAST_SUPPORTED_VERSION 0x11 /* Error codes: informative error codes */ @@ -526,6 +526,9 @@ int fdt_next_property_offset(const void *fdt, int offs * fdt_property structure within the device tree blob at the given * offset. If lenp is non-NULL, the length of the property value is * also returned, in the integer pointed to by lenp. + * + * Note that this code only works on device tree versions >= 16. fdt_getprop() + * works on all versions. * * returns: * pointer to the structure representing the property From owner-svn-src-all@freebsd.org Sat Jan 27 21:32:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25607EC39FE; Sat, 27 Jan 2018 21:32:35 +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 820B27AB77; Sat, 27 Jan 2018 21:32:33 +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 w0RLWMHE011257; Sat, 27 Jan 2018 13:32:22 -0800 (PST) (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 w0RLWMqi011256; Sat, 27 Jan 2018 13:32:22 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201801272132.w0RLWMqi011256@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-Reply-To: <20180127214840.dc033d582696ff7b51f6d7e6@bidouilliste.com> To: Emmanuel Vadot Date: Sat, 27 Jan 2018 13:32:22 -0800 (PST) CC: Adrian Chadd , Poul-Henning Kamp , Warner Losh , John Baldwin , Ravi Pokala , 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.25 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: Sat, 27 Jan 2018 21:32:35 -0000 > On Sat, 27 Jan 2018 12:13:57 -0800 > Adrian Chadd wrote: > > > Hi, > > > > Find the middle ground. Don't dissuade the developer too much. > > This is what happened two years ago when I started hacking on the > allwinner SoCs : > > - I asked what should be done for bringing a new board > - andrew@ told me that we first need to switch to upstream dts and > update drivers. > - Guess what, I did that. Great, thats good co-operatation and communications, sometimes though it is not so smooth. The better we become at dealing with the not so smooth the faster forward progress can be made. > > Here's an example: > > > > Make the driver follow DTS, allow a tunable/kenv check for it to > > override whether it needs to be in the DTS or not (the "keep phk happy > > for now" compromise) and have it default to obeying the device tree. > > > > That way phk is kept happy and the defaults are the same as normal-ish > > ARM /and/ you have a springboard to experiment with extending FDT > > overlays at runtime for people who wish to do so. > > I don't care about keeping phk@ (or any other developer) happy, we > have a standard, let's stick to it. *sigh* Let me ask you if you do not care about keeping any other developers happy, why should any of them be concerned about keeping you happy? We need to always try to find middle ground and co-operate in positive ways. On the "we have a standard" front, well when standards get in the way of forward progress they are often side stepped. Maybe this standard is not such a good standard and warts are going to form around it. I have seen some discusssion at least on ways to improve the current situation, hopefully someone takes them and runs with them. Others have pointed out they do not like the current model in that it gets in the way of developement progress. I can see this point. I can see phk's points, and I can see your points. IMHO if we shove the standard down our own throats we are in effect cutting our hands off in the process, not somethig we really want to do is it? > > (I personally hate having to edit the dts/recompile/reboot for every > > test hardware change; it makes breadboarding things up kinda > > hilariously annoying.) > > Use overlays then. And if you don't want to reboot provide patch for > loading overlays at runtime. Are those the only solutions? > > -adrian > Emmanuel Vadot -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sat Jan 27 21:42:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 338FDEC44AD for ; Sat, 27 Jan 2018 21:42:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic317-49.consmr.mail.ne1.yahoo.com (sonic317-49.consmr.mail.ne1.yahoo.com [66.163.184.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C25A57B1F7 for ; Sat, 27 Jan 2018 21:42:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1517089373; bh=jrMjVTM3eLl7GnStzP93WgfhizL2k26xnU81s5pmKFQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=pg/vxXfyq3PiqNvIwFnE0ocO+vdH1/Ym5id171AMJ8bt81V3tiKFYjErVTFGbJ6wHplhetlwq+ShZ6GUQKdVaWwplu/vcD4jxdT2u6qT6EhXIypjupSJNBeVx9wUzzfvv32b4d3oRoN9goi/mtHxt3Z/1ASb1/fF+TrowxFO/KAd2t354hWPAAJ5Gec1str8JM/my9y+ggmFwjhRGxac6qURYAH9qvWmEeKyTdVD7CiqRjx6/axchMQ0V0vQg7UeLrA5axTmgEf20kyhc7QQTl9vwwfGqtVB9ixEhm8xYHbwR7YwuGAqT9qrvjGiT3PnKbBJlG3NeE9kTn0bQJ/9/g== X-YMail-OSG: YxxhL.UVM1nKh5Kz9zC67.xny6u21LwEcO6qnOTk5AoQLx0Vtj8XPtdDU9I_SYp hUsiVq1yzmPFnoZgyzZGkuA5ZLnD2gS.09OKUKUq0pVZi30DL_P6Z_.gxTfe2GAs1tsnpuj2bsXb wOPTmC0HY.DmxD4ABw_5L4RIWAtvjxA0Ete1Gi4T1tPRoRxdmQZmsqmFGU8Q1LIdsdTDwvjd_Con qmmS8iF9ZtgissxsKunlYyTFu0sXJceE4y3b2tulC7IhoMUBFbIkWPsCF1yrHOiYq_rsQldX46vD iwhXs9T049bpv9UH4Yq5sQsv1EG7R8685xZD.eTAHXUNjWNk97mQphEwjK1uX2ggBLy_MuNNYWFa CfAHKHyJyShmfVuCZwSZAhYGwcWDbe3OMW1gAo4hceGQuG5uon01VtoRfz6yL.oqqvpE556MV0Bb E2gtEFk8nXhZE7Fe7HW_9dfnByFaLFDqOusGgUggaULSPLoMqyAKyntsByb_XUITvO69FUuAp2Z8 t3pu2vg.47w-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.ne1.yahoo.com with HTTP; Sat, 27 Jan 2018 21:42:53 +0000 Received: from smtp234.mail.ne1.yahoo.com (EHLO [192.168.0.8]) ([10.218.253.207]) by smtp414.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID f5cffd8c3486921569e85815f5fdbb6d; Sat, 27 Jan 2018 21:32:44 +0000 (UTC) Subject: Re: svn commit: r328486 - head/usr.bin/fortune/fortune To: cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801271743.w0RHh9io022619@repo.freebsd.org> From: Pedro Giffuni Message-ID: <1f1eb186-8f7b-6ec9-0970-d8b82b909e7b@FreeBSD.org> Date: Sat, 27 Jan 2018 16:32:42 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 21:42:55 -0000 Hi; On 01/27/18 14:56, Conrad Meyer wrote: > We can use 'true' and 'false' now. (style(9) also suggests using the > C99 names instead of TRUE/FALSE.) Yes, I noticed that change in DragonflyBSD but it is conceptually a different change and it deserves a different commit. Pedro. > On Sat, Jan 27, 2018 at 9:43 AM, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Sat Jan 27 17:43:09 2018 >> New Revision: 328486 >> URL: https://svnweb.freebsd.org/changeset/base/328486 >> >> Log: >> fortune(6): Fix gcc80 -Wbool-operation warnings. >> >> Hinted by: Dragonfly (git 4d1086765752f0569497d06460d95117c74f33ac) >> >> Modified: >> head/usr.bin/fortune/fortune/fortune.c >> >> Modified: head/usr.bin/fortune/fortune/fortune.c >> ============================================================================== >> --- head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:24:59 2018 (r328485) >> +++ head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:43:09 2018 (r328486) >> @@ -289,35 +289,35 @@ getargs(int argc, char *argv[]) >> #endif /* DEBUG */ >> switch(ch) { >> case 'a': /* any fortune */ >> - All_forts++; >> + All_forts = TRUE; >> break; >> #ifdef DEBUG >> case 'D': >> Debug++; >> break; >> #endif /* DEBUG */ >> - case 'e': >> - Equal_probs++; /* scatter un-allocted prob equally */ >> + case 'e': /* scatter un-allocted prob equally */ >> + Equal_probs = TRUE; >> break; >> case 'f': /* find fortune files */ >> - Find_files++; >> + Find_files = TRUE; >> break; >> case 'l': /* long ones only */ >> - Long_only++; >> + Long_only = TRUE; >> Short_only = FALSE; >> break; >> case 'o': /* offensive ones only */ >> - Offend++; >> + Offend = TRUE; >> break; >> case 's': /* short ones only */ >> - Short_only++; >> + Short_only = TRUE; >> Long_only = FALSE; >> break; >> case 'w': /* give time to read */ >> - Wait++; >> + Wait = TRUE; >> break; >> case 'm': /* dump out the fortunes */ >> - Match++; >> + Match = TRUE; >> pat = optarg; >> break; >> case 'i': /* case-insensitive match */ >> From owner-svn-src-all@freebsd.org Sat Jan 27 21:51:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10CF7EC4D08 for ; Sat, 27 Jan 2018 21:51:20 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x230.google.com (mail-io0-x230.google.com [IPv6:2607:f8b0:4001: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 96CFF7B5EF for ; Sat, 27 Jan 2018 21:51:19 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x230.google.com with SMTP id 25so3883693ioj.9 for ; Sat, 27 Jan 2018 13:51:19 -0800 (PST) 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=/Y7UzvuKXzrNv/VwOvr3strKfQHEUOD4GN29ysN0v04=; b=L6SH/IF4wozoDjKaiMXoodazW3Fgyyx1PAAeFo12TCH0Sv+tNLb8niWd9o3MRov+Bo +1/+i/NCoZuALN4pEozoIp+evHjd+PNo8SeOWDtKoeGYtboD4XyJnoidn8SzXZGoO+fR ZU66+S13z9/9CIAG+rk+JDItzF+tke3DAwEkWHmaj4W8u/H6Q6pwI3TtUtsrZTjNlUDI CMaBWuoGDoegi86F8C13JqQwnJSH3twRJjjnYs2ox43RywB6pLElamH399xpTaJ7JPxA 8NqFMJVBpi5gU1o7lBxk6GjZKRSYfW++OdEFgajaOJ79SFe7BfO3rg+vWupBau5NqtUT rIQw== 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=/Y7UzvuKXzrNv/VwOvr3strKfQHEUOD4GN29ysN0v04=; b=GzOck0nWYyhOM00g+URe/Dkm+qwNIhrh0wnb3i0sFd30adGd8FW85TPSafgKl8HGGA tell4tAuBL5Xv1Z1ArDOoZBHs0icfIST9fwVmtnXO+Vmgtqkv/lVxfYId5SxxRAU9ZA+ asgutFln01KiprWauFypdj9KqZCZkAO7QkEBx0VvunZzLG3XW+6elO/9iHztRlVTMavn iBNRt6/cfa0wutGyYQh3VpAkkFtX0eqN+Mfls1GVPlu0oHKDxrPSiGvOoDfCrO05skvE qrSsk2AJOtaBqI8VUoxkm34FpU3ccGm8w4rIocQ54ASxg9u9ac/NWB9q5EzqJwOInCO7 hDmA== X-Gm-Message-State: AKwxytecGwF0KmE8i0F6k4xIo7lYRXqEx+PbUe3sF20IYG5xoiF3ZlZc G3Uht32mLJocCxII2PkTws4xCtAMJG/xh2axtKTtZg== X-Google-Smtp-Source: AH8x227tZoWpft/3FVQLOYTpRAmYnGqhGEcry33D5ic0VJ9//hY571U50DsAw6dNxGdisRDz1pYQpTiYpOzbGHbdhDw= X-Received: by 10.107.136.76 with SMTP id k73mr21354321iod.301.1517089878961; Sat, 27 Jan 2018 13:51:18 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Sat, 27 Jan 2018 13:51:17 -0800 (PST) X-Originating-IP: [2607:fb90:6e30:c242:925:21a5:6ad2:b82] Received: by 10.79.201.67 with HTTP; Sat, 27 Jan 2018 13:51:17 -0800 (PST) In-Reply-To: <201801272132.w0RLWMqi011256@pdx.rh.CN85.dnsmgr.net> References: <20180127214840.dc033d582696ff7b51f6d7e6@bidouilliste.com> <201801272132.w0RLWMqi011256@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Sat, 27 Jan 2018 14:51:17 -0700 X-Google-Sender-Auth: kSH7z1yfJAtCK20rtf0TANc1C3Q Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: "Rodney W. Grimes" Cc: Emmanuel Vadot , Adrian Chadd , Poul-Henning Kamp , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 21:51:20 -0000 On Jan 27, 2018 2:32 PM, "Rodney W. Grimes" wrote: > On Sat, 27 Jan 2018 12:13:57 -0800 > Adrian Chadd wrote: > > > Hi, > > > > Find the middle ground. Don't dissuade the developer too much. > > This is what happened two years ago when I started hacking on the > allwinner SoCs : > > - I asked what should be done for bringing a new board > - andrew@ told me that we first need to switch to upstream dts and > update drivers. > - Guess what, I did that. Great, thats good co-operatation and communications, sometimes though it is not so smooth. The better we become at dealing with the not so smooth the faster forward progress can be made. The path we are on is the fastest. > > Here's an example: > > > > Make the driver follow DTS, allow a tunable/kenv check for it to > > override whether it needs to be in the DTS or not (the "keep phk happy > > for now" compromise) and have it default to obeying the device tree. > > > > That way phk is kept happy and the defaults are the same as normal-ish > > ARM /and/ you have a springboard to experiment with extending FDT > > overlays at runtime for people who wish to do so. > > I don't care about keeping phk@ (or any other developer) happy, we > have a standard, let's stick to it. *sigh* Let me ask you if you do not care about keeping any other developers happy, why should any of them be concerned about keeping you happy? We need to always try to find middle ground and co-operate in positive ways. On the "we have a standard" front, well when standards get in the way of forward progress they are often side stepped. Maybe this standard is not such a good standard and warts are going to form around it. I have seen some discusssion at least on ways to improve the current situation, hopefully someone takes them and runs with them. Others have pointed out they do not like the current model in that it gets in the way of developement progress. I can see this point. I can see phk's points, and I can see your points. IMHO if we shove the standard down our own throats we are in effect cutting our hands off in the process, not somethig we really want to do is it? It beats the chaos we had before where nothing was leveraged and everything was a custom hack. > > (I personally hate having to edit the dts/recompile/reboot for every > > test hardware change; it makes breadboarding things up kinda > > hilariously annoying.) > > Use overlays then. And if you don't want to reboot provide patch for > loading overlays at runtime. Are those the only solutions? Yes. Unless you show up with a boatload of work. There is a decade of history here that I'm loathe to just ignore. I have some WiP that will make things better, but it is complicated. You can't just enable the device. You have to change the pinctl stuff too. People saying just do this hack or that hack which ignores this will be ignored as their solution is incomplete (and basically useless). My advice is to see where we are once I find a few minutes to finish my WiP before pronouncing the right way forward. Or you can comment on the design I sent a week ago. Warner > > -adrian > Emmanuel Vadot -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sat Jan 27 21:57:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3016EEC524C; Sat, 27 Jan 2018 21:57:16 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: from mail-lf0-x230.google.com (mail-lf0-x230.google.com [IPv6:2a00:1450:4010:c07::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 8746D7BBDF; Sat, 27 Jan 2018 21:57:15 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: by mail-lf0-x230.google.com with SMTP id q17so4840722lfa.9; Sat, 27 Jan 2018 13:57:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9u4/gIc0FXXKEcTOVxE8EP/9gmVfxvCKbJFPW6zf/Hk=; b=o0htt12rRNOKA0IIGE5r0e88ImkMooC+qg1QGFUthFuMwzsGjLHG05mQs7uQFKQWGO ruwIDEqFXxNwn+SMV9zZxeqs1sM2egR5SVtmHoISVWnFk8IXvx7whLmdzPnDzIcw065w ktKlf05876owsAqOqhkTbpnyajxODdj/j1ld9yWvn7BX2kpSQnUcXhWeG1btOgYDZcQf iLkb9sVJqTaKbJHB+HcrQqGgS9Ds71PIupGZEpC4xpjwlurxJWme3Hs9IDHKSokG4JR/ Iend2QagZ1FripgKmWiEFGW1GuHJFIw3iIR/zJ5DDsEAAgPoudM891mQhnO0enfVHesM g8mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=9u4/gIc0FXXKEcTOVxE8EP/9gmVfxvCKbJFPW6zf/Hk=; b=KOuHxC4t/2ktVwF5rs5fm5cbU2mSOkgtBL2WWQ+TOr/Jt+q8NnbDuVt6ftUMnrrY4C nHWP2NB4mVjNesSlj4xyO/esfuqxFJSsCLebPAO7VtOufJZZRGgYK53cjPeQdFIZdSB4 2gnLdJuBD9Py0Sxi5OOk0OUhX2UL4WUtxeu41pv6NwIV8EGo2r85h534OPpw0sXvtM8Q EgBKItDOk/I21uHrtbY1jATHhpcf1dkYba3LTjz/Fj+OhbyJZL6Zko6cHCddk8mr3XGM k1mfVd5xvUpB0yh1YTKD9nCj4bjfG/a1dVS2X8gcysaXuqLLLoWjkXApW3bPJj3UznYi KfVA== X-Gm-Message-State: AKwxytdoEVkHM/NM4V7V56O8lnK3DOo2lL6Ipy81C3qee9TQBPTrygkR TQw6I3FKJILlbSavRTQYfVrQc/ES X-Google-Smtp-Source: AH8x224wrv7+12jYjZZz0KFiZA/pjrqOcV3GOhNhJNOX9O0K/rV3CIx4lrnPsbVKs04MYoWG8nSvow== X-Received: by 10.25.224.17 with SMTP id x17mr10568891lfg.91.1517090233520; Sat, 27 Jan 2018 13:57:13 -0800 (PST) Received: from jarvis ([5.172.235.64]) by smtp.gmail.com with ESMTPSA id y22sm1501223ljy.64.2018.01.27.13.57.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Jan 2018 13:57:12 -0800 (PST) Sender: Mariusz Zaborski Date: Sat, 27 Jan 2018 22:56:58 +0100 From: Mariusz Zaborski To: Cy Schubert Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328474 - head/sys/contrib/libnv Message-ID: <20180127215658.GA75080@jarvis> References: <201801271258.w0RCwMl0078832@repo.freebsd.org> <201801271532.w0RFWdYS035354@slippy.cwsent.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ew6BAiZeqk4r7MaW" Content-Disposition: inline In-Reply-To: <201801271532.w0RFWdYS035354@slippy.cwsent.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 21:57:16 -0000 --ew6BAiZeqk4r7MaW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 27, 2018 at 07:32:39AM -0800, Cy Schubert wrote: > In message <201801271258.w0RCwMl0078832@repo.freebsd.org>, Mariusz Zabors= ki=20 > wri > tes: > > Author: oshogbo > > Date: Sat Jan 27 12:58:21 2018 > > New Revision: 328474 > > URL: https://svnweb.freebsd.org/changeset/base/328474 > > > > Log: > > Add SPDX tags for nv(9). > > =20 > > MFC after: 2 weeks > > > > Modified: > > head/sys/contrib/libnv/cnvlist.c > > head/sys/contrib/libnv/dnvlist.c > > head/sys/contrib/libnv/nv_impl.h > > head/sys/contrib/libnv/nvlist.c > > head/sys/contrib/libnv/nvlist_impl.h > > head/sys/contrib/libnv/nvpair.c > > head/sys/contrib/libnv/nvpair_impl.h > > >=20 > When was it decided to add SPDX to contrib? The nv was development for and in FreeBSD. First whole library was in lib/libnv. Then the part which is also in the kernel was moved to sys/kern and sys/sys directories. The problem with that was that evrything in the sys/sys is instaled in /usr/include and in the *_impl.h we have things that should not be accesibl= e by developers. This was the main reason of moving libnv to contrib file at the time. If you have any other place where libnv can be kept I'm happy to move it. Thanks, --=20 Mariusz Zaborski oshogbo//vx | http://oshogbo.vexillium.org FreeBSD commiter | https://freebsd.org Software developer | http://wheelsystems.com If it's not broken, let's fix it till it is!!1 --ew6BAiZeqk4r7MaW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEkD1x0xkJXVVY1Gwf38KEGuLGxWQFAlps9aYACgkQ38KEGuLG xWTXKw/+KpQBO1PZtqjprm8pOFhMTWbDq1Q7etBPl0NCnGmU6Nvtur0HErZaQkyD KjUoR/XV8rxBtjjrtlPe/a5z2Pr4oMu3nzpvstnBtWTNd29CyL10MkYZHHxMX55G RINdcsbGQD1zEECnPiUvn6mldEMwlPGft6wSpPqIAnJf05NJxyYC3JCOMACGwnjj L2H2IfY1BX1bhx2bE5xW+kfZR29XY+UakV+VBWX2mPGvtDyhBuXt/iadkvzOHYDD mr4Svv8zGvVtgdWrxjIq2SqOwf7durl+ND4FyfFxdMSoYMFbDq3hEnuN/lgEtc5N lSx2FoiVJHrB12bxp8+AAvDTmchNOMH5ktK16HdrnR3a1m8WrzJa0X3P14BxNY3S NRo7OmfyZ6ChFiWF2ZorHQgYH0nbqsCgKyjY2ozieLDoPoy5kkbmu3SIR8EBORrt mXpGDuDVAR7EWb65FTGpv5p0bkAINsTHYu+ONT61skSuj7Cc3HVGy1n1Ickykfh3 w2g1qR5ucSzPRRCZM1GMrfZZzyhaMBhBbK6iPEXvqynnxfIeQpTYDEbpISIZNit4 zuMkjRKeQ846nf4EkUw8o58EluYEeS8NScBvNktesb8u/TIfs8YzMd+vtkJ/6HSC ou5A+cwx5/AqA+hreWs1jetn5nlzmhVd9L8XzsV+N93l3afA9y0= =to6z -----END PGP SIGNATURE----- --ew6BAiZeqk4r7MaW-- From owner-svn-src-all@freebsd.org Sat Jan 27 22:16:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA07BEC6267; Sat, 27 Jan 2018 22:16:19 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 879117C5C7; Sat, 27 Jan 2018 22:16:19 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81A6D10982; Sat, 27 Jan 2018 22:16:19 +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 w0RMGJGW057493; Sat, 27 Jan 2018 22:16:19 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RMGJwo057492; Sat, 27 Jan 2018 22:16:19 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801272216.w0RMGJwo057492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 27 Jan 2018 22:16:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328492 - head/contrib/opie/libopie X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/contrib/opie/libopie X-SVN-Commit-Revision: 328492 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 22:16:20 -0000 Author: pfg Date: Sat Jan 27 22:16:19 2018 New Revision: 328492 URL: https://svnweb.freebsd.org/changeset/base/328492 Log: Fix gcc80 -Wsizeof-pointer-memaccess warning. Obtained from: DragonFlyBSD (git 56267d362d5769c8df07bf26d5e322610e0d24b4) Modified: head/contrib/opie/libopie/insecure.c Modified: head/contrib/opie/libopie/insecure.c ============================================================================== --- head/contrib/opie/libopie/insecure.c Sat Jan 27 21:25:45 2018 (r328491) +++ head/contrib/opie/libopie/insecure.c Sat Jan 27 22:16:19 2018 (r328492) @@ -135,8 +135,7 @@ int opieinsecure FUNCTION_NOARGS char host[sizeof(utmp.ut_host) + 1]; insecure = 1; - strncpy(host, utmp.ut_host, sizeof(utmp.ut_host)); - host[sizeof(utmp.ut_host)] = 0; + strncpy(host, utmp.ut_host, sizeof(host)); if (s = strchr(host, ':')) { int n = s - host; From owner-svn-src-all@freebsd.org Sat Jan 27 22:21:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C73AEC6782 for ; Sat, 27 Jan 2018 22:21:30 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-lf0-x22a.google.com (mail-lf0-x22a.google.com [IPv6:2a00:1450:4010:c07::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 B51577C9DA for ; Sat, 27 Jan 2018 22:21:29 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-lf0-x22a.google.com with SMTP id t139so4905310lff.0 for ; Sat, 27 Jan 2018 14:21:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Dtt7EaHPwSOiHCAo0RCHWnLOnevmBytyRbBXzkwueS4=; b=qy/LlzMFFrSAGaY/pNUtNcXOzUObJ44nJmleJE38vpR8UK7ycTkT6o4dwIAVusmKH7 7CSq2N3hLSbNm1qLigkXytRlGOXaBh7HziiRfFajNNJALk3eGQFBOqbp4O4I1gxSRwXs tJ5CuBVMdoECGemFrw/I7kXky962zzIKnf1py93fIpEsBQdXfXl2RaIR2kFyYMM3BtSE ttCNo6Hri+mIKl35N8L9mzdMO7WhoRjJ1OmqpgRdJA1fpD57fyA8zcux39cEu02mwwcE jz3nBK/afbYFB0yx5KaurwIzvWPy5wmviTXwni9vYIazGfDv1RwG4hmTi5cA+YVJExgT p1ww== 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=Dtt7EaHPwSOiHCAo0RCHWnLOnevmBytyRbBXzkwueS4=; b=dWi2vsnXBvOGYvGuj0PdWiJgUO2vmaV+CDqUZDuX8D7qv9rGl5OUBCt2Tw3/AwAR3R qDM8V5UWozwW+fZJOD+nuU8kVpN/zw+o8vAb0GoVcITPpcPfwE5ihupuOm0X2iusdb0c GP8b9DA0sLAkKSy+6PLQ81AZEiH9bs2+y2dI6L9EYReKc0ActKm7sxXrK0/zK3CJuQk1 /uyDr/UgKer+tiuUvOhQScTMSNwFnAtimfKFb6YWFz35vd8QIqoU/idNK+MWHznAAhCQ iYQ98j0/UmwkVgd6Y0pTU9Uv8WTM7mhcttDz4DJ9/3V4ZAlA7UJ5utr3MCZLJPqRnKts ZGww== X-Gm-Message-State: AKwxytfVjyLwyZysIjh9dLJuQUZnU/sTc+TxdUUst9gLlZNoPG3V9j5B ccSEl2/cRaKcUHSvETEUfc+SP5b0yOnDEHM3pNdRdA== X-Google-Smtp-Source: AH8x226LQhrch5v89vAyl4Eowq247xvtCubSGDegJ9TEXgAllBDulH5PG0A7wGp1OBYC0ywlOs65PQFb+TYCLrwcDUI= X-Received: by 10.25.20.168 with SMTP id 40mr10845246lfu.23.1517091687713; Sat, 27 Jan 2018 14:21:27 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.216.206 with HTTP; Sat, 27 Jan 2018 14:20:57 -0800 (PST) In-Reply-To: <201801272216.w0RMGJwo057492@repo.freebsd.org> References: <201801272216.w0RMGJwo057492@repo.freebsd.org> From: Ed Schouten Date: Sat, 27 Jan 2018 23:20:57 +0100 Message-ID: Subject: Re: svn commit: r328492 - head/contrib/opie/libopie To: "Pedro F. Giffuni" 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.25 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: Sat, 27 Jan 2018 22:21:30 -0000 Hi Pedro, 2018-01-27 23:16 GMT+01:00 Pedro F. Giffuni : > char host[sizeof(utmp.ut_host) + 1]; > insecure = 1; > > - strncpy(host, utmp.ut_host, sizeof(utmp.ut_host)); > - host[sizeof(utmp.ut_host)] = 0; > + strncpy(host, utmp.ut_host, sizeof(host)); Wait... This may access utmp.ut_host one byte past the end and no longer guarantees that host is null-terminated, right? -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands From owner-svn-src-all@freebsd.org Sat Jan 27 22:27:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67ADEEC6BC4; Sat, 27 Jan 2018 22:27:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0CEBB7CCC0; Sat, 27 Jan 2018 22:27:56 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0356F10B26; Sat, 27 Jan 2018 22:27:56 +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 w0RMRtaW062758; Sat, 27 Jan 2018 22:27:55 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RMRtmk062757; Sat, 27 Jan 2018 22:27:55 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801272227.w0RMRtmk062757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 27 Jan 2018 22:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328493 - head/lib/libthr/thread X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libthr/thread X-SVN-Commit-Revision: 328493 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 22:27:56 -0000 Author: pfg Date: Sat Jan 27 22:27:55 2018 New Revision: 328493 URL: https://svnweb.freebsd.org/changeset/base/328493 Log: libthr: Fix missing break in switch. This is also a warning in recent GCC with -Wimplicit-fallthrough. CID: 1356262 Obtained from: DragonFly (git 0f037c78 - partial) Modified: head/lib/libthr/thread/thr_printf.c Modified: head/lib/libthr/thread/thr_printf.c ============================================================================== --- head/lib/libthr/thread/thr_printf.c Sat Jan 27 22:16:19 2018 (r328492) +++ head/lib/libthr/thread/thr_printf.c Sat Jan 27 22:27:55 2018 (r328493) @@ -95,6 +95,7 @@ next: c = *fmt++; case 'p': pstr(fd, "0x"); islong = 1; + /* FALLTHROUGH */ case 'd': case 'u': case 'x': From owner-svn-src-all@freebsd.org Sat Jan 27 22:31:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7404EC7022; Sat, 27 Jan 2018 22:31:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70B847CF84; Sat, 27 Jan 2018 22:31:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from coleburn.home.andric.com (coleburn.home.andric.com [192.168.0.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 36756EF59; Sat, 27 Jan 2018 23:31:12 +0100 (CET) From: Dimitry Andric Message-Id: <7C471160-44B3-4EA6-8995-08A4EB4332A1@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_1FA37D74-6C1D-48F2-B90D-FF51BAB1973D"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r328492 - head/contrib/opie/libopie Date: Sat, 27 Jan 2018 23:31:11 +0100 In-Reply-To: Cc: "Pedro F. Giffuni" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Ed Schouten References: <201801272216.w0RMGJwo057492@repo.freebsd.org> X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 22:31:14 -0000 --Apple-Mail=_1FA37D74-6C1D-48F2-B90D-FF51BAB1973D Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 27 Jan 2018, at 23:20, Ed Schouten wrote: > > 2018-01-27 23:16 GMT+01:00 Pedro F. Giffuni : >> char host[sizeof(utmp.ut_host) + 1]; >> insecure = 1; >> >> - strncpy(host, utmp.ut_host, sizeof(utmp.ut_host)); >> - host[sizeof(utmp.ut_host)] = 0; >> + strncpy(host, utmp.ut_host, sizeof(host)); > > Wait... This may access utmp.ut_host one byte past the end and no > longer guarantees that host is null-terminated, right? No, strncpy "copies at most len characters from src into dst". However, if the length of the source is equal to or greater than len, the destination is *not* null terminated. This is likely why the "host[sizeof(utmp.ut_host)] = 0;" statement was added. In any case, this is why strlcpy exists. :) -Dimitry --Apple-Mail=_1FA37D74-6C1D-48F2-B90D-FF51BAB1973D Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWmz9rwAKCRCwXqMKLiCW ozvjAJwOzX8s9AFtYs55JtxbfsyJl3NHUwCZAVBzD3h33L0t/vC4Q1gNTs2A9es= =aCkh -----END PGP SIGNATURE----- --Apple-Mail=_1FA37D74-6C1D-48F2-B90D-FF51BAB1973D-- From owner-svn-src-all@freebsd.org Sat Jan 27 22:42:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF57DEC7968 for ; Sat, 27 Jan 2018 22:42:38 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-lf0-x22c.google.com (mail-lf0-x22c.google.com [IPv6:2a00:1450:4010:c07::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 4329A7D75A for ; Sat, 27 Jan 2018 22:42:38 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-lf0-x22c.google.com with SMTP id v188so4886443lfa.11 for ; Sat, 27 Jan 2018 14:42:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=1KSkqbk9apJLQ4Or3dl2xr4mI4vErXFCix5wB3fZIzU=; b=iUiWRIFHbrqkeu70rlcGiuJOljrQ3v1AqUz6mrO6DJZef0H6GWNrPpTs9WnSmlRjpE xbKL2A5r+0ZxxT+cZh6KayNWa8igTKQ9YJ3Ldb7A2pN6HrAU77E3jqtX+2Nx/AstxNbK v8cixJlE7PeYtAM5uDg3ihgoUeSky1geJfJovif295rcKPL/G/XSRc1SWMbYKGJZsUTf 2uPQLPOc2j5MIlTN+h6P+V1T2WE4m1Kt6TXD8CDQN7MTNNj8jZ8eDLhf/Hi11SMhrudT SKp4H+WgosjLVtA/Fm4nwtYPoAQ77rBMXOGC0aLYkdrodF+QH8hjnGfO4CFmxYl6XSf4 rKNw== 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=1KSkqbk9apJLQ4Or3dl2xr4mI4vErXFCix5wB3fZIzU=; b=JDMvIQ85CknBpsH9EJRJXsoDmEOCs68cNxf3sJBsf6kxundn/Bc9hWSYmKL/iq6Oze qybJCGa3jWb9+/oIuzdXJmuUS7sKJgFX6UHYU+Fw+UEEg32IjZE+b9UhtndTt5Nz7lNU QjobluSUJgzp3PreWRN5dmYYVtjpQ9hLOmV8k0mrGIrrnfHSxWenKOLmgMpUgcVHrx8h 1pth8bqbWYW6y44nFcixk73b6MUT/6JDn0C1RUYE1g0u5HHl1yJWvdP613sIfkBosau2 0nKpgsP6n+cWae8V+MR2vd7YK5jNaYnVoLvIKTfbdTKu0GBrH2BRFqONb0kVEGpAPxmH MCwQ== X-Gm-Message-State: AKwxytcVxZDDga6fDGtkR4HhlIwHoJncHD3OrTw3gFpX3ZD8fMtoIQds uaxlwDhz5ee9zIIbcf96vOiFBE53XHf5vPBW4+Vpig== X-Google-Smtp-Source: AH8x2259x3UvrG0Gz4in+zP/MtexSPkgVXIafi9akU11+RO1UtDqBB2po/6VLThGhqZb1s7KtgSXIlOJYXYRvC0z0BA= X-Received: by 10.46.80.79 with SMTP id v15mr10080858ljd.125.1517092957011; Sat, 27 Jan 2018 14:42:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.216.206 with HTTP; Sat, 27 Jan 2018 14:42:06 -0800 (PST) In-Reply-To: <7C471160-44B3-4EA6-8995-08A4EB4332A1@FreeBSD.org> References: <201801272216.w0RMGJwo057492@repo.freebsd.org> <7C471160-44B3-4EA6-8995-08A4EB4332A1@FreeBSD.org> From: Ed Schouten Date: Sat, 27 Jan 2018 23:42:06 +0100 Message-ID: Subject: Re: svn commit: r328492 - head/contrib/opie/libopie To: Dimitry Andric Cc: "Pedro F. Giffuni" , 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.25 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: Sat, 27 Jan 2018 22:42:39 -0000 2018-01-27 23:31 GMT+01:00 Dimitry Andric : > On 27 Jan 2018, at 23:20, Ed Schouten wrote: >> >> 2018-01-27 23:16 GMT+01:00 Pedro F. Giffuni : >>> char host[sizeof(utmp.ut_host) + 1]; >>> insecure = 1; >>> >>> - strncpy(host, utmp.ut_host, sizeof(utmp.ut_host)); >>> - host[sizeof(utmp.ut_host)] = 0; >>> + strncpy(host, utmp.ut_host, sizeof(host)); >> >> Wait... This may access utmp.ut_host one byte past the end and no >> longer guarantees that host is null-terminated, right? > > No, strncpy "copies at most len characters from src into dst". Substituting 'len', 'src' and 'dst' gives me: strncpy "copies at most 'sizeof(utmp.ut_host) + 1' characters from 'utmp.ut_host' into 'host'". As 'utmp.ut_host' is not guaranteed to be null-terminated by POSIX*, it can actually end up in the situation where it copies 'sizeof(utmp.ut_host) + 1' characters, which may leave 'host' unterminated. -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands From owner-svn-src-all@freebsd.org Sat Jan 27 22:49:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87DE3EC7E78; Sat, 27 Jan 2018 22:49:35 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 30EC97DAE3; Sat, 27 Jan 2018 22:49:35 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2140C10E64; Sat, 27 Jan 2018 22:49:35 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RMnYZN072409; Sat, 27 Jan 2018 22:49:34 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RMnYdL072408; Sat, 27 Jan 2018 22:49:34 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201801272249.w0RMnYdL072408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 27 Jan 2018 22:49:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328494 - head/lib/libcasper/services/cap_random X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_random X-SVN-Commit-Revision: 328494 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 22:49:35 -0000 Author: oshogbo Date: Sat Jan 27 22:49:34 2018 New Revision: 328494 URL: https://svnweb.freebsd.org/changeset/base/328494 Log: Document the random Casper service. Reviewed by: bcr@ Differential Revision: https://reviews.freebsd.org/D14072 Added: head/lib/libcasper/services/cap_random/cap_random.3 (contents, props changed) Added: head/lib/libcasper/services/cap_random/cap_random.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_random/cap_random.3 Sat Jan 27 22:49:34 2018 (r328494) @@ -0,0 +1,98 @@ +.\" Copyright (c) 2018 Mariusz Zaborski +.\" 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 AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 27, 2018 +.Dt CAP_RANDOM 3 +.Os +.Sh NAME +.Nm cap_random_buf +.Nd "library for getting entropy in capability mode" +.Sh LIBRARY +.Lb libcap_random +.Sh SYNOPSIS +.In sys/nv.h +.In libcasper.h +.In casper/cap_random.h +.Ft "int" +.Fn cap_random_buf "cap_channel_t *chan" "void *buf" "size_t nbytes" +.Sh DESCRIPTION +The function +.Fn cap_random_buf +is equivalent to +.Xr arc4random_buf 3 +except that the connection to the +.Nm system.random +service needs to be provided. +.Sh EXAMPLES +The following example first opens a capability to casper and then uses this +capability to create the +.Nm system.random +casper service to obtain entropy. +.Bd -literal +cap_channel_t *capcas, *caprandom; +unsigned char buf[16]; +int i; + +/* Open capability to Casper. */ +capcas = cap_init(); +if (capcas == NULL) + err(1, "Unable to contact Casper"); + +/* Enter capability mode sandbox. */ +if (cap_enter() < 0 && errno != ENOSYS) + err(1, "Unable to enter capability mode"); + +/* Use Casper capability to create capability to the system.random service. */ +caprandom = cap_service_open(capcas, "system.random"); +if (caprandom == NULL) + err(1, "Unable to open system.random service"); + +/* Close Casper capability, we don't need it anymore. */ +cap_close(capcas); + +/* Obtain entropy. */ +if (cap_random_buf(caprandom, buf, sizeof(buf)) < 0) + err(1, "Unable to obtain entropy"); + +for (i = 0; i < sizeof(buf); i++) + printf("%.2x ", buf[i]); +printf("\\n"); +.Ed +.Sh SEE ALSO +.Xr cap_enter 2 , +.Xr arc4random_buf 3 , +.Xr err 3 , +.Xr nv 3 , +.Xr capsicum 4 +.Sh AUTHORS +The +.Nm cap_random +service was implemented by +.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net +under sponsorship from the FreeBSD Foundation. +.Pp +This manual page was written by +.An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org . From owner-svn-src-all@freebsd.org Sat Jan 27 22:50:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E082EC7F54; Sat, 27 Jan 2018 22:50:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40E347DC4A; Sat, 27 Jan 2018 22:50:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B84C10E76; Sat, 27 Jan 2018 22:50:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RMoRUr072515; Sat, 27 Jan 2018 22:50:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RMoQk3072508; Sat, 27 Jan 2018 22:50:26 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801272250.w0RMoQk3072508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 22:50: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: r328495 - stable/11/usr.bin/dtc X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/dtc X-SVN-Commit-Revision: 328495 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 22:50:28 -0000 Author: kevans Date: Sat Jan 27 22:50:26 2018 New Revision: 328495 URL: https://svnweb.freebsd.org/changeset/base/328495 Log: MFC r320296, r328173: Update dtc(1) MFC r320296 (manu): dtc: Update to upstream 9ce35ff8 - Add "compatible with gpl dtc X.Y.Z" to version output so U-Boot doesn't complain - Fix cross reference node This fixes some Allwinner DTS (and probably others). MFC r328173: dtc(1): Update to upstream ea3c233 Highlights of this update: - /__local_fixups__ is now generated to be GPL dtc and libfdt compliant - Compiling with -@ will now cause dtc to assign phandles to all labelled nodes - /include/ and /incbin/ now handle absolute paths correctly - The manpage now has information about overlays, including how to apply them and how to generate them - Syntactic sugar for overlays is now supported, allowing an overlay DTS like: = /dts-v1/; /plugin/; &foo { foo,status = "okay"; }; = to generate a fragment targetting <&foo>. Modified: stable/11/usr.bin/dtc/Makefile stable/11/usr.bin/dtc/dtc.1 stable/11/usr.bin/dtc/dtc.cc stable/11/usr.bin/dtc/fdt.cc stable/11/usr.bin/dtc/fdt.hh stable/11/usr.bin/dtc/input_buffer.cc stable/11/usr.bin/dtc/input_buffer.hh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/dtc/Makefile ============================================================================== --- stable/11/usr.bin/dtc/Makefile Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/Makefile Sat Jan 27 22:50:26 2018 (r328495) @@ -4,8 +4,6 @@ PROG_CXX=dtc SRCS= dtc.cc input_buffer.cc string.cc dtb.cc fdt.cc checking.cc MAN= dtc.1 -WARNS?= 3 - CXXFLAGS+= -std=c++11 -fno-rtti -fno-exceptions NO_SHARED?=NO Modified: stable/11/usr.bin/dtc/dtc.1 ============================================================================== --- stable/11/usr.bin/dtc/dtc.1 Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/dtc.1 Sat Jan 27 22:50:26 2018 (r328495) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd January 1, 2013 +.Dd January 17, 2018 .Dt DTC 1 .Os .Sh NAME @@ -57,7 +57,7 @@ The .Nm utility converts flattened device tree (FDT) representations. - It is most commonly used to generate device tree blobs (DTB), the binary +It is most commonly used to generate device tree blobs (DTB), the binary representation of an FDT, from device tree sources (DTS), the ASCII text source representation. .Pp @@ -153,9 +153,9 @@ format for property values. These allow property value to be specified on the command line. .It Fl R Ar entries The number of empty reservation table entries to pad the table with. -This is -useful if you are generating a device tree blob for bootloader or similar that -needs to reserve some memory before passing control to the operating system. +This is useful if you are generating a device tree blob for bootloader or +similar that needs to reserve some memory before passing control to the +operating system. .It Fl S Ar bytes The minimum size in bytes of the blob. The blob will be padded after the strings table to ensure that it is the @@ -244,6 +244,54 @@ Checks that all .Va /delete-node/ statements refer to nodes that are merged. .El +.Sh OVERLAYS +The utility provides support for generating overlays, also known as plugins. +Overlays are a method of patching a base device tree that has been compiled with +the +.Fl @ +flag, with some limited support for patching device trees that were not compiled +with the +.Fl @ +flag. +.Pp +To denote that a DTS is intended to be used as an overlay, +.Va /plugin/; +should be included in the header, following any applicable +.Va /dts-v1/; +tag. +.Pp +Conventional overlays are crafted by creating +.Va fragment +nodes in a root. +Each fragment node must have either a +.Va target +property set to a label reference, or a +.Va target-path +string property set to a path. +It must then have an +.Va __overlay__ +child node, whose properties and child nodes are merged into the base device +tree when the overlay is applied. +.Pp +Much simpler syntactic sugar was later invented to simplify generating overlays. +Instead of creating targetted fragments manually, one can instead create a root +node that targets a label in the base node using the +.Va &label +syntax supported in conventional DTS. +This will indicate that a fragment should be generated for the node, with the +given +.Va label +being the target, and the properties and child nodes will be used as the +__overlay__. +.Pp +Both conventional overlays and the later-added syntactic sugar are supported. +.Pp +Overlay blobs can be applied at boot time by setting +.Va fdt_overlays +in +.Xr loader.conf 5 . +Multiple overlays may be specified, and they will be applied in the order given. +.El .Sh EXAMPLES The command: .Pp @@ -254,8 +302,7 @@ will generate a file from the device tree source .Pa device.dts and print errors if any occur during parsing or property checking. -The -resulting file can be assembled and linked into a binary. +The resulting file can be assembled and linked into a binary. .Pp The command: .Pp @@ -265,6 +312,33 @@ will write the device tree source for the device tree .Pa device.dtb to the standard output. This is useful when debugging device trees. +.Pp +The command: +.Pp +.Dl "dtc -@ -O dtb -I dts -o device.dtb device.dts" +.Pp +will generate a +.Pa device.dtb +file from the device tree source +.Pa device.dts +with a __symbols__ node included so that overlays may be applied to it. +.Pp +The command: +.Pp +.Dl "dtc -@ -O dtb -I dts -o device_overlay.dtbo device_overlay.dts" +.Pp +will generate a +.Pa device_overlay.dtbo +file, using the standard extension for a device tree overlay, from the device +tree source +.Pa device_overlay.dts . +A __symbols__ node will be included so that overlays may be applied to it. +The presence of a +.Va /plugin/; +directive in +.Pa device_overlay.dts +will indicate to the utility that it should also generate the underlying +metadata required in overlays. .Sh COMPATIBILITY This utility is intended to be compatible with the device tree compiler provided by elinux.org. Modified: stable/11/usr.bin/dtc/dtc.cc ============================================================================== --- stable/11/usr.bin/dtc/dtc.cc Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/dtc.cc Sat Jan 27 22:50:26 2018 (r328495) @@ -47,20 +47,25 @@ using namespace dtc; using std::string; +namespace { + /** * The current major version of the tool. */ int version_major = 0; +int version_major_compatible = 1; /** * The current minor version of the tool. */ int version_minor = 5; +int version_minor_compatible = 4; /** * The current patch level of the tool. */ int version_patch = 0; +int version_patch_compatible = 0; -static void usage(const string &argv0) +void usage(const string &argv0) { fprintf(stderr, "Usage:\n" "\t%s\t[-fhsv@] [-b boot_cpu_id] [-d dependency_file]" @@ -75,11 +80,15 @@ static void usage(const string &argv0) /** * Prints the current version of this program.. */ -static void version(const char* progname) +void version(const char* progname) { - fprintf(stderr, "Version: %s %d.%d.%d\n", progname, version_major, - version_minor, version_patch); + fprintf(stdout, "Version: %s %d.%d.%d compatible with gpl dtc %d.%d.%d\n", progname, + version_major, version_minor, version_patch, + version_major_compatible, version_minor_compatible, + version_patch_compatible); } + +} // Anonymous namespace using fdt::device_tree; Modified: stable/11/usr.bin/dtc/fdt.cc ============================================================================== --- stable/11/usr.bin/dtc/fdt.cc Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/fdt.cc Sat Jan 27 22:50:26 2018 (r328495) @@ -495,6 +495,29 @@ property::property(text_input_buffer &input, return; case '/': { + if (input.consume("/incbin/(\"")) + { + auto loc = input.location(); + std::string filename = input.parse_to('"'); + if (!(valid = input.consume('"'))) + { + loc.report_error("Syntax error, expected '\"' to terminate /incbin/("); + return; + } + property_value v; + if (!(valid = input.read_binary_file(filename, v.byte_data))) + { + input.parse_error("Cannot open binary include file"); + return; + } + if (!(valid &= input.consume(')'))) + { + input.parse_error("Syntax error, expected ')' to terminate /incbin/("); + return; + } + values.push_back(v); + break; + } unsigned long long bits = 0; valid = input.consume("/bits/"); input.next_token(); @@ -997,7 +1020,7 @@ node::get_property(const string &key) } void -node::merge_node(node_ptr other) +node::merge_node(node_ptr &other) { for (auto &l : other->labels) { @@ -1032,7 +1055,7 @@ node::merge_node(node_ptr other) { if (i->name == c->name && i->unit_address == c->unit_address) { - i->merge_node(std::move(c)); + i->merge_node(c); found = true; break; } @@ -1205,9 +1228,68 @@ device_tree::collect_names() collect_names_recursive(root, p); } +property_ptr +device_tree::assign_phandle(node *n, uint32_t &phandle) +{ + // If there is an existing phandle, use it + property_ptr p = n->get_property("phandle"); + if (p == 0) + { + p = n->get_property("linux,phandle"); + } + if (p == 0) + { + // Otherwise insert a new phandle node + property_value v; + while (used_phandles.find(phandle) != used_phandles.end()) + { + // Note that we only don't need to + // store this phandle in the set, + // because we are monotonically + // increasing the value of phandle and + // so will only ever revisit this value + // if we have used 2^32 phandles, at + // which point our blob won't fit in + // any 32-bit system and we've done + // something badly wrong elsewhere + // already. + phandle++; + } + push_big_endian(v.byte_data, phandle++); + if (phandle_node_name == BOTH || phandle_node_name == LINUX) + { + p.reset(new property("linux,phandle")); + p->add_value(v); + n->add_property(p); + } + if (phandle_node_name == BOTH || phandle_node_name == EPAPR) + { + p.reset(new property("phandle")); + p->add_value(v); + n->add_property(p); + } + } + + return (p); +} + void -device_tree::resolve_cross_references() +device_tree::assign_phandles(node_ptr &n, uint32_t &next) { + if (!n->labels.empty()) + { + assign_phandle(n.get(), next); + } + + for (auto &c : n->child_nodes()) + { + assign_phandles(c, next); + } +} + +void +device_tree::resolve_cross_references(uint32_t &phandle) +{ for (auto *pv : cross_references) { node_path path = node_paths[pv->string_data]; @@ -1224,9 +1306,9 @@ device_tree::resolve_cross_references() { pv->byte_data.push_back('@'); push_string(pv->byte_data, p->second); - pv->byte_data.push_back(0); } } + pv->byte_data.push_back(0); } } std::unordered_map phandle_set; @@ -1250,7 +1332,6 @@ device_tree::resolve_cross_references() }); assert(sorted_phandles.size() == fixups.size()); - uint32_t phandle = 1; for (auto &i : sorted_phandles) { string target_name = i.get().val.string_data; @@ -1332,43 +1413,7 @@ device_tree::resolve_cross_references() } } // If there is an existing phandle, use it - property_ptr p = target->get_property("phandle"); - if (p == 0) - { - p = target->get_property("linux,phandle"); - } - if (p == 0) - { - // Otherwise insert a new phandle node - property_value v; - while (used_phandles.find(phandle) != used_phandles.end()) - { - // Note that we only don't need to - // store this phandle in the set, - // because we are monotonically - // increasing the value of phandle and - // so will only ever revisit this value - // if we have used 2^32 phandles, at - // which point our blob won't fit in - // any 32-bit system and we've done - // something badly wrong elsewhere - // already. - phandle++; - } - push_big_endian(v.byte_data, phandle++); - if (phandle_node_name == BOTH || phandle_node_name == LINUX) - { - p.reset(new property("linux,phandle")); - p->add_value(v); - target->add_property(p); - } - if (phandle_node_name == BOTH || phandle_node_name == EPAPR) - { - p.reset(new property("phandle")); - p->add_value(v); - target->add_property(p); - } - } + property_ptr p = assign_phandle(target, phandle); p->begin()->push_to_buffer(i.get().val.byte_data); assert(i.get().val.byte_data.size() == 4); } @@ -1642,7 +1687,73 @@ device_tree::node_path::to_string() const return path; } +node_ptr +device_tree::create_fragment_wrapper(node_ptr &node, int &fragnum) +{ + // In a plugin, we can massage these non-/ root nodes into into a fragment + std::string fragment_address = "fragment@" + std::to_string(fragnum); + ++fragnum; + + std::vector symbols; + + // Intentionally left empty + node_ptr newroot = node::create_special_node("", symbols); + node_ptr wrapper = node::create_special_node("__overlay__", symbols); + + // Generate the fragment with target = <&name> + property_value v; + v.string_data = node->name; + v.type = property_value::PHANDLE; + auto prop = std::make_shared(std::string("target")); + prop->add_value(v); + symbols.push_back(prop); + + node_ptr fragment = node::create_special_node(fragment_address, symbols); + + wrapper->merge_node(node); + fragment->add_child(std::move(wrapper)); + newroot->add_child(std::move(fragment)); + return newroot; +} + +node_ptr +device_tree::generate_root(node_ptr &node, int &fragnum) +{ + + string name = node->name; + if (name == string()) + { + return std::move(node); + } + else if (!is_plugin) + { + return nullptr; + } + + return create_fragment_wrapper(node, fragnum); +} + void +device_tree::reassign_fragment_numbers(node_ptr &node, int &delta) +{ + + for (auto &c : node->child_nodes()) + { + if (c->name == std::string("fragment")) + { + int current_address = std::stoi(c->unit_address, nullptr, 16); + std::ostringstream new_address; + current_address += delta; + // It's possible that we hopped more than one somewhere, so just reset + // delta to the next in sequence. + delta = current_address + 1; + new_address << std::hex << current_address; + c->unit_address = new_address.str(); + } + } +} + +void device_tree::parse_dts(const string &fn, FILE *depfile) { auto in = input_buffer::buffer_for_file(fn); @@ -1663,6 +1774,7 @@ device_tree::parse_dts(const string &fn, FILE *depfile dirname(fn), depfile); bool read_header = false; + int fragnum = 0; parse_file(input, roots, read_header); switch (roots.size()) { @@ -1671,18 +1783,36 @@ device_tree::parse_dts(const string &fn, FILE *depfile input.parse_error("Failed to find root node /."); return; case 1: - root = std::move(roots[0]); + root = generate_root(roots[0], fragnum); + if (!root) + { + valid = false; + input.parse_error("Failed to find root node /."); + return; + } break; default: { - root = std::move(roots[0]); + root = generate_root(roots[0], fragnum); + if (!root) + { + valid = false; + input.parse_error("Failed to find root node /."); + return; + } for (auto i=++(roots.begin()), e=roots.end() ; i!=e ; ++i) { auto &node = *i; string name = node->name; if (name == string()) { - root->merge_node(std::move(node)); + if (is_plugin) + { + // Re-assign any fragment numbers based on a delta of + // fragnum before we merge it + reassign_fragment_numbers(node, fragnum); + } + root->merge_node(node); } else { @@ -1694,20 +1824,36 @@ device_tree::parse_dts(const string &fn, FILE *depfile } if (existing == node_names.end()) { - fprintf(stderr, "Unable to merge node: %s\n", name.c_str()); + if (is_plugin) + { + auto fragment = create_fragment_wrapper(node, fragnum); + root->merge_node(fragment); + } + else + { + fprintf(stderr, "Unable to merge node: %s\n", name.c_str()); + } } else { - existing->second->merge_node(std::move(node)); + existing->second->merge_node(node); } } } } } collect_names(); - resolve_cross_references(); + uint32_t phandle = 1; + // If we're writing symbols, go ahead and assign phandles to the entire + // tree. We'll do this before we resolve cross references, just to keep + // order semi-predictable and stable. if (write_symbols) { + assign_phandles(root, phandle); + } + resolve_cross_references(phandle); + if (write_symbols) + { std::vector symbols; // Create a symbol table. Each label in this device tree may be // referenced by other plugins, so we create a __symbols__ node inside @@ -1767,21 +1913,72 @@ device_tree::parse_dts(const string &fn, FILE *depfile } symbols.clear(); // If we have any resolved phandle references in this plugin, then - // we must leave a property in the /__local_fixups__ node whose key - // is 'fixup' and whose value is as described above. + // we must create a child in the __local_fixups__ node whose path + // matches the node path from the root and whose value contains the + // location of the reference within a property. + + // Create a local_fixups node that is initially empty. + node_ptr local_fixups = node::create_special_node("__local_fixups__", symbols); for (auto &i : fixups) { if (!i.val.is_phandle()) { continue; } - symbols.push_back(create_fixup_entry(i, "fixup")); + node *n = local_fixups.get(); + for (auto &p : i.path) + { + // Skip the implicit root + if (p.first.empty()) + { + continue; + } + bool found = false; + for (auto &c : n->child_nodes()) + { + if (c->name == p.first) + { + n = c.get(); + found = true; + break; + } + } + if (!found) + { + n->add_child(node::create_special_node(p.first, symbols)); + n = (--n->child_end())->get(); + } + } + assert(n); + property_value pv; + push_big_endian(pv.byte_data, static_cast(i.prop->offset_of_value(i.val))); + pv.type = property_value::BINARY; + auto key = i.prop->get_key(); + property_ptr prop = n->get_property(key); + // If we don't have an existing property then create one and + // use this property value + if (!prop) + { + prop = std::make_shared(std::move(key)); + n->add_property(prop); + prop->add_value(pv); + } + else + { + // If we do have an existing property value, try to append + // this value. + property_value &old_val = *(--prop->end()); + if (!old_val.try_to_merge(pv)) + { + prop->add_value(pv); + } + } } // We've iterated over all fixups, but only emit the // __local_fixups__ if we found some that were resolved internally. - if (!symbols.empty()) + if (local_fixups->child_begin() != local_fixups->child_end()) { - root->add_child(node::create_special_node("__local_fixups__", symbols)); + root->add_child(std::move(local_fixups)); } } } Modified: stable/11/usr.bin/dtc/fdt.hh ============================================================================== --- stable/11/usr.bin/dtc/fdt.hh Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/fdt.hh Sat Jan 27 22:50:26 2018 (r328495) @@ -368,7 +368,7 @@ class property /** * Returns the key for this property. */ - inline std::string get_key() + inline const std::string &get_key() { return key; } @@ -618,7 +618,7 @@ class node * Merges a node into this one. Any properties present in both are * overridden, any properties present in only one are preserved. */ - void merge_node(node_ptr other); + void merge_node(node_ptr &other); /** * Write this node to the specified output. Although nodes do not * refer to a string table directly, their properties do. The string @@ -674,12 +674,12 @@ class device_tree /** * The format that we should use for writing phandles. */ - phandle_format phandle_node_name; + phandle_format phandle_node_name = EPAPR; /** * Flag indicating that this tree is valid. This will be set to false * on parse errors. */ - bool valid; + bool valid = true; /** * Type used for memory reservations. A reservation is two 64-bit * values indicating a base address and length in memory that the @@ -773,23 +773,23 @@ class device_tree /** * The default boot CPU, specified in the device tree header. */ - uint32_t boot_cpu; + uint32_t boot_cpu = 0; /** * The number of empty reserve map entries to generate in the blob. */ - uint32_t spare_reserve_map_entries; + uint32_t spare_reserve_map_entries = 0; /** * The minimum size in bytes of the blob. */ - uint32_t minimum_blob_size; + uint32_t minimum_blob_size = 0; /** * The number of bytes of padding to add to the end of the blob. */ - uint32_t blob_padding; + uint32_t blob_padding = 0; /** * Is this tree a plugin? */ - bool is_plugin; + bool is_plugin = false; /** * Visit all of the nodes recursively, and if they have labels then add * them to the node_paths and node_names vectors so that they can be @@ -798,6 +798,12 @@ class device_tree */ void collect_names_recursive(node_ptr &n, node_path &path); /** + * Assign a phandle property to a single node. The next parameter + * holds the phandle to be assigned, and will be incremented upon + * assignment. + */ + property_ptr assign_phandle(node *n, uint32_t &next); + /** * Assign phandle properties to all nodes that have been referenced and * require one. This method will recursively visit the tree starting at * the node that it is passed. @@ -810,9 +816,11 @@ class device_tree /** * Resolves all cross references. Any properties that refer to another * node must have their values replaced by either the node path or - * phandle value. + * phandle value. The phandle parameter holds the next phandle to be + * assigned, should the need arise. It will be incremented upon each + * assignment of a phandle. */ - void resolve_cross_references(); + void resolve_cross_references(uint32_t &phandle); /** * Parses a dts file in the given buffer and adds the roots to the parsed * set. The `read_header` argument indicates whether the header has @@ -857,15 +865,33 @@ class device_tree /** * Default constructor. Creates a valid, but empty FDT. */ - device_tree() : phandle_node_name(EPAPR), valid(true), - boot_cpu(0), spare_reserve_map_entries(0), - minimum_blob_size(0), blob_padding(0) {} + device_tree() {} /** * Constructs a device tree from the specified file name, referring to * a file that contains a device tree blob. */ void parse_dtb(const std::string &fn, FILE *depfile); /** + * Construct a fragment wrapper around node. This will assume that node's + * name may be used as the target of the fragment, and the contents are to + * be wrapped in an __overlay__ node. The fragment wrapper will be assigned + * fragnumas its fragment number, and fragment number will be incremented. + */ + node_ptr create_fragment_wrapper(node_ptr &node, int &fragnum); + /** + * Generate a root node from the node passed in. This is sensitive to + * whether we're in a plugin context or not, so that if we're in a plugin we + * can circumvent any errors that might normally arise from a non-/ root. + * fragnum will be assigned to any fragment wrapper generated as a result + * of the call, and fragnum will be incremented. + */ + node_ptr generate_root(node_ptr &node, int &fragnum); + /** + * Reassign any fragment numbers from this new node, based on the given + * delta. + */ + void reassign_fragment_numbers(node_ptr &node, int &delta); + /* * Constructs a device tree from the specified file name, referring to * a file that contains device tree source. */ @@ -904,7 +930,10 @@ class device_tree */ void sort() { - root->sort(); + if (root) + { + root->sort(); + } } /** * Adds a path to search for include files. The argument must be a Modified: stable/11/usr.bin/dtc/input_buffer.cc ============================================================================== --- stable/11/usr.bin/dtc/input_buffer.cc Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/input_buffer.cc Sat Jan 27 22:50:26 2018 (r328495) @@ -204,9 +204,9 @@ text_input_buffer::handle_include() { next_token(); string name = parse_property_name(); - if (defines.count(name) > 0) + if (defines.count(name) == 0) { - reallyInclude = true; + reallyInclude = false; } consume('/'); } @@ -248,6 +248,48 @@ text_input_buffer::handle_include() return; } input_stack.push(std::move(include_buffer)); +} + +bool text_input_buffer::read_binary_file(const std::string &filename, byte_buffer &b) +{ + bool try_include_paths = true; + string include_file; + if (filename[0] == '/') + { + include_file = filename; + // Don't try include paths if we're given an absolute path. + // Failing is better so that we don't accidentally do the wrong thing, + // but make it seem like everything is alright. + try_include_paths = false; + } + else + { + include_file = dir + '/' + filename; + } + auto include_buffer = input_buffer::buffer_for_file(include_file, false); + if (include_buffer == 0 && try_include_paths) + { + for (auto i : include_paths) + { + include_file = i + '/' + filename; + include_buffer = input_buffer::buffer_for_file(include_file, false); + if (include_buffer != 0) + { + break; + } + } + } + if (!include_buffer) + { + return false; + } + if (depfile) + { + putc(' ', depfile); + fputs(include_file.c_str(), depfile); + } + b.insert(b.begin(), include_buffer->begin(), include_buffer->end()); + return true; } input_buffer Modified: stable/11/usr.bin/dtc/input_buffer.hh ============================================================================== --- stable/11/usr.bin/dtc/input_buffer.hh Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/input_buffer.hh Sat Jan 27 22:50:26 2018 (r328495) @@ -164,6 +164,14 @@ class input_buffer cursor++; return *this; } + const char *begin() + { + return buffer; + } + const char *end() + { + return buffer + size; + } /** * Consumes a character. Moves the cursor one character forward if the * next character matches the argument, returning true. If the current @@ -523,6 +531,13 @@ class text_input_buffer * Prints a message indicating the location of a parse error. */ void parse_error(const char *msg); + /** + * Reads the contents of a binary file into `b`. The file name is assumed + * to be relative to one of the include paths. + * + * Returns true if the file exists and can be read, false otherwise. + */ + bool read_binary_file(const std::string &filename, byte_buffer &b); private: /** * Prints a message indicating the location of a parse error, given a From owner-svn-src-all@freebsd.org Sat Jan 27 22:53:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27CC9EC84C1; Sat, 27 Jan 2018 22:53:29 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BC1A7E101; Sat, 27 Jan 2018 22:53:29 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 963851101A; Sat, 27 Jan 2018 22:53:29 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RMrTEW077080; Sat, 27 Jan 2018 22:53:29 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RMrTIc077079; Sat, 27 Jan 2018 22:53:29 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201801272253.w0RMrTIc077079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 27 Jan 2018 22:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328496 - head/lib/libcasper/libcasper X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/libcasper X-SVN-Commit-Revision: 328496 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 22:53:30 -0000 Author: oshogbo Date: Sat Jan 27 22:53:29 2018 New Revision: 328496 URL: https://svnweb.freebsd.org/changeset/base/328496 Log: Fix caspermock - the cap_recv_nvlist should return nvlist. Modified: head/lib/libcasper/libcasper/libcasper.h Modified: head/lib/libcasper/libcasper/libcasper.h ============================================================================== --- head/lib/libcasper/libcasper/libcasper.h Sat Jan 27 22:50:26 2018 (r328495) +++ head/lib/libcasper/libcasper/libcasper.h Sat Jan 27 22:53:29 2018 (r328496) @@ -232,7 +232,7 @@ int cap_send_nvlist(const cap_channel_t *chan, const n #ifdef WITH_CASPER nvlist_t *cap_recv_nvlist(const cap_channel_t *chan, int flags); #else -#define cap_recv_nvlist(chan, flags) (0) +#define cap_recv_nvlist(chan, flags) (nvlist_create(flags)) #endif /* From owner-svn-src-all@freebsd.org Sat Jan 27 22:57:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 951B4EC8853; Sat, 27 Jan 2018 22:57:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 44C057E366; Sat, 27 Jan 2018 22:57:02 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3FA0711022; Sat, 27 Jan 2018 22:57:02 +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 w0RMv2ld077273; Sat, 27 Jan 2018 22:57:02 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RMv2qV077272; Sat, 27 Jan 2018 22:57:02 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801272257.w0RMv2qV077272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 27 Jan 2018 22:57:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328497 - head/sbin/pfctl X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/sbin/pfctl X-SVN-Commit-Revision: 328497 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 22:57:02 -0000 Author: pfg Date: Sat Jan 27 22:57:01 2018 New Revision: 328497 URL: https://svnweb.freebsd.org/changeset/base/328497 Log: pfctl(8): Fix two wrong conditions. Caught by gcc80's -Wtautological-compare option. MFC after: 5 days Approved by: kp Obtained from: DragonFlyBSD (git e3cdbf6c) Differential Revision: https://reviews.freebsd.org/D14083 Modified: head/sbin/pfctl/pfctl_optimize.c Modified: head/sbin/pfctl/pfctl_optimize.c ============================================================================== --- head/sbin/pfctl/pfctl_optimize.c Sat Jan 27 22:53:29 2018 (r328496) +++ head/sbin/pfctl/pfctl_optimize.c Sat Jan 27 22:57:01 2018 (r328497) @@ -1092,7 +1092,7 @@ skip_cmp_dst_addr(struct pf_rule *a, struct pf_rule *b return (0); case PF_ADDR_DYNIFTL: if (strcmp(a->dst.addr.v.ifname, b->dst.addr.v.ifname) != 0 || - a->dst.addr.iflags != a->dst.addr.iflags || + a->dst.addr.iflags != b->dst.addr.iflags || memcmp(&a->dst.addr.v.a.mask, &b->dst.addr.v.a.mask, sizeof(a->dst.addr.v.a.mask))) return (1); @@ -1164,7 +1164,7 @@ skip_cmp_src_addr(struct pf_rule *a, struct pf_rule *b return (0); case PF_ADDR_DYNIFTL: if (strcmp(a->src.addr.v.ifname, b->src.addr.v.ifname) != 0 || - a->src.addr.iflags != a->src.addr.iflags || + a->src.addr.iflags != b->src.addr.iflags || memcmp(&a->src.addr.v.a.mask, &b->src.addr.v.a.mask, sizeof(a->src.addr.v.a.mask))) return (1); From owner-svn-src-all@freebsd.org Sat Jan 27 22:57:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42D88EC888A; Sat, 27 Jan 2018 22:57:09 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6EDBE7E3CA; Sat, 27 Jan 2018 22:57:07 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C611611023; Sat, 27 Jan 2018 22:57:06 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RMv61R077321; Sat, 27 Jan 2018 22:57:06 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RMv6Wb077320; Sat, 27 Jan 2018 22:57:06 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201801272257.w0RMv6Wb077320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 27 Jan 2018 22:57:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328498 - head/lib/libcasper/services/cap_random X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/services/cap_random X-SVN-Commit-Revision: 328498 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 22:57:09 -0000 Author: oshogbo Date: Sat Jan 27 22:57:06 2018 New Revision: 328498 URL: https://svnweb.freebsd.org/changeset/base/328498 Log: Add cap_random.3 to build system. This should be done with r328494. Modified: head/lib/libcasper/services/cap_random/Makefile Modified: head/lib/libcasper/services/cap_random/Makefile ============================================================================== --- head/lib/libcasper/services/cap_random/Makefile Sat Jan 27 22:57:01 2018 (r328497) +++ head/lib/libcasper/services/cap_random/Makefile Sat Jan 27 22:57:06 2018 (r328498) @@ -21,4 +21,9 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +MAN+= cap_random.3 + +MLINKS+=cap_random.3 libcap_random.3 +MLINKS+=cap_random.3 cap_random_buf.3 + .include From owner-svn-src-all@freebsd.org Sat Jan 27 22:58:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59744EC8A7D for ; Sat, 27 Jan 2018 22:58:57 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic312-36.consmr.mail.ne1.yahoo.com (sonic312-36.consmr.mail.ne1.yahoo.com [66.163.191.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E80707E639 for ; Sat, 27 Jan 2018 22:58:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1517093936; bh=BfEGz7TEtJLG3i+jJCI6ml2izEOfwY/agIzWT7aCHIc=; h=Subject:From:To:References:Date:In-Reply-To:From:Subject; b=Rn2UUxsReAkZMOecG1MS/iW+5ekzzSk2DUw2k065wFJt8dEvL0aS76JErBm5PM9fVANfvak/YyhHDgGaf4MT0jJ9fFV2KuuAxEe8fjQps979uk3m/V8k2bBlOW2lpjXmg4UzBMQHvlBFg82dwYCuWomb79K6ESar4+X1Lo8UlNbiIHTnZpDdchTsYEQ0rgD3NJq6hJa2DPruGKpszqpYEem96tlzoQpFum0BAl30iU3G720SNtmEkkeTrA1Pgzomwxs1nWtuBpZtqVIjhes4UnBdnGtGaW8JuYphZwaa1rhfqSsLFhknpt8vhPivCSWxLRZXnkv+POgTDtaE71U4rw== X-YMail-OSG: yZgq9xUVM1kn55b9JfHAXFC8UmcGvdfKDmRvzvp25718rJ5g.K9E8d9XaHFceuE wQELONWXrIhCyynAQRixN4DRCTWSDacvvF6_94GCB9QZhTy_eEvpe_PFYSDkagd7FiJ3X3S18Lye ygnx_0SacUGwi8CTMcrrN46fw6IRXcPQ_XopcesZ7Hw02LjgSo0pLzLfETSjj86CxsacEQLFowMP fHJkHp2K9jbYCT8SHTyTAyfNSuzuH6CehmQmpyZxKC1u35uQcxhL.yjwjyralWiB5mKPKRnjKVA3 B6UhWNmHwMh4XClHSCJXT8LZgvKLfDmRguVsXbZF1HPrIK4Yt_E19SCVjYqseuLkgdyfFa4xc_nG MhubJ7lc9TTTJJ1YrWtecWoq6JmG1LvrzI9u7CHSyDNG9BAe6odVx85VOdmCtrQ9KpWq.te5evse kFizo0jVIb28ymLu3TN.8VDBRstRmBA8ZulTpSgCS7kAR88PSHjTmK0xEAnsLntAa0sI5lSbrCMX AAl1x3npcIg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ne1.yahoo.com with HTTP; Sat, 27 Jan 2018 22:58:56 +0000 Received: from smtpgate103.mail.ne1.yahoo.com (EHLO [192.168.0.8]) ([216.155.193.162]) by smtp415.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID d3d43b418667210d2593a20331613847; Sat, 27 Jan 2018 22:58:51 +0000 (UTC) Subject: Re: svn commit: r328493 - head/lib/libthr/thread From: Pedro Giffuni To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801272227.w0RMRtmk062757@repo.freebsd.org> Message-ID: <7fe99389-750d-78f5-fd55-2c63bf814019@FreeBSD.org> Date: Sat, 27 Jan 2018 17:58:51 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <201801272227.w0RMRtmk062757@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 22:58:57 -0000 For the record ... On 01/27/18 17:27, Pedro F. Giffuni wrote: > Author: pfg > Date: Sat Jan 27 22:27:55 2018 > New Revision: 328493 > URL: https://svnweb.freebsd.org/changeset/base/328493 > > Log: > libthr: Fix missing break in switch. > Hmm.. There is no "missing break" I just copy/pasted the Coverity report (a false positive). Sorry if that confused people. Pedro. > This is also a warning in recent GCC with -Wimplicit-fallthrough. > > CID: 1356262 > Obtained from: DragonFly (git 0f037c78 - partial) > > Modified: > head/lib/libthr/thread/thr_printf.c > > Modified: head/lib/libthr/thread/thr_printf.c > ============================================================================== > --- head/lib/libthr/thread/thr_printf.c Sat Jan 27 22:16:19 2018 (r328492) > +++ head/lib/libthr/thread/thr_printf.c Sat Jan 27 22:27:55 2018 (r328493) > @@ -95,6 +95,7 @@ next: c = *fmt++; > case 'p': > pstr(fd, "0x"); > islong = 1; > + /* FALLTHROUGH */ > case 'd': > case 'u': > case 'x': > From owner-svn-src-all@freebsd.org Sat Jan 27 23:02:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C336EC8CDB; Sat, 27 Jan 2018 23:02:22 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f47.google.com (mail-it0-f47.google.com [209.85.214.47]) (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 BED007EA63; Sat, 27 Jan 2018 23:02:21 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f47.google.com with SMTP id 196so5437713iti.5; Sat, 27 Jan 2018 15:02:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=I/GnOTP7UbI++Hxa6lGaKTc9tY64cZ+vEypJ/vZZ8Xk=; b=PuPbXUvZTo03lNaFTjmdPwUDJVcZvmTEyPNG5+7U8Qi6xby/XLN2e/IVGXPYWL8W9h BbPFXWW9mqjJLlkIKFecL9E2zDudwls2be9I05Vb0qCOvApRmC+1gdnF2KGnPq6nQDZu LNPZ4YmPdPGV1nslKb5ejnoF7xgFQsvyraRyO9irZoWFb+EAbOS3bU0TLZ53OxF/kSDf /nbJ6ZqQW14xhaAwj+0CYRg1Wkd8ebva2Cdph8aMU9TwZ7tI9qS1CQowUPK/11ZZz7WB Y+Wo1q5Tmw/t5YFXaCFHGDVAhSSbdz4uY3PRsS/BD2o08JUBEEsWKSfBdTztiq7s/1rF J+YQ== X-Gm-Message-State: AKwxytd+iTl/V4rRHaaoAB43MiZ0m5eO269VbT1aqbI61bi4j+Fv+p5o 8HsuCDijiF+cDiHa7rdJylW0fTQj X-Google-Smtp-Source: AH8x224z7EU5cozHuDtyOgd4xbOOR9eyOKZwog5/k1ClJivz/2aNjmv5ceENf6g7gVaIjvseCxMmmg== X-Received: by 10.36.80.135 with SMTP id m129mr22562811itb.134.1517093787962; Sat, 27 Jan 2018 14:56:27 -0800 (PST) Received: from mail-io0-f178.google.com (mail-io0-f178.google.com. [209.85.223.178]) by smtp.gmail.com with ESMTPSA id 82sm2223542iod.54.2018.01.27.14.56.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Jan 2018 14:56:27 -0800 (PST) Received: by mail-io0-f178.google.com with SMTP id m11so3964393iob.2; Sat, 27 Jan 2018 14:56:27 -0800 (PST) X-Received: by 10.107.35.84 with SMTP id j81mr19982242ioj.226.1517093787325; Sat, 27 Jan 2018 14:56:27 -0800 (PST) MIME-Version: 1.0 References: <201801271743.w0RHh9io022619@repo.freebsd.org> <1f1eb186-8f7b-6ec9-0970-d8b82b909e7b@FreeBSD.org> In-Reply-To: <1f1eb186-8f7b-6ec9-0970-d8b82b909e7b@FreeBSD.org> From: Conrad Meyer Date: Sat, 27 Jan 2018 22:56:17 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r328486 - head/usr.bin/fortune/fortune To: Pedro Giffuni Cc: cem@freebsd.org, src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 23:02:22 -0000 I don=E2=80=99t think dragonfly has anything to do with this? If you=E2=80= =99re converting bool increments to setting true values in FreeBSD, use =E2=80=9Ctrue.=E2=80= =9D That=E2=80=99s all there is to it. Best, Conrad On Sat, Jan 27, 2018 at 1:44 PM Pedro Giffuni wrote: > Hi; > > > On 01/27/18 14:56, Conrad Meyer wrote: > > We can use 'true' and 'false' now. (style(9) also suggests using the > > C99 names instead of TRUE/FALSE.) > > Yes, I noticed that change in DragonflyBSD but it is conceptually a > different change and it deserves a different commit. > > Pedro. > > > On Sat, Jan 27, 2018 at 9:43 AM, Pedro F. Giffuni > wrote: > >> Author: pfg > >> Date: Sat Jan 27 17:43:09 2018 > >> New Revision: 328486 > >> URL: https://svnweb.freebsd.org/changeset/base/328486 > >> > >> Log: > >> fortune(6): Fix gcc80 -Wbool-operation warnings. > >> > >> Hinted by: Dragonfly (git > 4d1086765752f0569497d06460d95117c74f33ac) > >> > >> Modified: > >> head/usr.bin/fortune/fortune/fortune.c > >> > >> Modified: head/usr.bin/fortune/fortune/fortune.c > >> > =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/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:24:59 > 2018 (r328485) > >> +++ head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:43:09 > 2018 (r328486) > >> @@ -289,35 +289,35 @@ getargs(int argc, char *argv[]) > >> #endif /* DEBUG */ > >> switch(ch) { > >> case 'a': /* any fortune */ > >> - All_forts++; > >> + All_forts =3D TRUE; > >> break; > >> #ifdef DEBUG > >> case 'D': > >> Debug++; > >> break; > >> #endif /* DEBUG */ > >> - case 'e': > >> - Equal_probs++; /* scatter un-allocted prob > equally */ > >> + case 'e': /* scatter un-allocted prob > equally */ > >> + Equal_probs =3D TRUE; > >> break; > >> case 'f': /* find fortune files */ > >> - Find_files++; > >> + Find_files =3D TRUE; > >> break; > >> case 'l': /* long ones only */ > >> - Long_only++; > >> + Long_only =3D TRUE; > >> Short_only =3D FALSE; > >> break; > >> case 'o': /* offensive ones only */ > >> - Offend++; > >> + Offend =3D TRUE; > >> break; > >> case 's': /* short ones only */ > >> - Short_only++; > >> + Short_only =3D TRUE; > >> Long_only =3D FALSE; > >> break; > >> case 'w': /* give time to read */ > >> - Wait++; > >> + Wait =3D TRUE; > >> break; > >> case 'm': /* dump out the > fortunes */ > >> - Match++; > >> + Match =3D TRUE; > >> pat =3D optarg; > >> break; > >> case 'i': /* case-insensitive > match */ > >> > > From owner-svn-src-all@freebsd.org Sat Jan 27 23:06:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 257A4EC90C5 for ; Sat, 27 Jan 2018 23:06:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic314-35.consmr.mail.ne1.yahoo.com (sonic314-35.consmr.mail.ne1.yahoo.com [66.163.189.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAED07EC75 for ; Sat, 27 Jan 2018 23:06:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1517094367; bh=GOKw3rL1ObrJadA3dFrNifKVveMEk3tx39JHIwo/gXQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=TMYupulUD/nhghqYslhFt6flqMTSXaDmQB+G45k18umI13/CEInUjDmaEbwa5Wqpa1DhZkFiMe1kcqV9GSeYk9ml91KjDLqkXkXxE6zqjldRmlicnZ51Y+2Ql3XTz6fiqYHS3kBNhjTQCaLWiY9I87SxtBjlJEhlvlGLEW+XuCeQ5kK0VR+dw6mH3UV6hNV3i6M0HTKQARB1gx9vPsjM+0aKQNlo+l6kmjs0fKwxnlmuz7/ZCXvBllhMUwYWhjMGdXo8So8rlP7Mgd+1rxS3XXCxfzqP9wwYruBLy8tizxRDuoMtW1/mm9uf74HbAPwZAxW7lWE1Sg6VSTinqCAC9A== X-YMail-OSG: bNiz0UMVM1lCi7NbUftJAgY_wDH3zwnhSneVeby4xzR3U0fs.D9Tm4BpMSSnlHg Vl3IN.2UxU8gfEm6v74RPcN684.UQzBedhxlxweVVXcL.oTHzrrGvlxTTYPxH4P1wyvwRYlRAAxm qxxbClrCXzlIUCmhZnw1wP0069GHVn23ilZzvx21FmHP4ePYOhfYbtNE3SdBVuoV1LA3J4PvH_hZ CkFuz4gHDuzihKqLwCy7DibGPbPq.4.Ys.nVVfeoXK6qb9ZjT5Edf.tDuhIUaL8N.7STaDZRixmA .EcTa_YtUo8qpSPcqY4mL4u6M8LZKOG_UW.A7zdCxuv2MieOu8MOLajRnb4ZOqr3rNX12Rlo90Oa 2ypE0ZAAK66oDEB1emBAFDk_BPA7Up1Kq3SYWfVpmmaq_7npjL3MlCrEG4DbGCLRwnSO.1kSM6fd 3TZzAuRMIgBDiy0x.vfbRzT9XsEdVnwG1BAtArLj0zup_NrGD4DDuLc5AaTLXCLcrBoMr1COw.CJ 2Ub.n7tMJEg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.ne1.yahoo.com with HTTP; Sat, 27 Jan 2018 23:06:07 +0000 Received: from smtpgate105.mail.ne1.yahoo.com (EHLO [192.168.0.8]) ([216.155.193.135]) by smtp410.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 7f5d7920bbbdd9344de8cb8ef9f92715; Sat, 27 Jan 2018 23:06:03 +0000 (UTC) Subject: Re: svn commit: r328486 - head/usr.bin/fortune/fortune To: Conrad Meyer Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201801271743.w0RHh9io022619@repo.freebsd.org> <1f1eb186-8f7b-6ec9-0970-d8b82b909e7b@FreeBSD.org> From: Pedro Giffuni Message-ID: Date: Sat, 27 Jan 2018 18:06:02 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 23:06:09 -0000 On 01/27/18 17:56, Conrad Meyer wrote: > I don’t think dragonfly has anything to do with this?  If you’re > converting bool increments to setting true values in FreeBSD, use > “true.”  That’s all there is to it. > s/TRUE/true/ s/FALSE/false/ Then remove the two #defines for TRUE and FALSE, but I am on my way out, so feel free to do the change :). Pedro. > Best, > Conrad > > On Sat, Jan 27, 2018 at 1:44 PM Pedro Giffuni > wrote: > > Hi; > > > On 01/27/18 14:56, Conrad Meyer wrote: > > We can use 'true' and 'false' now.  (style(9) also suggests > using the > > C99 names instead of TRUE/FALSE.) > > Yes, I noticed that change in DragonflyBSD but it is conceptually a > different change and it deserves a different commit. > > Pedro. > > > On Sat, Jan 27, 2018 at 9:43 AM, Pedro F. Giffuni > > wrote: > >> Author: pfg > >> Date: Sat Jan 27 17:43:09 2018 > >> New Revision: 328486 > >> URL: https://svnweb.freebsd.org/changeset/base/328486 > >> > >> Log: > >>    fortune(6): Fix gcc80 -Wbool-operation warnings. > >> > >>    Hinted by:    Dragonfly (git > 4d1086765752f0569497d06460d95117c74f33ac) > >> > >> Modified: > >>    head/usr.bin/fortune/fortune/fortune.c > >> > >> Modified: head/usr.bin/fortune/fortune/fortune.c > >> > ============================================================================== > >> --- head/usr.bin/fortune/fortune/fortune.c      Sat Jan 27 > 17:24:59 2018        (r328485) > >> +++ head/usr.bin/fortune/fortune/fortune.c      Sat Jan 27 > 17:43:09 2018        (r328486) > >> @@ -289,35 +289,35 @@ getargs(int argc, char *argv[]) > >>   #endif /* DEBUG */ > >>                  switch(ch) { > >>                  case 'a':               /* any fortune */ > >> -                       All_forts++; > >> +                       All_forts = TRUE; > >>                          break; > >>   #ifdef DEBUG > >>                  case 'D': > >>                          Debug++; > >>                          break; > >>   #endif /* DEBUG */ > >> -               case 'e': > >> -                       Equal_probs++;  /* scatter un-allocted > prob equally */ > >> +               case 'e':               /* scatter un-allocted > prob equally */ > >> +                       Equal_probs = TRUE; > >>                          break; > >>                  case 'f':               /* find fortune files */ > >> -                       Find_files++; > >> +                       Find_files = TRUE; > >>                          break; > >>                  case 'l':               /* long ones only */ > >> -                       Long_only++; > >> +                       Long_only = TRUE; > >>                          Short_only = FALSE; > >>                          break; > >>                  case 'o':               /* offensive ones only */ > >> -                       Offend++; > >> +                       Offend = TRUE; > >>                          break; > >>                  case 's':               /* short ones only */ > >> -                       Short_only++; > >> +                       Short_only = TRUE; > >>                          Long_only = FALSE; > >>                          break; > >>                  case 'w':               /* give time to read */ > >> -                       Wait++; > >> +                       Wait = TRUE; > >>                          break; > >>                  case 'm':                       /* dump out > the fortunes */ > >> -                       Match++; > >> +                       Match = TRUE; > >>                          pat = optarg; > >>                          break; > >>                  case 'i':                       /* > case-insensitive match */ > >> > From owner-svn-src-all@freebsd.org Sat Jan 27 23:09:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50720EC92E8 for ; Sat, 27 Jan 2018 23:09:03 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (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 BF7047EE45 for ; Sat, 27 Jan 2018 23:09:02 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 0c514b55-03b7-11e8-b951-f99fef315fd9 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id 0c514b55-03b7-11e8-b951-f99fef315fd9; Sat, 27 Jan 2018 23:08:56 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w0RN8xgh003213; Sat, 27 Jan 2018 16:08:59 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1517094539.1517.9.camel@freebsd.org> Subject: Re: svn commit: r328486 - head/usr.bin/fortune/fortune From: Ian Lepore To: Conrad Meyer , Pedro Giffuni Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sat, 27 Jan 2018 16:08:59 -0700 In-Reply-To: References: <201801271743.w0RHh9io022619@repo.freebsd.org> <1f1eb186-8f7b-6ec9-0970-d8b82b909e7b@FreeBSD.org> Content-Type: text/plain; charset="iso-8859-13" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 23:09:03 -0000 On Sat, 2018-01-27 at 22:56 +0000, Conrad Meyer wrote: > I dont think dragonfly has anything to do with this?If youre > converting > bool increments to setting true values in FreeBSD, use > true.Thats all > there is to it. > > Best, > Conrad style(9) emphasizes internal consistancy in several places. The uppercase TRUE/FALSE is currently the style within that code, so it makes sense to stick with it. If a (somewhat gratuitous) conversion to the new style is made, it should be a separate commit just for that, emphasizing that it changes just style and not functionality. -- Ian From owner-svn-src-all@freebsd.org Sat Jan 27 23:12:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A068EC9693; Sat, 27 Jan 2018 23:12:31 +0000 (UTC) (envelope-from jason.harmening@gmail.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 D3BC17F25E; Sat, 27 Jan 2018 23:12:30 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: by mail-io0-x22d.google.com with SMTP id 25so3981515ioj.9; Sat, 27 Jan 2018 15:12:30 -0800 (PST) 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=23Gy77FC4QzLvIEEc//QciW+5LhKQOp2I/KHMkJpp2g=; b=AcMmASNrwbsEiBQu8OF2MMXU9yVDwmm9RCE+q+bTr2+nJ6mToTQKrGo6s6upPSxQlR IFKxsq/rLQKzjaBxcHYtdT1Bf8fnX0E5izri8vJJree48HeAKh/l+dd94xp+c7XzbhaB 2PcKSrgXpA3FY+DkAECrLkIwnkQfSARsrNQqbxLz+Tl1FqFb6Ym7gJrQUVE9ST/+LNiR WwIUfZJGjdzOTkjlSv+cVABoKLXM+jWDk0Nct/JVePc7DNuhsj2DYog66RFpEWQ8MDui crNkbV7pV8trJ8NwqBtFF4+gqWhc5gU6GDpeWfaQuXyMsQo+0qjBIujqZbRzMAaRuHAr JDrw== 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=23Gy77FC4QzLvIEEc//QciW+5LhKQOp2I/KHMkJpp2g=; b=uGe6OvCyMf0YZjVpcJ8jyj9rffDmGnRV9fpYNucTRIVA4ALtAvePexEDNXQj5EDKry 9LUI8KQZtThPhOFQ/6LN0MRlbt+ERta2DSUv3SQFipyHf2C4I8SbCkXfRkzEMkd+6MVQ O9OGQL67r80V2UXe7bWuWGMJ4rtzVLIZJ5bGap5P1eZ49TdxOy5SCb1pPtqqS8oG9e9c W7V+UwMxxZxkkAvOFPsYcqJNbhG11nHe8nF7at05R3/YAgC+8ghl38fehEWoJ3VL8POq MhZsLTtHYw7sPJ0MeIQv4QFANcteVe6LI1mAGiUn73YHnIQzoakD09TaXp+epJz6S3A2 8lvA== X-Gm-Message-State: AKwxytc2e4UN7tni+Kl8S0rIM+8YRHbfLsOTbCrlQDGcSV7NNjP0A1rW 7AXgJYyBZ/SkMHWfHQGi81BobAH8ibc0zuOQeA== X-Google-Smtp-Source: AH8x227f+N1V9QDCgoUQabygXOpq3vuIEbT8PepaH6o491WC/4+useVrsvfXT6Hj+dBK9qqf5KH3HPs/Fyrq7qK+dtg= X-Received: by 10.107.173.17 with SMTP id w17mr20393381ioe.262.1517094750069; Sat, 27 Jan 2018 15:12:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.136.103 with HTTP; Sat, 27 Jan 2018 15:12:29 -0800 (PST) In-Reply-To: <20180127214755.3c59661e@thor.intern.walstatt.dynvpn.de> References: <201801272013.w0RKDaMU098200@repo.freebsd.org> <20180127214755.3c59661e@thor.intern.walstatt.dynvpn.de> From: Jason Harmening Date: Sat, 27 Jan 2018 15:12:29 -0800 Message-ID: Subject: Re: svn commit: r328489 - head/sys/conf To: "O. Hartmann" Cc: "Jason A. Harmening" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 23:12:31 -0000 On Sat, Jan 27, 2018 at 12:47 PM, O. Hartmann wrote: > Am Sat, 27 Jan 2018 20:13:36 +0000 (UTC) > "Jason A. Harmening" schrieb: > > > Author: jah > > Date: Sat Jan 27 20:13:36 2018 > > New Revision: 328489 > > URL: https://svnweb.freebsd.org/changeset/base/328489 > > > > Log: > > Remove system makefile path directives from env passed to > PORTS_MODULES step > > > > Previously, MAKESYSPATH as well as '-m' directives in MAKEFLAGS would > cause > > any port rebuilt during the PORTS_MODULES stage to consume system > makefiles > > from $(SRCROOT)/share/mk instead of those installed under > /usr/share/mk. > > For kernel modules that need to build against an updated src tree thi= s > > makes sense; less so for or any userspace library or > utility > > the port may also happen to install. > > > > Before 11.0, this probably didn't matter much in practice. But the > addition > > of src.libnames.mk under $(SRCROOT)/share/mk in 11.0 breaks any > consumer of > > bsd.prog.mk and DPADD/LDADD during PORTS_MODULES. > > > > Address the build breakage by removing MAKESYSPATH and any occurrence > of > > '-m' from MAKEFLAGS in the environment created for the port build. > > Instead set SYSDIR so that any kmod built by the port will still > consume > > conf/kmod.mk from the updated src tree, assuming it uses > > > > Reviewed by: bdrewery > > MFC after: 2 weeks > > Differential Revision: https://reviews.freebsd.org/D13053 > > > > Modified: > > head/sys/conf/kern.post.mk > > > > Modified: head/sys/conf/kern.post.mk > > =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/sys/conf/kern.post.mk Sat Jan 27 19:23:42 2018 > (r328488) > > +++ head/sys/conf/kern.post.mk Sat Jan 27 20:13:36 2018 > (r328489) > > @@ -69,6 +69,9 @@ PORTSMODULESENV=3D\ > > -u CC \ > > -u CXX \ > > -u CPP \ > > + -u MAKESYSPATH \ > > + MAKEFLAGS=3D"${MAKEFLAGS:M*:tW:S/^-m /-m_/g:S/ -m / > -m_/g:tw:N-m_*}" \ > > + SYSDIR=3D${SYSDIR} \ > > PATH=3D${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \ > > SRC_BASE=3D${SRC_BASE} \ > > OSVERSION=3D${OSRELDATE} \ > > _______________________________________________ > > svn-src-head@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/svn-src-head > > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > > This happens now if PORTS_MODULE=3Dx11/nvidia-driver is defined in > /etc/src.conf: > > [...] > --- kernel-install --- > mkdir -p /boot/kernel > install -p -m 555 -o root -g wheel kernel /boot/kernel/ > --- ports-install --- > Variable OBJTOP is recursive. > > make[8]: stopped > in /usr/obj/usr/src/amd64.amd64/sys/FY/usr/ports/x11/nvidia- > driver/work/NVIDIA-FreeBSD-x86_64-387.34/src/nvidia > *** Error code 2 > > Stop. > make[7]: stopped > in /usr/obj/usr/src/amd64.amd64/sys/THOR/usr/ports/x11/nvidia- > driver/work/NVIDIA-FreeBSD-x86_64-387.34/src > *** Error code 1 > Hmm, I haven't been able to reproduce this locally so far. What command are you running? Can you post the contents of make.conf and src.conf ? > > -- > O. Hartmann > > Ich widerspreche der Nutzung oder =C3=9Cbermittlung meiner Daten f=C3=BCr > Werbezwecke oder f=C3=BCr die Markt- oder Meinungsforschung (=C2=A7 28 Ab= s. 4 BDSG). > From owner-svn-src-all@freebsd.org Sat Jan 27 23:14:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EED71EC987B; Sat, 27 Jan 2018 23:14:46 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 5C7CF7F50B; Sat, 27 Jan 2018 23:14:45 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id 38CD427397; Sat, 27 Jan 2018 23:14:44 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w0RNESIe072044 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 27 Jan 2018 23:14:28 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0RNERXg072043; Sat, 27 Jan 2018 23:14:27 GMT (envelope-from phk) To: Emmanuel Vadot cc: Warner Losh , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <72041.1517094867.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Sat, 27 Jan 2018 23:14:27 +0000 Message-ID: <72042.1517094867@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 23:14:47 -0000 -------- In message <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com>, Emm= anuel Vadot writes: > - We have a commiter that commited something for his own need: he >wanted to use the pwm on his rpi, coded a driver (this part is good) >but feel that the standard we were using was crap and commited his work >without talking with arm developper on what the proper way to do it was. First, as a general rule, I think you should leave it to me to express what I think and feel, because you truly suck at it. FDT may or may not be the right technology to use, I take no position on that, because I am not the one doing all the work to implement it, and I certainly don't propose to do the work to come up with an alternative. > - Now we have a crappy driver in the tree. 1. Hardly our first 2. "Crappy driver" is not pass/fail, we grade that on a curve. 3. You confuse "I don't like" with "crappy" > - We still have this driver that doesn't follow the standard we said we >want to adhere to. And part of that decision, clearly explained for all who participated in making it, was that we should time-warp back to FreeBSD 1.X where hardware changes always required a reboot ? Right, I didn't think so... Maybe we *also* need to make some decisions about *how* we want this FDT stuff to work for us in practice? My summary of the situation: Everybody I have communicated with over the last couple of months have given me clear indication that nothing significant will happen on the RPi platform, which people see as inferior and not worth the/any effort. I don't entirely agree about that, I think RPi is a platform we as project ignore at our peril, so I have started to do a little bit of an effort, as I find time and information for it. You keep yelling at me for not adhering to an entirely undocumented design vision, which we don't even have a single compliant reference platform for yet. The stuff (clock manager, pin manager, runtime overlays) you are upset about me not using, does not exist on the RPi platform in FreeBSD at this point in time, which is why I don't use them. There is no documentation anywhere to be found, how to implement these hypothetical pieces of code, which is why I don't implement them. I am quite tempted to quote Gen. Patton on you and say "Lead me, Follow me, or get out of my way", but that would be a bit too rude. Instead I will repeat what I have already said to you several times: The moment the correct infrastructure appears on the RPi platform, if it ever does, I will change my driver to use that infrastructure. Until then, you are wasting everybodys time pointing accusingly into your book of unwritten rules. Poul-Henning -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-svn-src-all@freebsd.org Sat Jan 27 23:13:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C20BBEC97AC; Sat, 27 Jan 2018 23:13:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 76F507F3F0; Sat, 27 Jan 2018 23:13:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71E1C1137D; Sat, 27 Jan 2018 23:13:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RNDZxg087006; Sat, 27 Jan 2018 23:13:35 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RNDZMQ087002; Sat, 27 Jan 2018 23:13:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801272313.w0RNDZMQ087002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 23:13: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: r328499 - in stable/11: etc/mtree share/man/man7 sys/boot/arm/uboot sys/boot/mips/uboot X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: etc/mtree share/man/man7 sys/boot/arm/uboot sys/boot/mips/uboot X-SVN-Commit-Revision: 328499 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 23:13:36 -0000 Author: kevans Date: Sat Jan 27 23:13:34 2018 New Revision: 328499 URL: https://svnweb.freebsd.org/changeset/base/328499 Log: MFC (conceptually) r328107: Add /boot/overlays This is a direct commit to stable/11, due to path changes in HEAD. Diffs have been applied on top of stable/11, with exception to the change to forth/loader.conf. forth/loader.conf has seen additional changes in HEAD mthat are not being MFC'd to stable/11, so the addition of /boot/overlays to its module_path is not necessary. MFC r328107: stand: Add /boot/overlays for separation of overlays from DTB This matches directory structure used commonly in Linux-land, and it's cleaner than mixing overlays into the existing module paths. Overlays are still mixed in by specifying fdt_overlays in loader.conf(5). Modified: stable/11/etc/mtree/BSD.root.dist stable/11/share/man/man7/hier.7 stable/11/sys/boot/arm/uboot/loader.conf stable/11/sys/boot/mips/uboot/loader.conf Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.root.dist ============================================================================== --- stable/11/etc/mtree/BSD.root.dist Sat Jan 27 22:57:06 2018 (r328498) +++ stable/11/etc/mtree/BSD.root.dist Sat Jan 27 23:13:34 2018 (r328499) @@ -18,6 +18,8 @@ .. modules .. + overlays + .. zfs .. .. Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sat Jan 27 22:57:06 2018 (r328498) +++ stable/11/share/man/man7/hier.7 Sat Jan 27 23:13:34 2018 (r328499) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd April 6, 2017 +.Dd January 15, 2018 .Dt HIER 7 .Os .Sh NAME @@ -63,6 +63,11 @@ at boot time) and kernel modules third-party loadable kernel modules; see .Xr kldstat 8 +.It Pa overlays/ +Compiled flattened device tree (FDT) overlays; see +.Xr fdt 4 +and +.Xr dtc 1 .It Pa zfs/ .Xr zfs 8 zpool cache files Modified: stable/11/sys/boot/arm/uboot/loader.conf ============================================================================== --- stable/11/sys/boot/arm/uboot/loader.conf Sat Jan 27 22:57:06 2018 (r328498) +++ stable/11/sys/boot/arm/uboot/loader.conf Sat Jan 27 23:13:34 2018 (r328499) @@ -7,7 +7,7 @@ autoboot_delay=10 bootfile="kernel" # Kernel name (possibly absolute path) kernel="kernel" # /boot sub-directory containing kernel and modules loader_conf_files="/boot/loader.conf /boot/loader.conf.local" -module_path="/boot/kernel;/boot/modules;/boot/dtb" +module_path="/boot/kernel;/boot/modules;/boot/dtb;/boot/overlays" nextboot_conf="/boot/nextboot.conf" nextboot_enable="NO" verbose_loading="NO" Modified: stable/11/sys/boot/mips/uboot/loader.conf ============================================================================== --- stable/11/sys/boot/mips/uboot/loader.conf Sat Jan 27 22:57:06 2018 (r328498) +++ stable/11/sys/boot/mips/uboot/loader.conf Sat Jan 27 23:13:34 2018 (r328499) @@ -7,7 +7,7 @@ autoboot_delay=10 bootfile="kernel" # Kernel name (possibly absolute path) kernel="kernel" # /boot sub-directory containing kernel and modules loader_conf_files="/boot/loader.conf /boot/loader.conf.local" -module_path="/boot/kernel;/boot/modules;/boot/dtb" +module_path="/boot/kernel;/boot/modules;/boot/dtb;/boot/overlays" nextboot_conf="/boot/nextboot.conf" nextboot_enable="NO" verbose_loading="NO" From owner-svn-src-all@freebsd.org Sat Jan 27 23:20:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC725EC9CD0; Sat, 27 Jan 2018 23:20:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5B7177F79A; Sat, 27 Jan 2018 23:20:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5642111389; Sat, 27 Jan 2018 23:20:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RNK2MB087306; Sat, 27 Jan 2018 23:20:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RNK1PL087298; Sat, 27 Jan 2018 23:20:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801272320.w0RNK1PL087298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 23:20:01 +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: r328500 - in stable/11/usr.bin/hexdump: . tests X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/usr.bin/hexdump: . tests X-SVN-Commit-Revision: 328500 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 23:20:02 -0000 Author: kevans Date: Sat Jan 27 23:20:01 2018 New Revision: 328500 URL: https://svnweb.freebsd.org/changeset/base/328500 Log: MFC r328188,r328189,r328200: Fix wrong output for multibyte corner cases MFC r328188: od(1): Fix wrong output for corner cases in multibyte locales. Restore the original character to print if we used the look-ahead buffer, but that didn't help -- we either got an illegal sequence or still can't complete. MFC r328189: od(1): Fix mis-patch from r328188 od_test.sh got duplicated erroneously when it was added in r328188. Dedup. MFC r328200: Silence the gcc warning: 'op' may be used uninitialized in this function PR: 224552 Added: stable/11/usr.bin/hexdump/tests/d_od_cflag_a.out - copied unchanged from r328188, head/usr.bin/hexdump/tests/d_od_cflag_a.out stable/11/usr.bin/hexdump/tests/d_od_cflag_b.out - copied unchanged from r328188, head/usr.bin/hexdump/tests/d_od_cflag_b.out stable/11/usr.bin/hexdump/tests/od_test.sh - copied, changed from r328188, head/usr.bin/hexdump/tests/od_test.sh Modified: stable/11/usr.bin/hexdump/conv.c stable/11/usr.bin/hexdump/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/hexdump/conv.c ============================================================================== --- stable/11/usr.bin/hexdump/conv.c Sat Jan 27 23:13:34 2018 (r328499) +++ stable/11/usr.bin/hexdump/conv.c Sat Jan 27 23:20:01 2018 (r328500) @@ -54,7 +54,10 @@ conv_c(PR *pr, u_char *p, size_t bufsize) size_t clen, oclen; int converr, pad, width; u_char peekbuf[MB_LEN_MAX]; + u_char *op; + op = NULL; + if (pr->mbleft > 0) { str = "**"; pr->mbleft--; @@ -105,6 +108,15 @@ retry: else if (clen == (size_t)-1 || (clen == (size_t)-2 && p == peekbuf)) { memset(&pr->mbstate, 0, sizeof(pr->mbstate)); + if (p == peekbuf) { + /* + * We peeked ahead, but that didn't help -- + * we either got an illegal sequence or still + * can't complete; restore original character. + */ + oclen = 0; + p = op; + } wc = *p; clen = 1; converr = 1; @@ -114,6 +126,7 @@ retry: * can complete it. */ oclen = bufsize; + op = p; bufsize = peek(p = peekbuf, MB_CUR_MAX); goto retry; } @@ -126,7 +139,7 @@ retry: if (!odmode) { *pr->cchar = 'c'; (void)printf(pr->fmt, (int)wc); - } else { + } else { *pr->cchar = 'C'; assert(strcmp(pr->fmt, "%3C") == 0); width = wcwidth(wc); Modified: stable/11/usr.bin/hexdump/tests/Makefile ============================================================================== --- stable/11/usr.bin/hexdump/tests/Makefile Sat Jan 27 23:13:34 2018 (r328499) +++ stable/11/usr.bin/hexdump/tests/Makefile Sat Jan 27 23:20:01 2018 (r328500) @@ -2,7 +2,7 @@ PACKAGE= tests -ATF_TESTS_SH= hexdump_test +ATF_TESTS_SH= hexdump_test od_test ${PACKAGE}FILES+= d_hexdump_a.in ${PACKAGE}FILES+= d_hexdump_b.in @@ -27,5 +27,7 @@ ${PACKAGE}FILES+= d_hexdump_UCflag_c.out ${PACKAGE}FILES+= d_hexdump_xflag_a.out ${PACKAGE}FILES+= d_hexdump_xflag_b.out ${PACKAGE}FILES+= d_hexdump_xflag_c.out +${PACKAGE}FILES+= d_od_cflag_a.out +${PACKAGE}FILES+= d_od_cflag_b.out .include Copied: stable/11/usr.bin/hexdump/tests/d_od_cflag_a.out (from r328188, head/usr.bin/hexdump/tests/d_od_cflag_a.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/usr.bin/hexdump/tests/d_od_cflag_a.out Sat Jan 27 23:20:01 2018 (r328500, copy of r328188, head/usr.bin/hexdump/tests/d_od_cflag_a.out) @@ -0,0 +1,3 @@ +0000000 T e s t T e s t T e s t T e s 345 +0000020 T e s t 345 +0000025 Copied: stable/11/usr.bin/hexdump/tests/d_od_cflag_b.out (from r328188, head/usr.bin/hexdump/tests/d_od_cflag_b.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/usr.bin/hexdump/tests/d_od_cflag_b.out Sat Jan 27 23:20:01 2018 (r328500, copy of r328188, head/usr.bin/hexdump/tests/d_od_cflag_b.out) @@ -0,0 +1,3 @@ +0000000 T e s t T e s t T e s t T e s т +0000020 ** Т ** е ** с ** т ** +0000031 Copied and modified: stable/11/usr.bin/hexdump/tests/od_test.sh (from r328188, head/usr.bin/hexdump/tests/od_test.sh) ============================================================================== --- head/usr.bin/hexdump/tests/od_test.sh Sat Jan 20 02:49:32 2018 (r328188, copy source) +++ stable/11/usr.bin/hexdump/tests/od_test.sh Sat Jan 27 23:20:01 2018 (r328500) @@ -47,48 +47,3 @@ atf_init_test_cases() { atf_add_test_case c_flag } -# -# Copyright 2018 The FreeBSD Project -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ - -atf_test_case c_flag -c_flag_head() -{ - atf_set "descr" "Verify -c output" -} -c_flag_body() -{ - printf 'TestTestTestTes\345Test\345' > d_od_cflag.in - atf_check -o file:"$(atf_get_srcdir)/d_od_cflag_a.out" \ - env LC_CTYPE="en_US.UTF-8" od -c "d_od_cflag.in" - printf 'TestTestTestTesтТест' > d_od_cflag.in - atf_check -o file:"$(atf_get_srcdir)/d_od_cflag_b.out" \ - env LC_CTYPE="en_US.UTF-8" od -c "d_od_cflag.in" -} - -atf_init_test_cases() -{ - atf_add_test_case c_flag -} From owner-svn-src-all@freebsd.org Sat Jan 27 23:21:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08614EC9F69; Sat, 27 Jan 2018 23:21:47 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 7E8B17FB04; Sat, 27 Jan 2018 23:21:45 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 2944D10B8AB; Sun, 28 Jan 2018 10:21:43 +1100 (AEDT) Date: Sun, 28 Jan 2018 10:21:42 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Dimitry Andric cc: Ed Schouten , "Pedro F. Giffuni" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328492 - head/contrib/opie/libopie In-Reply-To: <7C471160-44B3-4EA6-8995-08A4EB4332A1@FreeBSD.org> Message-ID: <20180128093811.G4029@besplex.bde.org> References: <201801272216.w0RMGJwo057492@repo.freebsd.org> <7C471160-44B3-4EA6-8995-08A4EB4332A1@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=YbvN30Zf c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=Hs2ZQaMOoJN6KwDMJ4AA:9 a=2D251b_JUCYupp0T:21 a=CEcq3IAuxX1zZp2m:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 23:21:47 -0000 On Sat, 27 Jan 2018, Dimitry Andric wrote: > On 27 Jan 2018, at 23:20, Ed Schouten wrote: >> >> 2018-01-27 23:16 GMT+01:00 Pedro F. Giffuni : >>> char host[sizeof(utmp.ut_host) + 1]; >>> insecure = 1; >>> >>> - strncpy(host, utmp.ut_host, sizeof(utmp.ut_host)); >>> - host[sizeof(utmp.ut_host)] = 0; >>> + strncpy(host, utmp.ut_host, sizeof(host)); >> >> Wait... This may access utmp.ut_host one byte past the end and no >> longer guarantees that host is null-terminated, right? > No, strncpy "copies at most len characters from src into dst". However, No, the change breaks the length so 1 byte past the end is accessed in implementations where ut_host is not guaranteed to be NUL terminated and the current instance of ut_host is not NUL terminated. > if the length of the source is equal to or greater than len, the > destination is *not* null terminated. This is likely why the > "host[sizeof(utmp.ut_host)] = 0;" statement was added. This is why that statement was there. This change is not even wrong under FreeBSD, since ut_host and several other fields are guaranteed to be NUL terminated in the FreeBSD implementation. The code was correct and portable and the change just breaks its portability. > In any case, this is why strlcpy exists. :) Using strlcpy() in libopie would be another good unportabilization. contrib/opie never uses strlc*() except in 1 place previously unportabilized in r208586. That at least fixed 2 bugs (2 related off by 1 errors in the code intended to avoid buffer overruns, with the result that buffer overruns were limited to 1 byte). It moved the style bugs by changing hacking on the source string to use of strlcpy(). Bruce From owner-svn-src-all@freebsd.org Sat Jan 27 23:27:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02E1EECA3EB for ; Sat, 27 Jan 2018 23:27:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x230.google.com (mail-io0-x230.google.com [IPv6:2607:f8b0:4001: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 74D587FE20 for ; Sat, 27 Jan 2018 23:27:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x230.google.com with SMTP id d13so4000125iog.5 for ; Sat, 27 Jan 2018 15:27:25 -0800 (PST) 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=e/8nHBlx8uAGB9qF4bJMSGijYq9jKok1rc/8oAZ2scc=; b=GQhyHqPI3e67c6NMFKqiqHi4kLkuUkIWW6HTgLmwmvOgOAnIV9N5sagKJyUP4lHUFr 32EloH1BaYHV8fzPDMhC2T8EHgUiqTplGyJ6pnj2osuKVrMqaPRVd2gXLXBnwXYkk391 gnE38AxArb/Mj5V+shhIO7e1YkO2ntAcTgiXb+qsWFn/+uXJh7OAoej1Eyfe2CB9vgC+ 88MtTXf1AlO8U88GoTVZ11Xdo2KwtVflwvBD6+vJ0O+7sZd3Q7qAulOIlwjFzOAVGthf wkPXcdJCXE5+uLhak3b5MfbGlWBSnbFZyfC9gL0kvnT8N9bwpstPZlNXJIhIXn2IEKwF 2QCw== 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=e/8nHBlx8uAGB9qF4bJMSGijYq9jKok1rc/8oAZ2scc=; b=MljiKproOY2fmEEvaDS3oCwSmCWkdNz2MZXWttHNO0/R0dXO1FUYaOgSXy2lxvtYke 5BT5en3y4N0jNcoKFdRephygGncYRuMEwAOBKcqpiuU91PqwDczS2FwY9ZgmOwPhHIQJ OqYj9/rFI4mzgtw7bW3WTxeyLm6AzholeWi1ryaubS3TQxhPkG/2ZrmBuC0FBWIRRucH MJ95ULkTDCD9ikmIQVllQVerj3m41bATDU4NGblj6LbjEauu8/lyDHWmT2Eun+xVdKAe /wDqJDxQGFegZIGrDZmHuRzsuKj7gHU3QhDzQU0E2ZDal7R+RonOI176b6RfGo1A3g/E Dd1Q== X-Gm-Message-State: AKwxytd+K/gV0pQl3f4DkZNza6n9yLqtjL6mu+5WA97kzfGvfs9wpn2F r6smQGQSj4ZxXbD+clw+6j5L2DcuXh6JnakppwKbFA== X-Google-Smtp-Source: AH8x2260mrbORFzXNiRRiwBwvoRUm/Y6+0GBc029jtOwgvG1Sqbo0CaIFWZntLXfPbNGbxGDw3TS/VkoaX0xJkWPYDU= X-Received: by 10.107.88.12 with SMTP id m12mr19459453iob.136.1517095644716; Sat, 27 Jan 2018 15:27:24 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Sat, 27 Jan 2018 15:27:24 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: <72042.1517094867@critter.freebsd.dk> References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> From: Warner Losh Date: Sat, 27 Jan 2018 16:27:24 -0700 X-Google-Sender-Auth: kaO3cFHGKVLJWYzqY431ip1QCC4 Message-ID: Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules To: Poul-Henning Kamp Cc: Emmanuel Vadot , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 23:27:26 -0000 On Sat, Jan 27, 2018 at 4:14 PM, Poul-Henning Kamp wrote: > > The moment the correct infrastructure appears on the RPi platform, > if it ever does, I will change my driver to use that infrastructure. > The root of the problem is that we have the right infrastructure... Everywhere except RPi. It needs a proper pinmux/pinctl driver. That's the next step in fixing this issue. If you don't want to be part of fixing that, then get out of the way. Embedded is different and we've had a decade now of increasing FDT use, and it works. The RPi port, sadly, didn't come with this, and we're paying the price now. In an ideal word, you could just enable the driver, have it attach, and have it's pins muxed properly by the infrastructure. We're there on boot on every other armv7/arm64 platform, just not there incrementally at runtime. Some work would be needed to make that happen, but I think I have a reasonable design that I've started to socialize... You're welcome to join in in making it happen, if you like.... The next step, though, is to bring the RPI's infrastructure up to speed with the rest of the arm ports... That's where time is best spent, honestly. Fighting a never ending series of one-off kludges is doomed to failure. Warner From owner-svn-src-all@freebsd.org Sat Jan 27 23:40:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CC44ECAEE6; Sat, 27 Jan 2018 23:40:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AAB4B80438; Sat, 27 Jan 2018 23:40:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5903116E0; Sat, 27 Jan 2018 23:40:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RNef6o097226; Sat, 27 Jan 2018 23:40:41 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RNef44097225; Sat, 27 Jan 2018 23:40:41 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801272340.w0RNef44097225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 27 Jan 2018 23:40:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328501 - stable/11/usr.bin/limits X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/limits X-SVN-Commit-Revision: 328501 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 23:40:42 -0000 Author: eadler Date: Sat Jan 27 23:40:41 2018 New Revision: 328501 URL: https://svnweb.freebsd.org/changeset/base/328501 Log: MFC r328206: limits(1): add missing break Modified: stable/11/usr.bin/limits/limits.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/limits/limits.c ============================================================================== --- stable/11/usr.bin/limits/limits.c Sat Jan 27 23:20:01 2018 (r328500) +++ stable/11/usr.bin/limits/limits.c Sat Jan 27 23:40:41 2018 (r328501) @@ -608,6 +608,7 @@ resource_num(int which, int ch, const char *str) break; case 'w': case 'W': /* weeks */ tim *= (60L * 60L * 24L * 7L); + break; case 'y': case 'Y': /* Years */ tim *= (60L * 60L * 24L * 365L); } From owner-svn-src-all@freebsd.org Sat Jan 27 23:46:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6CD1ECB39C; Sat, 27 Jan 2018 23:46:44 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 7D046808F2; Sat, 27 Jan 2018 23:46:44 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id 766642739F; Sat, 27 Jan 2018 23:46:36 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id w0RNkLu6073054 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 27 Jan 2018 23:46:21 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id w0RNkL8n073053; Sat, 27 Jan 2018 23:46:21 GMT (envelope-from phk) To: Warner Losh cc: Emmanuel Vadot , John Baldwin , Ravi Pokala , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules In-reply-to: From: "Poul-Henning Kamp" References: <201801220710.w0M7AUm9091853@repo.freebsd.org> <90451.1516663240@critter.freebsd.dk> <2987003.eeGRFBb6N8@ralph.baldwin.cx> <93949.1516733748@critter.freebsd.dk> <20180127210801.37b8001125dd0a2c92372f98@bidouilliste.com> <72042.1517094867@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <73051.1517096781.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Sat, 27 Jan 2018 23:46:21 +0000 Message-ID: <73052.1517096781@critter.freebsd.dk> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Sat, 27 Jan 2018 23:46:45 -0000 -------- In message , Warner Losh writes: >> The moment the correct infrastructure appears on the RPi platform, >> if it ever does, I will change my driver to use that infrastructure. > >The root of the problem is that we have the right infrastructure... >Everywhere except RPi. It needs a proper pinmux/pinctl driver. That's the >next step in fixing this issue. If you don't want to be part of fixing >that, then get out of the way. My driver is not built into any kernels, you have to kldload it AND configure it via sysctls before it can possibly get in the way of anything, so yes: I am out of the way. >The next step, though, is to bring the RPI's infrastructure up to speed >with the rest of the arm ports... That's where time is best spent, >honestly. Fighting a never ending series of one-off kludges is doomed to >failure. I don't think the two evenings I spent in my lap measuring and figuring out what the datasheet didn't say and said wrong about the PWM hardware is a failure just because a couple of hardware unrelated lines of source code needs to be changed at a later date. >We're there on >boot on every other armv7/arm64 platform, just not there incrementally at >runtime. Some work would be needed to make that happen, but I think I hav= e a >reasonable design that I've started to socialize... You're welcome to joi= n in >in making it happen, if you like.... With the limited time I have available, I will. Poul-Henning -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= .