From owner-svn-src-stable@freebsd.org Sun Dec 8 04:19:07 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 266E51D768F; Sun, 8 Dec 2019 04:19:07 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VtPR0xmWz4c1X; Sun, 8 Dec 2019 04:19:07 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD9E224963; Sun, 8 Dec 2019 04:19:06 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB84J60V011292; Sun, 8 Dec 2019 04:19:06 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB84J6Dc011288; Sun, 8 Dec 2019 04:19:06 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201912080419.xB84J6Dc011288@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Sun, 8 Dec 2019 04:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355520 - stable/12/bin/dd X-SVN-Group: stable-12 X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: stable/12/bin/dd X-SVN-Commit-Revision: 355520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Dec 2019 04:19:07 -0000 Author: mmacy Date: Sun Dec 8 04:19:05 2019 New Revision: 355520 URL: https://svnweb.freebsd.org/changeset/base/355520 Log: MFC r351770,r352920-r352923 MFCs to dd appear to have been haphazard so selectively MFCing individually didn't work easily. Add conv=fsync flag to dd The fsync flag performs an fsync(2) on the output file before closing it. This will be useful for the ZFS test suite. Add conv=fdatasync flag to dd The fdatasync flag performs an fdatasync(2) on the output file before closing it. This will be useful for the ZFS test suite. dd: Check result of close(2) for errors close(2) can return errors from previous operations which should not be ignored. Add oflag=fsync and oflag=sync capability to dd Sets the O_FSYNC flag on the output file. oflag=fsync and oflag=sync are synonyms just as O_FSYNC and O_SYNC are synonyms. This functionality is intended to improve portability of dd commands in the ZFS test suite. Add iflag=fullblock to dd Normally, count=n means read(2) will be called n times on the input to dd. If the read() returns short, as may happen when reading from a pipe, fewer bytes will be copied from the input. With conv=sync the buffer is padded with zeros to fill the rest of the block. iflag=fullblock causes dd to continue reading until the block is full, so that count=n means n full blocks are copied. This flag is compatible with illumos and GNU dd and is used in the ZFS test suite. Submitted by: Ryan Moeller, Thomas Hurst Reviewed by: manpages, mmacy@ Sponsored by: iXsystems, Inc. Modified: stable/12/bin/dd/args.c stable/12/bin/dd/dd.1 stable/12/bin/dd/dd.c stable/12/bin/dd/dd.h stable/12/bin/dd/extern.h Modified: stable/12/bin/dd/args.c ============================================================================== --- stable/12/bin/dd/args.c Sun Dec 8 04:17:04 2019 (r355519) +++ stable/12/bin/dd/args.c Sun Dec 8 04:19:05 2019 (r355520) @@ -41,7 +41,7 @@ static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/ #include __FBSDID("$FreeBSD$"); -#include +#include #include #include @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); static int c_arg(const void *, const void *); static int c_conv(const void *, const void *); +static int c_iflag(const void *, const void *); +static int c_oflag(const void *, const void *); static void f_bs(char *); static void f_cbs(char *); static void f_conv(char *); @@ -65,8 +67,10 @@ static void f_files(char *); static void f_fillchar(char *); static void f_ibs(char *); static void f_if(char *); +static void f_iflag(char *); static void f_obs(char *); static void f_of(char *); +static void f_oflag(char *); static void f_seek(char *); static void f_skip(char *); static void f_speed(char *); @@ -77,7 +81,7 @@ static off_t get_off_t(const char *); static const struct arg { const char *name; void (*f)(char *); - u_int set, noset; + uint64_t set, noset; } args[] = { { "bs", f_bs, C_BS, C_BS|C_IBS|C_OBS|C_OSYNC }, { "cbs", f_cbs, C_CBS, C_CBS }, @@ -87,9 +91,11 @@ static const struct arg { { "fillchar", f_fillchar, C_FILL, C_FILL }, { "ibs", f_ibs, C_IBS, C_BS|C_IBS }, { "if", f_if, C_IF, C_IF }, + { "iflag", f_iflag, 0, 0 }, { "iseek", f_skip, C_SKIP, C_SKIP }, { "obs", f_obs, C_OBS, C_BS|C_OBS }, { "of", f_of, C_OF, C_OF }, + { "oflag", f_oflag, 0, 0 }, { "oseek", f_seek, C_SEEK, C_SEEK }, { "seek", f_seek, C_SEEK, C_SEEK }, { "skip", f_skip, C_SKIP, C_SKIP }, @@ -256,7 +262,39 @@ f_if(char *arg) in.name = arg; } +static const struct iflag { + const char *name; + uint64_t set, noset; +} ilist[] = { + { "fullblock", C_IFULLBLOCK, C_SYNC }, +}; + static void +f_iflag(char *arg) +{ + struct iflag *ip, tmp; + + while (arg != NULL) { + tmp.name = strsep(&arg, ","); + ip = bsearch(&tmp, ilist, nitems(ilist), sizeof(struct iflag), + c_iflag); + if (ip == NULL) + errx(1, "unknown iflag %s", tmp.name); + if (ddflags & ip->noset) + errx(1, "%s: illegal conversion combination", tmp.name); + ddflags |= ip->set; + } +} + +static int +c_iflag(const void *a, const void *b) +{ + + return (strcmp(((const struct iflag *)a)->name, + ((const struct iflag *)b)->name)); +} + +static void f_obs(char *arg) { uintmax_t res; @@ -314,12 +352,14 @@ f_status(char *arg) static const struct conv { const char *name; - u_int set, noset; + uint64_t set, noset; const u_char *ctab; } clist[] = { { "ascii", C_ASCII, C_EBCDIC, e2a_POSIX }, { "block", C_BLOCK, C_UNBLOCK, NULL }, { "ebcdic", C_EBCDIC, C_ASCII, a2e_POSIX }, + { "fdatasync", C_FDATASYNC, 0, NULL }, + { "fsync", C_FSYNC, 0, NULL }, { "ibm", C_EBCDIC, C_ASCII, a2ibm_POSIX }, { "lcase", C_LCASE, C_UCASE, NULL }, { "noerror", C_NOERROR, 0, NULL }, @@ -334,7 +374,7 @@ static const struct conv { { "parset", C_PARSET, C_PARODD|C_PAREVEN|C_PARNONE, NULL}, { "sparse", C_SPARSE, 0, NULL }, { "swab", C_SWAB, 0, NULL }, - { "sync", C_SYNC, 0, NULL }, + { "sync", C_SYNC, C_IFULLBLOCK, NULL }, { "ucase", C_UCASE, C_LCASE, NULL }, { "unblock", C_UNBLOCK, C_BLOCK, NULL }, }; @@ -346,8 +386,8 @@ f_conv(char *arg) while (arg != NULL) { tmp.name = strsep(&arg, ","); - cp = bsearch(&tmp, clist, sizeof(clist) / sizeof(struct conv), - sizeof(struct conv), c_conv); + cp = bsearch(&tmp, clist, nitems(clist), sizeof(struct conv), + c_conv); if (cp == NULL) errx(1, "unknown conversion %s", tmp.name); if (ddflags & cp->noset) @@ -364,6 +404,37 @@ c_conv(const void *a, const void *b) return (strcmp(((const struct conv *)a)->name, ((const struct conv *)b)->name)); +} + +static const struct oflag { + const char *name; + uint64_t set; +} olist[] = { + { "fsync", C_OFSYNC }, + { "sync", C_OFSYNC }, +}; + +static void +f_oflag(char *arg) +{ + struct oflag *op, tmp; + + while (arg != NULL) { + tmp.name = strsep(&arg, ","); + op = bsearch(&tmp, olist, nitems(olist), sizeof(struct oflag), + c_oflag); + if (op == NULL) + errx(1, "unknown open flag %s", tmp.name); + ddflags |= op->set; + } +} + +static int +c_oflag(const void *a, const void *b) +{ + + return (strcmp(((const struct oflag *)a)->name, + ((const struct oflag *)b)->name)); } static intmax_t Modified: stable/12/bin/dd/dd.1 ============================================================================== --- stable/12/bin/dd/dd.1 Sun Dec 8 04:17:04 2019 (r355519) +++ stable/12/bin/dd/dd.1 Sun Dec 8 04:19:05 2019 (r355520) @@ -32,7 +32,7 @@ .\" @(#)dd.1 8.2 (Berkeley) 1/13/94 .\" $FreeBSD$ .\" -.Dd August 8, 2018 +.Dd March 26, 2019 .Dt DD 1 .Os .Sh NAME @@ -102,6 +102,22 @@ bytes instead of the default 512. Read input from .Ar file instead of the standard input. +.It Cm iflag Ns = Ns Ar value Ns Op , Ns Ar value ... +Where +.Cm value +is one of the symbols from the following list. +.Bl -tag -width "fullblock" +.It Cm fullblock +Reading from the input file may not obtain a full block. +When a read returns short, continue reading to fill the block. +Without this flag, +.Cm count +limits the number of times +.Xr read 2 +is called on the input rather than the number of blocks copied in full. +May not be combined with +.Cm conv=sync . +.El .It Cm iseek Ns = Ns Ar n Seek on the input file .Ar n @@ -123,6 +139,19 @@ If an initial portion of the output file is seeked pas .Cm oseek operand), the output file is truncated at that point. +.It Cm oflag Ns = Ns Ar value Ns Op , Ns Ar value ... +Where +.Cm value +is one of the symbols from the following list. +.Bl -tag -width "fsync" +.It Cm fsync +Set the O_FSYNC flag on the output file to make writes synchronous. +.It Cm sync +Set the O_SYNC flag on the output file to make writes synchronous. +This is synonymous with the +.Cm fsync +value. +.El .It Cm oseek Ns = Ns Ar n Seek on the output file .Ar n @@ -252,6 +281,14 @@ are maps used in historic and .No pre- Ns Bx 4.3 reno systems. +.It Cm fdatasync +Perform an +.Xr fdatasync 2 +on the output file before closing it. +.It Cm fsync +Perform an +.Xr fsync 2 +on the output file before closing it. .It Cm lcase Transform uppercase characters into lowercase characters. .It Cm pareven , parnone , parodd , parset @@ -427,7 +464,8 @@ if necessary, to a 1MiB boundary: .Xr mt 1 , .Xr recoverdisk 1 , .Xr tr 1 , -.Xr geom 4 +.Xr geom 4 , +.Xr trim 8 .Sh STANDARDS The .Nm Modified: stable/12/bin/dd/dd.c ============================================================================== --- stable/12/bin/dd/dd.c Sun Dec 8 04:17:04 2019 (r355519) +++ stable/12/bin/dd/dd.c Sun Dec 8 04:19:05 2019 (r355520) @@ -83,7 +83,7 @@ STAT st; /* statistics */ void (*cfunc)(void); /* conversion function */ uintmax_t cpy_cnt; /* # of blocks to copy */ static off_t pending = 0; /* pending seek if sparse */ -u_int ddflags = 0; /* conversion options */ +uint64_t ddflags = 0; /* conversion options */ size_t cbsz; /* conversion block size */ uintmax_t files_cnt = 1; /* # of files to copy */ const u_char *ctab; /* conversion table */ @@ -124,7 +124,8 @@ main(int argc __unused, char *argv[]) * descriptor explicitly so that the summary handler (called * from an atexit() hook) includes this work. */ - close(out.fd); + if (close(out.fd) == -1 && errno != EINTR) + err(1, "close"); exit(0); } @@ -142,6 +143,7 @@ static void setup(void) { u_int cnt; + int oflags; cap_rights_t rights; unsigned long cmds[] = { FIODTYPE, MTIOCTOP }; @@ -164,21 +166,34 @@ setup(void) errx(1, "files is not supported for non-tape devices"); cap_rights_set(&rights, CAP_FTRUNCATE, CAP_IOCTL, CAP_WRITE); + if (ddflags & (C_FDATASYNC | C_FSYNC)) + cap_rights_set(&rights, CAP_FSYNC); if (out.name == NULL) { /* No way to check for read access here. */ out.fd = STDOUT_FILENO; out.name = "stdout"; + if (ddflags & C_OFSYNC) { + oflags = fcntl(out.fd, F_GETFL); + if (oflags == -1) + err(1, "unable to get fd flags for stdout"); + oflags |= O_FSYNC; + if (fcntl(out.fd, F_SETFL, oflags) == -1) + err(1, "unable to set fd flags for stdout"); + } } else { -#define OFLAGS \ - (O_CREAT | (ddflags & (C_SEEK | C_NOTRUNC) ? 0 : O_TRUNC)) - out.fd = open(out.name, O_RDWR | OFLAGS, DEFFILEMODE); + oflags = O_CREAT; + if (!(ddflags & (C_SEEK | C_NOTRUNC))) + oflags |= O_TRUNC; + if (ddflags & C_OFSYNC) + oflags |= O_FSYNC; + out.fd = open(out.name, O_RDWR | oflags, DEFFILEMODE); /* * May not have read access, so try again with write only. * Without read we may have a problem if output also does * not support seeks. */ if (out.fd == -1) { - out.fd = open(out.name, O_WRONLY | OFLAGS, DEFFILEMODE); + out.fd = open(out.name, O_WRONLY | oflags, DEFFILEMODE); out.flags |= NOREAD; cap_rights_clear(&rights, CAP_READ); } @@ -393,13 +408,15 @@ dd_in(void) memset(in.dbp, 0, in.dbsz); } - n = read(in.fd, in.dbp, in.dbsz); - if (n == 0) { - in.dbrcnt = 0; + in.dbrcnt = 0; +fill: + n = read(in.fd, in.dbp + in.dbrcnt, in.dbsz - in.dbrcnt); + + /* EOF */ + if (n == 0 && in.dbrcnt == 0) return; - } - /* Read error. */ + /* Read error */ if (n == -1) { /* * If noerror not specified, die. POSIX requires that @@ -423,26 +440,26 @@ dd_in(void) /* If sync not specified, omit block and continue. */ if (!(ddflags & C_SYNC)) continue; + } - /* Read errors count as full blocks. */ - in.dbcnt += in.dbrcnt = in.dbsz; - ++st.in_full; + /* If conv=sync, use the entire block. */ + if (ddflags & C_SYNC) + n = in.dbsz; - /* Handle full input blocks. */ - } else if ((size_t)n == (size_t)in.dbsz) { - in.dbcnt += in.dbrcnt = n; - ++st.in_full; + /* Count the bytes read for this block. */ + in.dbrcnt += n; - /* Handle partial input blocks. */ - } else { - /* If sync, use the entire block. */ - if (ddflags & C_SYNC) - in.dbcnt += in.dbrcnt = in.dbsz; - else - in.dbcnt += in.dbrcnt = n; + /* Count the number of full and partial blocks. */ + if (in.dbrcnt == in.dbsz) + ++st.in_full; + else if (ddflags & C_IFULLBLOCK && n != 0) + goto fill; /* these don't count */ + else ++st.in_part; - } + /* Count the total bytes read for this file. */ + in.dbcnt += in.dbrcnt; + /* * POSIX states that if bs is set and no other conversions * than noerror, notrunc or sync are specified, the block @@ -463,6 +480,7 @@ dd_in(void) swapbytes(in.dbp, (size_t)n); } + /* Advance to the next block. */ in.dbp += in.dbrcnt; (*cfunc)(); if (need_summary) @@ -504,6 +522,14 @@ dd_close(void) if (out.seek_offset > 0 && (out.flags & ISTRUNC)) { if (ftruncate(out.fd, out.seek_offset) == -1) err(1, "truncating %s", out.name); + } + + if (ddflags & C_FSYNC) { + if (fsync(out.fd) == -1) + err(1, "fsyncing %s", out.name); + } else if (ddflags & C_FDATASYNC) { + if (fdatasync(out.fd) == -1) + err(1, "fdatasyncing %s", out.name); } } Modified: stable/12/bin/dd/dd.h ============================================================================== --- stable/12/bin/dd/dd.h Sun Dec 8 04:17:04 2019 (r355519) +++ stable/12/bin/dd/dd.h Sun Dec 8 04:19:05 2019 (r355520) @@ -70,37 +70,41 @@ typedef struct { } STAT; /* Flags (in ddflags). */ -#define C_ASCII 0x00000001 -#define C_BLOCK 0x00000002 -#define C_BS 0x00000004 -#define C_CBS 0x00000008 -#define C_COUNT 0x00000010 -#define C_EBCDIC 0x00000020 -#define C_FILES 0x00000040 -#define C_IBS 0x00000080 -#define C_IF 0x00000100 -#define C_LCASE 0x00000200 -#define C_NOERROR 0x00000400 -#define C_NOTRUNC 0x00000800 -#define C_OBS 0x00001000 -#define C_OF 0x00002000 -#define C_OSYNC 0x00004000 -#define C_PAREVEN 0x00008000 -#define C_PARNONE 0x00010000 -#define C_PARODD 0x00020000 -#define C_PARSET 0x00040000 -#define C_SEEK 0x00080000 -#define C_SKIP 0x00100000 -#define C_SPARSE 0x00200000 -#define C_SWAB 0x00400000 -#define C_SYNC 0x00800000 -#define C_UCASE 0x01000000 -#define C_UNBLOCK 0x02000000 -#define C_FILL 0x04000000 -#define C_STATUS 0x08000000 -#define C_NOXFER 0x10000000 -#define C_NOINFO 0x20000000 -#define C_PROGRESS 0x40000000 +#define C_ASCII 0x0000000000000001ULL +#define C_BLOCK 0x0000000000000002ULL +#define C_BS 0x0000000000000004ULL +#define C_CBS 0x0000000000000008ULL +#define C_COUNT 0x0000000000000010ULL +#define C_EBCDIC 0x0000000000000020ULL +#define C_FILES 0x0000000000000040ULL +#define C_IBS 0x0000000000000080ULL +#define C_IF 0x0000000000000100ULL +#define C_LCASE 0x0000000000000200ULL +#define C_NOERROR 0x0000000000000400ULL +#define C_NOTRUNC 0x0000000000000800ULL +#define C_OBS 0x0000000000001000ULL +#define C_OF 0x0000000000002000ULL +#define C_OSYNC 0x0000000000004000ULL +#define C_PAREVEN 0x0000000000008000ULL +#define C_PARNONE 0x0000000000010000ULL +#define C_PARODD 0x0000000000020000ULL +#define C_PARSET 0x0000000000040000ULL +#define C_SEEK 0x0000000000080000ULL +#define C_SKIP 0x0000000000100000ULL +#define C_SPARSE 0x0000000000200000ULL +#define C_SWAB 0x0000000000400000ULL +#define C_SYNC 0x0000000000800000ULL +#define C_UCASE 0x0000000001000000ULL +#define C_UNBLOCK 0x0000000002000000ULL +#define C_FILL 0x0000000004000000ULL +#define C_STATUS 0x0000000008000000ULL +#define C_NOXFER 0x0000000010000000ULL +#define C_NOINFO 0x0000000020000000ULL +#define C_PROGRESS 0x0000000040000000ULL +#define C_FSYNC 0x0000000080000000ULL +#define C_FDATASYNC 0x0000000100000000ULL +#define C_OFSYNC 0x0000000200000000ULL +#define C_IFULLBLOCK 0x0000000400000000ULL #define C_PARITY (C_PAREVEN | C_PARODD | C_PARNONE | C_PARSET) Modified: stable/12/bin/dd/extern.h ============================================================================== --- stable/12/bin/dd/extern.h Sun Dec 8 04:17:04 2019 (r355519) +++ stable/12/bin/dd/extern.h Sun Dec 8 04:19:05 2019 (r355520) @@ -58,7 +58,7 @@ extern STAT st; extern void (*cfunc)(void); extern uintmax_t cpy_cnt; extern size_t cbsz; -extern u_int ddflags; +extern uint64_t ddflags; extern size_t speed; extern uintmax_t files_cnt; extern const u_char *ctab; From owner-svn-src-stable@freebsd.org Sun Dec 8 15:22:21 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B81E1E59DA; Sun, 8 Dec 2019 15:22:21 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47W96h72PFz480t; Sun, 8 Dec 2019 15:22:20 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC9C64392; Sun, 8 Dec 2019 15:22:20 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB8FMKAX006197; Sun, 8 Dec 2019 15:22:20 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB8FMKjg006196; Sun, 8 Dec 2019 15:22:20 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201912081522.xB8FMKjg006196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 8 Dec 2019 15:22:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355528 - stable/12/sys/netipsec X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/sys/netipsec X-SVN-Commit-Revision: 355528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Dec 2019 15:22:21 -0000 Author: ae Date: Sun Dec 8 15:22:20 2019 New Revision: 355528 URL: https://svnweb.freebsd.org/changeset/base/355528 Log: MFC r355129: Add support for dummy ESP packets with next header field equal to IPPROTO_NONE. According to RFC4303 2.6 they should be silently dropped. Submitted by: aurelien.cazuc.external_stormshield.eu Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D22557 Modified: stable/12/sys/netipsec/xform_esp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netipsec/xform_esp.c ============================================================================== --- stable/12/sys/netipsec/xform_esp.c Sun Dec 8 09:44:50 2019 (r355527) +++ stable/12/sys/netipsec/xform_esp.c Sun Dec 8 15:22:20 2019 (r355528) @@ -607,6 +607,13 @@ esp_input_cb(struct cryptop *crp) } } + /* + * RFC4303 2.6: + * Silently drop packet if next header field is IPPROTO_NONE. + */ + if (lastthree[2] == IPPROTO_NONE) + goto bad; + /* Trim the mbuf chain to remove trailing authenticator and padding */ m_adj(m, -(lastthree[1] + 2)); From owner-svn-src-stable@freebsd.org Sun Dec 8 15:24:04 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B6B61E5AAE; Sun, 8 Dec 2019 15:24:04 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47W98h3Dqpz48Bf; Sun, 8 Dec 2019 15:24:04 +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 684C543AA; Sun, 8 Dec 2019 15:24:04 +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 xB8FO4bB006330; Sun, 8 Dec 2019 15:24:04 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB8FO4qA006329; Sun, 8 Dec 2019 15:24:04 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201912081524.xB8FO4qA006329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 8 Dec 2019 15:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355529 - stable/11/sys/netipsec X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netipsec X-SVN-Commit-Revision: 355529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Dec 2019 15:24:04 -0000 Author: ae Date: Sun Dec 8 15:24:03 2019 New Revision: 355529 URL: https://svnweb.freebsd.org/changeset/base/355529 Log: MFC r355129: Add support for dummy ESP packets with next header field equal to IPPROTO_NONE. According to RFC4303 2.6 they should be silently dropped. Submitted by: aurelien.cazuc.external_stormshield.eu Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D22557 Modified: stable/11/sys/netipsec/xform_esp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netipsec/xform_esp.c ============================================================================== --- stable/11/sys/netipsec/xform_esp.c Sun Dec 8 15:22:20 2019 (r355528) +++ stable/11/sys/netipsec/xform_esp.c Sun Dec 8 15:24:03 2019 (r355529) @@ -607,6 +607,13 @@ esp_input_cb(struct cryptop *crp) } } + /* + * RFC4303 2.6: + * Silently drop packet if next header field is IPPROTO_NONE. + */ + if (lastthree[2] == IPPROTO_NONE) + goto bad; + /* Trim the mbuf chain to remove trailing authenticator and padding */ m_adj(m, -(lastthree[1] + 2)); From owner-svn-src-stable@freebsd.org Mon Dec 9 00:34:35 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 805061BFF3E; Mon, 9 Dec 2019 00:34:35 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47WPMv2nL9z43QK; Mon, 9 Dec 2019 00:34:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A1A8A8BA; Mon, 9 Dec 2019 00:34:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB90YZUY061041; Mon, 9 Dec 2019 00:34:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB90YZ7S061040; Mon, 9 Dec 2019 00:34:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912090034.xB90YZ7S061040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 9 Dec 2019 00:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355541 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 355541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 00:34:35 -0000 Author: markj Date: Mon Dec 9 00:34:34 2019 New Revision: 355541 URL: https://svnweb.freebsd.org/changeset/base/355541 Log: MFC r355469: Fix fault_type handling in vm_map_lookup(). Modified: stable/12/sys/vm/vm_map.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_map.c ============================================================================== --- stable/12/sys/vm/vm_map.c Mon Dec 9 00:30:05 2019 (r355540) +++ stable/12/sys/vm/vm_map.c Mon Dec 9 00:34:34 2019 (r355541) @@ -4525,7 +4525,7 @@ vm_map_lookup(vm_map_t *var_map, /* IN/OUT */ vm_map_entry_t entry; vm_map_t map = *var_map; vm_prot_t prot; - vm_prot_t fault_type = fault_typea; + vm_prot_t fault_type; vm_object_t eobject; vm_size_t size; struct ucred *cred; @@ -4569,7 +4569,7 @@ RetryLookupLocked: vm_map_growstack(map, vaddr, entry) == KERN_SUCCESS) goto RetryLookupLocked; } - fault_type &= VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE; + fault_type = fault_typea & VM_PROT_ALL; if ((fault_type & prot) != fault_type || prot == VM_PROT_NONE) { vm_map_unlock_read(map); return (KERN_PROTECTION_FAILURE); From owner-svn-src-stable@freebsd.org Mon Dec 9 00:42:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 266981C827B; Mon, 9 Dec 2019 00:42:13 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47WPXj0HcZz43nG; Mon, 9 Dec 2019 00:42:13 +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 051A9AA50; Mon, 9 Dec 2019 00:42:13 +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 xB90gCaO063815; Mon, 9 Dec 2019 00:42:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB90gCB3063814; Mon, 9 Dec 2019 00:42:12 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912090042.xB90gCB3063814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 9 Dec 2019 00:42:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355542 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 355542 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 00:42:13 -0000 Author: kib Date: Mon Dec 9 00:42:12 2019 New Revision: 355542 URL: https://svnweb.freebsd.org/changeset/base/355542 Log: MFC r355287: mlx5: Downgrade assert about misbehaving hardware to error message. Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Dec 9 00:34:34 2019 (r355541) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Dec 9 00:42:12 2019 (r355542) @@ -137,9 +137,11 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) mdev->dump_rege[++i].addr = next_addr; addr = next_addr; } - KASSERT(i + 1 == sz, - ("inconsistent hw crspace reads: sz %u i %u addr %#lx", - sz, i, (unsigned long)addr)); + if (i + 1 != sz) { + mlx5_core_err(mdev, + "Inconsistent hw crspace reads: sz %u i %u addr %#lx", + sz, i, (unsigned long)addr); + } mdev->dump_size = mlx5_fwdump_getsize(mdev->dump_rege); mdev->dump_data = malloc(mdev->dump_size * sizeof(uint32_t), From owner-svn-src-stable@freebsd.org Mon Dec 9 00:43:12 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BE9D1C8301; Mon, 9 Dec 2019 00:43:12 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47WPYr2CFbz43wt; Mon, 9 Dec 2019 00:43:12 +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 46D90AA75; Mon, 9 Dec 2019 00:43:12 +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 xB90hCZW067095; Mon, 9 Dec 2019 00:43:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB90hC5X067094; Mon, 9 Dec 2019 00:43:12 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912090043.xB90hC5X067094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 9 Dec 2019 00:43:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355543 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 355543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 00:43:12 -0000 Author: kib Date: Mon Dec 9 00:43:11 2019 New Revision: 355543 URL: https://svnweb.freebsd.org/changeset/base/355543 Log: MFC r355288: mlx5: Do not try to enable fwdumps if scan space did not responded. Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Dec 9 00:42:12 2019 (r355542) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Dec 9 00:43:11 2019 (r355543) @@ -111,6 +111,10 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) sz++; addr = next_addr; } + if (sz == 1) { + mlx5_core_warn(mdev, "no output from scan space\n"); + goto unlock_vsc; + } mdev->dump_rege = malloc(sz * sizeof(struct mlx5_crspace_regmap), M_MLX5_DUMP, M_WAITOK | M_ZERO); From owner-svn-src-stable@freebsd.org Mon Dec 9 00:45:32 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D3E61C83BE; Mon, 9 Dec 2019 00:45:32 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47WPcW6f1lz444G; Mon, 9 Dec 2019 00:45:31 +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 DADCDAA76; Mon, 9 Dec 2019 00:45:31 +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 xB90jVmJ067278; Mon, 9 Dec 2019 00:45:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB90jVWP067277; Mon, 9 Dec 2019 00:45:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912090045.xB90jVWP067277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 9 Dec 2019 00:45: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: r355544 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 355544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 00:45:32 -0000 Author: kib Date: Mon Dec 9 00:45:31 2019 New Revision: 355544 URL: https://svnweb.freebsd.org/changeset/base/355544 Log: MFC r355287: mlx5: Downgrade assert about misbehaving hardware to error message. Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Dec 9 00:43:11 2019 (r355543) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Dec 9 00:45:31 2019 (r355544) @@ -137,9 +137,11 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) mdev->dump_rege[++i].addr = next_addr; addr = next_addr; } - KASSERT(i + 1 == sz, - ("inconsistent hw crspace reads: sz %u i %u addr %#lx", - sz, i, (unsigned long)addr)); + if (i + 1 != sz) { + mlx5_core_err(mdev, + "Inconsistent hw crspace reads: sz %u i %u addr %#lx", + sz, i, (unsigned long)addr); + } mdev->dump_size = mlx5_fwdump_getsize(mdev->dump_rege); mdev->dump_data = malloc(mdev->dump_size * sizeof(uint32_t), From owner-svn-src-stable@freebsd.org Mon Dec 9 00:46:14 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6261B1C846D; Mon, 9 Dec 2019 00:46:14 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47WPdL22N0z44BX; Mon, 9 Dec 2019 00:46:14 +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 411F8AA79; Mon, 9 Dec 2019 00:46:14 +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 xB90kELi067367; Mon, 9 Dec 2019 00:46:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB90kEEL067366; Mon, 9 Dec 2019 00:46:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912090046.xB90kEEL067366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 9 Dec 2019 00:46: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: r355545 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 355545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 00:46:14 -0000 Author: kib Date: Mon Dec 9 00:46:13 2019 New Revision: 355545 URL: https://svnweb.freebsd.org/changeset/base/355545 Log: MFC r355288: mlx5: Do not try to enable fwdumps if scan space did not responded. Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Dec 9 00:45:31 2019 (r355544) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Dec 9 00:46:13 2019 (r355545) @@ -111,6 +111,10 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) sz++; addr = next_addr; } + if (sz == 1) { + mlx5_core_warn(mdev, "no output from scan space\n"); + goto unlock_vsc; + } mdev->dump_rege = malloc(sz * sizeof(struct mlx5_crspace_regmap), M_MLX5_DUMP, M_WAITOK | M_ZERO); From owner-svn-src-stable@freebsd.org Mon Dec 9 15:30:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E6D11D9295; Mon, 9 Dec 2019 15:30:13 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47WnFK3F7Tz3FvG; Mon, 9 Dec 2019 15:30:13 +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 507501C96D; Mon, 9 Dec 2019 15:30: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 xB9FUDEg084586; Mon, 9 Dec 2019 15:30:13 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB9FUCqJ084584; Mon, 9 Dec 2019 15:30:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912091530.xB9FUCqJ084584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 9 Dec 2019 15:30:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355559 - in stable: 11/release/arm 12/release/arm 12/release/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/release/arm 12/release/arm 12/release/arm64 X-SVN-Commit-Revision: 355559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 15:30:13 -0000 Author: kevans Date: Mon Dec 9 15:30:12 2019 New Revision: 355559 URL: https://svnweb.freebsd.org/changeset/base/355559 Log: MFC r355424: release: chase ports r519089 (rpi-firmware update) Modified: stable/12/release/arm/RPI-B.conf stable/12/release/arm64/RPI3.conf Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/release/arm/RPI-B.conf Directory Properties: stable/11/ (props changed) Modified: stable/12/release/arm/RPI-B.conf ============================================================================== --- stable/12/release/arm/RPI-B.conf Mon Dec 9 15:23:05 2019 (r355558) +++ stable/12/release/arm/RPI-B.conf Mon Dec 9 15:30:12 2019 (r355559) @@ -16,7 +16,7 @@ NODOC=1 UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi" RPI_FIRMWARE_DIR="/usr/local/share/rpi-firmware" OL_DIR="${RPI_FIRMWARE_DIR}/overlays" -OVERLAYS="mmc.dtbo pi3-disable-bt.dtbo" +OVERLAYS="mmc.dtbo disable-bt.dtbo" PART_SCHEME="MBR" export BOARDNAME="RPI-B" @@ -25,8 +25,8 @@ arm_install_uboot() { RPI_FIRMWARE_FILES="bootcode.bin config.txt \ fixup.dat fixup_cd.dat fixup_db.dat fixup_x.dat \ start.elf start_cd.elf start_db.elf start_x.elf \ - bcm2708-rpi-0-w.dtb bcm2708-rpi-b-plus.dtb bcm2708-rpi-b.dtb \ - bcm2708-rpi-cm.dtb" + bcm2708-rpi-zero-w.dtb bcm2708-rpi-b-plus.dtb \ + bcm2708-rpi-b.dtb bcm2708-rpi-cm.dtb" FATMOUNT="${DESTDIR%${KERNEL}}/fat" chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} Modified: stable/12/release/arm64/RPI3.conf ============================================================================== --- stable/12/release/arm64/RPI3.conf Mon Dec 9 15:23:05 2019 (r355558) +++ stable/12/release/arm64/RPI3.conf Mon Dec 9 15:30:12 2019 (r355559) @@ -4,7 +4,7 @@ # DTB_DIR="/usr/local/share/rpi-firmware" -DTB="bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb" +DTB="bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb bcm2711-rpi-4-b.dtb" EMBEDDED_TARGET_ARCH="aarch64" EMBEDDED_TARGET="arm64" EMBEDDEDBUILD=1 @@ -16,14 +16,14 @@ KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" NODOC=1 OL_DIR="${DTB_DIR}/overlays" -OVERLAYS="mmc.dtbo pwm.dtbo pi3-disable-bt.dtbo" +OVERLAYS="mmc.dtbo pwm.dtbo disable-bt.dtbo" PART_SCHEME="MBR" export BOARDNAME="RPI3" arm_install_uboot() { UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi3" UBOOT_FILES="README u-boot.bin" - DTB_FILES="armstub8.bin bootcode.bin fixup_cd.dat \ + DTB_FILES="armstub8.bin armstub8-gic.bin bootcode.bin fixup_cd.dat \ fixup_db.dat fixup_x.dat fixup.dat LICENCE.broadcom \ start_cd.elf start_db.elf start_x.elf start.elf ${DTB}" FATMOUNT="${DESTDIR%${KERNEL}}fat" @@ -37,6 +37,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${DTB_DIR}/${_DF} \ ${FATMOUNT}/${_DF} done + chroot ${CHROOTDIR} cp -p ${DTB_DIR}/config_rpi4.txt \ + ${FATMOUNT} chroot ${CHROOTDIR} cp -p ${DTB_DIR}/config_rpi3.txt \ ${FATMOUNT}/config.txt chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/overlays From owner-svn-src-stable@freebsd.org Mon Dec 9 15:30:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 045EF1D9291; Mon, 9 Dec 2019 15:30:13 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47WnFJ6Kj5z3FvF; Mon, 9 Dec 2019 15:30:12 +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 D457A1C96C; Mon, 9 Dec 2019 15:30:12 +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 xB9FUCBB084579; Mon, 9 Dec 2019 15:30:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB9FUCkm084578; Mon, 9 Dec 2019 15:30:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912091530.xB9FUCkm084578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 9 Dec 2019 15:30:12 +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: r355559 - in stable: 11/release/arm 12/release/arm 12/release/arm64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/release/arm 12/release/arm 12/release/arm64 X-SVN-Commit-Revision: 355559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 15:30:13 -0000 Author: kevans Date: Mon Dec 9 15:30:12 2019 New Revision: 355559 URL: https://svnweb.freebsd.org/changeset/base/355559 Log: MFC r355424: release: chase ports r519089 (rpi-firmware update) Modified: stable/11/release/arm/RPI-B.conf Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/release/arm/RPI-B.conf stable/12/release/arm64/RPI3.conf Directory Properties: stable/12/ (props changed) Modified: stable/11/release/arm/RPI-B.conf ============================================================================== --- stable/11/release/arm/RPI-B.conf Mon Dec 9 15:23:05 2019 (r355558) +++ stable/11/release/arm/RPI-B.conf Mon Dec 9 15:30:12 2019 (r355559) @@ -16,7 +16,7 @@ NODOC=1 UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi" RPI_FIRMWARE_DIR="/usr/local/share/rpi-firmware" OL_DIR="${RPI_FIRMWARE_DIR}/overlays" -OVERLAYS="mmc.dtbo pi3-disable-bt.dtbo" +OVERLAYS="mmc.dtbo disable-bt.dtbo" PART_SCHEME="MBR" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x2000000" @@ -25,8 +25,8 @@ arm_install_uboot() { RPI_FIRMWARE_FILES="bootcode.bin config.txt \ fixup.dat fixup_cd.dat fixup_db.dat fixup_x.dat \ start.elf start_cd.elf start_db.elf start_x.elf \ - bcm2708-rpi-0-w.dtb bcm2708-rpi-b-plus.dtb bcm2708-rpi-b.dtb \ - bcm2708-rpi-cm.dtb" + bcm2708-rpi-zero-w.dtb bcm2708-rpi-b-plus.dtb \ + bcm2708-rpi-b.dtb bcm2708-rpi-cm.dtb" FATMOUNT="${DESTDIR%${KERNEL}}/fat" chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} From owner-svn-src-stable@freebsd.org Mon Dec 9 16:21:27 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 794EE1DA2C6; Mon, 9 Dec 2019 16:21:27 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47WpNR3MDWz3JxK; Mon, 9 Dec 2019 16:21:27 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E4521D2E0; Mon, 9 Dec 2019 16:21:27 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB9GLR4e017111; Mon, 9 Dec 2019 16:21:27 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB9GLQLE017107; Mon, 9 Dec 2019 16:21:26 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912091621.xB9GLQLE017107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 9 Dec 2019 16:21:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355560 - in stable/12/stand/efi: include libefi X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in stable/12/stand/efi: include libefi X-SVN-Commit-Revision: 355560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 16:21:27 -0000 Author: tsoome Date: Mon Dec 9 16:21:26 2019 New Revision: 355560 URL: https://svnweb.freebsd.org/changeset/base/355560 Log: MFC r355224, r355308, r355392: loader.efi: efipart needs better support detecting nested partitions Just as disks can have nested partitions, the same happens with cd devices, so we need to detect device paths and make sure we will not mix the handles. To address this: we fetch handle array and create linked list of block devices. we walk the list and detect parent devices and set children pd_parent. for {fd, cd, hd}, we walk device list and pick up our devices and store to corresponding list. We make sure we store parent device first. For sorting we use 3 steps: We check for floppy, we check for cd and then everything else must be hd. In general, it seems the floppy devices have no parent. CD can have both parents and children (multiple boot entries, partitions from the hybrid disk image). Tested by: cross+freebsd@distal.com on Cisco UCS systems, C200 series (C220M5, C240M4, C220M3). Also on MBP with UEFI 1.10 Modified: stable/12/stand/efi/include/efidevp.h stable/12/stand/efi/include/efilib.h stable/12/stand/efi/libefi/devpath.c stable/12/stand/efi/libefi/efipart.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/include/efidevp.h ============================================================================== --- stable/12/stand/efi/include/efidevp.h Mon Dec 9 15:30:12 2019 (r355559) +++ stable/12/stand/efi/include/efidevp.h Mon Dec 9 16:21:26 2019 (r355560) @@ -288,6 +288,14 @@ typedef struct _UART_DEVICE_PATH { #define DEVICE_PATH_MESSAGING_VT_UTF8 \ { 0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88} } +/* Device Logical Unit SubType. */ +#define MSG_DEVICE_LOGICAL_UNIT_DP 0x11 +typedef struct { + EFI_DEVICE_PATH Header; + /* Logical Unit Number for the interface. */ + UINT8 Lun; +} DEVICE_LOGICAL_UNIT_DEVICE_PATH; + #define MSG_SATA_DP 0x12 typedef struct _SATA_DEVICE_PATH { EFI_DEVICE_PATH Header; Modified: stable/12/stand/efi/include/efilib.h ============================================================================== --- stable/12/stand/efi/include/efilib.h Mon Dec 9 15:30:12 2019 (r355559) +++ stable/12/stand/efi/include/efilib.h Mon Dec 9 16:21:26 2019 (r355560) @@ -84,6 +84,7 @@ int efi_handle_update_dev(EFI_HANDLE, struct devsw *, EFI_DEVICE_PATH *efi_lookup_image_devpath(EFI_HANDLE); EFI_DEVICE_PATH *efi_lookup_devpath(EFI_HANDLE); +void efi_close_devpath(EFI_HANDLE); EFI_HANDLE efi_devpath_handle(EFI_DEVICE_PATH *); EFI_DEVICE_PATH *efi_devpath_last_node(EFI_DEVICE_PATH *); EFI_DEVICE_PATH *efi_devpath_trim(EFI_DEVICE_PATH *); Modified: stable/12/stand/efi/libefi/devpath.c ============================================================================== --- stable/12/stand/efi/libefi/devpath.c Mon Dec 9 15:30:12 2019 (r355559) +++ stable/12/stand/efi/libefi/devpath.c Mon Dec 9 16:21:26 2019 (r355560) @@ -68,6 +68,16 @@ efi_lookup_devpath(EFI_HANDLE handle) return (devpath); } +void +efi_close_devpath(EFI_HANDLE handle) +{ + EFI_STATUS status; + + status = BS->CloseProtocol(handle, &DevicePathGUID, IH, NULL); + if (EFI_ERROR(status)) + printf("CloseProtocol error: %lu\n", EFI_ERROR_CODE(status)); +} + static char * efi_make_tail(char *suffix) { Modified: stable/12/stand/efi/libefi/efipart.c ============================================================================== --- stable/12/stand/efi/libefi/efipart.c Mon Dec 9 15:30:12 2019 (r355559) +++ stable/12/stand/efi/libefi/efipart.c Mon Dec 9 16:21:26 2019 (r355560) @@ -44,9 +44,11 @@ __FBSDID("$FreeBSD$"); static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL; +typedef bool (*pd_test_cb_t)(pdinfo_t *, pdinfo_t *); static int efipart_initfd(void); static int efipart_initcd(void); static int efipart_inithd(void); +static void efipart_cdinfo_add(pdinfo_t *); static int efipart_strategy(void *, int, daddr_t, size_t, char *, size_t *); static int efipart_realstrategy(void *, int, daddr_t, size_t, char *, size_t *); @@ -209,6 +211,139 @@ efiblk_pdinfo_count(pdinfo_list_t *pdi) return (i); } +static pdinfo_t * +efipart_find_parent(pdinfo_list_t *pdi, EFI_DEVICE_PATH *devpath) +{ + pdinfo_t *pd; + EFI_DEVICE_PATH *parent; + + /* We want to find direct parent */ + parent = efi_devpath_trim(devpath); + /* We should not get out of memory here but be careful. */ + if (parent == NULL) + return (NULL); + + STAILQ_FOREACH(pd, pdi, pd_link) { + /* We must have exact match. */ + if (efi_devpath_match(pd->pd_devpath, parent)) + break; + } + free(parent); + return (pd); +} + +/* + * Return true when we should ignore this device. + */ +static bool +efipart_ignore_device(EFI_HANDLE h, EFI_BLOCK_IO *blkio, + EFI_DEVICE_PATH *devpath) +{ + EFI_DEVICE_PATH *node, *parent; + + /* + * We assume the block size 512 or greater power of 2. + * Also skip devices with block size > 64k (16 is max + * ashift supported by zfs). + * iPXE is known to insert stub BLOCK IO device with + * BlockSize 1. + */ + if (blkio->Media->BlockSize < 512 || + blkio->Media->BlockSize > (1 << 16) || + !powerof2(blkio->Media->BlockSize)) { + efi_close_devpath(h); + return (true); + } + + /* Allowed values are 0, 1 and power of 2. */ + if (blkio->Media->IoAlign > 1 && + !powerof2(blkio->Media->IoAlign)) { + efi_close_devpath(h); + return (true); + } + + /* + * With device tree setup: + * PciRoot(0x0)/Pci(0x14,0x0)/USB(0x5,0)/USB(0x2,0x0) + * PciRoot(0x0)/Pci(0x14,0x0)/USB(0x5,0)/USB(0x2,0x0)/Unit(0x1) + * PciRoot(0x0)/Pci(0x14,0x0)/USB(0x5,0)/USB(0x2,0x0)/Unit(0x2) + * PciRoot(0x0)/Pci(0x14,0x0)/USB(0x5,0)/USB(0x2,0x0)/Unit(0x3) + * PciRoot(0x0)/Pci(0x14,0x0)/USB(0x5,0)/USB(0x2,0x0)/Unit(0x3)/CDROM.. + * PciRoot(0x0)/Pci(0x14,0x0)/USB(0x5,0)/USB(0x2,0x0)/Unit(0x3)/CDROM.. + * PciRoot(0x0)/Pci(0x14,0x0)/USB(0x5,0)/USB(0x2,0x0)/Unit(0x4) + * PciRoot(0x0)/Pci(0x14,0x0)/USB(0x5,0)/USB(0x2,0x0)/Unit(0x5) + * PciRoot(0x0)/Pci(0x14,0x0)/USB(0x5,0)/USB(0x2,0x0)/Unit(0x6) + * PciRoot(0x0)/Pci(0x14,0x0)/USB(0x5,0)/USB(0x2,0x0)/Unit(0x7) + * + * In above exmple only Unit(0x3) has media, all other nodes are + * missing media and should not be used. + * + * No media does not always mean there is no device, but in above + * case, we can not really assume there is any device. + * Therefore, if this node is USB, or this node is Unit (LUN) and + * direct parent is USB and we have no media, we will ignore this + * device. + * + * Variation of the same situation, but with SCSI devices: + * PciRoot(0x0)/Pci(0x1a,0x0)/USB(0x1,0)/USB(0x3,0x0)/SCSI(0x0,0x1) + * PciRoot(0x0)/Pci(0x1a,0x0)/USB(0x1,0)/USB(0x3,0x0)/SCSI(0x0,0x2) + * PciRoot(0x0)/Pci(0x1a,0x0)/USB(0x1,0)/USB(0x3,0x0)/SCSI(0x0,0x3) + * PciRoot(0x0)/Pci(0x1a,0x0)/USB(0x1,0)/USB(0x3,0x0)/SCSI(0x0,0x3)/CD.. + * PciRoot(0x0)/Pci(0x1a,0x0)/USB(0x1,0)/USB(0x3,0x0)/SCSI(0x0,0x3)/CD.. + * PciRoot(0x0)/Pci(0x1a,0x0)/USB(0x1,0)/USB(0x3,0x0)/SCSI(0x0,0x4) + * + * Here above the SCSI luns 1,2 and 4 have no media. + */ + + /* Do not ignore device with media. */ + if (blkio->Media->MediaPresent) + return (false); + + node = efi_devpath_last_node(devpath); + if (node == NULL) + return (false); + + /* USB without media present */ + if (DevicePathType(node) == MESSAGING_DEVICE_PATH && + DevicePathSubType(node) == MSG_USB_DP) { + efi_close_devpath(h); + return (true); + } + + parent = efi_devpath_trim(devpath); + if (parent != NULL) { + bool parent_is_usb = false; + + node = efi_devpath_last_node(parent); + if (node == NULL) { + free(parent); + return (false); + } + if (DevicePathType(node) == MESSAGING_DEVICE_PATH && + DevicePathSubType(node) == MSG_USB_DP) + parent_is_usb = true; + free(parent); + + node = efi_devpath_last_node(devpath); + if (node == NULL) + return (false); + if (parent_is_usb && + DevicePathType(node) == MESSAGING_DEVICE_PATH) { + /* + * no media, parent is USB and devicepath is + * LUN or SCSI. + */ + if (DevicePathSubType(node) == + MSG_DEVICE_LOGICAL_UNIT_DP || + DevicePathSubType(node) == MSG_SCSI_DP) { + efi_close_devpath(h); + return (true); + } + } + } + return (false); +} + int efipart_inithandles(void) { @@ -256,25 +391,9 @@ efipart_inithandles(void) continue; } - /* - * We assume the block size 512 or greater power of 2. - * Also skip devices with block size > 64k (16 is max - * ashift supported by zfs). - * iPXE is known to insert stub BLOCK IO device with - * BlockSize 1. - */ - if (blkio->Media->BlockSize < 512 || - blkio->Media->BlockSize > (1 << 16) || - !powerof2(blkio->Media->BlockSize)) { + if (efipart_ignore_device(hin[i], blkio, devpath)) continue; - } - /* Allowed values are 0, 1 and power of 2. */ - if (blkio->Media->IoAlign > 1 && - !powerof2(blkio->Media->IoAlign)) { - continue; - } - /* This is bad. */ if ((pd = calloc(1, sizeof(*pd))) == NULL) { printf("efipart_inithandles: Out of memory.\n"); @@ -289,10 +408,32 @@ efipart_inithandles(void) STAILQ_INSERT_TAIL(&pdinfo, pd, pd_link); } + /* + * Walk pdinfo and set parents based on device path. + */ + STAILQ_FOREACH(pd, &pdinfo, pd_link) { + pd->pd_parent = efipart_find_parent(&pdinfo, pd->pd_devpath); + } free(hin); return (0); } +/* + * Get node identified by pd_test() from plist. + */ +static pdinfo_t * +efipart_get_pd(pdinfo_list_t *plist, pd_test_cb_t pd_test, pdinfo_t *data) +{ + pdinfo_t *pd; + + STAILQ_FOREACH(pd, plist, pd_link) { + if (pd_test(pd, data)) + break; + } + + return (pd); +} + static ACPI_HID_DEVICE_PATH * efipart_floppy(EFI_DEVICE_PATH *node) { @@ -310,19 +451,19 @@ efipart_floppy(EFI_DEVICE_PATH *node) return (NULL); } -static pdinfo_t * -efipart_find_parent(pdinfo_list_t *pdi, EFI_DEVICE_PATH *devpath) +static bool +efipart_testfd(pdinfo_t *fd, pdinfo_t *data __unused) { - pdinfo_t *pd, *part; + EFI_DEVICE_PATH *node; - STAILQ_FOREACH(pd, pdi, pd_link) { - if (efi_devpath_is_prefix(pd->pd_devpath, devpath)) - return (pd); - part = efipart_find_parent(&pd->pd_part, devpath); - if (part != NULL) - return (part); - } - return (NULL); + node = efi_devpath_last_node(fd->pd_devpath); + if (node == NULL) + return (false); + + if (efipart_floppy(node) != NULL) + return (true); + + return (false); } static int @@ -332,8 +473,7 @@ efipart_initfd(void) ACPI_HID_DEVICE_PATH *acpi; pdinfo_t *parent, *fd; -restart: - STAILQ_FOREACH(fd, &pdinfo, pd_link) { + while ((fd = efipart_get_pd(&pdinfo, efipart_testfd, NULL)) != NULL) { if ((node = efi_devpath_last_node(fd->pd_devpath)) == NULL) continue; @@ -341,7 +481,7 @@ restart: continue; STAILQ_REMOVE(&pdinfo, fd, pdinfo, pd_link); - parent = efipart_find_parent(&pdinfo, fd->pd_devpath); + parent = fd->pd_parent; if (parent != NULL) { STAILQ_REMOVE(&pdinfo, parent, pdinfo, pd_link); parent->pd_alias = fd->pd_handle; @@ -353,7 +493,6 @@ restart: } fd->pd_devsw = &efipart_fddev; STAILQ_INSERT_TAIL(&fdinfo, fd, pd_link); - goto restart; } bcache_add_dev(efiblk_pdinfo_count(&fdinfo)); @@ -366,208 +505,136 @@ restart: static void efipart_cdinfo_add(pdinfo_t *cd) { - pdinfo_t *pd, *last; + pdinfo_t *parent, *pd, *last; - STAILQ_FOREACH(pd, &cdinfo, pd_link) { - if (efi_devpath_is_prefix(pd->pd_devpath, cd->pd_devpath)) { - last = STAILQ_LAST(&pd->pd_part, pdinfo, pd_link); - if (last != NULL) - cd->pd_unit = last->pd_unit + 1; - else - cd->pd_unit = 0; - cd->pd_parent = pd; - cd->pd_devsw = &efipart_cddev; - STAILQ_INSERT_TAIL(&pd->pd_part, cd, pd_link); - return; + if (cd == NULL) + return; + + parent = cd->pd_parent; + /* Make sure we have parent added */ + efipart_cdinfo_add(parent); + + STAILQ_FOREACH(pd, &pdinfo, pd_link) { + if (efi_devpath_match(pd->pd_devpath, cd->pd_devpath)) { + STAILQ_REMOVE(&pdinfo, cd, pdinfo, pd_link); + break; } } + if (pd == NULL) { + /* This device is already added. */ + return; + } + if (parent != NULL) { + last = STAILQ_LAST(&parent->pd_part, pdinfo, pd_link); + if (last != NULL) + cd->pd_unit = last->pd_unit + 1; + else + cd->pd_unit = 0; + cd->pd_devsw = &efipart_cddev; + STAILQ_INSERT_TAIL(&parent->pd_part, cd, pd_link); + return; + } + last = STAILQ_LAST(&cdinfo, pdinfo, pd_link); if (last != NULL) cd->pd_unit = last->pd_unit + 1; else cd->pd_unit = 0; - cd->pd_parent = NULL; cd->pd_devsw = &efipart_cddev; STAILQ_INSERT_TAIL(&cdinfo, cd, pd_link); } static bool -efipart_testcd(EFI_DEVICE_PATH *node, EFI_BLOCK_IO *blkio) +efipart_testcd(pdinfo_t *cd, pdinfo_t *data __unused) { + EFI_DEVICE_PATH *node; + + node = efi_devpath_last_node(cd->pd_devpath); + if (node == NULL) + return (false); + + if (efipart_floppy(node) != NULL) + return (false); + if (DevicePathType(node) == MEDIA_DEVICE_PATH && DevicePathSubType(node) == MEDIA_CDROM_DP) { return (true); } /* cd drive without the media. */ - if (blkio->Media->RemovableMedia && - !blkio->Media->MediaPresent) { + if (cd->pd_blkio->Media->RemovableMedia && + !cd->pd_blkio->Media->MediaPresent) { return (true); } return (false); } -static void -efipart_updatecd(void) +/* + * Test if pd is parent for device. + */ +static bool +efipart_testchild(pdinfo_t *dev, pdinfo_t *pd) { - EFI_DEVICE_PATH *devpath, *node; - EFI_STATUS status; - pdinfo_t *parent, *cd; + /* device with no parent. */ + if (dev->pd_parent == NULL) + return (false); -restart: - STAILQ_FOREACH(cd, &pdinfo, pd_link) { - if ((node = efi_devpath_last_node(cd->pd_devpath)) == NULL) - continue; - - if (efipart_floppy(node) != NULL) - continue; - - /* Is parent of this device already registered? */ - parent = efipart_find_parent(&cdinfo, cd->pd_devpath); - if (parent != NULL) { - STAILQ_REMOVE(&pdinfo, cd, pdinfo, pd_link); - efipart_cdinfo_add(cd); - goto restart; - } - - if (!efipart_testcd(node, cd->pd_blkio)) - continue; - - /* Find parent and unlink both parent and cd from pdinfo */ - STAILQ_REMOVE(&pdinfo, cd, pdinfo, pd_link); - parent = efipart_find_parent(&pdinfo, cd->pd_devpath); - if (parent != NULL) { - STAILQ_REMOVE(&pdinfo, parent, pdinfo, pd_link); - efipart_cdinfo_add(parent); - } - - if (parent == NULL) - parent = efipart_find_parent(&cdinfo, cd->pd_devpath); - - /* - * If we come across a logical partition of subtype CDROM - * it doesn't refer to the CD filesystem itself, but rather - * to any usable El Torito boot image on it. In this case - * we try to find the parent device and add that instead as - * that will be the CD filesystem. - */ - if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_CDROM_DP && - parent == NULL) { - parent = calloc(1, sizeof(*parent)); - if (parent == NULL) { - printf("efipart_updatecd: out of memory\n"); - /* this device is lost but try again. */ - free(cd); - goto restart; - } - - devpath = efi_devpath_trim(cd->pd_devpath); - if (devpath == NULL) { - printf("efipart_updatecd: out of memory\n"); - /* this device is lost but try again. */ - free(parent); - free(cd); - goto restart; - } - parent->pd_devpath = devpath; - status = BS->LocateDevicePath(&blkio_guid, - &parent->pd_devpath, &parent->pd_handle); - free(devpath); - if (EFI_ERROR(status)) { - printf("efipart_updatecd: error %lu\n", - EFI_ERROR_CODE(status)); - free(parent); - free(cd); - goto restart; - } - parent->pd_devpath = - efi_lookup_devpath(parent->pd_handle); - efipart_cdinfo_add(parent); - } - - efipart_cdinfo_add(cd); - goto restart; + if (efi_devpath_match(dev->pd_parent->pd_devpath, pd->pd_devpath)) { + return (true); } + return (false); } static int efipart_initcd(void) { - efipart_updatecd(); + pdinfo_t *cd; + while ((cd = efipart_get_pd(&pdinfo, efipart_testcd, NULL)) != NULL) + efipart_cdinfo_add(cd); + + /* Find all children of CD devices we did add above. */ + STAILQ_FOREACH(cd, &cdinfo, pd_link) { + pdinfo_t *child; + + for (child = efipart_get_pd(&pdinfo, efipart_testchild, cd); + child != NULL; + child = efipart_get_pd(&pdinfo, efipart_testchild, cd)) + efipart_cdinfo_add(child); + } bcache_add_dev(efiblk_pdinfo_count(&cdinfo)); return (0); } -static bool +static void efipart_hdinfo_add_node(pdinfo_t *hd, EFI_DEVICE_PATH *node) { - pdinfo_t *pd, *ptr; + pdinfo_t *parent, *ptr; if (node == NULL) - return (false); + return; - /* Find our disk device. */ - STAILQ_FOREACH(pd, &hdinfo, pd_link) { - if (efi_devpath_is_prefix(pd->pd_devpath, hd->pd_devpath)) - break; - } - if (pd == NULL) - return (false); - - /* If the node is not MEDIA_HARDDRIVE_DP, it is sub-partition. */ + parent = hd->pd_parent; + /* + * If the node is not MEDIA_HARDDRIVE_DP, it is sub-partition. + * This can happen with Vendor nodes, and since we do not know + * the more about those nodes, we just count them. + */ if (DevicePathSubType(node) != MEDIA_HARDDRIVE_DP) { - STAILQ_FOREACH(ptr, &pd->pd_part, pd_link) { - if (efi_devpath_is_prefix(ptr->pd_devpath, - hd->pd_devpath)) - break; - } - /* - * ptr == NULL means we have handles in unexpected order - * and we would need to re-order the partitions later. - */ + ptr = STAILQ_LAST(&parent->pd_part, pdinfo, pd_link); if (ptr != NULL) - pd = ptr; - } - - /* Add the partition. */ - if (DevicePathSubType(node) == MEDIA_HARDDRIVE_DP) { - hd->pd_unit = ((HARDDRIVE_DEVICE_PATH *)node)->PartitionNumber; - } else { - ptr = STAILQ_LAST(&pd->pd_part, pdinfo, pd_link); - if (ptr != NULL) hd->pd_unit = ptr->pd_unit + 1; else hd->pd_unit = 0; + } else { + hd->pd_unit = ((HARDDRIVE_DEVICE_PATH *)node)->PartitionNumber; } - hd->pd_parent = pd; - hd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&pd->pd_part, hd, pd_link); - return (true); -} - -static void -efipart_hdinfo_add(pdinfo_t *hd, EFI_DEVICE_PATH *node) -{ - pdinfo_t *last; - - if (efipart_hdinfo_add_node(hd, node)) - return; - - last = STAILQ_LAST(&hdinfo, pdinfo, pd_link); - if (last != NULL) - hd->pd_unit = last->pd_unit + 1; - else - hd->pd_unit = 0; - - /* Add the disk. */ hd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&hdinfo, hd, pd_link); + STAILQ_INSERT_TAIL(&parent->pd_part, hd, pd_link); } /* @@ -640,96 +707,75 @@ efipart_hdinfo_add_filepath(pdinfo_t *hd, FILEPATH_DEV } static void -efipart_updatehd(void) +efipart_hdinfo_add(pdinfo_t *hd) { - EFI_DEVICE_PATH *devpath, *node; - EFI_STATUS status; - pdinfo_t *parent, *hd; + pdinfo_t *parent, *pd, *last; + EFI_DEVICE_PATH *node; -restart: - STAILQ_FOREACH(hd, &pdinfo, pd_link) { - if ((node = efi_devpath_last_node(hd->pd_devpath)) == NULL) - continue; + if (hd == NULL) + return; - if (efipart_floppy(node) != NULL) - continue; + parent = hd->pd_parent; + /* Make sure we have parent added */ + efipart_hdinfo_add(parent); - if (efipart_testcd(node, hd->pd_blkio)) - continue; - - if (DevicePathType(node) == HARDWARE_DEVICE_PATH && - (DevicePathSubType(node) == HW_PCI_DP || - DevicePathSubType(node) == HW_VENDOR_DP)) { + STAILQ_FOREACH(pd, &pdinfo, pd_link) { + if (efi_devpath_match(pd->pd_devpath, hd->pd_devpath)) { STAILQ_REMOVE(&pdinfo, hd, pdinfo, pd_link); - efipart_hdinfo_add(hd, NULL); - goto restart; + break; } + } + if (pd == NULL) { + /* This device is already added. */ + return; + } - if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_FILEPATH_DP) { - STAILQ_REMOVE(&pdinfo, hd, pdinfo, pd_link); - efipart_hdinfo_add_filepath(hd, - (FILEPATH_DEVICE_PATH *)node); - goto restart; - } + if ((node = efi_devpath_last_node(hd->pd_devpath)) == NULL) + return; - STAILQ_REMOVE(&pdinfo, hd, pdinfo, pd_link); - parent = efipart_find_parent(&pdinfo, hd->pd_devpath); - if (parent != NULL) { - STAILQ_REMOVE(&pdinfo, parent, pdinfo, pd_link); - efipart_hdinfo_add(parent, NULL); - } else { - parent = efipart_find_parent(&hdinfo, hd->pd_devpath); - } + if (DevicePathType(node) == MEDIA_DEVICE_PATH && + DevicePathSubType(node) == MEDIA_FILEPATH_DP) { + efipart_hdinfo_add_filepath(hd, + (FILEPATH_DEVICE_PATH *)node); + return; + } - if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_HARDDRIVE_DP && - parent == NULL) { - parent = calloc(1, sizeof(*parent)); - if (parent == NULL) { - printf("efipart_updatehd: out of memory\n"); - /* this device is lost but try again. */ - free(hd); - goto restart; - } + if (parent != NULL) { + efipart_hdinfo_add_node(hd, node); + return; + } - devpath = efi_devpath_trim(hd->pd_devpath); - if (devpath == NULL) { - printf("efipart_updatehd: out of memory\n"); - /* this device is lost but try again. */ - free(parent); - free(hd); - goto restart; - } + last = STAILQ_LAST(&hdinfo, pdinfo, pd_link); + if (last != NULL) + hd->pd_unit = last->pd_unit + 1; + else + hd->pd_unit = 0; - parent->pd_devpath = devpath; - status = BS->LocateDevicePath(&blkio_guid, - &parent->pd_devpath, &parent->pd_handle); - free(devpath); - if (EFI_ERROR(status)) { - printf("efipart_updatehd: error %lu\n", - EFI_ERROR_CODE(status)); - free(parent); - free(hd); - goto restart; - } + /* Add the disk. */ + hd->pd_devsw = &efipart_hddev; + STAILQ_INSERT_TAIL(&hdinfo, hd, pd_link); +} - parent->pd_devpath = - efi_lookup_devpath(&parent->pd_handle); +static bool +efipart_testhd(pdinfo_t *hd, pdinfo_t *data __unused) +{ + if (efipart_testfd(hd, NULL)) + return (false); - efipart_hdinfo_add(parent, NULL); - } + if (efipart_testcd(hd, NULL)) + return (false); - efipart_hdinfo_add(hd, node); - goto restart; - } + /* Anything else must be HD. */ + return (true); } static int efipart_inithd(void) { + pdinfo_t *hd; - efipart_updatehd(); + while ((hd = efipart_get_pd(&pdinfo, efipart_testhd, NULL)) != NULL) + efipart_hdinfo_add(hd); bcache_add_dev(efiblk_pdinfo_count(&hdinfo)); return (0); From owner-svn-src-stable@freebsd.org Mon Dec 9 17:13:17 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F09601DB0A9; Mon, 9 Dec 2019 17:13:17 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47WqXF5wx0z3M0k; Mon, 9 Dec 2019 17:13:17 +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 C6DD01DD1B; Mon, 9 Dec 2019 17:13: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 xB9HDHd8049076; Mon, 9 Dec 2019 17:13:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB9HDHPo049074; Mon, 9 Dec 2019 17:13:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912091713.xB9HDHPo049074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 9 Dec 2019 17:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355561 - in stable/12/sys/dev: amdsmn amdtemp X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys/dev: amdsmn amdtemp X-SVN-Commit-Revision: 355561 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 17:13:18 -0000 Author: mav Date: Mon Dec 9 17:13:17 2019 New Revision: 355561 URL: https://svnweb.freebsd.org/changeset/base/355561 Log: MFC r350624 (by cem): amdtemp(4), amdsmn(4): Attach to Ryzen 3 (Zen 2) hostbridges PR: 239607 Modified: stable/12/sys/dev/amdsmn/amdsmn.c stable/12/sys/dev/amdtemp/amdtemp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/amdsmn/amdsmn.c ============================================================================== --- stable/12/sys/dev/amdsmn/amdsmn.c Mon Dec 9 16:21:26 2019 (r355560) +++ stable/12/sys/dev/amdsmn/amdsmn.c Mon Dec 9 17:13:17 2019 (r355561) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #define PCI_DEVICE_ID_AMD_15H_M60H_ROOT 0x1576 #define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450 #define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0 +#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 struct pciid; struct amdsmn_softc { @@ -87,6 +88,12 @@ static const struct pciid { { .amdsmn_vendorid = CPU_VENDOR_AMD, .amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M10H_ROOT, + .amdsmn_addr_reg = F17H_SMN_ADDR_REG, + .amdsmn_data_reg = F17H_SMN_DATA_REG, + }, + { + .amdsmn_vendorid = CPU_VENDOR_AMD, + .amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M30H_ROOT, .amdsmn_addr_reg = F17H_SMN_ADDR_REG, .amdsmn_data_reg = F17H_SMN_DATA_REG, }, Modified: stable/12/sys/dev/amdtemp/amdtemp.c ============================================================================== --- stable/12/sys/dev/amdtemp/amdtemp.c Mon Dec 9 16:21:26 2019 (r355560) +++ stable/12/sys/dev/amdtemp/amdtemp.c Mon Dec 9 17:13:17 2019 (r355561) @@ -96,6 +96,7 @@ struct amdtemp_softc { #define DEVICEID_AMD_MISC16_M30H 0x1583 #define DEVICEID_AMD_HOSTB17H_ROOT 0x1450 #define DEVICEID_AMD_HOSTB17H_M10H_ROOT 0x15d0 +#define DEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 static const struct amdtemp_product { uint16_t amdtemp_vendorid; @@ -118,6 +119,7 @@ static const struct amdtemp_product { { VENDORID_AMD, DEVICEID_AMD_MISC16_M30H, true }, { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_ROOT, false }, { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M10H_ROOT, false }, + { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M30H_ROOT, false }, }; /* From owner-svn-src-stable@freebsd.org Mon Dec 9 17:14:44 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B46E61DB1D0; Mon, 9 Dec 2019 17:14: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47WqYw4MZPz3MFZ; Mon, 9 Dec 2019 17:14: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 910DB1DD27; Mon, 9 Dec 2019 17:14: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 xB9HEi0Q049325; Mon, 9 Dec 2019 17:14:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB9HEiMK049324; Mon, 9 Dec 2019 17:14:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912091714.xB9HEiMK049324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 9 Dec 2019 17:14: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: r355562 - in stable/11/sys/dev: amdsmn amdtemp X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/dev: amdsmn amdtemp X-SVN-Commit-Revision: 355562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 17:14:44 -0000 Author: mav Date: Mon Dec 9 17:14:43 2019 New Revision: 355562 URL: https://svnweb.freebsd.org/changeset/base/355562 Log: MFC r350624 (by cem): amdtemp(4), amdsmn(4): Attach to Ryzen 3 (Zen 2) hostbridges PR: 239607 Modified: stable/11/sys/dev/amdsmn/amdsmn.c stable/11/sys/dev/amdtemp/amdtemp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/amdsmn/amdsmn.c ============================================================================== --- stable/11/sys/dev/amdsmn/amdsmn.c Mon Dec 9 17:13:17 2019 (r355561) +++ stable/11/sys/dev/amdsmn/amdsmn.c Mon Dec 9 17:14:43 2019 (r355562) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #define PCI_DEVICE_ID_AMD_15H_M60H_ROOT 0x1576 #define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450 #define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0 +#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 struct pciid; struct amdsmn_softc { @@ -87,6 +88,12 @@ static const struct pciid { { .amdsmn_vendorid = CPU_VENDOR_AMD, .amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M10H_ROOT, + .amdsmn_addr_reg = F17H_SMN_ADDR_REG, + .amdsmn_data_reg = F17H_SMN_DATA_REG, + }, + { + .amdsmn_vendorid = CPU_VENDOR_AMD, + .amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M30H_ROOT, .amdsmn_addr_reg = F17H_SMN_ADDR_REG, .amdsmn_data_reg = F17H_SMN_DATA_REG, }, Modified: stable/11/sys/dev/amdtemp/amdtemp.c ============================================================================== --- stable/11/sys/dev/amdtemp/amdtemp.c Mon Dec 9 17:13:17 2019 (r355561) +++ stable/11/sys/dev/amdtemp/amdtemp.c Mon Dec 9 17:14:43 2019 (r355562) @@ -94,6 +94,7 @@ struct amdtemp_softc { #define DEVICEID_AMD_MISC16_M30H 0x1583 #define DEVICEID_AMD_HOSTB17H_ROOT 0x1450 #define DEVICEID_AMD_HOSTB17H_M10H_ROOT 0x15d0 +#define DEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 static const struct amdtemp_product { uint16_t amdtemp_vendorid; @@ -116,6 +117,7 @@ static const struct amdtemp_product { { VENDORID_AMD, DEVICEID_AMD_MISC16_M30H, true }, { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_ROOT, false }, { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M10H_ROOT, false }, + { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M30H_ROOT, false }, { 0, 0 } }; From owner-svn-src-stable@freebsd.org Mon Dec 9 21:10:19 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29B3A1DEE64; Mon, 9 Dec 2019 21:10:19 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Wwnl0Hylz442s; Mon, 9 Dec 2019 21:10:19 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0104320673; Mon, 9 Dec 2019 21:10:18 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB9LAIBH086252; Mon, 9 Dec 2019 21:10:18 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB9LAILI086251; Mon, 9 Dec 2019 21:10:18 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912092110.xB9LAILI086251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 9 Dec 2019 21:10:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355571 - stable/12/stand/efi/libefi X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/stand/efi/libefi X-SVN-Commit-Revision: 355571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 21:10:19 -0000 Author: tsoome Date: Mon Dec 9 21:10:18 2019 New Revision: 355571 URL: https://svnweb.freebsd.org/changeset/base/355571 Log: MFC r355347: loader: ReadKeyStrokeEx may return partial keystrokes In some systems we can receive no scancode nor unicodechar values. PR: 240760 Reported by: Ariel Millennium Thornton Modified: stable/12/stand/efi/libefi/efi_console.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/libefi/efi_console.c ============================================================================== --- stable/12/stand/efi/libefi/efi_console.c Mon Dec 9 19:25:15 2019 (r355570) +++ stable/12/stand/efi/libefi/efi_console.c Mon Dec 9 21:10:18 2019 (r355571) @@ -558,10 +558,11 @@ efi_readkey_ex(void) kp->UnicodeChar++; } } + if (kp->ScanCode == 0 && kp->UnicodeChar == 0) + return (false); + keybuf_inschar(kp); + return (true); } - - keybuf_inschar(kp); - return (true); } return (false); } From owner-svn-src-stable@freebsd.org Tue Dec 10 07:04:21 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C30771D1329; Tue, 10 Dec 2019 07:04:21 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47X9z94jyVz4WhK; Tue, 10 Dec 2019 07:04:21 +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 82BED2721C; Tue, 10 Dec 2019 07:04:21 +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 xBA74Lh9038781; Tue, 10 Dec 2019 07:04:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBA74LT7038779; Tue, 10 Dec 2019 07:04:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912100704.xBA74LT7038779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Dec 2019 07:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355576 - in stable/12/sys: netinet netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: netinet netinet6 X-SVN-Commit-Revision: 355576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2019 07:04:21 -0000 Author: hselasky Date: Tue Dec 10 07:04:20 2019 New Revision: 355576 URL: https://svnweb.freebsd.org/changeset/base/355576 Log: MFC r355322: Use refcount from "in_joingroup_locked()" when joining multicast groups. Do not acquire additional references. This makes the IPv4 IGMP code in line with the IPv6 MLD code. Background: The IPv4 multicast code puts an extra reference on the in_multi struct when joining groups. This becomes visible when using daemons like igmpproxy from ports, that multicast entries do not disappear from the output of ifmcstat(8) when multicast streams are disconnected. This fixes a regression issue after r349762. While at it factor the ip_mfilter_insert() and ip6_mfilter_insert() calls to avoid repeated "is_new" check. Differential Revision: https://reviews.freebsd.org/D22595 Tested by: Guido van Rooij Reviewed by: rgrimes (network) Sponsored by: Mellanox Technologies Modified: stable/12/sys/netinet/in_mcast.c stable/12/sys/netinet6/in6_mcast.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/in_mcast.c ============================================================================== --- stable/12/sys/netinet/in_mcast.c Tue Dec 10 03:42:59 2019 (r355575) +++ stable/12/sys/netinet/in_mcast.c Tue Dec 10 07:04:20 2019 (r355576) @@ -2205,7 +2205,11 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt __func__); goto out_inp_locked; } - inm_acquire(imf->imf_inm); + /* + * NOTE: Refcount from in_joingroup_locked() + * is protecting membership. + */ + ip_mfilter_insert(&imo->imo_head, imf); } else { CTR1(KTR_IGMPV3, "%s: merge inm state", __func__); IN_MULTI_LIST_LOCK(); @@ -2229,8 +2233,6 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt goto out_inp_locked; } } - if (is_new) - ip_mfilter_insert(&imo->imo_head, imf); imf_commit(imf); imf = NULL; Modified: stable/12/sys/netinet6/in6_mcast.c ============================================================================== --- stable/12/sys/netinet6/in6_mcast.c Tue Dec 10 03:42:59 2019 (r355575) +++ stable/12/sys/netinet6/in6_mcast.c Tue Dec 10 07:04:20 2019 (r355576) @@ -2109,6 +2109,7 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sop * NOTE: Refcount from in6_joingroup_locked() * is protecting membership. */ + ip6_mfilter_insert(&imo->im6o_head, imf); } else { CTR1(KTR_MLD, "%s: merge inm state", __func__); IN6_MULTI_LIST_LOCK(); @@ -2133,9 +2134,6 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sop goto out_in6p_locked; } } - - if (is_new) - ip6_mfilter_insert(&imo->im6o_head, imf); im6f_commit(imf); imf = NULL; From owner-svn-src-stable@freebsd.org Tue Dec 10 07:06:33 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62E911D145B; Tue, 10 Dec 2019 07:06:33 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47XB1j20Mwz4WsL; Tue, 10 Dec 2019 07:06:33 +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 3FB7627241; Tue, 10 Dec 2019 07:06:33 +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 xBA76XGT038941; Tue, 10 Dec 2019 07:06:33 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBA76WhF038939; Tue, 10 Dec 2019 07:06:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912100706.xBA76WhF038939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Dec 2019 07:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355577 - in stable/12/sys/dev/usb: . video X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/usb: . video X-SVN-Commit-Revision: 355577 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2019 07:06:33 -0000 Author: hselasky Date: Tue Dec 10 07:06:32 2019 New Revision: 355577 URL: https://svnweb.freebsd.org/changeset/base/355577 Log: MFC r354969: Add USB ID for Diamond Multimedia BVU195 Display Link device. Submitted by: darius@dons.net.au PR: 242128 Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/usb/usbdevs stable/12/sys/dev/usb/video/udl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/usbdevs ============================================================================== --- stable/12/sys/dev/usb/usbdevs Tue Dec 10 07:04:20 2019 (r355576) +++ stable/12/sys/dev/usb/usbdevs Tue Dec 10 07:06:32 2019 (r355577) @@ -1784,6 +1784,7 @@ product DISPLAYLINK M01061 0x01e2 Lenovo DVI product DISPLAYLINK SWDVI 0x024c SUNWEIT DVI product DISPLAYLINK NBDOCK 0x0215 VideoHome NBdock1920 product DISPLAYLINK LUM70 0x02a9 Lilliput UM-70 +product DISPLAYLINK DVI_19 0x0360 USB to DVI-19 product DISPLAYLINK UM7X0 0x401a nanovision MiMo product DISPLAYLINK LT1421 0x03e0 Lenovo ThinkVision LT1421 product DISPLAYLINK POLARIS2 0x0117 Polaris2 USB dock Modified: stable/12/sys/dev/usb/video/udl.c ============================================================================== --- stable/12/sys/dev/usb/video/udl.c Tue Dec 10 07:04:20 2019 (r355576) +++ stable/12/sys/dev/usb/video/udl.c Tue Dec 10 07:06:32 2019 (r355577) @@ -179,6 +179,7 @@ static const STRUCT_USB_HOST_ID udl_devs[] = { {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_POLARIS2, DLUNK)}, {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_LT1421, DLUNK)}, {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_ITEC, DL165)}, + {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_DVI_19, DL165)}, }; static void From owner-svn-src-stable@freebsd.org Tue Dec 10 07:07:18 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B26481D14F8; Tue, 10 Dec 2019 07:07:18 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47XB2Z4HzPz4X0w; Tue, 10 Dec 2019 07:07:18 +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 8E7F327246; Tue, 10 Dec 2019 07:07:18 +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 xBA77IqS039057; Tue, 10 Dec 2019 07:07:18 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBA77IjP039056; Tue, 10 Dec 2019 07:07:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912100707.xBA77IjP039056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 10 Dec 2019 07:07: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: r355578 - in stable/11/sys/dev/usb: . video X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/usb: . video X-SVN-Commit-Revision: 355578 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2019 07:07:18 -0000 Author: hselasky Date: Tue Dec 10 07:07:17 2019 New Revision: 355578 URL: https://svnweb.freebsd.org/changeset/base/355578 Log: MFC r354969: Add USB ID for Diamond Multimedia BVU195 Display Link device. Submitted by: darius@dons.net.au PR: 242128 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/usb/usbdevs stable/11/sys/dev/usb/video/udl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/usbdevs ============================================================================== --- stable/11/sys/dev/usb/usbdevs Tue Dec 10 07:06:32 2019 (r355577) +++ stable/11/sys/dev/usb/usbdevs Tue Dec 10 07:07:17 2019 (r355578) @@ -1713,6 +1713,7 @@ product DISPLAYLINK M01061 0x01e2 Lenovo DVI product DISPLAYLINK SWDVI 0x024c SUNWEIT DVI product DISPLAYLINK NBDOCK 0x0215 VideoHome NBdock1920 product DISPLAYLINK LUM70 0x02a9 Lilliput UM-70 +product DISPLAYLINK DVI_19 0x0360 USB to DVI-19 product DISPLAYLINK UM7X0 0x401a nanovision MiMo product DISPLAYLINK LT1421 0x03e0 Lenovo ThinkVision LT1421 product DISPLAYLINK POLARIS2 0x0117 Polaris2 USB dock Modified: stable/11/sys/dev/usb/video/udl.c ============================================================================== --- stable/11/sys/dev/usb/video/udl.c Tue Dec 10 07:06:32 2019 (r355577) +++ stable/11/sys/dev/usb/video/udl.c Tue Dec 10 07:07:17 2019 (r355578) @@ -179,6 +179,7 @@ static const STRUCT_USB_HOST_ID udl_devs[] = { {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_POLARIS2, DLUNK)}, {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_LT1421, DLUNK)}, {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_ITEC, DL165)}, + {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_DVI_19, DL165)}, }; static void From owner-svn-src-stable@freebsd.org Wed Dec 11 06:30:27 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E679A1CDF72; Wed, 11 Dec 2019 06:30:27 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Xn9b5nWSz3FGj; Wed, 11 Dec 2019 06:30:27 +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 C0EDC71D9; Wed, 11 Dec 2019 06:30:27 +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 xBB6URou074349; Wed, 11 Dec 2019 06:30:27 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBB6UQrB074342; Wed, 11 Dec 2019 06:30:26 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201912110630.xBB6UQrB074342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 11 Dec 2019 06:30:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355603 - in stable/12: contrib/expat contrib/expat/doc contrib/expat/examples contrib/expat/lib contrib/expat/tests contrib/expat/tests/benchmark contrib/expat/xmlwf lib/libexpat X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/12: contrib/expat contrib/expat/doc contrib/expat/examples contrib/expat/lib contrib/expat/tests contrib/expat/tests/benchmark contrib/expat/xmlwf lib/libexpat X-SVN-Commit-Revision: 355603 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2019 06:30:28 -0000 Author: delphij Date: Wed Dec 11 06:30:26 2019 New Revision: 355603 URL: https://svnweb.freebsd.org/changeset/base/355603 Log: MFC r340127,340133,355085: libbsdxml (expat) 2.2.9. Added: stable/12/contrib/expat/AUTHORS - copied unchanged from r340127, head/contrib/expat/AUTHORS stable/12/contrib/expat/Makefile.am - copied, changed from r340127, head/contrib/expat/Makefile.am stable/12/contrib/expat/README.md - copied, changed from r340127, head/contrib/expat/README.md stable/12/contrib/expat/doc/Makefile.am - copied, changed from r340127, head/contrib/expat/doc/Makefile.am stable/12/contrib/expat/doc/Makefile.in - copied, changed from r340127, head/contrib/expat/doc/Makefile.in stable/12/contrib/expat/examples/Makefile.am - copied unchanged from r340127, head/contrib/expat/examples/Makefile.am stable/12/contrib/expat/examples/Makefile.in - copied, changed from r340127, head/contrib/expat/examples/Makefile.in stable/12/contrib/expat/fix-xmltest-log.sh - copied unchanged from r355085, head/contrib/expat/fix-xmltest-log.sh stable/12/contrib/expat/lib/Makefile.am - copied, changed from r340127, head/contrib/expat/lib/Makefile.am stable/12/contrib/expat/lib/Makefile.in - copied, changed from r340127, head/contrib/expat/lib/Makefile.in stable/12/contrib/expat/lib/loadlibrary.c - copied unchanged from r340127, head/contrib/expat/lib/loadlibrary.c stable/12/contrib/expat/lib/siphash.h - copied, changed from r340127, head/contrib/expat/lib/siphash.h stable/12/contrib/expat/run.sh.in - copied unchanged from r340127, head/contrib/expat/run.sh.in stable/12/contrib/expat/test-driver-wrapper.sh - copied, changed from r340127, head/contrib/expat/test-driver-wrapper.sh stable/12/contrib/expat/tests/Makefile.am - copied unchanged from r340127, head/contrib/expat/tests/Makefile.am stable/12/contrib/expat/tests/Makefile.in - copied, changed from r340127, head/contrib/expat/tests/Makefile.in stable/12/contrib/expat/tests/benchmark/Makefile.am - copied unchanged from r340127, head/contrib/expat/tests/benchmark/Makefile.am stable/12/contrib/expat/tests/benchmark/Makefile.in - copied, changed from r340127, head/contrib/expat/tests/benchmark/Makefile.in stable/12/contrib/expat/tests/benchmark/benchmark.sln - copied unchanged from r340127, head/contrib/expat/tests/benchmark/benchmark.sln stable/12/contrib/expat/tests/memcheck.c - copied, changed from r340127, head/contrib/expat/tests/memcheck.c stable/12/contrib/expat/tests/memcheck.h - copied, changed from r340127, head/contrib/expat/tests/memcheck.h stable/12/contrib/expat/tests/runtests.sln - copied unchanged from r340127, head/contrib/expat/tests/runtests.sln stable/12/contrib/expat/tests/structdata.c - copied, changed from r340127, head/contrib/expat/tests/structdata.c stable/12/contrib/expat/tests/structdata.h - copied, changed from r340127, head/contrib/expat/tests/structdata.h stable/12/contrib/expat/tests/udiffer.py - copied unchanged from r340127, head/contrib/expat/tests/udiffer.py stable/12/contrib/expat/tests/xmltest.log.expected - copied unchanged from r340127, head/contrib/expat/tests/xmltest.log.expected stable/12/contrib/expat/xmlwf/Makefile.am - copied, changed from r340127, head/contrib/expat/xmlwf/Makefile.am stable/12/contrib/expat/xmlwf/Makefile.in - copied, changed from r340127, head/contrib/expat/xmlwf/Makefile.in stable/12/contrib/expat/xmlwf/xmlwf_helpgen.py - copied unchanged from r355085, head/contrib/expat/xmlwf/xmlwf_helpgen.py stable/12/contrib/expat/xmlwf/xmlwf_helpgen.sh - copied unchanged from r355085, head/contrib/expat/xmlwf/xmlwf_helpgen.sh Deleted: stable/12/contrib/expat/MANIFEST stable/12/contrib/expat/README Modified: stable/12/contrib/expat/COPYING (contents, props changed) stable/12/contrib/expat/Changes (contents, props changed) stable/12/contrib/expat/FREEBSD-Xlist (contents, props changed) stable/12/contrib/expat/Makefile.in (contents, props changed) stable/12/contrib/expat/configure.ac (contents, props changed) stable/12/contrib/expat/doc/reference.html (contents, props changed) stable/12/contrib/expat/doc/xmlwf.1 (contents, props changed) stable/12/contrib/expat/doc/xmlwf.xml (contents, props changed) stable/12/contrib/expat/examples/elements.c (contents, props changed) stable/12/contrib/expat/examples/outline.c (contents, props changed) stable/12/contrib/expat/expat_config.h.in (contents, props changed) stable/12/contrib/expat/lib/ascii.h (contents, props changed) stable/12/contrib/expat/lib/asciitab.h (contents, props changed) stable/12/contrib/expat/lib/expat.h (contents, props changed) stable/12/contrib/expat/lib/expat_external.h (contents, props changed) stable/12/contrib/expat/lib/iasciitab.h (contents, props changed) stable/12/contrib/expat/lib/internal.h (contents, props changed) stable/12/contrib/expat/lib/latin1tab.h (contents, props changed) stable/12/contrib/expat/lib/nametab.h (contents, props changed) stable/12/contrib/expat/lib/utf8tab.h (contents, props changed) stable/12/contrib/expat/lib/xmlparse.c (contents, props changed) stable/12/contrib/expat/lib/xmlrole.c (contents, props changed) stable/12/contrib/expat/lib/xmlrole.h (contents, props changed) stable/12/contrib/expat/lib/xmltok.c (contents, props changed) stable/12/contrib/expat/lib/xmltok.h (contents, props changed) stable/12/contrib/expat/lib/xmltok_impl.c (contents, props changed) stable/12/contrib/expat/lib/xmltok_impl.h (contents, props changed) stable/12/contrib/expat/lib/xmltok_ns.c (contents, props changed) stable/12/contrib/expat/tests/benchmark/benchmark.c (contents, props changed) stable/12/contrib/expat/tests/chardata.c (contents, props changed) stable/12/contrib/expat/tests/chardata.h (contents, props changed) stable/12/contrib/expat/tests/minicheck.c (contents, props changed) stable/12/contrib/expat/tests/minicheck.h (contents, props changed) stable/12/contrib/expat/tests/runtests.c (contents, props changed) stable/12/contrib/expat/tests/runtestspp.cpp (contents, props changed) stable/12/contrib/expat/tests/xmltest.sh (contents, props changed) stable/12/contrib/expat/xmlwf/codepage.c (contents, props changed) stable/12/contrib/expat/xmlwf/codepage.h (contents, props changed) stable/12/contrib/expat/xmlwf/ct.c (contents, props changed) stable/12/contrib/expat/xmlwf/filemap.h (contents, props changed) stable/12/contrib/expat/xmlwf/readfilemap.c (contents, props changed) stable/12/contrib/expat/xmlwf/unixfilemap.c (contents, props changed) stable/12/contrib/expat/xmlwf/win32filemap.c (contents, props changed) stable/12/contrib/expat/xmlwf/xmlfile.c (contents, props changed) stable/12/contrib/expat/xmlwf/xmlfile.h (contents, props changed) stable/12/contrib/expat/xmlwf/xmlmime.c (contents, props changed) stable/12/contrib/expat/xmlwf/xmlmime.h (contents, props changed) stable/12/contrib/expat/xmlwf/xmltchar.h (contents, props changed) stable/12/contrib/expat/xmlwf/xmlurl.h (contents, props changed) stable/12/contrib/expat/xmlwf/xmlwf.c (contents, props changed) stable/12/contrib/expat/xmlwf/xmlwin32url.cxx (contents, props changed) stable/12/lib/libexpat/expat_config.h stable/12/lib/libexpat/libbsdxml.3 Directory Properties: stable/12/ (props changed) stable/12/contrib/expat/doc/style.css (props changed) stable/12/contrib/expat/tests/README.txt (props changed) stable/12/contrib/expat/tests/benchmark/README.txt (props changed) Copied: stable/12/contrib/expat/AUTHORS (from r340127, head/contrib/expat/AUTHORS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/contrib/expat/AUTHORS Wed Dec 11 06:30:26 2019 (r355603, copy of r340127, head/contrib/expat/AUTHORS) @@ -0,0 +1,10 @@ +Expat is brought to you by: + +Clark Cooper +Fred L. Drake, Jr. +Greg Stein +James Clark +Karl Waclawek +Rhodri James +Sebastian Pipping +Steven Solie Modified: stable/12/contrib/expat/COPYING ============================================================================== --- stable/12/contrib/expat/COPYING Tue Dec 10 22:10:25 2019 (r355602) +++ stable/12/contrib/expat/COPYING Wed Dec 11 06:30:26 2019 (r355603) @@ -1,5 +1,5 @@ Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper -Copyright (c) 2001-2016 Expat maintainers +Copyright (c) 2001-2017 Expat maintainers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Modified: stable/12/contrib/expat/Changes ============================================================================== --- stable/12/contrib/expat/Changes Tue Dec 10 22:10:25 2019 (r355602) +++ stable/12/contrib/expat/Changes Wed Dec 11 06:30:26 2019 (r355603) @@ -1,3 +1,489 @@ +NOTE: We are looking for help with a few things: + https://github.com/libexpat/libexpat/labels/help%20wanted + If you can help, please get in touch. Thanks! + +Release 2.2.9 Wed Septemper 25 2019 + Other changes: + examples: Drop executable bits from elements.c + #349 Windows: Change the name of the Windows DLLs from expat*.dll + to libexpat*.dll once more (regression from 2.2.8, first + fixed in 1.95.3, issue #61 on SourceForge today, + was issue #432456 back then); needs a fix due + case-insensitive file systems on Windows and the fact that + Perl's XML::Parser::Expat compiles into Expat.dll. + #347 Windows: Only define _CRT_RAND_S if not defined + Version info bumped from 7:10:6 to 7:11:6 + + Special thanks to: + Ben Wagner + +Release 2.2.8 Fri Septemper 13 2019 + Security fixes: + #317 #318 CVE-2019-15903 -- Fix heap overflow triggered by + XML_GetCurrentLineNumber (or XML_GetCurrentColumnNumber), + and deny internal entities closing the doctype; + fixed in commit c20b758c332d9a13afbbb276d30db1d183a85d43 + + Bug fixes: + #240 Fix cases where XML_StopParser did not have any effect + when called from inside of an end element handler + #341 xmlwf: Fix exit code for operation without "-d DIRECTORY"; + previously, only "-d DIRECTORY" would give you a proper + exit code: + # xmlwf -d . <<<'' 2>/dev/null ; echo $? + 2 + # xmlwf <<<'' 2>/dev/null ; echo $? + 0 + Now both cases return exit code 2. + + Other changes: + #299 #302 Windows: Replace LoadLibrary hack to access + unofficial API function SystemFunction036 (RtlGenRandom) + by using official API function rand_s (needs WinXP+) + #325 Windows: Drop support for Visual Studio <=7.1/2003 + and document supported compilers in README.md + #286 Windows: Remove COM code from xmlwf; in case it turns + out needed later, there will be a dedicated repository + below https://github.com/libexpat/ for that code + #322 Windows: Remove explicit MSVC solution and project files. + You can generate Visual Studio solution files through + CMake, e.g.: cmake -G"Visual Studio 15 2017" . + #338 xmlwf: Make "xmlwf -h" help output more friendly + #339 examples: Improve elements.c + #244 #264 Autotools: Add argument --enable-xml-attr-info + #239 #301 Autotools: Add arguments + --with-getrandom + --without-getrandom + --with-sys-getrandom + --without-sys-getrandom + #312 #343 Autotools: Fix linking issues with "./configure LD=clang" + Autotools: Fix "make run-xmltest" for out-of-source builds + #329 #336 CMake: Pull all options from Expat <=2.2.7 into namespace + prefix EXPAT_ with the exception of DOCBOOK_TO_MAN: + - BUILD_doc -> EXPAT_BUILD_DOCS (plural) + - BUILD_examples -> EXPAT_BUILD_EXAMPLES + - BUILD_shared -> EXPAT_SHARED_LIBS + - BUILD_tests -> EXPAT_BUILD_TESTS + - BUILD_tools -> EXPAT_BUILD_TOOLS + - DOCBOOK_TO_MAN -> DOCBOOK_TO_MAN (unchanged) + - INSTALL -> EXPAT_ENABLE_INSTALL + - MSVC_USE_STATIC_CRT -> EXPAT_MSVC_STATIC_CRT + - USE_libbsd -> EXPAT_WITH_LIBBSD + - WARNINGS_AS_ERRORS -> EXPAT_WARNINGS_AS_ERRORS + - XML_CONTEXT_BYTES -> EXPAT_CONTEXT_BYTES + - XML_DEV_URANDOM -> EXPAT_DEV_URANDOM + - XML_DTD -> EXPAT_DTD + - XML_NS -> EXPAT_NS + - XML_UNICODE -> EXPAT_CHAR_TYPE=ushort (!) + - XML_UNICODE_WCHAR_T -> EXPAT_CHAR_TYPE=wchar_t (!) + #244 #264 CMake: Add argument -DEXPAT_ATTR_INFO=(ON|OFF), + default OFF + #326 CMake: Add argument -DEXPAT_LARGE_SIZE=(ON|OFF), + default OFF + #328 CMake: Add argument -DEXPAT_MIN_SIZE=(ON|OFF), + default OFF + #239 #277 CMake: Add arguments + -DEXPAT_WITH_GETRANDOM=(ON|OFF|AUTO), default AUTO + -DEXPAT_WITH_SYS_GETRANDOM=(ON|OFF|AUTO), default AUTO + #326 CMake: Install expat_config.h to include directory + #326 CMake: Generate and install configuration files for + future find_package(expat [..] CONFIG [..]) + CMake: Now produces a summary of applied configuration + CMake: Require C++ compiler only when tests are enabled + #330 CMake: Fix compilation for 16bit character types, + i.e. ex -DXML_UNICODE=ON (and ex -DXML_UNICODE_WCHAR_T=ON) + #265 CMake: Fix linking with MinGW + #330 CMake: Add full support for MinGW; to enable, use + -DCMAKE_TOOLCHAIN_FILE=[expat]/cmake/mingw-toolchain.cmake + #330 CMake: Port "make run-xmltest" from GNU Autotools to CMake + #316 CMake: Windows: Make binary postfix match MSVC + Old: expat[d].lib + New: expat[w][d][MD|MT].lib + CMake: Migrate files from Windows to Unix line endings + #308 CMake: Integrate OSS-Fuzz fuzzers, option + -DEXPAT_BUILD_FUZZERS=(ON|OFF), default OFF + #14 Drop an OpenVMS support leftover + #235 #268 .. + #270 #310 .. + #313 #331 #333 Address compiler warnings + #282 #283 .. + #284 #285 Address cppcheck warnings + #294 #295 Address Clang Static Analyzer warnings + #24 #293 Mass-apply clang-format 9 (and ensure conformance during CI) + Version info bumped from 7:9:6 to 7:10:6 + + Special thanks to: + David Loffredo + Joonun Jang + Khajapasha Mohammed + Kishore Kunche + Marco Maggi + Mitch Phillips + Rolf Ade + xantares + Zhongyuan Zhou + +Release 2.2.7 Wed June 19 2019 + Security fixes: + #186 #262 CVE-2018-20843 -- Fix extraction of namespace prefixes from + XML names; XML names with multiple colons could end up in + the wrong namespace, and take a high amount of RAM and CPU + resources while processing, opening the door to + use for denial-of-service attacks + + Other changes: + #195 #197 Autotools/CMake: Utilize -fvisibility=hidden to stop + exporting non-API symbols + #227 Autotools: Add --without-examples and --without-tests + #228 Autotools: Modernize configure.ac + #245 #246 Autotools: Fix check for -fvisibility=hidden for Clang + #247 #248 Autotools: Fix compilation for lack of docbook2x-man + #236 #258 Autotools: Produce .tar.{gz,lz,xz} release archives + #212 CMake: Make libdir of pkgconfig expat.pc support multilib + #158 #263 CMake: Build man page in PROJECT_BINARY_DIR not _SOURCE_DIR + #219 Remove fallback to bcopy, assume that memmove(3) exists + #257 Use portable "/usr/bin/env bash" shebang (e.g. for OpenBSD) + #243 Windows: Fix syntax of .def module definition files + Version info bumped from 7:8:6 to 7:9:6 + + Special thanks to: + Benjamin Peterson + Caolán McNamara + Hanno Böck + KangLin + Kishore Kunche + Marco Maggi + Rhodri James + Sebastian Dröge + userwithuid + Yury Gribov + +Release 2.2.6 Sun August 12 2018 + Bug fixes: + #170 #206 Avoid doing arithmetic with NULL pointers in XML_GetBuffer + #204 #205 Fix 2.2.5 regression with suspend-resume while parsing + a document like '' + + Other changes: + #165 #168 Autotools: Fix docbook-related configure syntax error + #166 Autotools: Avoid grep option `-q` for Solaris + #167 Autotools: Support + ./configure DOCBOOK_TO_MAN="xmlto man --skip-validation" + #159 #167 Autotools: Support DOCBOOK_TO_MAN command which produces + xmlwf.1 rather than XMLWF.1; also covers case insensitive + file systems + #181 Autotools: Drop -rpath option passed to libtool + #188 Autotools: Detect and deny SGML docbook2man as ours is XML + #188 Autotools/CMake: Support command db2x_docbook2man as well + #174 CMake: Introduce option WARNINGS_AS_ERRORS, defaults to OFF + #184 #185 CMake: Introduce option MSVC_USE_STATIC_CRT, defaults to OFF + #207 #208 CMake: Introduce option XML_UNICODE and XML_UNICODE_WCHAR_T, + both defaulting to OFF + #175 CMake: Prefer check_symbol_exists over check_function_exists + #176 CMake: Create the same pkg-config file as with GNU Autotools + #178 #179 CMake: Use GNUInstallDirs module to set proper defaults for + install directories + #208 CMake: Utilize expat_config.h.cmake for XML_DEV_URANDOM + #180 Windows: Fix compilation of test suite for Visual Studio 2008 + #131 #173 #202 Address compiler warnings + #187 #190 #200 Fix miscellaneous typos + Version info bumped from 7:7:6 to 7:8:6 + + Special thanks to: + Anton Maklakov + Benjamin Peterson + Brad King + Franek Korta + Frank Rast + Joe Orton + luzpaz + Pedro Vicente + Rainer Jung + Rhodri James + Rolf Ade + Rolf Eike Beer + Thomas Beutlich + Tomasz Kłoczko + +Release 2.2.5 Tue October 31 2017 + Bug fixes: + #8 If the parser runs out of memory, make sure its internal + state reflects the memory it actually has, not the memory + it wanted to have. + #11 The default handler wasn't being called when it should for + a SYSTEM or PUBLIC doctype if an entity declaration handler + was registered. + #137 #138 Fix a case of mistakenly reported parsing success where + XML_StopParser was called from an element handler + #162 Function XML_ErrorString was returning NULL rather than + a message for code XML_ERROR_INVALID_ARGUMENT + introduced with release 2.2.1 + + Other changes: + #106 xmlwf: Add argument -N adding notation declarations + #75 #106 Test suite: Resolve expected failure cases where xmlwf + output was incomplete + #127 Windows: Fix test suite compilation + #126 #127 Windows: Fix compilation for Visual Studio 2012 + Windows: Upgrade shipped project files to Visual Studio 2017 + #33 #132 tests: Mass-fix compilation for XML_UNICODE_WCHAR_T + #129 examples: Fix compilation for XML_UNICODE_WCHAR_T + #130 benchmark: Fix compilation for XML_UNICODE_WCHAR_T + #144 xmlwf: Fix compilation for XML_UNICODE_WCHAR_T; still needs + Windows or MinGW for 2-byte wchar_t + #9 Address two Clang Static Analyzer false positives + #59 Resolve troublesome macros hiding parser struct membership + and dereferencing that pointer + #6 Resolve superfluous internal malloc/realloc switch + #153 #155 Improve docbook2x-man detection + #160 Undefine NDEBUG in the test suite (rather than rejecting it) + #161 Address compiler warnings + Version info bumped from 7:6:6 to 7:7:6 + + Special thanks to: + Benbuck Nason + Hans Wennborg + José Gutiérrez de la Concha + Pedro Monreal Gonzalez + Rhodri James + Rolf Ade + Stephen Groat + and + Core Infrastructure Initiative + +Release 2.2.4 Sat August 19 2017 + Bug fixes: + #115 Fix copying of partial characters for UTF-8 input + + Other changes: + #109 Fix "make check" for non-x86 architectures that default + to unsigned type char (-128..127 rather than 0..255) + #109 coverage.sh: Cover -funsigned-char + Autotools: Introduce --without-xmlwf argument + #65 Autotools: Replace handwritten Makefile with GNU Automake + #43 CMake: Auto-detect high quality entropy extractors, add new + option USE_libbsd=ON to use arc4random_buf of libbsd + #74 CMake: Add -fno-strict-aliasing only where supported + #114 CMake: Always honor manually set BUILD_* options + #114 CMake: Compile man page if docbook2x-man is available, only + #117 Include file tests/xmltest.log.expected in source tarball + (required for "make run-xmltest") + #117 Include (existing) Visual Studio 2013 files in source tarball + Improve test suite error output + #111 Fix some typos in documentation + Version info bumped from 7:5:6 to 7:6:6 + + Special thanks to: + Jakub Wilk + Joe Orton + Lin Tian + Rolf Eike Beer + +Release 2.2.3 Wed August 2 2017 + Security fixes: + #82 CVE-2017-11742 -- Windows: Fix DLL hijacking vulnerability + using Steve Holme's LoadLibrary wrapper for/of cURL + + Bug fixes: + #85 Fix a dangling pointer issue related to realloc + + Other changes: + Increase code coverage + #91 Linux: Allow getrandom to fail if nonblocking pool has not + yet been initialized and read /dev/urandom then, instead. + This is in line with what recent Python does. + #81 Pre-10.7/Lion macOS: Support entropy from arc4random + #86 Check that a UTF-16 encoding in an XML declaration has the + right endianness + #4 #5 #7 Recover correctly when some reallocations fail + Repair "./configure && make" for systems without any + provider of high quality entropy + and try reading /dev/urandom on those + Ensure that user-defined character encodings have converter + functions when they are needed + Fix mis-leading description of argument -c in xmlwf.1 + Rely on macro HAVE_ARC4RANDOM_BUF (rather than __CloudABI__) + for CloudABI + #100 Fix use of SIPHASH_MAIN in siphash.h + #23 Test suite: Fix memory leaks + Version info bumped from 7:4:6 to 7:5:6 + + Special thanks to: + Chanho Park + Joe Orton + Pascal Cuoq + Rhodri James + Simon McVittie + Vadim Zeitlin + Viktor Szakats + and + Core Infrastructure Initiative + +Release 2.2.2 Wed July 12 2017 + Security fixes: + #43 Protect against compilation without any source of high + quality entropy enabled, e.g. with CMake build system; + commit ff0207e6076e9828e536b8d9cd45c9c92069b895 + #60 Windows with _UNICODE: + Unintended use of LoadLibraryW with a non-wide string + resulted in failure to load advapi32.dll and degradation + in quality of used entropy when compiled with _UNICODE for + Windows; you can launch existing binaries with + EXPAT_ENTROPY_DEBUG=1 in the environment to inspect the + quality of entropy used during runtime; commits + * 95b95032f907ef1cd17ee7a9a1768010a825d61d + * 73a5a2e9c081f49f2d775cf7ced864158b68dc80 + [MOX-006] Fix non-NULL parser parameter validation in XML_Parse; + resulted in NULL dereference, previously; + commit ac256dafdffc9622ab0dc2c62fcecb0dfcfa71fe + + Bug fixes: + #69 Fix improper use of unsigned long long integer literals + + Other changes: + #73 Start requiring a C99 compiler + #49 Fix "==" Bashism in configure script + #50 Fix too eager getrandom detection for Debian GNU/kFreeBSD + #52 and macOS + #51 Address lack of stdint.h in Visual Studio 2003 to 2008 + #58 Address compile warnings + #68 Fix "./buildconf.sh && ./configure" for some versions + of Dash for /bin/sh + #72 CMake: Ease use of Expat in context of a parent project + with multiple CMakeLists.txt files + #72 CMake: Resolve mistaken executable permissions + #76 Address compile warning with -DNDEBUG (not recommended!) + #77 Address compile warning about macro redefinition + + Special thanks to: + Alexander Bluhm + Ben Boeckel + Cătălin Răceanu + Kerin Millar + László Böszörményi + S. P. Zeidler + Segev Finer + Václav Slavík + Victor Stinner + Viktor Szakats + and + Radically Open Security + +Release 2.2.1 Sat June 17 2017 + Security fixes: + CVE-2017-9233 -- External entity infinite loop DoS + Details: https://libexpat.github.io/doc/cve-2017-9233/ + Commit c4bf96bb51dd2a1b0e185374362ee136fe2c9d7f + [MOX-002] CVE-2016-9063 -- Detect integer overflow; commit + d4f735b88d9932bd5039df2335eefdd0723dbe20 + (Fixed version of existing downstream patches!) + (SF.net) #539 Fix regression from fix to CVE-2016-0718 cutting off + longer tag names; commits + * 896b6c1fd3b842f377d1b62135dccf0a579cf65d + * af507cef2c93cb8d40062a0abe43a4f4e9158fb2 + #16 * 0dbbf43fdb20f593ddf4fa1ff67288000dd4a7fd + #25 More integer overflow detection (function poolGrow); commits + * 810b74e4703dcfdd8f404e3cb177d44684775143 + * 44178553f3539ce69d34abee77a05e879a7982ac + [MOX-002] Detect overflow from len=INT_MAX call to XML_Parse; commits + * 4be2cb5afcc018d996f34bbbce6374b7befad47f + * 7e5b71b748491b6e459e5c9a1d090820f94544d8 + [MOX-005] #30 Use high quality entropy for hash initialization: + * arc4random_buf on BSD, systems with libbsd + (when configured with --with-libbsd), CloudABI + * RtlGenRandom on Windows XP / Server 2003 and later + * getrandom on Linux 3.17+ + In a way, that's still part of CVE-2016-5300. + https://github.com/libexpat/libexpat/pull/30/commits + [MOX-005] For the low quality entropy extraction fallback code, + the parser instance address can no longer leak, commit + 04ad658bd3079dd15cb60fc67087900f0ff4b083 + [MOX-003] Prevent use of uninitialised variable; commit + [MOX-004] a4dc944f37b664a3ca7199c624a98ee37babdb4b + Add missing parameter validation to public API functions + and dedicated error code XML_ERROR_INVALID_ARGUMENT: + [MOX-006] * NULL checks; commits + * d37f74b2b7149a3a95a680c4c4cd2a451a51d60a (merge/many) + * 9ed727064b675b7180c98cb3d4f75efba6966681 + * 6a747c837c50114dfa413994e07c0ba477be4534 + * Negative length (XML_Parse); commit + [MOX-002] 70db8d2538a10f4c022655d6895e4c3e78692e7f + [MOX-001] #35 Change hash algorithm to William Ahern's version of SipHash + to go further with fixing CVE-2012-0876. + https://github.com/libexpat/libexpat/pull/39/commits + + Bug fixes: + #32 Fix sharing of hash salt across parsers; + relevant where XML_ExternalEntityParserCreate is called + prior to XML_Parse, in particular (e.g. FBReader) + #28 xmlwf: Auto-disable use of memory-mapping (and parsing + as a single chunk) for files larger than ~1 GB (2^30 bytes) + rather than failing with error "out of memory" + #3 Fix double free after malloc failure in DTD code; commit + 7ae9c3d3af433cd4defe95234eae7dc8ed15637f + #17 Fix memory leak on parser error for unbound XML attribute + prefix with new namespaces defined in the same tag; + found by Google's OSS-Fuzz; commits + * 16f87daae5a16132e479e4f71862128c7a915c73 + * b47dbc9745932c160893d433220e462bd605f8cd + xmlwf on Windows: Add missing calls to CloseHandle + + New features: + #30 Introduced environment switch EXPAT_ENTROPY_DEBUG=1 + for runtime debugging of entropy extraction + + Other changes: + Increase code coverage + #33 Reject use of XML_UNICODE_WCHAR_T with sizeof(wchar_t) != 2; + XML_UNICODE_WCHAR_T was never meant to be used outside + of Windows; 4-byte wchar_t is common on Linux + (SF.net) #538 Start using -fno-strict-aliasing + (SF.net) #540 Support compilation against cloudlibc of CloudABI + Allow MinGW cross-compilation + (SF.net) #534 CMake: Introduce option "BUILD_doc" (enabled by default) + to bypass compilation of the xmlwf.1 man page + (SF.net) pr2 CMake: Introduce option "INSTALL" (enabled by default) + to bypass installation of expat files + CMake: Fix ninja support + Autotools: Add parameters --enable-xml-context [COUNT] + and --disable-xml-context; default of context of 1024 + bytes enabled unchanged + #14 Drop AmigaOS 4.x code and includes + #14 Drop ancient build systems: + * Borland C++ Builder + * OpenVMS + * Open Watcom + * Visual Studio 6.0 + * Pre-X Mac OS (MPW Makefile) + If you happen to rely on some of these, please get in + touch for joining with maintenance. + #10 Move from WIN32 to _WIN32 + #13 Fix "make run-xmltest" order instability + Address compile warnings + Bump version info from 7:2:6 to 7:3:6 + Add AUTHORS file + + Infrastructure: + #1 Migrate from SourceForge to GitHub (except downloads): + https://github.com/libexpat/ + #1 Re-create http://libexpat.org/ project website + Start utilizing Travis CI + + Special thanks to: + Andy Wang + Don Lewis + Ed Schouten + Karl Waclawek + Pascal Cuoq + Rhodri James + Sergei Nikulov + Tobias Taschner + Viktor Szakats + and + Core Infrastructure Initiative + Mozilla Foundation (MOSS Track 3: Secure Open Source) + Radically Open Security + Release 2.2.0 Tue June 21 2016 Security fixes: #537 CVE-2016-0718 -- Fix crash on malformed input @@ -63,24 +549,25 @@ Release 2.1.1 Sat March 12 2016 libtool now invoked with --verbose Release 2.1.0 Sat March 24 2012 + - Security fixes: + #2958794: CVE-2012-1148 - Memory leak in poolGrow. + #2895533: CVE-2012-1147 - Resource leak in readfilemap.c. + #3496608: CVE-2012-0876 - Hash DOS attack. + #2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8(). + #1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences. - Bug Fixes: #1742315: Harmful XML_ParserCreateNS suggestion. - #2895533: CVE-2012-1147 - Resource leak in readfilemap.c. #1785430: Expat build fails on linux-amd64 with gcc version>=4.1 -O3. #1983953, 2517952, 2517962, 2649838: Build modifications using autoreconf instead of buildconf.sh. #2815947, #2884086: OBJEXT and EXEEXT support while building. - #1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences. #2517938: xmlwf should return non-zero exit status if not well-formed. #2517946: Wrong statement about XMLDecl in xmlwf.1 and xmlwf.sgml. #2855609: Dangling positionPtr after error. - #2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8(). - #2958794: CVE-2012-1148 - Memory leak in poolGrow. #2990652: CMake support. #3010819: UNEXPECTED_STATE with a trailing "%" in entity value. - #3206497: Unitialized memory returned from XML_Parse. + #3206497: Uninitialized memory returned from XML_Parse. #3287849: make check fails on mingw-w64. - #3496608: CVE-2012-0876 - Hash DOS attack. - Patches: #1749198: pkg-config support. #3010222: Fix for bug #3010819. Modified: stable/12/contrib/expat/FREEBSD-Xlist ============================================================================== --- stable/12/contrib/expat/FREEBSD-Xlist Tue Dec 10 22:10:25 2019 (r355602) +++ stable/12/contrib/expat/FREEBSD-Xlist Wed Dec 11 06:30:26 2019 (r355603) @@ -6,7 +6,9 @@ *.dsw *.m4 *.pc.in +*.vcxproj* *config.h +cmake CMake* Configure* amiga @@ -14,6 +16,7 @@ bcb5 configure conftools doc/valid-xhtml10.png +expat.sln m4 vms win32 Copied and modified: stable/12/contrib/expat/Makefile.am (from r340127, head/contrib/expat/Makefile.am) ============================================================================== --- head/contrib/expat/Makefile.am Sun Nov 4 16:08:59 2018 (r340127, copy source) +++ stable/12/contrib/expat/Makefile.am Wed Dec 11 06:30:26 2019 (r355603) @@ -30,14 +30,21 @@ AUTOMAKE_OPTIONS = \ dist-bzip2 \ + dist-lzip \ + dist-xz \ foreign \ - no-dist-gzip \ subdir-objects ACLOCAL_AMFLAGS = -I m4 LIBTOOLFLAGS = --verbose -SUBDIRS = lib examples tests # lib goes first to build first +SUBDIRS = lib # lib goes first to build first +if WITH_EXAMPLES +SUBDIRS += examples +endif +if WITH_TESTS +SUBDIRS += tests +endif if WITH_XMLWF SUBDIRS += xmlwf doc endif @@ -47,41 +54,19 @@ pkgconfigdir = $(libdir)/pkgconfig _EXTRA_DIST_CMAKE = \ + cmake/expat-config.cmake.in \ + cmake/mingw-toolchain.cmake \ + \ CMakeLists.txt \ CMake.README \ ConfigureChecks.cmake \ expat_config.h.cmake _EXTRA_DIST_WINDOWS = \ - examples/elements.vcxproj \ - examples/elements.vcxproj.filters \ - examples/outline.vcxproj \ - examples/outline.vcxproj.filters \ - \ - lib/expat_static.vcxproj \ - lib/expat_static.vcxproj.filters \ - lib/expat.vcxproj \ - lib/expat.vcxproj.filters \ - lib/expatw_static.vcxproj \ - lib/expatw_static.vcxproj.filters \ - lib/expatw.vcxproj \ - lib/expatw.vcxproj.filters \ - \ - tests/benchmark/benchmark.sln \ - tests/benchmark/benchmark.vcxproj \ - \ - tests/runtests.sln \ - tests/runtests.vcxproj \ - tests/runtests.vcxproj.filters \ - \ + win32/build_expat_iss.bat \ win32/expat.iss \ win32/MANIFEST.txt \ - win32/README.txt \ - \ - xmlwf/xmlwf.vcxproj \ - xmlwf/xmlwf.vcxproj.filters \ - \ - expat.sln + win32/README.txt EXTRA_DIST = \ $(_EXTRA_DIST_CMAKE) \ @@ -91,8 +76,13 @@ EXTRA_DIST = \ conftools/get-version.sh \ conftools/PrintPath \ \ + xmlwf/xmlwf_helpgen.py \ + xmlwf/xmlwf_helpgen.sh \ + \ Changes \ README.md \ + \ + fix-xmltest-log.sh \ test-driver-wrapper.sh @@ -121,7 +111,8 @@ run-benchmark: $(MAKE) -C tests/benchmark ./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3 -tests/xmlts.zip: +.PHONY: download-xmlts-zip +download-xmlts-zip: if test "$(XMLTS_ZIP)" = ""; then \ wget --output-document=tests/xmlts.zip \ https://www.w3.org/XML/Test/xmlts20080827.zip; \ @@ -129,16 +120,26 @@ tests/xmlts.zip: cp $(XMLTS_ZIP) tests/xmlts.zip; \ fi -tests/xmlconf: tests/xmlts.zip +tests/xmlts.zip: + $(MAKE) download-xmlts-zip + +.PHONY: extract-xmlts-zip +extract-xmlts-zip: tests/xmlts.zip + [ -f $(builddir)/tests/xmlts.zip ] || $(MAKE) download-xmlts-zip # vpath workaround cd tests && unzip -q xmlts.zip +tests/xmlconf: tests/xmlts.zip + $(MAKE) extract-xmlts-zip + .PHONY: run-xmltest run-xmltest: tests/xmlconf if WITH_XMLWF + [ -d $(builddir)/tests/xmlconf ] || $(MAKE) extract-xmlts-zip # vpath workaround + $(MAKE) -C lib $(MAKE) -C xmlwf - tests/xmltest.sh "$(PWD)/run.sh $(PWD)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee tests/xmltest.log - dos2unix tests/xmltest.log - diff -u tests/xmltest.log.expected tests/xmltest.log + $(srcdir)/tests/xmltest.sh "$(abs_builddir)/run.sh $(abs_builddir)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee $(builddir)/tests/xmltest.log + $(srcdir)/fix-xmltest-log.sh $(builddir)/tests/xmltest.log + diff -u $(srcdir)/tests/xmltest.log.expected $(builddir)/tests/xmltest.log else @echo 'ERROR: xmlwf is needed for "make run-xmltest".' >&2 @echo 'ERROR: Please re-configure without --without-xmlwf.' >&2 @@ -147,7 +148,7 @@ endif .PHONY: qa qa: - ./qa.sh address - ./qa.sh memory - ./qa.sh undefined - ./qa.sh coverage + QA_COMPILER=clang QA_SANITIZER=address ./qa.sh + QA_COMPILER=clang QA_SANITIZER=memory ./qa.sh + QA_COMPILER=clang QA_SANITIZER=undefined ./qa.sh + QA_COMPILER=gcc QA_PROCESSOR=gcov ./qa.sh Modified: stable/12/contrib/expat/Makefile.in ============================================================================== --- stable/12/contrib/expat/Makefile.in Tue Dec 10 22:10:25 2019 (r355602) +++ stable/12/contrib/expat/Makefile.in Wed Dec 11 06:30:26 2019 (r355603) @@ -1,212 +1,1034 @@ -################################################################ -# Process this file with top-level configure script to produce Makefile +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + # -# Copyright 2000 Clark Cooper +# __ __ _ +# ___\ \/ /_ __ __ _| |_ +# / _ \\ /| '_ \ / _` | __| +# | __// \| |_) | (_| | |_ +# \___/_/\_\ .__/ \__,_|\__| +# |_| XML parser # -# This file is part of EXPAT. +# Copyright (c) 2017 Expat development team +# Licensed under the MIT license: # -# EXPAT is free software; you can redistribute it and/or modify it -# under the terms of the License (based on the MIT/X license) contained -# in the file COPYING that comes with this distribution. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to permit +# persons to whom the Software is furnished to do so, subject to the +# following conditions: # -# EXPAT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN EXPAT. +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WITH_EXAMPLES_TRUE@am__append_1 = examples +@WITH_TESTS_TRUE@am__append_2 = tests +@WITH_XMLWF_TRUE@am__append_3 = xmlwf doc +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/conftools/ax-require-defined.m4 \ + $(top_srcdir)/conftools/ax-check-compile-flag.m4 \ + $(top_srcdir)/conftools/ax-check-link-flag.m4 \ + $(top_srcdir)/conftools/ax-append-flag.m4 \ + $(top_srcdir)/conftools/ax-append-compile-flags.m4 \ + $(top_srcdir)/conftools/ax-append-link-flags.m4 \ + $(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = expat_config.h +CONFIG_CLEAN_FILES = expat.pc run.sh +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(pkgconfigdir)" +DATA = $(pkgconfig_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir distdir-am dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)expat_config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +CSCOPE = cscope +DIST_SUBDIRS = lib examples tests xmlwf doc +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/expat.pc.in \ + $(srcdir)/expat_config.h.in $(srcdir)/run.sh.in \ + $(top_srcdir)/conftools/ar-lib $(top_srcdir)/conftools/compile \ + $(top_srcdir)/conftools/config.guess \ + $(top_srcdir)/conftools/config.sub \ + $(top_srcdir)/conftools/install-sh \ + $(top_srcdir)/conftools/ltmain.sh \ + $(top_srcdir)/conftools/missing AUTHORS COPYING \ + conftools/ar-lib conftools/compile conftools/config.guess \ + conftools/config.sub conftools/depcomp conftools/install-sh \ + conftools/ltmain.sh conftools/missing +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Wed Dec 11 06:34:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D56D1CE557; Wed, 11 Dec 2019 06:34:50 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47XnGf25Z4z3FsX; Wed, 11 Dec 2019 06:34:50 +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 4224673C8; Wed, 11 Dec 2019 06:34: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 xBB6YoaH079937; Wed, 11 Dec 2019 06:34:50 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBB6YnYH079930; Wed, 11 Dec 2019 06:34:49 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201912110634.xBB6YnYH079930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 11 Dec 2019 06:34: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: r355604 - in stable/11: contrib/expat contrib/expat/doc contrib/expat/examples contrib/expat/lib contrib/expat/tests contrib/expat/tests/benchmark contrib/expat/xmlwf lib/libexpat X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/11: contrib/expat contrib/expat/doc contrib/expat/examples contrib/expat/lib contrib/expat/tests contrib/expat/tests/benchmark contrib/expat/xmlwf lib/libexpat X-SVN-Commit-Revision: 355604 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2019 06:34:50 -0000 Author: delphij Date: Wed Dec 11 06:34:48 2019 New Revision: 355604 URL: https://svnweb.freebsd.org/changeset/base/355604 Log: MFC r340127,340133,355085: libbsdxml (expat) 2.2.9. Added: stable/11/contrib/expat/AUTHORS - copied unchanged from r340127, head/contrib/expat/AUTHORS stable/11/contrib/expat/Makefile.am - copied, changed from r340127, head/contrib/expat/Makefile.am stable/11/contrib/expat/README.md - copied, changed from r340127, head/contrib/expat/README.md stable/11/contrib/expat/doc/Makefile.am - copied, changed from r340127, head/contrib/expat/doc/Makefile.am stable/11/contrib/expat/doc/Makefile.in - copied, changed from r340127, head/contrib/expat/doc/Makefile.in stable/11/contrib/expat/examples/Makefile.am - copied unchanged from r340127, head/contrib/expat/examples/Makefile.am stable/11/contrib/expat/examples/Makefile.in - copied, changed from r340127, head/contrib/expat/examples/Makefile.in stable/11/contrib/expat/fix-xmltest-log.sh - copied unchanged from r355085, head/contrib/expat/fix-xmltest-log.sh stable/11/contrib/expat/lib/Makefile.am - copied, changed from r340127, head/contrib/expat/lib/Makefile.am stable/11/contrib/expat/lib/Makefile.in - copied, changed from r340127, head/contrib/expat/lib/Makefile.in stable/11/contrib/expat/lib/loadlibrary.c - copied unchanged from r340127, head/contrib/expat/lib/loadlibrary.c stable/11/contrib/expat/lib/siphash.h - copied, changed from r340127, head/contrib/expat/lib/siphash.h stable/11/contrib/expat/run.sh.in - copied unchanged from r340127, head/contrib/expat/run.sh.in stable/11/contrib/expat/test-driver-wrapper.sh - copied, changed from r340127, head/contrib/expat/test-driver-wrapper.sh stable/11/contrib/expat/tests/Makefile.am - copied unchanged from r340127, head/contrib/expat/tests/Makefile.am stable/11/contrib/expat/tests/Makefile.in - copied, changed from r340127, head/contrib/expat/tests/Makefile.in stable/11/contrib/expat/tests/benchmark/Makefile.am - copied unchanged from r340127, head/contrib/expat/tests/benchmark/Makefile.am stable/11/contrib/expat/tests/benchmark/Makefile.in - copied, changed from r340127, head/contrib/expat/tests/benchmark/Makefile.in stable/11/contrib/expat/tests/benchmark/benchmark.sln - copied unchanged from r340127, head/contrib/expat/tests/benchmark/benchmark.sln stable/11/contrib/expat/tests/memcheck.c - copied, changed from r340127, head/contrib/expat/tests/memcheck.c stable/11/contrib/expat/tests/memcheck.h - copied, changed from r340127, head/contrib/expat/tests/memcheck.h stable/11/contrib/expat/tests/runtests.sln - copied unchanged from r340127, head/contrib/expat/tests/runtests.sln stable/11/contrib/expat/tests/structdata.c - copied, changed from r340127, head/contrib/expat/tests/structdata.c stable/11/contrib/expat/tests/structdata.h - copied, changed from r340127, head/contrib/expat/tests/structdata.h stable/11/contrib/expat/tests/udiffer.py - copied unchanged from r340127, head/contrib/expat/tests/udiffer.py stable/11/contrib/expat/tests/xmltest.log.expected - copied unchanged from r340127, head/contrib/expat/tests/xmltest.log.expected stable/11/contrib/expat/xmlwf/Makefile.am - copied, changed from r340127, head/contrib/expat/xmlwf/Makefile.am stable/11/contrib/expat/xmlwf/Makefile.in - copied, changed from r340127, head/contrib/expat/xmlwf/Makefile.in stable/11/contrib/expat/xmlwf/xmlwf_helpgen.py - copied unchanged from r355085, head/contrib/expat/xmlwf/xmlwf_helpgen.py stable/11/contrib/expat/xmlwf/xmlwf_helpgen.sh - copied unchanged from r355085, head/contrib/expat/xmlwf/xmlwf_helpgen.sh Deleted: stable/11/contrib/expat/MANIFEST stable/11/contrib/expat/README Modified: stable/11/contrib/expat/COPYING (contents, props changed) stable/11/contrib/expat/Changes (contents, props changed) stable/11/contrib/expat/FREEBSD-Xlist (contents, props changed) stable/11/contrib/expat/Makefile.in (contents, props changed) stable/11/contrib/expat/configure.ac (contents, props changed) stable/11/contrib/expat/doc/reference.html (contents, props changed) stable/11/contrib/expat/doc/xmlwf.1 (contents, props changed) stable/11/contrib/expat/doc/xmlwf.xml (contents, props changed) stable/11/contrib/expat/examples/elements.c (contents, props changed) stable/11/contrib/expat/examples/outline.c (contents, props changed) stable/11/contrib/expat/expat_config.h.in (contents, props changed) stable/11/contrib/expat/lib/ascii.h (contents, props changed) stable/11/contrib/expat/lib/asciitab.h (contents, props changed) stable/11/contrib/expat/lib/expat.h (contents, props changed) stable/11/contrib/expat/lib/expat_external.h (contents, props changed) stable/11/contrib/expat/lib/iasciitab.h (contents, props changed) stable/11/contrib/expat/lib/internal.h (contents, props changed) stable/11/contrib/expat/lib/latin1tab.h (contents, props changed) stable/11/contrib/expat/lib/nametab.h (contents, props changed) stable/11/contrib/expat/lib/utf8tab.h (contents, props changed) stable/11/contrib/expat/lib/xmlparse.c (contents, props changed) stable/11/contrib/expat/lib/xmlrole.c (contents, props changed) stable/11/contrib/expat/lib/xmlrole.h (contents, props changed) stable/11/contrib/expat/lib/xmltok.c (contents, props changed) stable/11/contrib/expat/lib/xmltok.h (contents, props changed) stable/11/contrib/expat/lib/xmltok_impl.c (contents, props changed) stable/11/contrib/expat/lib/xmltok_impl.h (contents, props changed) stable/11/contrib/expat/lib/xmltok_ns.c (contents, props changed) stable/11/contrib/expat/tests/benchmark/benchmark.c (contents, props changed) stable/11/contrib/expat/tests/chardata.c (contents, props changed) stable/11/contrib/expat/tests/chardata.h (contents, props changed) stable/11/contrib/expat/tests/minicheck.c (contents, props changed) stable/11/contrib/expat/tests/minicheck.h (contents, props changed) stable/11/contrib/expat/tests/runtests.c (contents, props changed) stable/11/contrib/expat/tests/runtestspp.cpp (contents, props changed) stable/11/contrib/expat/tests/xmltest.sh (contents, props changed) stable/11/contrib/expat/xmlwf/codepage.c (contents, props changed) stable/11/contrib/expat/xmlwf/codepage.h (contents, props changed) stable/11/contrib/expat/xmlwf/ct.c (contents, props changed) stable/11/contrib/expat/xmlwf/filemap.h (contents, props changed) stable/11/contrib/expat/xmlwf/readfilemap.c (contents, props changed) stable/11/contrib/expat/xmlwf/unixfilemap.c (contents, props changed) stable/11/contrib/expat/xmlwf/win32filemap.c (contents, props changed) stable/11/contrib/expat/xmlwf/xmlfile.c (contents, props changed) stable/11/contrib/expat/xmlwf/xmlfile.h (contents, props changed) stable/11/contrib/expat/xmlwf/xmlmime.c (contents, props changed) stable/11/contrib/expat/xmlwf/xmlmime.h (contents, props changed) stable/11/contrib/expat/xmlwf/xmltchar.h (contents, props changed) stable/11/contrib/expat/xmlwf/xmlurl.h (contents, props changed) stable/11/contrib/expat/xmlwf/xmlwf.c (contents, props changed) stable/11/contrib/expat/xmlwf/xmlwin32url.cxx (contents, props changed) stable/11/lib/libexpat/expat_config.h stable/11/lib/libexpat/libbsdxml.3 Directory Properties: stable/11/ (props changed) stable/11/contrib/expat/doc/style.css (props changed) stable/11/contrib/expat/tests/README.txt (props changed) stable/11/contrib/expat/tests/benchmark/README.txt (props changed) Copied: stable/11/contrib/expat/AUTHORS (from r340127, head/contrib/expat/AUTHORS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/expat/AUTHORS Wed Dec 11 06:34:48 2019 (r355604, copy of r340127, head/contrib/expat/AUTHORS) @@ -0,0 +1,10 @@ +Expat is brought to you by: + +Clark Cooper +Fred L. Drake, Jr. +Greg Stein +James Clark +Karl Waclawek +Rhodri James +Sebastian Pipping +Steven Solie Modified: stable/11/contrib/expat/COPYING ============================================================================== --- stable/11/contrib/expat/COPYING Wed Dec 11 06:30:26 2019 (r355603) +++ stable/11/contrib/expat/COPYING Wed Dec 11 06:34:48 2019 (r355604) @@ -1,5 +1,5 @@ Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper -Copyright (c) 2001-2016 Expat maintainers +Copyright (c) 2001-2017 Expat maintainers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Modified: stable/11/contrib/expat/Changes ============================================================================== --- stable/11/contrib/expat/Changes Wed Dec 11 06:30:26 2019 (r355603) +++ stable/11/contrib/expat/Changes Wed Dec 11 06:34:48 2019 (r355604) @@ -1,3 +1,489 @@ +NOTE: We are looking for help with a few things: + https://github.com/libexpat/libexpat/labels/help%20wanted + If you can help, please get in touch. Thanks! + +Release 2.2.9 Wed Septemper 25 2019 + Other changes: + examples: Drop executable bits from elements.c + #349 Windows: Change the name of the Windows DLLs from expat*.dll + to libexpat*.dll once more (regression from 2.2.8, first + fixed in 1.95.3, issue #61 on SourceForge today, + was issue #432456 back then); needs a fix due + case-insensitive file systems on Windows and the fact that + Perl's XML::Parser::Expat compiles into Expat.dll. + #347 Windows: Only define _CRT_RAND_S if not defined + Version info bumped from 7:10:6 to 7:11:6 + + Special thanks to: + Ben Wagner + +Release 2.2.8 Fri Septemper 13 2019 + Security fixes: + #317 #318 CVE-2019-15903 -- Fix heap overflow triggered by + XML_GetCurrentLineNumber (or XML_GetCurrentColumnNumber), + and deny internal entities closing the doctype; + fixed in commit c20b758c332d9a13afbbb276d30db1d183a85d43 + + Bug fixes: + #240 Fix cases where XML_StopParser did not have any effect + when called from inside of an end element handler + #341 xmlwf: Fix exit code for operation without "-d DIRECTORY"; + previously, only "-d DIRECTORY" would give you a proper + exit code: + # xmlwf -d . <<<'' 2>/dev/null ; echo $? + 2 + # xmlwf <<<'' 2>/dev/null ; echo $? + 0 + Now both cases return exit code 2. + + Other changes: + #299 #302 Windows: Replace LoadLibrary hack to access + unofficial API function SystemFunction036 (RtlGenRandom) + by using official API function rand_s (needs WinXP+) + #325 Windows: Drop support for Visual Studio <=7.1/2003 + and document supported compilers in README.md + #286 Windows: Remove COM code from xmlwf; in case it turns + out needed later, there will be a dedicated repository + below https://github.com/libexpat/ for that code + #322 Windows: Remove explicit MSVC solution and project files. + You can generate Visual Studio solution files through + CMake, e.g.: cmake -G"Visual Studio 15 2017" . + #338 xmlwf: Make "xmlwf -h" help output more friendly + #339 examples: Improve elements.c + #244 #264 Autotools: Add argument --enable-xml-attr-info + #239 #301 Autotools: Add arguments + --with-getrandom + --without-getrandom + --with-sys-getrandom + --without-sys-getrandom + #312 #343 Autotools: Fix linking issues with "./configure LD=clang" + Autotools: Fix "make run-xmltest" for out-of-source builds + #329 #336 CMake: Pull all options from Expat <=2.2.7 into namespace + prefix EXPAT_ with the exception of DOCBOOK_TO_MAN: + - BUILD_doc -> EXPAT_BUILD_DOCS (plural) + - BUILD_examples -> EXPAT_BUILD_EXAMPLES + - BUILD_shared -> EXPAT_SHARED_LIBS + - BUILD_tests -> EXPAT_BUILD_TESTS + - BUILD_tools -> EXPAT_BUILD_TOOLS + - DOCBOOK_TO_MAN -> DOCBOOK_TO_MAN (unchanged) + - INSTALL -> EXPAT_ENABLE_INSTALL + - MSVC_USE_STATIC_CRT -> EXPAT_MSVC_STATIC_CRT + - USE_libbsd -> EXPAT_WITH_LIBBSD + - WARNINGS_AS_ERRORS -> EXPAT_WARNINGS_AS_ERRORS + - XML_CONTEXT_BYTES -> EXPAT_CONTEXT_BYTES + - XML_DEV_URANDOM -> EXPAT_DEV_URANDOM + - XML_DTD -> EXPAT_DTD + - XML_NS -> EXPAT_NS + - XML_UNICODE -> EXPAT_CHAR_TYPE=ushort (!) + - XML_UNICODE_WCHAR_T -> EXPAT_CHAR_TYPE=wchar_t (!) + #244 #264 CMake: Add argument -DEXPAT_ATTR_INFO=(ON|OFF), + default OFF + #326 CMake: Add argument -DEXPAT_LARGE_SIZE=(ON|OFF), + default OFF + #328 CMake: Add argument -DEXPAT_MIN_SIZE=(ON|OFF), + default OFF + #239 #277 CMake: Add arguments + -DEXPAT_WITH_GETRANDOM=(ON|OFF|AUTO), default AUTO + -DEXPAT_WITH_SYS_GETRANDOM=(ON|OFF|AUTO), default AUTO + #326 CMake: Install expat_config.h to include directory + #326 CMake: Generate and install configuration files for + future find_package(expat [..] CONFIG [..]) + CMake: Now produces a summary of applied configuration + CMake: Require C++ compiler only when tests are enabled + #330 CMake: Fix compilation for 16bit character types, + i.e. ex -DXML_UNICODE=ON (and ex -DXML_UNICODE_WCHAR_T=ON) + #265 CMake: Fix linking with MinGW + #330 CMake: Add full support for MinGW; to enable, use + -DCMAKE_TOOLCHAIN_FILE=[expat]/cmake/mingw-toolchain.cmake + #330 CMake: Port "make run-xmltest" from GNU Autotools to CMake + #316 CMake: Windows: Make binary postfix match MSVC + Old: expat[d].lib + New: expat[w][d][MD|MT].lib + CMake: Migrate files from Windows to Unix line endings + #308 CMake: Integrate OSS-Fuzz fuzzers, option + -DEXPAT_BUILD_FUZZERS=(ON|OFF), default OFF + #14 Drop an OpenVMS support leftover + #235 #268 .. + #270 #310 .. + #313 #331 #333 Address compiler warnings + #282 #283 .. + #284 #285 Address cppcheck warnings + #294 #295 Address Clang Static Analyzer warnings + #24 #293 Mass-apply clang-format 9 (and ensure conformance during CI) + Version info bumped from 7:9:6 to 7:10:6 + + Special thanks to: + David Loffredo + Joonun Jang + Khajapasha Mohammed + Kishore Kunche + Marco Maggi + Mitch Phillips + Rolf Ade + xantares + Zhongyuan Zhou + +Release 2.2.7 Wed June 19 2019 + Security fixes: + #186 #262 CVE-2018-20843 -- Fix extraction of namespace prefixes from + XML names; XML names with multiple colons could end up in + the wrong namespace, and take a high amount of RAM and CPU + resources while processing, opening the door to + use for denial-of-service attacks + + Other changes: + #195 #197 Autotools/CMake: Utilize -fvisibility=hidden to stop + exporting non-API symbols + #227 Autotools: Add --without-examples and --without-tests + #228 Autotools: Modernize configure.ac + #245 #246 Autotools: Fix check for -fvisibility=hidden for Clang + #247 #248 Autotools: Fix compilation for lack of docbook2x-man + #236 #258 Autotools: Produce .tar.{gz,lz,xz} release archives + #212 CMake: Make libdir of pkgconfig expat.pc support multilib + #158 #263 CMake: Build man page in PROJECT_BINARY_DIR not _SOURCE_DIR + #219 Remove fallback to bcopy, assume that memmove(3) exists + #257 Use portable "/usr/bin/env bash" shebang (e.g. for OpenBSD) + #243 Windows: Fix syntax of .def module definition files + Version info bumped from 7:8:6 to 7:9:6 + + Special thanks to: + Benjamin Peterson + Caolán McNamara + Hanno Böck + KangLin + Kishore Kunche + Marco Maggi + Rhodri James + Sebastian Dröge + userwithuid + Yury Gribov + +Release 2.2.6 Sun August 12 2018 + Bug fixes: + #170 #206 Avoid doing arithmetic with NULL pointers in XML_GetBuffer + #204 #205 Fix 2.2.5 regression with suspend-resume while parsing + a document like '' + + Other changes: + #165 #168 Autotools: Fix docbook-related configure syntax error + #166 Autotools: Avoid grep option `-q` for Solaris + #167 Autotools: Support + ./configure DOCBOOK_TO_MAN="xmlto man --skip-validation" + #159 #167 Autotools: Support DOCBOOK_TO_MAN command which produces + xmlwf.1 rather than XMLWF.1; also covers case insensitive + file systems + #181 Autotools: Drop -rpath option passed to libtool + #188 Autotools: Detect and deny SGML docbook2man as ours is XML + #188 Autotools/CMake: Support command db2x_docbook2man as well + #174 CMake: Introduce option WARNINGS_AS_ERRORS, defaults to OFF + #184 #185 CMake: Introduce option MSVC_USE_STATIC_CRT, defaults to OFF + #207 #208 CMake: Introduce option XML_UNICODE and XML_UNICODE_WCHAR_T, + both defaulting to OFF + #175 CMake: Prefer check_symbol_exists over check_function_exists + #176 CMake: Create the same pkg-config file as with GNU Autotools + #178 #179 CMake: Use GNUInstallDirs module to set proper defaults for + install directories + #208 CMake: Utilize expat_config.h.cmake for XML_DEV_URANDOM + #180 Windows: Fix compilation of test suite for Visual Studio 2008 + #131 #173 #202 Address compiler warnings + #187 #190 #200 Fix miscellaneous typos + Version info bumped from 7:7:6 to 7:8:6 + + Special thanks to: + Anton Maklakov + Benjamin Peterson + Brad King + Franek Korta + Frank Rast + Joe Orton + luzpaz + Pedro Vicente + Rainer Jung + Rhodri James + Rolf Ade + Rolf Eike Beer + Thomas Beutlich + Tomasz Kłoczko + +Release 2.2.5 Tue October 31 2017 + Bug fixes: + #8 If the parser runs out of memory, make sure its internal + state reflects the memory it actually has, not the memory + it wanted to have. + #11 The default handler wasn't being called when it should for + a SYSTEM or PUBLIC doctype if an entity declaration handler + was registered. + #137 #138 Fix a case of mistakenly reported parsing success where + XML_StopParser was called from an element handler + #162 Function XML_ErrorString was returning NULL rather than + a message for code XML_ERROR_INVALID_ARGUMENT + introduced with release 2.2.1 + + Other changes: + #106 xmlwf: Add argument -N adding notation declarations + #75 #106 Test suite: Resolve expected failure cases where xmlwf + output was incomplete + #127 Windows: Fix test suite compilation + #126 #127 Windows: Fix compilation for Visual Studio 2012 + Windows: Upgrade shipped project files to Visual Studio 2017 + #33 #132 tests: Mass-fix compilation for XML_UNICODE_WCHAR_T + #129 examples: Fix compilation for XML_UNICODE_WCHAR_T + #130 benchmark: Fix compilation for XML_UNICODE_WCHAR_T + #144 xmlwf: Fix compilation for XML_UNICODE_WCHAR_T; still needs + Windows or MinGW for 2-byte wchar_t + #9 Address two Clang Static Analyzer false positives + #59 Resolve troublesome macros hiding parser struct membership + and dereferencing that pointer + #6 Resolve superfluous internal malloc/realloc switch + #153 #155 Improve docbook2x-man detection + #160 Undefine NDEBUG in the test suite (rather than rejecting it) + #161 Address compiler warnings + Version info bumped from 7:6:6 to 7:7:6 + + Special thanks to: + Benbuck Nason + Hans Wennborg + José Gutiérrez de la Concha + Pedro Monreal Gonzalez + Rhodri James + Rolf Ade + Stephen Groat + and + Core Infrastructure Initiative + +Release 2.2.4 Sat August 19 2017 + Bug fixes: + #115 Fix copying of partial characters for UTF-8 input + + Other changes: + #109 Fix "make check" for non-x86 architectures that default + to unsigned type char (-128..127 rather than 0..255) + #109 coverage.sh: Cover -funsigned-char + Autotools: Introduce --without-xmlwf argument + #65 Autotools: Replace handwritten Makefile with GNU Automake + #43 CMake: Auto-detect high quality entropy extractors, add new + option USE_libbsd=ON to use arc4random_buf of libbsd + #74 CMake: Add -fno-strict-aliasing only where supported + #114 CMake: Always honor manually set BUILD_* options + #114 CMake: Compile man page if docbook2x-man is available, only + #117 Include file tests/xmltest.log.expected in source tarball + (required for "make run-xmltest") + #117 Include (existing) Visual Studio 2013 files in source tarball + Improve test suite error output + #111 Fix some typos in documentation + Version info bumped from 7:5:6 to 7:6:6 + + Special thanks to: + Jakub Wilk + Joe Orton + Lin Tian + Rolf Eike Beer + +Release 2.2.3 Wed August 2 2017 + Security fixes: + #82 CVE-2017-11742 -- Windows: Fix DLL hijacking vulnerability + using Steve Holme's LoadLibrary wrapper for/of cURL + + Bug fixes: + #85 Fix a dangling pointer issue related to realloc + + Other changes: + Increase code coverage + #91 Linux: Allow getrandom to fail if nonblocking pool has not + yet been initialized and read /dev/urandom then, instead. + This is in line with what recent Python does. + #81 Pre-10.7/Lion macOS: Support entropy from arc4random + #86 Check that a UTF-16 encoding in an XML declaration has the + right endianness + #4 #5 #7 Recover correctly when some reallocations fail + Repair "./configure && make" for systems without any + provider of high quality entropy + and try reading /dev/urandom on those + Ensure that user-defined character encodings have converter + functions when they are needed + Fix mis-leading description of argument -c in xmlwf.1 + Rely on macro HAVE_ARC4RANDOM_BUF (rather than __CloudABI__) + for CloudABI + #100 Fix use of SIPHASH_MAIN in siphash.h + #23 Test suite: Fix memory leaks + Version info bumped from 7:4:6 to 7:5:6 + + Special thanks to: + Chanho Park + Joe Orton + Pascal Cuoq + Rhodri James + Simon McVittie + Vadim Zeitlin + Viktor Szakats + and + Core Infrastructure Initiative + +Release 2.2.2 Wed July 12 2017 + Security fixes: + #43 Protect against compilation without any source of high + quality entropy enabled, e.g. with CMake build system; + commit ff0207e6076e9828e536b8d9cd45c9c92069b895 + #60 Windows with _UNICODE: + Unintended use of LoadLibraryW with a non-wide string + resulted in failure to load advapi32.dll and degradation + in quality of used entropy when compiled with _UNICODE for + Windows; you can launch existing binaries with + EXPAT_ENTROPY_DEBUG=1 in the environment to inspect the + quality of entropy used during runtime; commits + * 95b95032f907ef1cd17ee7a9a1768010a825d61d + * 73a5a2e9c081f49f2d775cf7ced864158b68dc80 + [MOX-006] Fix non-NULL parser parameter validation in XML_Parse; + resulted in NULL dereference, previously; + commit ac256dafdffc9622ab0dc2c62fcecb0dfcfa71fe + + Bug fixes: + #69 Fix improper use of unsigned long long integer literals + + Other changes: + #73 Start requiring a C99 compiler + #49 Fix "==" Bashism in configure script + #50 Fix too eager getrandom detection for Debian GNU/kFreeBSD + #52 and macOS + #51 Address lack of stdint.h in Visual Studio 2003 to 2008 + #58 Address compile warnings + #68 Fix "./buildconf.sh && ./configure" for some versions + of Dash for /bin/sh + #72 CMake: Ease use of Expat in context of a parent project + with multiple CMakeLists.txt files + #72 CMake: Resolve mistaken executable permissions + #76 Address compile warning with -DNDEBUG (not recommended!) + #77 Address compile warning about macro redefinition + + Special thanks to: + Alexander Bluhm + Ben Boeckel + Cătălin Răceanu + Kerin Millar + László Böszörményi + S. P. Zeidler + Segev Finer + Václav Slavík + Victor Stinner + Viktor Szakats + and + Radically Open Security + +Release 2.2.1 Sat June 17 2017 + Security fixes: + CVE-2017-9233 -- External entity infinite loop DoS + Details: https://libexpat.github.io/doc/cve-2017-9233/ + Commit c4bf96bb51dd2a1b0e185374362ee136fe2c9d7f + [MOX-002] CVE-2016-9063 -- Detect integer overflow; commit + d4f735b88d9932bd5039df2335eefdd0723dbe20 + (Fixed version of existing downstream patches!) + (SF.net) #539 Fix regression from fix to CVE-2016-0718 cutting off + longer tag names; commits + * 896b6c1fd3b842f377d1b62135dccf0a579cf65d + * af507cef2c93cb8d40062a0abe43a4f4e9158fb2 + #16 * 0dbbf43fdb20f593ddf4fa1ff67288000dd4a7fd + #25 More integer overflow detection (function poolGrow); commits + * 810b74e4703dcfdd8f404e3cb177d44684775143 + * 44178553f3539ce69d34abee77a05e879a7982ac + [MOX-002] Detect overflow from len=INT_MAX call to XML_Parse; commits + * 4be2cb5afcc018d996f34bbbce6374b7befad47f + * 7e5b71b748491b6e459e5c9a1d090820f94544d8 + [MOX-005] #30 Use high quality entropy for hash initialization: + * arc4random_buf on BSD, systems with libbsd + (when configured with --with-libbsd), CloudABI + * RtlGenRandom on Windows XP / Server 2003 and later + * getrandom on Linux 3.17+ + In a way, that's still part of CVE-2016-5300. + https://github.com/libexpat/libexpat/pull/30/commits + [MOX-005] For the low quality entropy extraction fallback code, + the parser instance address can no longer leak, commit + 04ad658bd3079dd15cb60fc67087900f0ff4b083 + [MOX-003] Prevent use of uninitialised variable; commit + [MOX-004] a4dc944f37b664a3ca7199c624a98ee37babdb4b + Add missing parameter validation to public API functions + and dedicated error code XML_ERROR_INVALID_ARGUMENT: + [MOX-006] * NULL checks; commits + * d37f74b2b7149a3a95a680c4c4cd2a451a51d60a (merge/many) + * 9ed727064b675b7180c98cb3d4f75efba6966681 + * 6a747c837c50114dfa413994e07c0ba477be4534 + * Negative length (XML_Parse); commit + [MOX-002] 70db8d2538a10f4c022655d6895e4c3e78692e7f + [MOX-001] #35 Change hash algorithm to William Ahern's version of SipHash + to go further with fixing CVE-2012-0876. + https://github.com/libexpat/libexpat/pull/39/commits + + Bug fixes: + #32 Fix sharing of hash salt across parsers; + relevant where XML_ExternalEntityParserCreate is called + prior to XML_Parse, in particular (e.g. FBReader) + #28 xmlwf: Auto-disable use of memory-mapping (and parsing + as a single chunk) for files larger than ~1 GB (2^30 bytes) + rather than failing with error "out of memory" + #3 Fix double free after malloc failure in DTD code; commit + 7ae9c3d3af433cd4defe95234eae7dc8ed15637f + #17 Fix memory leak on parser error for unbound XML attribute + prefix with new namespaces defined in the same tag; + found by Google's OSS-Fuzz; commits + * 16f87daae5a16132e479e4f71862128c7a915c73 + * b47dbc9745932c160893d433220e462bd605f8cd + xmlwf on Windows: Add missing calls to CloseHandle + + New features: + #30 Introduced environment switch EXPAT_ENTROPY_DEBUG=1 + for runtime debugging of entropy extraction + + Other changes: + Increase code coverage + #33 Reject use of XML_UNICODE_WCHAR_T with sizeof(wchar_t) != 2; + XML_UNICODE_WCHAR_T was never meant to be used outside + of Windows; 4-byte wchar_t is common on Linux + (SF.net) #538 Start using -fno-strict-aliasing + (SF.net) #540 Support compilation against cloudlibc of CloudABI + Allow MinGW cross-compilation + (SF.net) #534 CMake: Introduce option "BUILD_doc" (enabled by default) + to bypass compilation of the xmlwf.1 man page + (SF.net) pr2 CMake: Introduce option "INSTALL" (enabled by default) + to bypass installation of expat files + CMake: Fix ninja support + Autotools: Add parameters --enable-xml-context [COUNT] + and --disable-xml-context; default of context of 1024 + bytes enabled unchanged + #14 Drop AmigaOS 4.x code and includes + #14 Drop ancient build systems: + * Borland C++ Builder + * OpenVMS + * Open Watcom + * Visual Studio 6.0 + * Pre-X Mac OS (MPW Makefile) + If you happen to rely on some of these, please get in + touch for joining with maintenance. + #10 Move from WIN32 to _WIN32 + #13 Fix "make run-xmltest" order instability + Address compile warnings + Bump version info from 7:2:6 to 7:3:6 + Add AUTHORS file + + Infrastructure: + #1 Migrate from SourceForge to GitHub (except downloads): + https://github.com/libexpat/ + #1 Re-create http://libexpat.org/ project website + Start utilizing Travis CI + + Special thanks to: + Andy Wang + Don Lewis + Ed Schouten + Karl Waclawek + Pascal Cuoq + Rhodri James + Sergei Nikulov + Tobias Taschner + Viktor Szakats + and + Core Infrastructure Initiative + Mozilla Foundation (MOSS Track 3: Secure Open Source) + Radically Open Security + Release 2.2.0 Tue June 21 2016 Security fixes: #537 CVE-2016-0718 -- Fix crash on malformed input @@ -63,24 +549,25 @@ Release 2.1.1 Sat March 12 2016 libtool now invoked with --verbose Release 2.1.0 Sat March 24 2012 + - Security fixes: + #2958794: CVE-2012-1148 - Memory leak in poolGrow. + #2895533: CVE-2012-1147 - Resource leak in readfilemap.c. + #3496608: CVE-2012-0876 - Hash DOS attack. + #2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8(). + #1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences. - Bug Fixes: #1742315: Harmful XML_ParserCreateNS suggestion. - #2895533: CVE-2012-1147 - Resource leak in readfilemap.c. #1785430: Expat build fails on linux-amd64 with gcc version>=4.1 -O3. #1983953, 2517952, 2517962, 2649838: Build modifications using autoreconf instead of buildconf.sh. #2815947, #2884086: OBJEXT and EXEEXT support while building. - #1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences. #2517938: xmlwf should return non-zero exit status if not well-formed. #2517946: Wrong statement about XMLDecl in xmlwf.1 and xmlwf.sgml. #2855609: Dangling positionPtr after error. - #2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8(). - #2958794: CVE-2012-1148 - Memory leak in poolGrow. #2990652: CMake support. #3010819: UNEXPECTED_STATE with a trailing "%" in entity value. - #3206497: Unitialized memory returned from XML_Parse. + #3206497: Uninitialized memory returned from XML_Parse. #3287849: make check fails on mingw-w64. - #3496608: CVE-2012-0876 - Hash DOS attack. - Patches: #1749198: pkg-config support. #3010222: Fix for bug #3010819. Modified: stable/11/contrib/expat/FREEBSD-Xlist ============================================================================== --- stable/11/contrib/expat/FREEBSD-Xlist Wed Dec 11 06:30:26 2019 (r355603) +++ stable/11/contrib/expat/FREEBSD-Xlist Wed Dec 11 06:34:48 2019 (r355604) @@ -6,7 +6,9 @@ *.dsw *.m4 *.pc.in +*.vcxproj* *config.h +cmake CMake* Configure* amiga @@ -14,6 +16,7 @@ bcb5 configure conftools doc/valid-xhtml10.png +expat.sln m4 vms win32 Copied and modified: stable/11/contrib/expat/Makefile.am (from r340127, head/contrib/expat/Makefile.am) ============================================================================== --- head/contrib/expat/Makefile.am Sun Nov 4 16:08:59 2018 (r340127, copy source) +++ stable/11/contrib/expat/Makefile.am Wed Dec 11 06:34:48 2019 (r355604) @@ -30,14 +30,21 @@ AUTOMAKE_OPTIONS = \ dist-bzip2 \ + dist-lzip \ + dist-xz \ foreign \ - no-dist-gzip \ subdir-objects ACLOCAL_AMFLAGS = -I m4 LIBTOOLFLAGS = --verbose -SUBDIRS = lib examples tests # lib goes first to build first +SUBDIRS = lib # lib goes first to build first +if WITH_EXAMPLES +SUBDIRS += examples +endif +if WITH_TESTS +SUBDIRS += tests +endif if WITH_XMLWF SUBDIRS += xmlwf doc endif @@ -47,41 +54,19 @@ pkgconfigdir = $(libdir)/pkgconfig _EXTRA_DIST_CMAKE = \ + cmake/expat-config.cmake.in \ + cmake/mingw-toolchain.cmake \ + \ CMakeLists.txt \ CMake.README \ ConfigureChecks.cmake \ expat_config.h.cmake _EXTRA_DIST_WINDOWS = \ - examples/elements.vcxproj \ - examples/elements.vcxproj.filters \ - examples/outline.vcxproj \ - examples/outline.vcxproj.filters \ - \ - lib/expat_static.vcxproj \ - lib/expat_static.vcxproj.filters \ - lib/expat.vcxproj \ - lib/expat.vcxproj.filters \ - lib/expatw_static.vcxproj \ - lib/expatw_static.vcxproj.filters \ - lib/expatw.vcxproj \ - lib/expatw.vcxproj.filters \ - \ - tests/benchmark/benchmark.sln \ - tests/benchmark/benchmark.vcxproj \ - \ - tests/runtests.sln \ - tests/runtests.vcxproj \ - tests/runtests.vcxproj.filters \ - \ + win32/build_expat_iss.bat \ win32/expat.iss \ win32/MANIFEST.txt \ - win32/README.txt \ - \ - xmlwf/xmlwf.vcxproj \ - xmlwf/xmlwf.vcxproj.filters \ - \ - expat.sln + win32/README.txt EXTRA_DIST = \ $(_EXTRA_DIST_CMAKE) \ @@ -91,8 +76,13 @@ EXTRA_DIST = \ conftools/get-version.sh \ conftools/PrintPath \ \ + xmlwf/xmlwf_helpgen.py \ + xmlwf/xmlwf_helpgen.sh \ + \ Changes \ README.md \ + \ + fix-xmltest-log.sh \ test-driver-wrapper.sh @@ -121,7 +111,8 @@ run-benchmark: $(MAKE) -C tests/benchmark ./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3 -tests/xmlts.zip: +.PHONY: download-xmlts-zip +download-xmlts-zip: if test "$(XMLTS_ZIP)" = ""; then \ wget --output-document=tests/xmlts.zip \ https://www.w3.org/XML/Test/xmlts20080827.zip; \ @@ -129,16 +120,26 @@ tests/xmlts.zip: cp $(XMLTS_ZIP) tests/xmlts.zip; \ fi -tests/xmlconf: tests/xmlts.zip +tests/xmlts.zip: + $(MAKE) download-xmlts-zip + +.PHONY: extract-xmlts-zip +extract-xmlts-zip: tests/xmlts.zip + [ -f $(builddir)/tests/xmlts.zip ] || $(MAKE) download-xmlts-zip # vpath workaround cd tests && unzip -q xmlts.zip +tests/xmlconf: tests/xmlts.zip + $(MAKE) extract-xmlts-zip + .PHONY: run-xmltest run-xmltest: tests/xmlconf if WITH_XMLWF + [ -d $(builddir)/tests/xmlconf ] || $(MAKE) extract-xmlts-zip # vpath workaround + $(MAKE) -C lib $(MAKE) -C xmlwf - tests/xmltest.sh "$(PWD)/run.sh $(PWD)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee tests/xmltest.log - dos2unix tests/xmltest.log - diff -u tests/xmltest.log.expected tests/xmltest.log + $(srcdir)/tests/xmltest.sh "$(abs_builddir)/run.sh $(abs_builddir)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee $(builddir)/tests/xmltest.log + $(srcdir)/fix-xmltest-log.sh $(builddir)/tests/xmltest.log + diff -u $(srcdir)/tests/xmltest.log.expected $(builddir)/tests/xmltest.log else @echo 'ERROR: xmlwf is needed for "make run-xmltest".' >&2 @echo 'ERROR: Please re-configure without --without-xmlwf.' >&2 @@ -147,7 +148,7 @@ endif .PHONY: qa qa: - ./qa.sh address - ./qa.sh memory - ./qa.sh undefined - ./qa.sh coverage + QA_COMPILER=clang QA_SANITIZER=address ./qa.sh + QA_COMPILER=clang QA_SANITIZER=memory ./qa.sh + QA_COMPILER=clang QA_SANITIZER=undefined ./qa.sh + QA_COMPILER=gcc QA_PROCESSOR=gcov ./qa.sh Modified: stable/11/contrib/expat/Makefile.in ============================================================================== --- stable/11/contrib/expat/Makefile.in Wed Dec 11 06:30:26 2019 (r355603) +++ stable/11/contrib/expat/Makefile.in Wed Dec 11 06:34:48 2019 (r355604) @@ -1,212 +1,1034 @@ -################################################################ -# Process this file with top-level configure script to produce Makefile +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + # -# Copyright 2000 Clark Cooper +# __ __ _ +# ___\ \/ /_ __ __ _| |_ +# / _ \\ /| '_ \ / _` | __| +# | __// \| |_) | (_| | |_ +# \___/_/\_\ .__/ \__,_|\__| +# |_| XML parser # -# This file is part of EXPAT. +# Copyright (c) 2017 Expat development team +# Licensed under the MIT license: # -# EXPAT is free software; you can redistribute it and/or modify it -# under the terms of the License (based on the MIT/X license) contained -# in the file COPYING that comes with this distribution. +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to permit +# persons to whom the Software is furnished to do so, subject to the +# following conditions: # -# EXPAT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN EXPAT. +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WITH_EXAMPLES_TRUE@am__append_1 = examples +@WITH_TESTS_TRUE@am__append_2 = tests +@WITH_XMLWF_TRUE@am__append_3 = xmlwf doc +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/conftools/ax-require-defined.m4 \ + $(top_srcdir)/conftools/ax-check-compile-flag.m4 \ + $(top_srcdir)/conftools/ax-check-link-flag.m4 \ + $(top_srcdir)/conftools/ax-append-flag.m4 \ + $(top_srcdir)/conftools/ax-append-compile-flags.m4 \ + $(top_srcdir)/conftools/ax-append-link-flags.m4 \ + $(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = expat_config.h +CONFIG_CLEAN_FILES = expat.pc run.sh +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(pkgconfigdir)" +DATA = $(pkgconfig_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir distdir-am dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)expat_config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +CSCOPE = cscope +DIST_SUBDIRS = lib examples tests xmlwf doc +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/expat.pc.in \ + $(srcdir)/expat_config.h.in $(srcdir)/run.sh.in \ + $(top_srcdir)/conftools/ar-lib $(top_srcdir)/conftools/compile \ + $(top_srcdir)/conftools/config.guess \ + $(top_srcdir)/conftools/config.sub \ + $(top_srcdir)/conftools/install-sh \ + $(top_srcdir)/conftools/ltmain.sh \ + $(top_srcdir)/conftools/missing AUTHORS COPYING \ + conftools/ar-lib conftools/compile conftools/config.guess \ + conftools/config.sub conftools/depcomp conftools/install-sh \ + conftools/ltmain.sh conftools/missing +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Wed Dec 11 14:27:00 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F27901D7DD2; Wed, 11 Dec 2019 14:27:00 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47XzlS68vKz49Gj; Wed, 11 Dec 2019 14:27:00 +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 CE91EC997; Wed, 11 Dec 2019 14:27:00 +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 xBBER05k055947; Wed, 11 Dec 2019 14:27:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBBER0Qu055946; Wed, 11 Dec 2019 14:27:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912111427.xBBER0Qu055946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 11 Dec 2019 14:27:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355606 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 355606 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2019 14:27:01 -0000 Author: markj Date: Wed Dec 11 14:27:00 2019 New Revision: 355606 URL: https://svnweb.freebsd.org/changeset/base/355606 Log: MFC r355399: Fix an off-by-one error in vm_map_pmap_enter(). Modified: stable/12/sys/vm/vm_map.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_map.c ============================================================================== --- stable/12/sys/vm/vm_map.c Wed Dec 11 06:50:55 2019 (r355605) +++ stable/12/sys/vm/vm_map.c Wed Dec 11 14:27:00 2019 (r355606) @@ -2385,7 +2385,7 @@ vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, vm_p psize = atop(size); if (psize + pindex > object->size) { - if (object->size < pindex) { + if (pindex >= object->size) { VM_OBJECT_RUNLOCK(object); return; } From owner-svn-src-stable@freebsd.org Wed Dec 11 14:27:34 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08DAC1D7E3D; Wed, 11 Dec 2019 14:27: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Xzm56VTfz49PQ; Wed, 11 Dec 2019 14:27:33 +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 DA6BCC99A; Wed, 11 Dec 2019 14:27:33 +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 xBBERX4m056017; Wed, 11 Dec 2019 14:27:33 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBBERXGG056016; Wed, 11 Dec 2019 14:27:33 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912111427.xBBERXGG056016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 11 Dec 2019 14:27:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355607 - stable/12/sys/dev/iwm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/dev/iwm X-SVN-Commit-Revision: 355607 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2019 14:27:34 -0000 Author: markj Date: Wed Dec 11 14:27:33 2019 New Revision: 355607 URL: https://svnweb.freebsd.org/changeset/base/355607 Log: MFC r355143: iwm(4): Fix version string formatting. Modified: stable/12/sys/dev/iwm/if_iwm.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/iwm/if_iwm.c ============================================================================== --- stable/12/sys/dev/iwm/if_iwm.c Wed Dec 11 14:27:00 2019 (r355606) +++ stable/12/sys/dev/iwm/if_iwm.c Wed Dec 11 14:27:33 2019 (r355607) @@ -851,7 +851,7 @@ iwm_read_firmware(struct iwm_softc *sc) goto parse_out; } snprintf(sc->sc_fwver, sizeof(sc->sc_fwver), - "%d.%d.%d", + "%u.%u.%u", le32toh(((const uint32_t *)tlv_data)[0]), le32toh(((const uint32_t *)tlv_data)[1]), le32toh(((const uint32_t *)tlv_data)[2])); From owner-svn-src-stable@freebsd.org Wed Dec 11 14:28:14 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22D3C1D7EEF; Wed, 11 Dec 2019 14:28:14 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Xzmt0tzGz49ZX; Wed, 11 Dec 2019 14:28:14 +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 19B76C99D; Wed, 11 Dec 2019 14:28:14 +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 xBBESEuo056095; Wed, 11 Dec 2019 14:28:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBBESEMn056093; Wed, 11 Dec 2019 14:28:14 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912111428.xBBESEMn056093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 11 Dec 2019 14:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355608 - stable/12/sys/dev/iwm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/dev/iwm X-SVN-Commit-Revision: 355608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2019 14:28:14 -0000 Author: markj Date: Wed Dec 11 14:28:13 2019 New Revision: 355608 URL: https://svnweb.freebsd.org/changeset/base/355608 Log: MFC r355144: iwm(4): Remove _mvm from the namespace. Modified: stable/12/sys/dev/iwm/if_iwm.c stable/12/sys/dev/iwm/if_iwm_binding.c stable/12/sys/dev/iwm/if_iwm_binding.h stable/12/sys/dev/iwm/if_iwm_constants.h stable/12/sys/dev/iwm/if_iwm_fw.c stable/12/sys/dev/iwm/if_iwm_led.c stable/12/sys/dev/iwm/if_iwm_led.h stable/12/sys/dev/iwm/if_iwm_mac_ctxt.c stable/12/sys/dev/iwm/if_iwm_mac_ctxt.h stable/12/sys/dev/iwm/if_iwm_phy_ctxt.c stable/12/sys/dev/iwm/if_iwm_phy_ctxt.h stable/12/sys/dev/iwm/if_iwm_power.c stable/12/sys/dev/iwm/if_iwm_power.h stable/12/sys/dev/iwm/if_iwm_scan.c stable/12/sys/dev/iwm/if_iwm_scan.h stable/12/sys/dev/iwm/if_iwm_sf.c stable/12/sys/dev/iwm/if_iwm_sf.h stable/12/sys/dev/iwm/if_iwm_sta.c stable/12/sys/dev/iwm/if_iwm_sta.h stable/12/sys/dev/iwm/if_iwm_time_event.c stable/12/sys/dev/iwm/if_iwm_time_event.h stable/12/sys/dev/iwm/if_iwm_util.c stable/12/sys/dev/iwm/if_iwm_util.h stable/12/sys/dev/iwm/if_iwmreg.h stable/12/sys/dev/iwm/if_iwmvar.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/iwm/if_iwm.c ============================================================================== --- stable/12/sys/dev/iwm/if_iwm.c Wed Dec 11 14:27:33 2019 (r355607) +++ stable/12/sys/dev/iwm/if_iwm.c Wed Dec 11 14:28:13 2019 (r355608) @@ -231,10 +231,10 @@ struct iwm_nvm_section { uint8_t *data; }; -#define IWM_MVM_UCODE_ALIVE_TIMEOUT hz -#define IWM_MVM_UCODE_CALIB_TIMEOUT (2*hz) +#define IWM_UCODE_ALIVE_TIMEOUT hz +#define IWM_UCODE_CALIB_TIMEOUT (2*hz) -struct iwm_mvm_alive_data { +struct iwm_alive_data { int valid; uint32_t scd_base_addr; }; @@ -263,7 +263,7 @@ static void iwm_disable_interrupts(struct iwm_softc *) static void iwm_ict_reset(struct iwm_softc *); static int iwm_allow_mcast(struct ieee80211vap *, struct iwm_softc *); static void iwm_stop_device(struct iwm_softc *); -static void iwm_mvm_nic_config(struct iwm_softc *); +static void iwm_nic_config(struct iwm_softc *); static int iwm_nic_rx_init(struct iwm_softc *); static int iwm_nic_tx_init(struct iwm_softc *); static int iwm_nic_init(struct iwm_softc *); @@ -317,23 +317,23 @@ static int iwm_pcie_load_given_ucode(struct iwm_softc static int iwm_start_fw(struct iwm_softc *, const struct iwm_fw_img *); static int iwm_send_tx_ant_cfg(struct iwm_softc *, uint8_t); static int iwm_send_phy_cfg_cmd(struct iwm_softc *); -static int iwm_mvm_load_ucode_wait_alive(struct iwm_softc *, +static int iwm_load_ucode_wait_alive(struct iwm_softc *, enum iwm_ucode_type); -static int iwm_run_init_mvm_ucode(struct iwm_softc *, int); -static int iwm_mvm_config_ltr(struct iwm_softc *sc); +static int iwm_run_init_ucode(struct iwm_softc *, int); +static int iwm_config_ltr(struct iwm_softc *sc); static int iwm_rx_addbuf(struct iwm_softc *, int, int); -static void iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *, +static void iwm_rx_rx_phy_cmd(struct iwm_softc *, struct iwm_rx_packet *); static int iwm_get_noise(struct iwm_softc *, - const struct iwm_mvm_statistics_rx_non_phy *); -static void iwm_mvm_handle_rx_statistics(struct iwm_softc *, + const struct iwm_statistics_rx_non_phy *); +static void iwm_handle_rx_statistics(struct iwm_softc *, struct iwm_rx_packet *); -static bool iwm_mvm_rx_mpdu(struct iwm_softc *, struct mbuf *, +static bool iwm_rx_mpdu(struct iwm_softc *, struct mbuf *, uint32_t, bool); -static int iwm_mvm_rx_tx_cmd_single(struct iwm_softc *, +static int iwm_rx_tx_cmd_single(struct iwm_softc *, struct iwm_rx_packet *, struct iwm_node *); -static void iwm_mvm_rx_tx_cmd(struct iwm_softc *, struct iwm_rx_packet *); +static void iwm_rx_tx_cmd(struct iwm_softc *, struct iwm_rx_packet *); static void iwm_cmd_done(struct iwm_softc *, struct iwm_rx_packet *); #if 0 static void iwm_update_sched(struct iwm_softc *, int, int, uint8_t, @@ -346,7 +346,7 @@ static int iwm_tx(struct iwm_softc *, struct mbuf *, struct ieee80211_node *, int); static int iwm_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); -static int iwm_mvm_update_quotas(struct iwm_softc *, struct iwm_vap *); +static int iwm_update_quotas(struct iwm_softc *, struct iwm_vap *); static int iwm_auth(struct ieee80211vap *, struct iwm_softc *); static struct ieee80211_node * iwm_node_alloc(struct ieee80211vap *, @@ -358,10 +358,10 @@ static int iwm_media_change(struct ifnet *); static int iwm_newstate(struct ieee80211vap *, enum ieee80211_state, int); static void iwm_endscan_cb(void *, int); static int iwm_send_bt_init_conf(struct iwm_softc *); -static boolean_t iwm_mvm_is_lar_supported(struct iwm_softc *); -static boolean_t iwm_mvm_is_wifi_mcc_supported(struct iwm_softc *); +static boolean_t iwm_is_lar_supported(struct iwm_softc *); +static boolean_t iwm_is_wifi_mcc_supported(struct iwm_softc *); static int iwm_send_update_mcc_cmd(struct iwm_softc *, const char *); -static void iwm_mvm_tt_tx_backoff(struct iwm_softc *, uint32_t); +static void iwm_tt_tx_backoff(struct iwm_softc *, uint32_t); static int iwm_init_hw(struct iwm_softc *); static void iwm_init(struct iwm_softc *); static void iwm_start(struct iwm_softc *); @@ -1093,7 +1093,7 @@ iwm_alloc_tx_ring(struct iwm_softc *sc, struct iwm_tx_ * We only use rings 0 through 9 (4 EDCA + cmd) so there is no need * to allocate commands space for other rings. */ - if (qid > IWM_MVM_CMD_QUEUE) + if (qid > IWM_CMD_QUEUE) return 0; size = IWM_TX_RING_COUNT * sizeof(struct iwm_device_cmd); @@ -1106,7 +1106,7 @@ iwm_alloc_tx_ring(struct iwm_softc *sc, struct iwm_tx_ ring->cmd = ring->cmd_dma.vaddr; /* FW commands may require more mapped space than packets. */ - if (qid == IWM_MVM_CMD_QUEUE) { + if (qid == IWM_CMD_QUEUE) { maxsize = IWM_RBUF_SIZE; nsegments = 1; } else { @@ -1170,7 +1170,7 @@ iwm_reset_tx_ring(struct iwm_softc *sc, struct iwm_tx_ ring->queued = 0; ring->cur = 0; - if (ring->qid == IWM_MVM_CMD_QUEUE && sc->cmd_hold_nic_awake) + if (ring->qid == IWM_CMD_QUEUE && sc->cmd_hold_nic_awake) iwm_pcie_clear_cmd_in_flight(sc); } @@ -1359,11 +1359,11 @@ iwm_stop_device(struct iwm_softc *sc) /* iwlwifi: mvm/ops.c */ static void -iwm_mvm_nic_config(struct iwm_softc *sc) +iwm_nic_config(struct iwm_softc *sc) { uint8_t radio_cfg_type, radio_cfg_step, radio_cfg_dash; uint32_t reg_val = 0; - uint32_t phy_config = iwm_mvm_get_phy_config(sc); + uint32_t phy_config = iwm_get_phy_config(sc); radio_cfg_type = (phy_config & IWM_FW_PHY_CFG_RADIO_TYPE) >> IWM_FW_PHY_CFG_RADIO_TYPE_POS; @@ -1572,7 +1572,7 @@ iwm_nic_init(struct iwm_softc *sc) if (sc->cfg->device_family == IWM_DEVICE_FAMILY_7000) iwm_set_pwr(sc); - iwm_mvm_nic_config(sc); + iwm_nic_config(sc); if ((error = iwm_nic_rx_init(sc)) != 0) return error; @@ -1605,7 +1605,7 @@ iwm_enable_txq(struct iwm_softc *sc, int sta_id, int q IWM_WRITE(sc, IWM_HBUS_TARG_WRPTR, qid << 8 | 0); - if (qid == IWM_MVM_CMD_QUEUE) { + if (qid == IWM_CMD_QUEUE) { /* Disable the scheduler. */ iwm_write_prph(sc, IWM_SCD_EN_CTRL, 0); @@ -1665,7 +1665,7 @@ iwm_enable_txq(struct iwm_softc *sc, int sta_id, int q cmd.aggregate = 0; cmd.window = IWM_FRAME_LIMIT; - error = iwm_mvm_send_cmd_pdu(sc, IWM_SCD_QUEUE_CFG, IWM_CMD_SYNC, + error = iwm_send_cmd_pdu(sc, IWM_SCD_QUEUE_CFG, IWM_CMD_SYNC, sizeof(cmd), &cmd); if (error) { device_printf(sc->sc_dev, @@ -1726,7 +1726,7 @@ iwm_trans_pcie_fw_alive(struct iwm_softc *sc, uint32_t iwm_nic_unlock(sc); /* enable command channel */ - error = iwm_enable_txq(sc, 0 /* unused */, IWM_MVM_CMD_QUEUE, 7); + error = iwm_enable_txq(sc, 0 /* unused */, IWM_CMD_QUEUE, 7); if (error) return error; @@ -2788,7 +2788,7 @@ iwm_send_tx_ant_cfg(struct iwm_softc *sc, uint8_t vali .valid = htole32(valid_tx_ant), }; - return iwm_mvm_send_cmd_pdu(sc, IWM_TX_ANT_CONFIGURATION_CMD, + return iwm_send_cmd_pdu(sc, IWM_TX_ANT_CONFIGURATION_CMD, IWM_CMD_SYNC, sizeof(tx_ant_cmd), &tx_ant_cmd); } @@ -2800,7 +2800,7 @@ iwm_send_phy_cfg_cmd(struct iwm_softc *sc) enum iwm_ucode_type ucode_type = sc->cur_ucode; /* Set parameters */ - phy_cfg_cmd.phy_cfg = htole32(iwm_mvm_get_phy_config(sc)); + phy_cfg_cmd.phy_cfg = htole32(iwm_get_phy_config(sc)); phy_cfg_cmd.calib_control.event_trigger = sc->sc_default_calib[ucode_type].event_trigger; phy_cfg_cmd.calib_control.flow_trigger = @@ -2808,16 +2808,16 @@ iwm_send_phy_cfg_cmd(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_CMD | IWM_DEBUG_RESET, "Sending Phy CFG command: 0x%x\n", phy_cfg_cmd.phy_cfg); - return iwm_mvm_send_cmd_pdu(sc, IWM_PHY_CONFIGURATION_CMD, IWM_CMD_SYNC, + return iwm_send_cmd_pdu(sc, IWM_PHY_CONFIGURATION_CMD, IWM_CMD_SYNC, sizeof(phy_cfg_cmd), &phy_cfg_cmd); } static int iwm_alive_fn(struct iwm_softc *sc, struct iwm_rx_packet *pkt, void *data) { - struct iwm_mvm_alive_data *alive_data = data; - struct iwm_mvm_alive_resp_v3 *palive3; - struct iwm_mvm_alive_resp *palive; + struct iwm_alive_data *alive_data = data; + struct iwm_alive_resp_v3 *palive3; + struct iwm_alive_resp *palive; struct iwm_umac_alive *umac; struct iwm_lmac_alive *lmac1; struct iwm_lmac_alive *lmac2 = NULL; @@ -2885,15 +2885,15 @@ iwm_wait_phy_db_entry(struct iwm_softc *sc, } static int -iwm_mvm_load_ucode_wait_alive(struct iwm_softc *sc, +iwm_load_ucode_wait_alive(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) { struct iwm_notification_wait alive_wait; - struct iwm_mvm_alive_data alive_data; + struct iwm_alive_data alive_data; const struct iwm_fw_img *fw; enum iwm_ucode_type old_type = sc->cur_ucode; int error; - static const uint16_t alive_cmd[] = { IWM_MVM_ALIVE }; + static const uint16_t alive_cmd[] = { IWM_ALIVE }; fw = &sc->sc_fw.img[ucode_type]; sc->cur_ucode = ucode_type; @@ -2918,7 +2918,7 @@ iwm_mvm_load_ucode_wait_alive(struct iwm_softc *sc, */ IWM_UNLOCK(sc); error = iwm_wait_notification(sc->sc_notif_wait, &alive_wait, - IWM_MVM_UCODE_ALIVE_TIMEOUT); + IWM_UCODE_ALIVE_TIMEOUT); IWM_LOCK(sc); if (error) { if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) { @@ -2981,7 +2981,7 @@ iwm_mvm_load_ucode_wait_alive(struct iwm_softc *sc, * follows iwlwifi/fw.c */ static int -iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justnvm) +iwm_run_init_ucode(struct iwm_softc *sc, int justnvm) { struct iwm_notification_wait calib_wait; static const uint16_t init_complete[] = { @@ -3005,7 +3005,7 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justn sc->sc_phy_db); /* Will also start the device */ - ret = iwm_mvm_load_ucode_wait_alive(sc, IWM_UCODE_INIT); + ret = iwm_load_ucode_wait_alive(sc, IWM_UCODE_INIT); if (ret) { device_printf(sc->sc_dev, "Failed to start INIT ucode: %d\n", ret); @@ -3033,7 +3033,7 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justn } /* Send TX valid antennas before triggering calibrations */ - ret = iwm_send_tx_ant_cfg(sc, iwm_mvm_get_valid_tx_ant(sc)); + ret = iwm_send_tx_ant_cfg(sc, iwm_get_valid_tx_ant(sc)); if (ret) { device_printf(sc->sc_dev, "failed to send antennas before calibration: %d\n", ret); @@ -3058,7 +3058,7 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justn */ IWM_UNLOCK(sc); ret = iwm_wait_notification(sc->sc_notif_wait, &calib_wait, - IWM_MVM_UCODE_CALIB_TIMEOUT); + IWM_UCODE_CALIB_TIMEOUT); IWM_LOCK(sc); @@ -3071,7 +3071,7 @@ out: } static int -iwm_mvm_config_ltr(struct iwm_softc *sc) +iwm_config_ltr(struct iwm_softc *sc) { struct iwm_ltr_config_cmd cmd = { .flags = htole32(IWM_LTR_CFG_FLAG_FEATURE_ENABLE), @@ -3080,7 +3080,7 @@ iwm_mvm_config_ltr(struct iwm_softc *sc) if (!sc->sc_ltr_enabled) return 0; - return iwm_mvm_send_cmd_pdu(sc, IWM_LTR_CONFIG, 0, sizeof(cmd), &cmd); + return iwm_send_cmd_pdu(sc, IWM_LTR_CONFIG, 0, sizeof(cmd), &cmd); } /* @@ -3136,7 +3136,7 @@ iwm_rx_addbuf(struct iwm_softc *sc, int size, int idx) } static void -iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) +iwm_rx_rx_phy_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { struct iwm_rx_phy_info *phy_info = (void *)pkt->data; @@ -3150,7 +3150,7 @@ iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *sc, struct iwm */ static int iwm_get_noise(struct iwm_softc *sc, - const struct iwm_mvm_statistics_rx_non_phy *stats) + const struct iwm_statistics_rx_non_phy *stats) { int i, total, nbant, noise; @@ -3180,7 +3180,7 @@ iwm_get_noise(struct iwm_softc *sc, } static void -iwm_mvm_handle_rx_statistics(struct iwm_softc *sc, struct iwm_rx_packet *pkt) +iwm_handle_rx_statistics(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { struct iwm_notif_statistics_v10 *stats = (void *)&pkt->data; @@ -3190,13 +3190,13 @@ iwm_mvm_handle_rx_statistics(struct iwm_softc *sc, str /* iwlwifi: mvm/rx.c */ /* - * iwm_mvm_get_signal_strength - use new rx PHY INFO API + * iwm_get_signal_strength - use new rx PHY INFO API * values are reported by the fw as positive values - need to negate * to obtain their dBM. Account for missing antennas by replacing 0 * values by -256dBm: practically 0 power and a non-feasible 8 bit value. */ static int -iwm_mvm_rx_get_signal_strength(struct iwm_softc *sc, +iwm_rx_get_signal_strength(struct iwm_softc *sc, struct iwm_rx_phy_info *phy_info) { int energy_a, energy_b, energy_c, max_energy; @@ -3223,7 +3223,7 @@ iwm_mvm_rx_get_signal_strength(struct iwm_softc *sc, } static int -iwm_mvm_rxmq_get_signal_strength(struct iwm_softc *sc, +iwm_rxmq_get_signal_strength(struct iwm_softc *sc, struct iwm_rx_mpdu_desc *desc) { int energy_a, energy_b; @@ -3236,12 +3236,12 @@ iwm_mvm_rxmq_get_signal_strength(struct iwm_softc *sc, } /* - * iwm_mvm_rx_rx_mpdu - IWM_REPLY_RX_MPDU_CMD handler + * iwm_rx_rx_mpdu - IWM_REPLY_RX_MPDU_CMD handler * * Handles the actual data of the Rx packet from the fw */ static bool -iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, +iwm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, bool stolen) { struct ieee80211com *ic = &sc->sc_ic; @@ -3275,7 +3275,7 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf * return false; } - rssi = iwm_mvm_rx_get_signal_strength(sc, phy_info); + rssi = iwm_rx_get_signal_strength(sc, phy_info); /* Map it to relative value */ rssi = rssi - sc->sc_noise; @@ -3354,7 +3354,7 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf * } static bool -iwm_mvm_rx_mpdu_mq(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, +iwm_rx_mpdu_mq(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, bool stolen) { struct ieee80211com *ic = &sc->sc_ic; @@ -3397,7 +3397,7 @@ iwm_mvm_rx_mpdu_mq(struct iwm_softc *sc, struct mbuf * } /* Map it to relative value */ - rssi = iwm_mvm_rxmq_get_signal_strength(sc, desc); + rssi = iwm_rxmq_get_signal_strength(sc, desc); rssi = rssi - sc->sc_noise; /* replenish ring for the buffer we're going to feed to the sharks */ @@ -3462,7 +3462,7 @@ iwm_mvm_rx_mpdu_mq(struct iwm_softc *sc, struct mbuf * } static bool -iwm_mvm_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, +iwm_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, bool stolen) { struct ieee80211com *ic; @@ -3473,8 +3473,8 @@ iwm_mvm_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, ic = &sc->sc_ic; ret = sc->cfg->mqrx_supported ? - iwm_mvm_rx_mpdu_mq(sc, m, offset, stolen) : - iwm_mvm_rx_rx_mpdu(sc, m, offset, stolen); + iwm_rx_mpdu_mq(sc, m, offset, stolen) : + iwm_rx_rx_mpdu(sc, m, offset, stolen); if (!ret) { counter_u64_add(ic->ic_ierrors, 1); return (ret); @@ -3498,10 +3498,10 @@ iwm_mvm_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, } static int -iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, +iwm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, struct iwm_node *in) { - struct iwm_mvm_tx_resp *tx_resp = (void *)pkt->data; + struct iwm_tx_resp *tx_resp = (void *)pkt->data; struct ieee80211_ratectl_tx_status *txs = &sc->sc_txs; struct ieee80211_node *ni = &in->in_ni; struct ieee80211vap *vap = ni->ni_vap; @@ -3567,7 +3567,7 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct if (new_rate != 0 && new_rate != cur_rate) { struct iwm_node *in = IWM_NODE(vap->iv_bss); iwm_setrates(sc, in, rix); - iwm_mvm_send_lq_cmd(sc, &in->in_lq, FALSE); + iwm_send_lq_cmd(sc, &in->in_lq, FALSE); } } @@ -3575,7 +3575,7 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct } static void -iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) +iwm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { struct iwm_cmd_header *cmd_hdr; struct iwm_tx_ring *ring; @@ -3599,7 +3599,7 @@ iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_rx_ sc->sc_tx_timer = 0; - status = iwm_mvm_rx_tx_cmd_single(sc, pkt, in); + status = iwm_rx_tx_cmd_single(sc, pkt, in); /* Unmap and free mbuf. */ bus_dmamap_sync(ring->data_dmat, txd->map, BUS_DMASYNC_POSTWRITE); @@ -3633,10 +3633,10 @@ iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_rx_ static void iwm_cmd_done(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { - struct iwm_tx_ring *ring = &sc->txq[IWM_MVM_CMD_QUEUE]; + struct iwm_tx_ring *ring = &sc->txq[IWM_CMD_QUEUE]; struct iwm_tx_data *data; - if (pkt->hdr.qid != IWM_MVM_CMD_QUEUE) { + if (pkt->hdr.qid != IWM_CMD_QUEUE) { return; /* Not a command ack. */ } @@ -4047,7 +4047,7 @@ iwm_raw_xmit(struct ieee80211_node *ni, struct mbuf *m * 3) wait for the transport queues to be empty */ int -iwm_mvm_flush_tx_path(struct iwm_softc *sc, uint32_t tfd_msk, uint32_t flags) +iwm_flush_tx_path(struct iwm_softc *sc, uint32_t tfd_msk, uint32_t flags) { int ret; struct iwm_tx_path_flush_cmd flush_cmd = { @@ -4055,7 +4055,7 @@ iwm_mvm_flush_tx_path(struct iwm_softc *sc, uint32_t t .flush_ctl = htole16(IWM_DUMP_TX_FIFO_FLUSH), }; - ret = iwm_mvm_send_cmd_pdu(sc, IWM_TXPATH_FLUSH, flags, + ret = iwm_send_cmd_pdu(sc, IWM_TXPATH_FLUSH, flags, sizeof(flush_cmd), &flush_cmd); if (ret) device_printf(sc->sc_dev, @@ -4068,7 +4068,7 @@ iwm_mvm_flush_tx_path(struct iwm_softc *sc, uint32_t t */ static int -iwm_mvm_update_quotas(struct iwm_softc *sc, struct iwm_vap *ivp) +iwm_update_quotas(struct iwm_softc *sc, struct iwm_vap *ivp) { struct iwm_time_quota_cmd cmd; int i, idx, ret, num_active_macs, quota, quota_rem; @@ -4090,7 +4090,7 @@ iwm_mvm_update_quotas(struct iwm_softc *sc, struct iwm /* * The FW's scheduling session consists of - * IWM_MVM_MAX_QUOTA fragments. Divide these fragments + * IWM_MAX_QUOTA fragments. Divide these fragments * equally between all the bindings that require quota */ num_active_macs = 0; @@ -4102,8 +4102,8 @@ iwm_mvm_update_quotas(struct iwm_softc *sc, struct iwm quota = 0; quota_rem = 0; if (num_active_macs) { - quota = IWM_MVM_MAX_QUOTA / num_active_macs; - quota_rem = IWM_MVM_MAX_QUOTA % num_active_macs; + quota = IWM_MAX_QUOTA / num_active_macs; + quota_rem = IWM_MAX_QUOTA % num_active_macs; } for (idx = 0, i = 0; i < IWM_MAX_BINDINGS; i++) { @@ -4126,7 +4126,7 @@ iwm_mvm_update_quotas(struct iwm_softc *sc, struct iwm /* Give the remainder of the session to the first binding */ cmd.quotas[0].quota = htole32(le32toh(cmd.quotas[0].quota) + quota_rem); - ret = iwm_mvm_send_cmd_pdu(sc, IWM_TIME_QUOTA_CMD, IWM_CMD_SYNC, + ret = iwm_send_cmd_pdu(sc, IWM_TIME_QUOTA_CMD, IWM_CMD_SYNC, sizeof(cmd), &cmd); if (ret) device_printf(sc->sc_dev, @@ -4210,13 +4210,13 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *s * contexts that are required), let's do a dirty hack here. */ if (iv->is_uploaded) { - if ((error = iwm_mvm_mac_ctxt_changed(sc, vap)) != 0) { + if ((error = iwm_mac_ctxt_changed(sc, vap)) != 0) { device_printf(sc->sc_dev, "%s: failed to update MAC\n", __func__); goto out; } } else { - if ((error = iwm_mvm_mac_ctxt_add(sc, vap)) != 0) { + if ((error = iwm_mac_ctxt_add(sc, vap)) != 0) { device_printf(sc->sc_dev, "%s: failed to add MAC\n", __func__); goto out; @@ -4224,7 +4224,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *s } sc->sc_firmware_state = 1; - if ((error = iwm_mvm_phy_ctxt_changed(sc, &sc->sc_phyctxt[0], + if ((error = iwm_phy_ctxt_changed(sc, &sc->sc_phyctxt[0], in->in_ni.ni_chan, 1, 1)) != 0) { device_printf(sc->sc_dev, "%s: failed update phy ctxt\n", __func__); @@ -4232,7 +4232,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *s } iv->phy_ctxt = &sc->sc_phyctxt[0]; - if ((error = iwm_mvm_binding_add_vif(sc, iv)) != 0) { + if ((error = iwm_binding_add_vif(sc, iv)) != 0) { device_printf(sc->sc_dev, "%s: binding update cmd\n", __func__); goto out; @@ -4244,7 +4244,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *s * finished or is aborted. */ iv->ps_disabled = TRUE; - error = iwm_mvm_power_update_mac(sc); + error = iwm_power_update_mac(sc); iv->ps_disabled = FALSE; if (error != 0) { device_printf(sc->sc_dev, @@ -4252,7 +4252,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *s __func__); goto out; } - if ((error = iwm_mvm_add_sta(sc, in)) != 0) { + if ((error = iwm_add_sta(sc, in)) != 0) { device_printf(sc->sc_dev, "%s: failed to add sta\n", __func__); goto out; @@ -4264,8 +4264,8 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *s * by "protecting" the session with a time event. */ /* XXX duration is in units of TU, not MS */ - duration = IWM_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS; - iwm_mvm_protect_session(sc, iv, duration, 500 /* XXX magic number */, TRUE); + duration = IWM_TE_SESSION_PROTECTION_MAX_TIME_MS; + iwm_protect_session(sc, iv, duration, 500 /* XXX magic number */, TRUE); error = 0; out: @@ -4390,11 +4390,11 @@ iwm_setrates(struct iwm_softc *sc, struct iwm_node *in #if 0 if (txant == 0) - txant = iwm_mvm_get_valid_tx_ant(sc); + txant = iwm_get_valid_tx_ant(sc); nextant = 1<<(ffs(txant)-1); txant &= ~nextant; #else - nextant = iwm_mvm_get_valid_tx_ant(sc); + nextant = iwm_get_valid_tx_ant(sc); #endif tab = iwm_rates[ridx].plcp; tab |= nextant << IWM_RATE_MCS_ANT_POS; @@ -4445,8 +4445,8 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct i ivp->iv_auth = 0; if (sc->sc_firmware_state == 3) { iwm_xmit_queue_drain(sc); -// iwm_mvm_flush_tx_path(sc, 0xf, IWM_CMD_SYNC); - error = iwm_mvm_rm_sta(sc, vap, TRUE); +// iwm_flush_tx_path(sc, 0xf, IWM_CMD_SYNC); + error = iwm_rm_sta(sc, vap, TRUE); if (error) { device_printf(sc->sc_dev, "%s: Failed to remove station: %d\n", @@ -4454,7 +4454,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct i } } if (sc->sc_firmware_state == 3) { - error = iwm_mvm_mac_ctxt_changed(sc, vap); + error = iwm_mac_ctxt_changed(sc, vap); if (error) { device_printf(sc->sc_dev, "%s: Failed to change mac context: %d\n", @@ -4462,7 +4462,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct i } } if (sc->sc_firmware_state == 3) { - error = iwm_mvm_sf_update(sc, vap, FALSE); + error = iwm_sf_update(sc, vap, FALSE); if (error) { device_printf(sc->sc_dev, "%s: Failed to update smart FIFO: %d\n", @@ -4470,7 +4470,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct i } } if (sc->sc_firmware_state == 3) { - error = iwm_mvm_rm_sta_id(sc, vap); + error = iwm_rm_sta_id(sc, vap); if (error) { device_printf(sc->sc_dev, "%s: Failed to remove station id: %d\n", @@ -4478,7 +4478,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct i } } if (sc->sc_firmware_state == 3) { - error = iwm_mvm_update_quotas(sc, NULL); + error = iwm_update_quotas(sc, NULL); if (error) { device_printf(sc->sc_dev, "%s: Failed to update PHY quota: %d\n", @@ -4487,7 +4487,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct i } if (sc->sc_firmware_state == 3) { /* XXX Might need to specify bssid correctly. */ - error = iwm_mvm_mac_ctxt_changed(sc, vap); + error = iwm_mac_ctxt_changed(sc, vap); if (error) { device_printf(sc->sc_dev, "%s: Failed to change mac context: %d\n", @@ -4498,7 +4498,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct i sc->sc_firmware_state = 2; } if (sc->sc_firmware_state > 1) { - error = iwm_mvm_binding_remove_vif(sc, ivp); + error = iwm_binding_remove_vif(sc, ivp); if (error) { device_printf(sc->sc_dev, "%s: Failed to remove channel ctx: %d\n", @@ -4510,7 +4510,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct i } ivp->phy_ctxt = NULL; if (sc->sc_firmware_state > 0) { - error = iwm_mvm_mac_ctxt_changed(sc, vap); + error = iwm_mac_ctxt_changed(sc, vap); if (error) { device_printf(sc->sc_dev, "%s: Failed to change mac context: %d\n", @@ -4518,7 +4518,7 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct i } } if (sc->sc_firmware_state > 0) { - error = iwm_mvm_power_update_mac(sc); + error = iwm_power_update_mac(sc); if (error != 0) { device_printf(sc->sc_dev, "%s: failed to update power management\n", @@ -4555,9 +4555,9 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_ } if (vap->iv_state == IEEE80211_S_RUN && nstate != IEEE80211_S_RUN) { - iwm_mvm_led_disable(sc); + iwm_led_disable(sc); /* disable beacon filtering if we're hopping out of RUN */ - iwm_mvm_disable_beacon_filter(sc); + iwm_disable_beacon_filter(sc); if (((in = IWM_NODE(vap->iv_bss)) != NULL)) in->in_assoc = 0; } @@ -4568,7 +4568,7 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_ (nstate == IEEE80211_S_INIT || nstate == IEEE80211_S_SCAN || nstate == IEEE80211_S_AUTH)) { - iwm_mvm_stop_session_protection(sc, ivp); + iwm_stop_session_protection(sc, ivp); } if ((vap->iv_state == IEEE80211_S_RUN || @@ -4620,7 +4620,7 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_ in = IWM_NODE(vap->iv_bss); /* Update the association state, now we have it all */ /* (eg associd comes in at this point */ - error = iwm_mvm_update_sta(sc, in); + error = iwm_update_sta(sc, in); if (error != 0) { device_printf(sc->sc_dev, "%s: failed to update STA\n", __func__); @@ -4629,25 +4629,25 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_ return error; } in->in_assoc = 1; - error = iwm_mvm_mac_ctxt_changed(sc, vap); + error = iwm_mac_ctxt_changed(sc, vap); if (error != 0) { device_printf(sc->sc_dev, "%s: failed to update MAC: %d\n", __func__, error); } - iwm_mvm_sf_update(sc, vap, FALSE); - iwm_mvm_enable_beacon_filter(sc, ivp); - iwm_mvm_power_update_mac(sc); - iwm_mvm_update_quotas(sc, ivp); + iwm_sf_update(sc, vap, FALSE); + iwm_enable_beacon_filter(sc, ivp); + iwm_power_update_mac(sc); + iwm_update_quotas(sc, ivp); int rix = ieee80211_ratectl_rate(&in->in_ni, NULL, 0); iwm_setrates(sc, in, rix); - if ((error = iwm_mvm_send_lq_cmd(sc, &in->in_lq, TRUE)) != 0) { + if ((error = iwm_send_lq_cmd(sc, &in->in_lq, TRUE)) != 0) { device_printf(sc->sc_dev, "%s: IWM_LQ_CMD failed: %d\n", __func__, error); } - iwm_mvm_led_enable(sc); + iwm_led_enable(sc); break; default: @@ -4680,12 +4680,12 @@ iwm_send_bt_init_conf(struct iwm_softc *sc) bt_cmd.mode = htole32(IWM_BT_COEX_WIFI); bt_cmd.enabled_modules = htole32(IWM_BT_COEX_HIGH_BAND_RET); - return iwm_mvm_send_cmd_pdu(sc, IWM_BT_CONFIG, 0, sizeof(bt_cmd), + return iwm_send_cmd_pdu(sc, IWM_BT_CONFIG, 0, sizeof(bt_cmd), &bt_cmd); } static boolean_t -iwm_mvm_is_lar_supported(struct iwm_softc *sc) +iwm_is_lar_supported(struct iwm_softc *sc) { boolean_t nvm_lar = sc->nvm_data->lar_enabled; boolean_t tlv_lar = iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_SUPPORT); @@ -4704,7 +4704,7 @@ iwm_mvm_is_lar_supported(struct iwm_softc *sc) } static boolean_t -iwm_mvm_is_wifi_mcc_supported(struct iwm_softc *sc) +iwm_is_wifi_mcc_supported(struct iwm_softc *sc) { return iwm_fw_has_api(sc, IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) || iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC); @@ -4729,7 +4729,7 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const ch #endif int resp_v2 = iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2); - if (!iwm_mvm_is_lar_supported(sc)) { + if (!iwm_is_lar_supported(sc)) { IWM_DPRINTF(sc, IWM_DEBUG_LAR, "%s: no LAR support\n", __func__); return 0; @@ -4737,7 +4737,7 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const ch memset(&mcc_cmd, 0, sizeof(mcc_cmd)); mcc_cmd.mcc = htole16(alpha2[0] << 8 | alpha2[1]); - if (iwm_mvm_is_wifi_mcc_supported(sc)) + if (iwm_is_wifi_mcc_supported(sc)) mcc_cmd.source_id = IWM_MCC_SOURCE_GET_CURRENT; else mcc_cmd.source_id = IWM_MCC_SOURCE_OLD_FW; @@ -4783,7 +4783,7 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const ch } static void -iwm_mvm_tt_tx_backoff(struct iwm_softc *sc, uint32_t backoff) +iwm_tt_tx_backoff(struct iwm_softc *sc, uint32_t backoff) { struct iwm_host_cmd cmd = { .id = IWM_REPLY_THERMAL_MNG_BACKOFF, @@ -4810,8 +4810,8 @@ iwm_init_hw(struct iwm_softc *sc) return error; } - if ((error = iwm_run_init_mvm_ucode(sc, 0)) != 0) { - printf("iwm_run_init_mvm_ucode: failed %d\n", error); + if ((error = iwm_run_init_ucode(sc, 0)) != 0) { + printf("iwm_run_init_ucode: failed %d\n", error); return error; } @@ -4827,13 +4827,13 @@ iwm_init_hw(struct iwm_softc *sc) } /* omstart, this time with the regular firmware */ - error = iwm_mvm_load_ucode_wait_alive(sc, IWM_UCODE_REGULAR); + error = iwm_load_ucode_wait_alive(sc, IWM_UCODE_REGULAR); if (error) { device_printf(sc->sc_dev, "could not load firmware\n"); goto error; } - error = iwm_mvm_sf_update(sc, NULL, FALSE); + error = iwm_sf_update(sc, NULL, FALSE); if (error) device_printf(sc->sc_dev, "Failed to initialize Smart Fifo\n"); @@ -4842,7 +4842,7 @@ iwm_init_hw(struct iwm_softc *sc) goto error; } - error = iwm_send_tx_ant_cfg(sc, iwm_mvm_get_valid_tx_ant(sc)); + error = iwm_send_tx_ant_cfg(sc, iwm_get_valid_tx_ant(sc)); if (error != 0) { device_printf(sc->sc_dev, "antenna config failed\n"); goto error; @@ -4858,7 +4858,7 @@ iwm_init_hw(struct iwm_softc *sc) } /* Add auxiliary station for scanning */ - if ((error = iwm_mvm_add_aux_sta(sc)) != 0) { + if ((error = iwm_add_aux_sta(sc)) != 0) { device_printf(sc->sc_dev, "add_aux_sta failed\n"); goto error; } @@ -4869,19 +4869,19 @@ iwm_init_hw(struct iwm_softc *sc) * going to be overwritten in the other flows. * For now use the first channel we have. */ - if ((error = iwm_mvm_phy_ctxt_add(sc, + if ((error = iwm_phy_ctxt_add(sc, &sc->sc_phyctxt[i], &ic->ic_channels[1], 1, 1)) != 0) goto error; } /* Initialize tx backoffs to the minimum. */ if (sc->cfg->device_family == IWM_DEVICE_FAMILY_7000) - iwm_mvm_tt_tx_backoff(sc, 0); + iwm_tt_tx_backoff(sc, 0); - if (iwm_mvm_config_ltr(sc) != 0) + if (iwm_config_ltr(sc) != 0) device_printf(sc->sc_dev, "PCIe LTR configuration failed\n"); - error = iwm_mvm_power_update_device(sc); + error = iwm_power_update_device(sc); if (error) goto error; @@ -4889,19 +4889,19 @@ iwm_init_hw(struct iwm_softc *sc) goto error; if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { - if ((error = iwm_mvm_config_umac_scan(sc)) != 0) + if ((error = iwm_config_umac_scan(sc)) != 0) goto error; } /* Enable Tx queues. */ for (ac = 0; ac < WME_NUM_AC; ac++) { error = iwm_enable_txq(sc, IWM_STATION_ID, ac, - iwm_mvm_ac_to_tx_fifo[ac]); + iwm_ac_to_tx_fifo[ac]); if (error) goto error; } - if ((error = iwm_mvm_disable_beacon_filter(sc)) != 0) { + if ((error = iwm_disable_beacon_filter(sc)) != 0) { device_printf(sc->sc_dev, "failed to disable beacon filter\n"); goto error; } @@ -4932,7 +4932,7 @@ iwm_allow_mcast(struct ieee80211vap *vap, struct iwm_s cmd->pass_all = 1; IEEE80211_ADDR_COPY(cmd->bssid, ni->ni_bssid); - error = iwm_mvm_send_cmd_pdu(sc, IWM_MCAST_FILTER_CMD, + error = iwm_send_cmd_pdu(sc, IWM_MCAST_FILTER_CMD, IWM_CMD_SYNC, size, cmd); free(cmd, M_DEVBUF); @@ -5372,7 +5372,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) switch (code) { case IWM_REPLY_RX_PHY_CMD: - iwm_mvm_rx_rx_phy_cmd(sc, pkt); + iwm_rx_rx_phy_cmd(sc, pkt); break; case IWM_REPLY_RX_MPDU_CMD: { @@ -5388,7 +5388,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) nextpkt->hdr.idx == 0) || (nextpkt->len_n_flags == htole32(IWM_FH_RSCSR_FRAME_INVALID))) { - if (iwm_mvm_rx_mpdu(sc, m, offset, stolen)) { + if (iwm_rx_mpdu(sc, m, offset, stolen)) { stolen = FALSE; /* Make sure we abort the loop */ nextoff = maxoff; @@ -5399,14 +5399,14 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) /* * Use m_copym instead of m_split, because that * makes it easier to keep a valid rx buffer in - * the ring, when iwm_mvm_rx_mpdu() fails. + * the ring, when iwm_rx_mpdu() fails. * * We need to start m_copym() at offset 0, to get the * M_PKTHDR flag preserved. */ m1 = m_copym(m, 0, M_COPYALL, M_NOWAIT); if (m1) { - if (iwm_mvm_rx_mpdu(sc, m1, offset, stolen)) + if (iwm_rx_mpdu(sc, m1, offset, stolen)) stolen = TRUE; else m_freem(m1); @@ -5415,7 +5415,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) } case IWM_TX_CMD: - iwm_mvm_rx_tx_cmd(sc, pkt); + iwm_rx_tx_cmd(sc, pkt); break; case IWM_MISSED_BEACONS_NOTIFICATION: { @@ -5460,14 +5460,14 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) case IWM_MFUART_LOAD_NOTIFICATION: break; - case IWM_MVM_ALIVE: + case IWM_ALIVE: break; case IWM_CALIB_RES_NOTIF_PHY_DB: break; case IWM_STATISTICS_NOTIFICATION: - iwm_mvm_handle_rx_statistics(sc, pkt); + iwm_handle_rx_statistics(sc, pkt); break; case IWM_NVM_ACCESS_CMD: @@ -5548,7 +5548,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) break; case IWM_SCAN_OFFLOAD_COMPLETE: - iwm_mvm_rx_lmac_scan_complete_notif(sc, pkt); + iwm_rx_lmac_scan_complete_notif(sc, pkt); if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) { sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING; ieee80211_runtask(ic, &sc->sc_es_task); @@ -5562,7 +5562,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) } case IWM_SCAN_COMPLETE_UMAC: - iwm_mvm_rx_umac_scan_complete_notif(sc, pkt); + iwm_rx_umac_scan_complete_notif(sc, pkt); if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) { sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING; ieee80211_runtask(ic, &sc->sc_es_task); @@ -5591,7 +5591,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) } case IWM_TIME_EVENT_NOTIFICATION: - iwm_mvm_rx_time_event_notif(sc, pkt); + iwm_rx_time_event_notif(sc, pkt); break; /* @@ -5763,7 +5763,7 @@ iwm_intr(void *arg) #endif /* Dump driver status (TX and RX rings) while we're here. */ device_printf(sc->sc_dev, "driver status:\n"); - for (i = 0; i < IWM_MVM_MAX_QUEUES; i++) { + for (i = 0; i < IWM_MAX_QUEUES; i++) { struct iwm_tx_ring *ring = &sc->txq[i]; device_printf(sc->sc_dev, " tx ring %2d: qid=%-2d cur=%-3d " @@ -6266,7 +6266,7 @@ iwm_wme_update(struct ieee80211com *ic) if (ivp->is_uploaded && vap->iv_bss != NULL) { in = IWM_NODE(vap->iv_bss); if (in->in_assoc) { - if ((error = iwm_mvm_mac_ctxt_changed(sc, vap)) != 0) { + if ((error = iwm_mac_ctxt_changed(sc, vap)) != 0) { device_printf(sc->sc_dev, "%s: failed to update MAC\n", __func__); } @@ -6296,7 +6296,7 @@ iwm_preinit(void *arg) goto fail; } - error = iwm_run_init_mvm_ucode(sc, 1); + error = iwm_run_init_ucode(sc, 1); iwm_stop_device(sc); if (error) { IWM_UNLOCK(sc); @@ -6439,9 +6439,9 @@ iwm_scan_start(struct ieee80211com *ic) "%s: Previous scan not completed yet\n", __func__); } if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) - error = iwm_mvm_umac_scan(sc); + error = iwm_umac_scan(sc); else - error = iwm_mvm_lmac_scan(sc); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Wed Dec 11 15:15:23 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1E201D8D6A; Wed, 11 Dec 2019 15:15:23 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Y0qH4Fssz4D7L; Wed, 11 Dec 2019 15:15:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D322D2BB; Wed, 11 Dec 2019 15:15:23 +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 xBBFFNDr085344; Wed, 11 Dec 2019 15:15:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBBFFLRl085334; Wed, 11 Dec 2019 15:15:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912111515.xBBFFLRl085334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 11 Dec 2019 15:15:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355610 - in stable/12/sys: cam geom kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: cam geom kern X-SVN-Commit-Revision: 355610 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2019 15:15:23 -0000 Author: mav Date: Wed Dec 11 15:15:21 2019 New Revision: 355610 URL: https://svnweb.freebsd.org/changeset/base/355610 Log: MFC r355404: Mark some more hot global variables with __read_mostly. Modified: stable/12/sys/cam/cam_xpt.c stable/12/sys/geom/geom_io.c stable/12/sys/geom/geom_kern.c stable/12/sys/kern/kern_mtxpool.c stable/12/sys/kern/kern_shutdown.c stable/12/sys/kern/kern_timeout.c stable/12/sys/kern/sched_4bsd.c stable/12/sys/kern/sched_ule.c stable/12/sys/kern/vfs_bio.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_xpt.c ============================================================================== --- stable/12/sys/cam/cam_xpt.c Wed Dec 11 14:54:29 2019 (r355609) +++ stable/12/sys/cam/cam_xpt.c Wed Dec 11 15:15:21 2019 (r355610) @@ -214,7 +214,7 @@ static struct cdevsw xpt_cdevsw = { /* Storage for debugging datastructures */ struct cam_path *cam_dpath; -u_int32_t cam_dflags = CAM_DEBUG_FLAGS; +u_int32_t __read_mostly cam_dflags = CAM_DEBUG_FLAGS; SYSCTL_UINT(_kern_cam, OID_AUTO, dflags, CTLFLAG_RWTUN, &cam_dflags, 0, "Enabled debug flags"); u_int32_t cam_debug_delay = CAM_DEBUG_DELAY; Modified: stable/12/sys/geom/geom_io.c ============================================================================== --- stable/12/sys/geom/geom_io.c Wed Dec 11 14:54:29 2019 (r355609) +++ stable/12/sys/geom/geom_io.c Wed Dec 11 15:15:21 2019 (r355610) @@ -81,9 +81,9 @@ static struct g_bioq g_bio_run_up; * pressures exist. See g_io_schedule_down() for more details * and limitations. */ -static volatile u_int pace; +static volatile u_int __read_mostly pace; -static uma_zone_t biozone; +static uma_zone_t __read_mostly biozone; /* * The head of the list of classifiers used in g_io_request. @@ -91,8 +91,8 @@ static uma_zone_t biozone; * to add/remove entries to the list. * Classifiers are invoked in registration order. */ -static TAILQ_HEAD(g_classifier_tailq, g_classifier_hook) - g_classifier_tailq = TAILQ_HEAD_INITIALIZER(g_classifier_tailq); +static TAILQ_HEAD(, g_classifier_hook) g_classifier_tailq __read_mostly = + TAILQ_HEAD_INITIALIZER(g_classifier_tailq); #include Modified: stable/12/sys/geom/geom_kern.c ============================================================================== --- stable/12/sys/geom/geom_kern.c Wed Dec 11 14:54:29 2019 (r355609) +++ stable/12/sys/geom/geom_kern.c Wed Dec 11 15:15:21 2019 (r355610) @@ -61,12 +61,12 @@ MALLOC_DEFINE(M_GEOM, "GEOM", "Geom data structures"); struct sx topology_lock; static struct proc *g_proc; -static struct thread *g_up_td; -static struct thread *g_down_td; -static struct thread *g_event_td; +static struct thread __read_mostly *g_up_td; +static struct thread __read_mostly *g_down_td; +static struct thread __read_mostly *g_event_td; -int g_debugflags; -int g_collectstats = 1; +int __read_mostly g_debugflags; +int __read_mostly g_collectstats = G_STATS_PROVIDERS; int g_shutdown; int g_notaste; Modified: stable/12/sys/kern/kern_mtxpool.c ============================================================================== --- stable/12/sys/kern/kern_mtxpool.c Wed Dec 11 14:54:29 2019 (r355609) +++ stable/12/sys/kern/kern_mtxpool.c Wed Dec 11 15:15:21 2019 (r355610) @@ -82,7 +82,7 @@ struct mtx_pool { #define mtx_pool_shift mtx_pool_header.mtxpool_shift #define mtx_pool_next mtx_pool_header.mtxpool_next -struct mtx_pool *mtxpool_sleep; +struct mtx_pool __read_frequently *mtxpool_sleep; #if UINTPTR_MAX == UINT64_MAX /* 64 bits */ # define POINTER_BITS 64 Modified: stable/12/sys/kern/kern_shutdown.c ============================================================================== --- stable/12/sys/kern/kern_shutdown.c Wed Dec 11 14:54:29 2019 (r355609) +++ stable/12/sys/kern/kern_shutdown.c Wed Dec 11 15:15:21 2019 (r355610) @@ -205,9 +205,9 @@ SYSCTL_INT(_kern, OID_AUTO, kerneldump_gzlevel, CTLFLA * Variable panicstr contains argument to first call to panic; used as flag * to indicate that the kernel has already called panic. */ -const char *panicstr; +const char __read_mostly *panicstr; -int dumping; /* system is dumping */ +int __read_mostly dumping; /* system is dumping */ int rebooting; /* system is rebooting */ static struct dumperinfo dumper; /* our selected dumper */ Modified: stable/12/sys/kern/kern_timeout.c ============================================================================== --- stable/12/sys/kern/kern_timeout.c Wed Dec 11 14:54:29 2019 (r355609) +++ stable/12/sys/kern/kern_timeout.c Wed Dec 11 15:15:21 2019 (r355610) @@ -129,7 +129,8 @@ SYSCTL_INT(_kern, OID_AUTO, pin_pcpu_swi, CTLFLAG_RDTU * TODO: * allocate more timeout table slots when table overflows. */ -u_int callwheelsize, callwheelmask; +static u_int __read_mostly callwheelsize; +static u_int __read_mostly callwheelmask; /* * The callout cpu exec entities represent informations necessary for @@ -202,7 +203,7 @@ struct callout_cpu cc_cpu; #define CC_UNLOCK(cc) mtx_unlock_spin(&(cc)->cc_lock) #define CC_LOCK_ASSERT(cc) mtx_assert(&(cc)->cc_lock, MA_OWNED) -static int timeout_cpu; +static int __read_mostly timeout_cpu; static void callout_cpu_init(struct callout_cpu *cc, int cpu); static void softclock_call_cc(struct callout *c, struct callout_cpu *cc, Modified: stable/12/sys/kern/sched_4bsd.c ============================================================================== --- stable/12/sys/kern/sched_4bsd.c Wed Dec 11 14:54:29 2019 (r355609) +++ stable/12/sys/kern/sched_4bsd.c Wed Dec 11 15:15:21 2019 (r355610) @@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$"); #ifdef KDTRACE_HOOKS #include -int dtrace_vtime_active; +int __read_mostly dtrace_vtime_active; dtrace_vtime_switch_func_t dtrace_vtime_switch_func; #endif Modified: stable/12/sys/kern/sched_ule.c ============================================================================== --- stable/12/sys/kern/sched_ule.c Wed Dec 11 14:54:29 2019 (r355609) +++ stable/12/sys/kern/sched_ule.c Wed Dec 11 15:15:21 2019 (r355610) @@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$"); #ifdef KDTRACE_HOOKS #include -int dtrace_vtime_active; +int __read_mostly dtrace_vtime_active; dtrace_vtime_switch_func_t dtrace_vtime_switch_func; #endif @@ -206,23 +206,23 @@ _Static_assert(sizeof(struct thread) + sizeof(struct t * sched_slice: Runtime of each thread before rescheduling. * preempt_thresh: Priority threshold for preemption and remote IPIs. */ -static int sched_interact = SCHED_INTERACT_THRESH; -static int tickincr = 8 << SCHED_TICK_SHIFT; -static int realstathz = 127; /* reset during boot. */ -static int sched_slice = 10; /* reset during boot. */ -static int sched_slice_min = 1; /* reset during boot. */ +static int __read_mostly sched_interact = SCHED_INTERACT_THRESH; +static int __read_mostly tickincr = 8 << SCHED_TICK_SHIFT; +static int __read_mostly realstathz = 127; /* reset during boot. */ +static int __read_mostly sched_slice = 10; /* reset during boot. */ +static int __read_mostly sched_slice_min = 1; /* reset during boot. */ #ifdef PREEMPTION #ifdef FULL_PREEMPTION -static int preempt_thresh = PRI_MAX_IDLE; +static int __read_mostly preempt_thresh = PRI_MAX_IDLE; #else -static int preempt_thresh = PRI_MIN_KERN; +static int __read_mostly preempt_thresh = PRI_MIN_KERN; #endif #else -static int preempt_thresh = 0; +static int __read_mostly preempt_thresh = 0; #endif -static int static_boost = PRI_MIN_BATCH; -static int sched_idlespins = 10000; -static int sched_idlespinthresh = -1; +static int __read_mostly static_boost = PRI_MIN_BATCH; +static int __read_mostly sched_idlespins = 10000; +static int __read_mostly sched_idlespinthresh = -1; /* * tdq - per processor runqs and statistics. All fields are protected by the @@ -262,7 +262,7 @@ struct tdq { #define TDQ_IDLE 2 #ifdef SMP -struct cpu_group *cpu_top; /* CPU topology */ +struct cpu_group __read_mostly *cpu_top; /* CPU topology */ #define SCHED_AFFINITY_DEFAULT (max(1, hz / 1000)) #define SCHED_AFFINITY(ts, t) ((ts)->ts_rltick > ticks - ((t) * affinity)) @@ -272,16 +272,16 @@ struct cpu_group *cpu_top; /* CPU topology */ */ static int rebalance = 1; static int balance_interval = 128; /* Default set in sched_initticks(). */ -static int affinity; -static int steal_idle = 1; -static int steal_thresh = 2; -static int always_steal = 0; -static int trysteal_limit = 2; +static int __read_mostly affinity; +static int __read_mostly steal_idle = 1; +static int __read_mostly steal_thresh = 2; +static int __read_mostly always_steal = 0; +static int __read_mostly trysteal_limit = 2; /* * One thread queue per processor. */ -static struct tdq *balance_tdq; +static struct tdq __read_mostly *balance_tdq; static int balance_ticks; DPCPU_DEFINE_STATIC(struct tdq, tdq); DPCPU_DEFINE_STATIC(uint32_t, randomval); Modified: stable/12/sys/kern/vfs_bio.c ============================================================================== --- stable/12/sys/kern/vfs_bio.c Wed Dec 11 14:54:29 2019 (r355609) +++ stable/12/sys/kern/vfs_bio.c Wed Dec 11 15:15:21 2019 (r355610) @@ -148,7 +148,7 @@ struct bufdomain { static struct buf *buf; /* buffer header pool */ extern struct buf *swbuf; /* Swap buffer header pool. */ -caddr_t unmapped_buf; +caddr_t __read_mostly unmapped_buf; /* Used below and for softdep flushing threads in ufs/ffs/ffs_softdep.c */ struct proc *bufdaemonproc; From owner-svn-src-stable@freebsd.org Thu Dec 12 00:29:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E5AE1E45C9; Thu, 12 Dec 2019 00:29: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47YF706PSjz3L7g; Thu, 12 Dec 2019 00:29:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B91F11B778; Thu, 12 Dec 2019 00:29: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 xBC0TmLF021933; Thu, 12 Dec 2019 00:29:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBC0TmAJ021932; Thu, 12 Dec 2019 00:29:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912120029.xBC0TmAJ021932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 12 Dec 2019 00:29:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355636 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 355636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 00:29:49 -0000 Author: mav Date: Thu Dec 12 00:29:48 2019 New Revision: 355636 URL: https://svnweb.freebsd.org/changeset/base/355636 Log: MFC r355182: Fix use-after-free in case of L2ARC prefetch failure. In case L2ARC read failed, l2arc_read_done() creates _different_ ZIO to read data from the original storage device. Unfortunately pointer to the failed ZIO remains in hdr->b_l1hdr.b_acb->acb_zio_head, and if some other read try to bump the ZIO priority, it will crash. The problem is reproducible by corrupting L2ARC content and reading some data with prefetch if l2arc_noprefetch tunable is changed to 0. With the default setting the issue is probably not reproducible now. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Dec 12 00:14:01 2019 (r355635) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Dec 12 00:29:48 2019 (r355636) @@ -7886,7 +7886,6 @@ l2arc_read_done(zio_t *zio) zio->io_private = hdr; arc_read_done(zio); } else { - mutex_exit(hash_lock); /* * Buffer didn't survive caching. Increment stats and * reissue to the original storage device. @@ -7909,11 +7908,17 @@ l2arc_read_done(zio_t *zio) ASSERT(!pio || pio->io_child_type == ZIO_CHILD_LOGICAL); - zio_nowait(zio_read(pio, zio->io_spa, zio->io_bp, + zio = zio_read(pio, zio->io_spa, zio->io_bp, hdr->b_l1hdr.b_pabd, zio->io_size, arc_read_done, hdr, zio->io_priority, cb->l2rcb_flags, - &cb->l2rcb_zb)); - } + &cb->l2rcb_zb); + for (struct arc_callback *acb = hdr->b_l1hdr.b_acb; + acb != NULL; acb = acb->acb_next) + acb->acb_zio_head = zio; + mutex_exit(hash_lock); + zio_nowait(zio); + } else + mutex_exit(hash_lock); } kmem_free(cb, sizeof (l2arc_read_callback_t)); From owner-svn-src-stable@freebsd.org Thu Dec 12 00:30:21 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4641E1E4638; Thu, 12 Dec 2019 00:30: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47YF7d16lwz3LFd; Thu, 12 Dec 2019 00:30: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 219A31B77C; Thu, 12 Dec 2019 00:30:21 +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 xBC0ULcN022051; Thu, 12 Dec 2019 00:30:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBC0UKeh022050; Thu, 12 Dec 2019 00:30:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912120030.xBC0UKeh022050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 12 Dec 2019 00:30:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355637 - 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: 355637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 00:30:21 -0000 Author: mav Date: Thu Dec 12 00:30:20 2019 New Revision: 355637 URL: https://svnweb.freebsd.org/changeset/base/355637 Log: MFC r355182: Fix use-after-free in case of L2ARC prefetch failure. In case L2ARC read failed, l2arc_read_done() creates _different_ ZIO to read data from the original storage device. Unfortunately pointer to the failed ZIO remains in hdr->b_l1hdr.b_acb->acb_zio_head, and if some other read try to bump the ZIO priority, it will crash. The problem is reproducible by corrupting L2ARC content and reading some data with prefetch if l2arc_noprefetch tunable is changed to 0. With the default setting the issue is probably not reproducible now. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Dec 12 00:29:48 2019 (r355636) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Dec 12 00:30:20 2019 (r355637) @@ -7476,7 +7476,6 @@ l2arc_read_done(zio_t *zio) zio->io_private = hdr; arc_read_done(zio); } else { - mutex_exit(hash_lock); /* * Buffer didn't survive caching. Increment stats and * reissue to the original storage device. @@ -7499,11 +7498,17 @@ l2arc_read_done(zio_t *zio) ASSERT(!pio || pio->io_child_type == ZIO_CHILD_LOGICAL); - zio_nowait(zio_read(pio, zio->io_spa, zio->io_bp, + zio = zio_read(pio, zio->io_spa, zio->io_bp, hdr->b_l1hdr.b_pabd, zio->io_size, arc_read_done, hdr, zio->io_priority, cb->l2rcb_flags, - &cb->l2rcb_zb)); - } + &cb->l2rcb_zb); + for (struct arc_callback *acb = hdr->b_l1hdr.b_acb; + acb != NULL; acb = acb->acb_next) + acb->acb_zio_head = zio; + mutex_exit(hash_lock); + zio_nowait(zio); + } else + mutex_exit(hash_lock); } kmem_free(cb, sizeof (l2arc_read_callback_t)); From owner-svn-src-stable@freebsd.org Thu Dec 12 13:46:04 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 758281D2202; Thu, 12 Dec 2019 13:46:04 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47YZnm1jt9z4c6b; Thu, 12 Dec 2019 13:46:04 +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 DC612249ED; Thu, 12 Dec 2019 13:46:03 +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 xBCDk3BA094001; Thu, 12 Dec 2019 13:46:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBCDk3gg093960; Thu, 12 Dec 2019 13:46:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912121346.xBCDk3gg093960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 12 Dec 2019 13:46:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355651 - stable/12/sys/fs/tmpfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/tmpfs X-SVN-Commit-Revision: 355651 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 13:46:04 -0000 Author: kib Date: Thu Dec 12 13:46:02 2019 New Revision: 355651 URL: https://svnweb.freebsd.org/changeset/base/355651 Log: MFC r355407: Stop using per-mount tmpfs zones. Modified: stable/12/sys/fs/tmpfs/tmpfs.h stable/12/sys/fs/tmpfs/tmpfs_subr.c stable/12/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/12/sys/fs/tmpfs/tmpfs.h Thu Dec 12 13:28:46 2019 (r355650) +++ stable/12/sys/fs/tmpfs/tmpfs.h Thu Dec 12 13:46:02 2019 (r355651) @@ -378,10 +378,6 @@ struct tmpfs_mount { /* All node lock to protect the node list and tmp_pages_used. */ struct mtx tm_allnode_lock; - /* Zones used to store file system meta data, per tmpfs mount. */ - uma_zone_t tm_dirent_pool; - uma_zone_t tm_node_pool; - /* Read-only status. */ bool tm_ronly; /* Do not use namecache. */ @@ -491,8 +487,9 @@ struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node #define TMPFS_PAGES_MINRESERVED (4 * 1024 * 1024 / PAGE_SIZE) size_t tmpfs_mem_avail(void); - size_t tmpfs_pages_used(struct tmpfs_mount *tmp); +void tmpfs_subr_init(void); +void tmpfs_subr_uninit(void); #endif Modified: stable/12/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/12/sys/fs/tmpfs/tmpfs_subr.c Thu Dec 12 13:28:46 2019 (r355650) +++ stable/12/sys/fs/tmpfs/tmpfs_subr.c Thu Dec 12 13:46:02 2019 (r355651) @@ -72,7 +72,74 @@ SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmp static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED; +static uma_zone_t tmpfs_dirent_pool; +static uma_zone_t tmpfs_node_pool; + static int +tmpfs_node_ctor(void *mem, int size, void *arg, int flags) +{ + struct tmpfs_node *node; + + node = mem; + node->tn_gen++; + node->tn_size = 0; + node->tn_status = 0; + node->tn_flags = 0; + node->tn_links = 0; + node->tn_vnode = NULL; + node->tn_vpstate = 0; + return (0); +} + +static void +tmpfs_node_dtor(void *mem, int size, void *arg) +{ + struct tmpfs_node *node; + + node = mem; + node->tn_type = VNON; +} + +static int +tmpfs_node_init(void *mem, int size, int flags) +{ + struct tmpfs_node *node; + + node = mem; + node->tn_id = 0; + mtx_init(&node->tn_interlock, "tmpfsni", NULL, MTX_DEF); + node->tn_gen = arc4random(); + return (0); +} + +static void +tmpfs_node_fini(void *mem, int size) +{ + struct tmpfs_node *node; + + node = mem; + mtx_destroy(&node->tn_interlock); +} + +void +tmpfs_subr_init(void) +{ + tmpfs_dirent_pool = uma_zcreate("TMPFS dirent", + sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, 0); + tmpfs_node_pool = uma_zcreate("TMPFS node", + sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, + tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); +} + +void +tmpfs_subr_uninit(void) +{ + uma_zdestroy(tmpfs_node_pool); + uma_zdestroy(tmpfs_dirent_pool); +} + +static int sysctl_mem_reserved(SYSCTL_HANDLER_ARGS) { int error; @@ -221,8 +288,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount if ((mp->mnt_kern_flag & MNT_RDONLY) != 0) return (EROFS); - nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp, - M_WAITOK); + nnode = uma_zalloc_arg(tmpfs_node_pool, tmp, M_WAITOK); /* Generic initialization. */ nnode->tn_type = type; @@ -370,7 +436,7 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct panic("tmpfs_free_node: type %p %d", node, (int)node->tn_type); } - uma_zfree(tmp->tm_node_pool, node); + uma_zfree(tmpfs_node_pool, node); TMPFS_LOCK(tmp); tmpfs_free_tmp(tmp); return (true); @@ -437,7 +503,7 @@ tmpfs_alloc_dirent(struct tmpfs_mount *tmp, struct tmp { struct tmpfs_dirent *nde; - nde = uma_zalloc(tmp->tm_dirent_pool, M_WAITOK); + nde = uma_zalloc(tmpfs_dirent_pool, M_WAITOK); nde->td_node = node; if (name != NULL) { nde->ud.td_name = malloc(len, M_TMPFSNAME, M_WAITOK); @@ -473,7 +539,7 @@ tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpf } if (!tmpfs_dirent_duphead(de) && de->ud.td_name != NULL) free(de->ud.td_name, M_TMPFSNAME); - uma_zfree(tmp->tm_dirent_pool, de); + uma_zfree(tmpfs_dirent_pool, de); } void Modified: stable/12/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/12/sys/fs/tmpfs/tmpfs_vfsops.c Thu Dec 12 13:28:46 2019 (r355650) +++ stable/12/sys/fs/tmpfs/tmpfs_vfsops.c Thu Dec 12 13:46:02 2019 (r355651) @@ -96,49 +96,6 @@ static const char *tmpfs_updateopts[] = { "from", "export", "size", NULL }; -static int -tmpfs_node_ctor(void *mem, int size, void *arg, int flags) -{ - struct tmpfs_node *node = (struct tmpfs_node *)mem; - - node->tn_gen++; - node->tn_size = 0; - node->tn_status = 0; - node->tn_flags = 0; - node->tn_links = 0; - node->tn_vnode = NULL; - node->tn_vpstate = 0; - - return (0); -} - -static void -tmpfs_node_dtor(void *mem, int size, void *arg) -{ - struct tmpfs_node *node = (struct tmpfs_node *)mem; - node->tn_type = VNON; -} - -static int -tmpfs_node_init(void *mem, int size, int flags) -{ - struct tmpfs_node *node = (struct tmpfs_node *)mem; - node->tn_id = 0; - - mtx_init(&node->tn_interlock, "tmpfs node interlock", NULL, MTX_DEF); - node->tn_gen = arc4random(); - - return (0); -} - -static void -tmpfs_node_fini(void *mem, int size) -{ - struct tmpfs_node *node = (struct tmpfs_node *)mem; - - mtx_destroy(&node->tn_interlock); -} - /* * Handle updates of time from writes to mmaped regions. Use * MNT_VNODE_FOREACH_ALL instead of MNT_VNODE_FOREACH_ACTIVE, since @@ -479,12 +436,6 @@ tmpfs_mount(struct mount *mp) tmp->tm_pages_max = pages; tmp->tm_pages_used = 0; new_unrhdr64(&tmp->tm_ino_unr, 2); - tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent", - sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, 0); - tmp->tm_node_pool = uma_zcreate("TMPFS node", - sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, - tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0; tmp->tm_nonc = nonc; @@ -493,8 +444,6 @@ tmpfs_mount(struct mount *mp) root_mode & ALLPERMS, NULL, NULL, VNOVAL, &root); if (error != 0 || root == NULL) { - uma_zdestroy(tmp->tm_node_pool); - uma_zdestroy(tmp->tm_dirent_pool); free(tmp, M_TMPFSMNT); return (error); } @@ -588,9 +537,6 @@ tmpfs_free_tmp(struct tmpfs_mount *tmp) } TMPFS_UNLOCK(tmp); - uma_zdestroy(tmp->tm_dirent_pool); - uma_zdestroy(tmp->tm_node_pool); - mtx_destroy(&tmp->tm_allnode_lock); MPASS(tmp->tm_pages_used == 0); MPASS(tmp->tm_nodes_inuse == 0); @@ -700,10 +646,23 @@ tmpfs_susp_clean(struct mount *mp __unused) { } +static int +tmpfs_init(struct vfsconf *conf) +{ + tmpfs_subr_init(); + return (0); +} + +static int +tmpfs_uninit(struct vfsconf *conf) +{ + tmpfs_subr_uninit(); + return (0); +} + /* * tmpfs vfs operations. */ - struct vfsops tmpfs_vfsops = { .vfs_mount = tmpfs_mount, .vfs_unmount = tmpfs_unmount, @@ -712,5 +671,7 @@ struct vfsops tmpfs_vfsops = { .vfs_fhtovp = tmpfs_fhtovp, .vfs_sync = tmpfs_sync, .vfs_susp_clean = tmpfs_susp_clean, + .vfs_init = tmpfs_init, + .vfs_uninit = tmpfs_uninit, }; VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL); From owner-svn-src-stable@freebsd.org Thu Dec 12 13:47:03 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 655B71D2548; Thu, 12 Dec 2019 13:47:03 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47YZpv2713z4d92; Thu, 12 Dec 2019 13:47:03 +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 342D4249FB; Thu, 12 Dec 2019 13:47:03 +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 xBCDl3DY095342; Thu, 12 Dec 2019 13:47:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBCDl2VD095339; Thu, 12 Dec 2019 13:47:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912121347.xBCDl2VD095339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 12 Dec 2019 13:47:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355652 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 355652 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 13:47:03 -0000 Author: kib Date: Thu Dec 12 13:47:02 2019 New Revision: 355652 URL: https://svnweb.freebsd.org/changeset/base/355652 Log: MFC r355422: mlx5: Do not poke hardware for statistic after teardown is started. Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Thu Dec 12 13:46:02 2019 (r355651) +++ stable/12/sys/dev/mlx5/driver.h Thu Dec 12 13:47:02 2019 (r355652) @@ -640,7 +640,8 @@ enum mlx5_device_state { }; enum mlx5_interface_state { - MLX5_INTERFACE_STATE_UP, + MLX5_INTERFACE_STATE_UP = 0x1, + MLX5_INTERFACE_STATE_TEARDOWN = 0x2, }; enum mlx5_pci_status { Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Dec 12 13:46:02 2019 (r355651) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Dec 12 13:47:02 2019 (r355652) @@ -1606,6 +1606,8 @@ static void shutdown_one(struct pci_dev *pdev) /* enter polling mode */ mlx5_cmd_use_polling(dev); + set_bit(MLX5_INTERFACE_STATE_TEARDOWN, &dev->intf_state); + /* disable all interrupts */ mlx5_disable_interrupts(dev); Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 12 13:46:02 2019 (r355651) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 12 13:47:02 2019 (r355652) @@ -1037,9 +1037,10 @@ mlx5e_update_stats_work(struct work_struct *work) { struct mlx5e_priv *priv; - priv = container_of(work, struct mlx5e_priv, update_stats_work); + priv = container_of(work, struct mlx5e_priv, update_stats_work); PRIV_LOCK(priv); - if (test_bit(MLX5E_STATE_OPENED, &priv->state) != 0) + if (test_bit(MLX5E_STATE_OPENED, &priv->state) != 0 && + !test_bit(MLX5_INTERFACE_STATE_TEARDOWN, &priv->mdev->intf_state)) mlx5e_update_stats_locked(priv); PRIV_UNLOCK(priv); } From owner-svn-src-stable@freebsd.org Thu Dec 12 13:48:26 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 212571D28B7; Thu, 12 Dec 2019 13:48:26 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47YZrV02Kvz4fNV; Thu, 12 Dec 2019 13:48:26 +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 BF7B724A0F; Thu, 12 Dec 2019 13:48:24 +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 xBCDmOAE097170; Thu, 12 Dec 2019 13:48:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBCDmOwj097165; Thu, 12 Dec 2019 13:48:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912121348.xBCDmOwj097165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 12 Dec 2019 13:48: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: r355653 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 355653 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 13:48:26 -0000 Author: kib Date: Thu Dec 12 13:48:23 2019 New Revision: 355653 URL: https://svnweb.freebsd.org/changeset/base/355653 Log: MFC r355422: mlx5: Do not poke hardware for statistic after teardown is started. Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu Dec 12 13:47:02 2019 (r355652) +++ stable/11/sys/dev/mlx5/driver.h Thu Dec 12 13:48:23 2019 (r355653) @@ -614,7 +614,8 @@ enum mlx5_device_state { }; enum mlx5_interface_state { - MLX5_INTERFACE_STATE_UP, + MLX5_INTERFACE_STATE_UP = 0x1, + MLX5_INTERFACE_STATE_TEARDOWN = 0x2, }; enum mlx5_pci_status { Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Dec 12 13:47:02 2019 (r355652) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Dec 12 13:48:23 2019 (r355653) @@ -1588,6 +1588,8 @@ static void shutdown_one(struct pci_dev *pdev) /* enter polling mode */ mlx5_cmd_use_polling(dev); + set_bit(MLX5_INTERFACE_STATE_TEARDOWN, &dev->intf_state); + /* disable all interrupts */ mlx5_disable_interrupts(dev); Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 12 13:47:02 2019 (r355652) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 12 13:48:23 2019 (r355653) @@ -1037,9 +1037,10 @@ mlx5e_update_stats_work(struct work_struct *work) { struct mlx5e_priv *priv; - priv = container_of(work, struct mlx5e_priv, update_stats_work); + priv = container_of(work, struct mlx5e_priv, update_stats_work); PRIV_LOCK(priv); - if (test_bit(MLX5E_STATE_OPENED, &priv->state) != 0) + if (test_bit(MLX5E_STATE_OPENED, &priv->state) != 0 && + !test_bit(MLX5_INTERFACE_STATE_TEARDOWN, &priv->mdev->intf_state)) mlx5e_update_stats_locked(priv); PRIV_UNLOCK(priv); } From owner-svn-src-stable@freebsd.org Thu Dec 12 18:16:33 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE7A91D7D0B; Thu, 12 Dec 2019 18:16:33 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Yhns5BT5z3wws; Thu, 12 Dec 2019 18:16:33 +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 A1B6A27A9E; Thu, 12 Dec 2019 18:16:33 +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 xBCIGXIw057846; Thu, 12 Dec 2019 18:16:33 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBCIGXCq057844; Thu, 12 Dec 2019 18:16:33 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201912121816.xBCIGXCq057844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 12 Dec 2019 18:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355658 - in stable/12: include sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable/12: include sys/sys X-SVN-Commit-Revision: 355658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 18:16:33 -0000 Author: dim Date: Thu Dec 12 18:16:32 2019 New Revision: 355658 URL: https://svnweb.freebsd.org/changeset/base/355658 Log: MFC r355568: Correctly check for C++17 and higher when declaring timespec_get() Summary: In rS338751, the check to declare `timespec_get()` for C++17 and higher was incorrectly done against a `cplusplus` define, while it should have been `__cplusplus`. Fix this by using `__cplusplus`, and also bump `__FreeBSD_version` so it becomes possible to correctly check for `timespec_get()` in upstream libc++ headers. Reviewed by: brooks, emaste Differential Revision: https://reviews.freebsd.org/D22735 Modified: stable/12/include/time.h stable/12/sys/sys/param.h Directory Properties: stable/12/ (props changed) Modified: stable/12/include/time.h ============================================================================== --- stable/12/include/time.h Thu Dec 12 17:40:32 2019 (r355657) +++ stable/12/include/time.h Thu Dec 12 18:16:32 2019 (r355658) @@ -208,7 +208,7 @@ time_t posix2time(time_t t); #endif #if defined(__BSD_VISIBLE) || __ISO_C_VISIBLE >= 2011 || \ - (defined(cplusplus) && cplusplus >= 201703) + (defined(__cplusplus) && __cplusplus >= 201703) #include /* ISO/IEC 9899:201x 7.27.2.5 The timespec_get function */ #define TIME_UTC 1 /* time elapsed since epoch */ Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Thu Dec 12 17:40:32 2019 (r355657) +++ stable/12/sys/sys/param.h Thu Dec 12 18:16:32 2019 (r355658) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1201503 /* Master, propagated to newvers */ +#define __FreeBSD_version 1201504 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Thu Dec 12 18:51:33 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00EFA1D8A36; Thu, 12 Dec 2019 18:51:33 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47YjZD6HmXz3ytt; Thu, 12 Dec 2019 18:51:32 +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 D32141E6; Thu, 12 Dec 2019 18:51:32 +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 xBCIpW6O079635; Thu, 12 Dec 2019 18:51:32 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBCIpWcw079634; Thu, 12 Dec 2019 18:51:32 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912121851.xBCIpWcw079634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 12 Dec 2019 18:51: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: r355661 - in stable: 11/stand/lua 12/stand/lua X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/lua 12/stand/lua X-SVN-Commit-Revision: 355661 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 18:51:33 -0000 Author: kevans Date: Thu Dec 12 18:51:32 2019 New Revision: 355661 URL: https://svnweb.freebsd.org/changeset/base/355661 Log: MFC r354247, r355349: lualoader try_include improvement r354247: lualoader: rewrite try_include using lfs + dofile Actual modules get require()'d in, rather than try_include(). All instances of try_include should be provided with proper hooks/API in the rest of loader to do the work they need to do, since we can't rely on them to exist. Convert this now to lfs + dofile since we won't really be treating them as modules. lfs is required because dofile will properly throw an error if the file doesn't exist, which is not in the spirit of 'optionally included'. Getting out of the pcall game allows us to provide a loader.exit() style call that backs out to the common bits of loader (autoboot sequence unless disabled with a loader.setenv("autoboot_delay", "NO")). The most ideal way identified so far to implement loader.exit() is to throw a special abort-style error that indicates to the caller in interp_lua that we've not actually errored out, just continue execution. Otherwise, we have to hack in logic to bubble up and return from loader.lua without continuing further, which gets kind of ugly depending on the context in which we're aborting. A compat shim is provided temporarily in case the executing loader doesn't yet have loader.lua_path, which was just added in r354246. r355349: lualoader: correct a typo from r354247 r354247 converted try_include to lfs + dofile with the loader.lua_path added just before. Fortunately, there was a hardcoded /boot/lua fallback in case loader.lua_path wasn't being set yet- I typo'd it as loader.lua_paths. Fix the typo. Modified: stable/11/stand/lua/core.lua Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/stand/lua/core.lua Directory Properties: stable/12/ (props changed) Modified: stable/11/stand/lua/core.lua ============================================================================== --- stable/11/stand/lua/core.lua Thu Dec 12 18:45:31 2019 (r355660) +++ stable/11/stand/lua/core.lua Thu Dec 12 18:51:32 2019 (r355661) @@ -69,12 +69,28 @@ end -- try_include will return the loaded module on success, or false and the error -- message on failure. function try_include(module) - local status, ret = pcall(require, module) - -- ret is the module if we succeeded. - if status then - return ret + if module:sub(1, 1) ~= "/" then + local lua_path = loader.lua_path + -- XXX Temporary compat shim; this should be removed once the + -- loader.lua_path export has sufficiently spread. + if lua_path == nil then + lua_path = "/boot/lua" + end + module = lua_path .. "/" .. module + -- We only attempt to append an extension if an absolute path + -- wasn't specified. This assumes that the caller either wants + -- to treat this like it would require() and specify just the + -- base filename, or they know what they're doing as they've + -- specified an absolute path and we shouldn't impede. + if module:match(".lua$") == nil then + module = module .. ".lua" + end end - return false, ret + if lfs.attributes(module, "mode") ~= "file" then + return + end + + return dofile(module) end -- Module exports From owner-svn-src-stable@freebsd.org Thu Dec 12 18:51:33 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73B9B1D8A40; Thu, 12 Dec 2019 18:51:33 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47YjZF1Zpkz3ytv; Thu, 12 Dec 2019 18:51:33 +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 317E01E7; Thu, 12 Dec 2019 18:51: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 xBCIpXdc079641; Thu, 12 Dec 2019 18:51:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBCIpXsL079640; Thu, 12 Dec 2019 18:51:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912121851.xBCIpXsL079640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 12 Dec 2019 18:51:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355661 - in stable: 11/stand/lua 12/stand/lua X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/lua 12/stand/lua X-SVN-Commit-Revision: 355661 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 18:51:33 -0000 Author: kevans Date: Thu Dec 12 18:51:32 2019 New Revision: 355661 URL: https://svnweb.freebsd.org/changeset/base/355661 Log: MFC r354247, r355349: lualoader try_include improvement r354247: lualoader: rewrite try_include using lfs + dofile Actual modules get require()'d in, rather than try_include(). All instances of try_include should be provided with proper hooks/API in the rest of loader to do the work they need to do, since we can't rely on them to exist. Convert this now to lfs + dofile since we won't really be treating them as modules. lfs is required because dofile will properly throw an error if the file doesn't exist, which is not in the spirit of 'optionally included'. Getting out of the pcall game allows us to provide a loader.exit() style call that backs out to the common bits of loader (autoboot sequence unless disabled with a loader.setenv("autoboot_delay", "NO")). The most ideal way identified so far to implement loader.exit() is to throw a special abort-style error that indicates to the caller in interp_lua that we've not actually errored out, just continue execution. Otherwise, we have to hack in logic to bubble up and return from loader.lua without continuing further, which gets kind of ugly depending on the context in which we're aborting. A compat shim is provided temporarily in case the executing loader doesn't yet have loader.lua_path, which was just added in r354246. r355349: lualoader: correct a typo from r354247 r354247 converted try_include to lfs + dofile with the loader.lua_path added just before. Fortunately, there was a hardcoded /boot/lua fallback in case loader.lua_path wasn't being set yet- I typo'd it as loader.lua_paths. Fix the typo. Modified: stable/12/stand/lua/core.lua Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/stand/lua/core.lua Directory Properties: stable/11/ (props changed) Modified: stable/12/stand/lua/core.lua ============================================================================== --- stable/12/stand/lua/core.lua Thu Dec 12 18:45:31 2019 (r355660) +++ stable/12/stand/lua/core.lua Thu Dec 12 18:51:32 2019 (r355661) @@ -69,12 +69,28 @@ end -- try_include will return the loaded module on success, or false and the error -- message on failure. function try_include(module) - local status, ret = pcall(require, module) - -- ret is the module if we succeeded. - if status then - return ret + if module:sub(1, 1) ~= "/" then + local lua_path = loader.lua_path + -- XXX Temporary compat shim; this should be removed once the + -- loader.lua_path export has sufficiently spread. + if lua_path == nil then + lua_path = "/boot/lua" + end + module = lua_path .. "/" .. module + -- We only attempt to append an extension if an absolute path + -- wasn't specified. This assumes that the caller either wants + -- to treat this like it would require() and specify just the + -- base filename, or they know what they're doing as they've + -- specified an absolute path and we shouldn't impede. + if module:match(".lua$") == nil then + module = module .. ".lua" + end end - return false, ret + if lfs.attributes(module, "mode") ~= "file" then + return + end + + return dofile(module) end -- Module exports From owner-svn-src-stable@freebsd.org Thu Dec 12 18:53:46 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 400541D8B2B; Thu, 12 Dec 2019 18:53: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Yjcp0wx5z40HG; Thu, 12 Dec 2019 18:53: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 1AFE9241; Thu, 12 Dec 2019 18:53: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 xBCIrjqh081311; Thu, 12 Dec 2019 18:53:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBCIrjTT081308; Thu, 12 Dec 2019 18:53:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912121853.xBCIrjTT081308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 12 Dec 2019 18:53:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355662 - in stable: 11/lib/libbe 12/lib/libbe X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/lib/libbe 12/lib/libbe X-SVN-Commit-Revision: 355662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 18:53:46 -0000 Author: kevans Date: Thu Dec 12 18:53:45 2019 New Revision: 355662 URL: https://svnweb.freebsd.org/changeset/base/355662 Log: MFC r355460: libbe: fix build against sysutils/openzfs, part 1 This is the half of the changes required that work as-is with both in-tree ZFS and the new hotness, sysutils/openzfs. Highlights are less dependency on header pollution (from somewhere) and using 'mnttab' instead of 'extmnttab'. In the in-tree ZFS, the latter is a #define for the former, but in the port extmnttab is actually a distinct struct that's a super-set of mnttab. We really want mnttab here anyways, so just use it. Modified: stable/11/lib/libbe/be.c stable/11/lib/libbe/be_access.c stable/11/lib/libbe/be_info.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/lib/libbe/be.c stable/12/lib/libbe/be_access.c stable/12/lib/libbe/be_info.c Directory Properties: stable/12/ (props changed) Modified: stable/11/lib/libbe/be.c ============================================================================== --- stable/11/lib/libbe/be.c Thu Dec 12 18:51:32 2019 (r355661) +++ stable/11/lib/libbe/be.c Thu Dec 12 18:53:45 2019 (r355662) @@ -34,6 +34,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include #include @@ -67,7 +70,7 @@ static int be_locate_rootfs(libbe_handle_t *lbh) { struct statfs sfs; - struct extmnttab entry; + struct mnttab entry; zfs_handle_t *zfs; /* Modified: stable/11/lib/libbe/be_access.c ============================================================================== --- stable/11/lib/libbe/be_access.c Thu Dec 12 18:51:32 2019 (r355661) +++ stable/11/lib/libbe/be_access.c Thu Dec 12 18:53:45 2019 (r355662) @@ -31,6 +31,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "be.h" #include "be_impl.h" Modified: stable/11/lib/libbe/be_info.c ============================================================================== --- stable/11/lib/libbe/be_info.c Thu Dec 12 18:51:32 2019 (r355661) +++ stable/11/lib/libbe/be_info.c Thu Dec 12 18:53:45 2019 (r355662) @@ -30,6 +30,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "be.h" #include "be_impl.h" From owner-svn-src-stable@freebsd.org Thu Dec 12 18:53:46 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8F2B1D8B39; Thu, 12 Dec 2019 18:53: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Yjcp5vpGz40HH; Thu, 12 Dec 2019 18:53: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 C5F59242; Thu, 12 Dec 2019 18:53: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 xBCIrkUC081320; Thu, 12 Dec 2019 18:53:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBCIrkYM081317; Thu, 12 Dec 2019 18:53:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912121853.xBCIrkYM081317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 12 Dec 2019 18:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355662 - in stable: 11/lib/libbe 12/lib/libbe X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/lib/libbe 12/lib/libbe X-SVN-Commit-Revision: 355662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 18:53:47 -0000 Author: kevans Date: Thu Dec 12 18:53:45 2019 New Revision: 355662 URL: https://svnweb.freebsd.org/changeset/base/355662 Log: MFC r355460: libbe: fix build against sysutils/openzfs, part 1 This is the half of the changes required that work as-is with both in-tree ZFS and the new hotness, sysutils/openzfs. Highlights are less dependency on header pollution (from somewhere) and using 'mnttab' instead of 'extmnttab'. In the in-tree ZFS, the latter is a #define for the former, but in the port extmnttab is actually a distinct struct that's a super-set of mnttab. We really want mnttab here anyways, so just use it. Modified: stable/12/lib/libbe/be.c stable/12/lib/libbe/be_access.c stable/12/lib/libbe/be_info.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/libbe/be.c stable/11/lib/libbe/be_access.c stable/11/lib/libbe/be_info.c Directory Properties: stable/11/ (props changed) Modified: stable/12/lib/libbe/be.c ============================================================================== --- stable/12/lib/libbe/be.c Thu Dec 12 18:51:32 2019 (r355661) +++ stable/12/lib/libbe/be.c Thu Dec 12 18:53:45 2019 (r355662) @@ -34,6 +34,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include #include @@ -67,7 +70,7 @@ static int be_locate_rootfs(libbe_handle_t *lbh) { struct statfs sfs; - struct extmnttab entry; + struct mnttab entry; zfs_handle_t *zfs; /* Modified: stable/12/lib/libbe/be_access.c ============================================================================== --- stable/12/lib/libbe/be_access.c Thu Dec 12 18:51:32 2019 (r355661) +++ stable/12/lib/libbe/be_access.c Thu Dec 12 18:53:45 2019 (r355662) @@ -31,6 +31,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "be.h" #include "be_impl.h" Modified: stable/12/lib/libbe/be_info.c ============================================================================== --- stable/12/lib/libbe/be_info.c Thu Dec 12 18:51:32 2019 (r355661) +++ stable/12/lib/libbe/be_info.c Thu Dec 12 18:53:45 2019 (r355662) @@ -30,6 +30,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "be.h" #include "be_impl.h" From owner-svn-src-stable@freebsd.org Thu Dec 12 19:17:27 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 272221D8F70; Thu, 12 Dec 2019 19:17:27 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Yk8701cnz41PJ; Thu, 12 Dec 2019 19:17:27 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFFC3611; Thu, 12 Dec 2019 19:17:26 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBCJHQJs093553; Thu, 12 Dec 2019 19:17:26 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBCJHQKf093552; Thu, 12 Dec 2019 19:17:26 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201912121917.xBCJHQKf093552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 12 Dec 2019 19:17:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355663 - stable/12/usr.bin/netstat X-SVN-Group: stable-12 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/12/usr.bin/netstat X-SVN-Commit-Revision: 355663 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 19:17:27 -0000 Author: bapt Date: Thu Dec 12 19:17:26 2019 New Revision: 355663 URL: https://svnweb.freebsd.org/changeset/base/355663 Log: MFC: r355554 Fix: netstat -rs Routing statistics requires somes symbols that are only loaded when not running live. Load them only in that specific case PR: 242423 Submitted by: olivier Modified: stable/12/usr.bin/netstat/main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/netstat/main.c ============================================================================== --- stable/12/usr.bin/netstat/main.c Thu Dec 12 18:53:45 2019 (r355662) +++ stable/12/usr.bin/netstat/main.c Thu Dec 12 19:17:26 2019 (r355663) @@ -484,6 +484,9 @@ main(int argc, char *argv[]) if (rflag) { xo_open_container("statistics"); if (sflag) { + if (live) { + kresolve_list(nl); + } rt_stats(); } else routepr(fib, af); From owner-svn-src-stable@freebsd.org Thu Dec 12 19:17:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BA5B1D8FA0; Thu, 12 Dec 2019 19:17:31 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Yk8B6dg1z41Rd; Thu, 12 Dec 2019 19:17:30 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF083613; Thu, 12 Dec 2019 19:17:30 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBCJHU0X093613; Thu, 12 Dec 2019 19:17:30 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBCJHUDu093612; Thu, 12 Dec 2019 19:17:30 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201912121917.xBCJHUDu093612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 12 Dec 2019 19:17: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: r355664 - stable/11/usr.bin/netstat X-SVN-Group: stable-11 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/11/usr.bin/netstat X-SVN-Commit-Revision: 355664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 19:17:31 -0000 Author: bapt Date: Thu Dec 12 19:17:30 2019 New Revision: 355664 URL: https://svnweb.freebsd.org/changeset/base/355664 Log: MFC: r355554 Fix: netstat -rs Routing statistics requires somes symbols that are only loaded when not running live. Load them only in that specific case PR: 242423 Submitted by: olivier Modified: stable/11/usr.bin/netstat/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/netstat/main.c ============================================================================== --- stable/11/usr.bin/netstat/main.c Thu Dec 12 19:17:26 2019 (r355663) +++ stable/11/usr.bin/netstat/main.c Thu Dec 12 19:17:30 2019 (r355664) @@ -478,6 +478,9 @@ main(int argc, char *argv[]) if (rflag) { xo_open_container("statistics"); if (sflag) { + if (live) { + kresolve_list(nl); + } rt_stats(); flowtable_stats(); } else From owner-svn-src-stable@freebsd.org Thu Dec 12 19:21:19 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A4361D917E; Thu, 12 Dec 2019 19:21:19 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47YkDb155qz41w0; Thu, 12 Dec 2019 19:21:19 +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 07A5A673; Thu, 12 Dec 2019 19:21:19 +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 xBCJLJDX095291; Thu, 12 Dec 2019 19:21:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBCJLGSQ095280; Thu, 12 Dec 2019 19:21:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912121921.xBCJLGSQ095280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 12 Dec 2019 19:21:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355665 - in stable/12/sys: arm/broadcom/bcm2835 arm64/conf conf X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/sys: arm/broadcom/bcm2835 arm64/conf conf X-SVN-Commit-Revision: 355665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 19:21:19 -0000 Author: kevans Date: Thu Dec 12 19:21:16 2019 New Revision: 355665 URL: https://svnweb.freebsd.org/changeset/base/355665 Log: MFC Collection of Raspberry Pi fixes: r348803-r348804, r354488, r354524, r354560-r354561, r354563, r354577, r354579, r354823, r354825, r354844-r354846, r354868, r354875-r354876, r354930-r354933, r354956, r355016, r355025-r355026, r355031, r355563 r348803 by bz: bcm2835_sdhci.c: save block registers to avoid controller bug Extending what the initial revision, r273264, r276985, r277346 have started for the transfer mode and command registers, another pair of 16bit registers written in sequence are block size and block count, which fall together onto the same 32bit line and hence the same register(s) would be written twice in sequence for those as well. Use a similar approach to transfer mode and command and save the writes to either of the block regiters and then only execute a write once. We can do this as with transfer mode their values are meaningless until a command is issued so we can use that write to command as a trigger to also write out the block registers. Compared to transfer mode and command the value of block count can change, so we need to keep state and actually read the block registers back the first time after a write. r348804 by bz: bcm2835_sdhci.c: exit DMA if not enough data left to avoid timeout errors In the DMA case, given we disable the data interrupts, we never seem to get DATA_END. Given we are relying on DMA interrupts we are not using the SDHCI state machine and hence only call into sdhci_platform_will_handle() for the first check of data. We do not call "will handle" for any following round trips of the same transaction if block size * count > BCM_DMA_BLOCK_SIZE. Manually check "left" in the DMA interrupt handler to see if we have at least another full BCM_DMA_BLOCK_SIZE to handle. Without this change we would DMA that and then even start a DMA with left == 0 which would lead to a timeout and error. Now we re-enable data interrupts and return and let the SDHCI generic interrupt handler and state machine pick the SPACE_AVAIL up and then find that it should punt to the pio_handler for the remaining bytes or finish the data transaction. With this change block mode seems to work beyond 7 * 64byte blocks, which worked as it was below BCM_DMA_BLOCK_SIZE. r354488: bcm_lintc: don't attach if "interrupt-controller" is missing This is a standard required property for interrupt controllers, and present on the bcm_lintc nodes for currently supported RPi models. For the RPi4, we have both bcm_lintc as well as GIC-400, but only one may be active at a time. Don't probe bcm_lintc if it's missing the "interrupt-controller" property -- in RPi 4 DTS, the bcm_lintc node is actually missing this along with other required interrupt properties. Presumably, if the earlier boot stages will support switching to the legacy interrupt controller (as is suggested possible by the documentation), the DTS will need to be updated to indicate the proper interrupt-parent and hopefully also mark this node as an interrupt-controller instead. r354524: bcm2835_dma: Mark IRQs shareable On the RPi4, some of these IRQs are shared. Start moving toward a mode where we accept that shared IRQs happen and simply ignore interrupts that are seemingly for no reason. I would like to be more verbose here, but my 30-minute assessment of the current world order is that mapping a resource/rid to an actual IRQ number (as found in FDT) data is not a simple matter. Determining if more than one handler is attached to an IRQ is closer to feasible, but it's unclear which way is the cleaner path. Beyond that, we're only really using it to be slightly more verbose when something's going wrong, so for now just suppress and drop a complaint-comment. This was originally submitted (via freebsd-arm@) by Robert Crowston; the additional verbosity was dropped by kevans@. r354560: bcm2835_sdhci: add some very basic support for rpi4 DMA is currently disabled while I work out why it's broken, but this is enough for upstream U-Boot + rpi-firmware + our rpi3-psci-monitor to boot with the right config. The RPi 4 is still not in a good "supported" state, as we have no USB/PCI-E/Ethernet drivers, but if air-gapped pies only able to operate over cereal is your thing, here's your guy. r354561: bcm2835_sdhci: remove unused power_id field This was once set, but I removed it by the time I committed it because both configurations use the same POWER_ID. This can be separated back out if the situation changes. r354563: bcm2835: commit missing constant from r354560 Surgically pulling the patch from my debugging work lead to this slopiness- my apologies. r354577: arm64: add SOC_BRCM_BCM2838, build it in GENERIC BCM2838/BCM2711 is the Raspberry Pi 4, which we will soon be able to boot on once some ports bits are worked out. r354579: bcm2835_sdhci: don't panic in DMA interrupt if curcmd went away This is an exceptional case; generally found during controller errors. A panic when we attempt to acess slot->curcmd->data is less ideal than warning, and other verbiage will be emitted to indicate the exact error. r354823: bcm2835_sdhci: push DATA_END handling out of DMA interrupt path This simplifies the DMA interrupt handler quite a bit. The sdhci framework will call platform_finish_transfer() if it's received SDHCI_INT_DATA_END, so we can take care of any final cleanup there and simply not worry about the possibility of it ending in the DMA interrupt path. r354825: bcm2835_sdhci: use a macro for interrupts we handle This is just further simplification, very little functional change. In the DMA interrupt handler, we *do* now acknowledge both DATA_AVAIL | SPACE_AVAIL every time -- these operations are mutually exclusive, so while this is a functional change, it's effectively a nop. Removing the 'mask' local allows us to further simplify in a future change. r354844: bcm2835_sdhci: drop an assert in start_dma_seg Trivial change to clarify locking expectations... no functional change. r354845: bcm2835_sdhci: some style cleanup, no functional change r354846: bcm2835_sdhci: formalize DMA tag/segment scaling requirements This allows easy and care-free scaling of NUM_DMA_SEGS with proper-ish calculations to make sure we can actually handle the number of segments we'd like to handle on average so that performance comparisons can be easily made at different values if/once we can actually handle it. It also makes it helps the untrained reader understand more quickly the reasoning behind the choice of maxsize/maxsegs/maxsegsize. r354868: bcm2835_sdhci: various refactoring of DMA path This round of refactoring is mostly about streamlining the interrupt handler to make it easier to verify and reason about operations taking place while trying to bring FreeBSD up on the RPi4. r354875: bcm2835: push address mapping conversion for DMA/mailbox to runtime We could maintain the static conversions for the !AArch64 Raspberry Pis, but I'm not sure it's worth it -- we'll traverse the platform list exactly once (of which there are only two for armv7), then every conversion there-after traverses the memory map listing of which there are at-most two entries for these boards: sdram and peripheral space. Detecting this at runtime is necessary for the AArch64 SOC, though, because of the distinct IO windows being otherwise not discernible just from support compiled into the kernel. We currently select the correct window based on /compatible in the FDT. We also use a similar mechanism to describe the DMA restrictions- the RPi 4 can have up to 4GB of RAM while the DMA controller and mailbox mechanism can technically, kind of, only access the lowest 1GB. See the comment in bcm2835_vcbus.h for a fun description/clarification of this. r354876: bcm2835_vcbus: add compatibility name for ^/sys/contrib/vchiq It's unclear how this didn't get caught in my last iteration, but the fix is easy- the interface is still compatible, it was just gratuituously renamed to match my arbitrary definition of consistency... VCBUS, the BCM2835 name, represents an address on the VideoCore CPU Bus. In a similar fashion, while it is a physical address, the ARMC portion represents that these are addresses as seen by the ARM CPU. To make things even more fun, the BCM2711 peripheral documentation describes not virtual address space vs. physical address space, but instead the 32-bit address map vs. the address map in "Low Peripheral" mode. The latter of these is what the *ARMC* macros translate to/from. r354930: bcm2835_sdhci: clean up DMA segments in error handling path Later parts assume that this would've been done if interrupts are enabled, but this is the only case in which that wouldn't have been true. This commit also reorders operations such that we're done touching slot/slot->intmask before we call back into the SDHCI framework and exit. r354931: Revert r354930: wrong diff, right message. r354932: bcm2835_sdhci: roll back r354823 r354823 kicked DATA_END handling out of the DMA interrupt path "to make things easy", but this was likely a mistake -- if we know we're done after we've finished pending DMA operations, we should go ahead and acknowledge it rather than waiting for the controller to finalize it. If it's not ready, we'll simply re-enable interrupts and wait for it anyways, to be re-entered in sdhci_data_intr. r354933: bcm2835_sdhci: clean up DMA segments in error handling path Later parts assume that this would've been done if interrupts are enabled, but this is the only case in which that wouldn't have been true. This commit also reorders operations such that we're done touching slot/slot->intmask before we call back into the SDHCI framework and exit. r354956: bcm2835_sdhci: only inspect interrupts we handle We'll write the value we read back to ack pending interrupts, but we should at least make it clear to ourselves that we only want to ack pending transfer interrupts. r355016: bcm2835_vcbus: add the *other* rpi4 compat string The DTS I used initially had brcm,bcm2838; the new one uses brcm,bcm2711. Add that one as well. r355025: bcm2835_sdhci: "fix" DMA on the RPi 4 According to the documentation I have, DREQ pacing should be required here. The DREQ# hasn't changed since the BCM2835. As soon as we attempt to setup DREQ, DMA stalls and there's no clear reason why as of yet. Setting this back to NONE seems to work just as well, though it's yet to be determined if this is a sustainable model in high-throughput scenarios. r355026: bcm2835_dma: rip out the "use_dma" flag, make it non-optional Now that it works for the Raspberry Pi 4, we can discontinue our workarounds that were put in place to at least get a bootable kernel for other testing. r355031: bcm2835_sdhci: fix non-INVARIANTS build sc is now only used to make sure we're not re-entering the data handling path erroneously. r355563: RPI: Fix DMA/SDHCI on the BCM2836 (Raspberry Pi 2) r354875 pushed VCBUS <-> ARMC translations to runtime determination, but incorrectly mapped addresses for the BCM2836 -- SOC_BCM2835 and SOC_BCM2836 are actually mutually exclusive, so the BCM2836 config (GENERIC) would have taken the latter path in the header and used 0x3f000000 as peripheral start. Easily fixed -- split out the BCM2836 into its own memmap config and use that instead if SOC_BCM2836 is included. With this, we get back to userland again. Added: stable/12/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c - copied, changed from r354876, head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_dma.c stable/12/sys/arm/broadcom/bcm2835/bcm2835_dma.h stable/12/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox.c stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h stable/12/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c stable/12/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h stable/12/sys/arm/broadcom/bcm2835/bcm2836.c stable/12/sys/arm/broadcom/bcm2835/files.bcm283x stable/12/sys/arm64/conf/GENERIC stable/12/sys/conf/files.arm64 stable/12/sys/conf/options.arm64 Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_dma.c ============================================================================== --- stable/12/sys/arm/broadcom/bcm2835/bcm2835_dma.c Thu Dec 12 19:17:30 2019 (r355664) +++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_dma.c Thu Dec 12 19:21:16 2019 (r355665) @@ -169,7 +169,7 @@ bcm_dmamap_cb(void *arg, bus_dma_segment_t *segs, return; addr = (bus_addr_t*)arg; - *addr = PHYS_TO_VCBUS(segs[0].ds_addr); + *addr = ARMC_TO_VCBUS(segs[0].ds_addr); } static void @@ -247,8 +247,12 @@ bcm_dma_init(device_t dev) if ((reg & bcm_dma_channel_mask) != 0) device_printf(dev, "statuses are not cleared\n"); - /* Allocate DMA chunks control blocks */ - /* p.40 of spec - control block should be 32-bit aligned */ + /* + * Allocate DMA chunks control blocks based on p.40 of the peripheral + * spec - control block should be 32-bit aligned. The DMA controller + * has a full 32-bit register dedicated to this address, so we do not + * need to bother with the per-SoC peripheral restrictions. + */ err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, @@ -561,14 +565,9 @@ bcm_dma_start(int ch, vm_paddr_t src, vm_paddr_t dst, return (-1); cb = sc->sc_dma_ch[ch].cb; - if (BCM2835_ARM_IS_IO(src)) - cb->src = IO_TO_VCBUS(src); - else - cb->src = PHYS_TO_VCBUS(src); - if (BCM2835_ARM_IS_IO(dst)) - cb->dst = IO_TO_VCBUS(dst); - else - cb->dst = PHYS_TO_VCBUS(dst); + cb->src = ARMC_TO_VCBUS(src); + cb->dst = ARMC_TO_VCBUS(dst); + cb->len = len; bus_dmamap_sync(sc->sc_dma_tag, @@ -619,18 +618,18 @@ bcm_dma_intr(void *arg) /* my interrupt? */ cs = bus_read_4(sc->sc_mem, BCM_DMA_CS(ch->ch)); - if (!(cs & (CS_INT | CS_ERR))) { - device_printf(sc->sc_dev, - "unexpected DMA intr CH=%d, CS=%x\n", ch->ch, cs); + /* + * Is it an active channel? Our diagnostics could be better here, but + * it's not necessarily an easy task to resolve a rid/resource to an + * actual irq number. We'd want to do this to set a flag indicating + * whether the irq is shared or not, so we know to complain. + */ + if (!(ch->flags & BCM_DMA_CH_USED)) return; - } - /* running? */ - if (!(ch->flags & BCM_DMA_CH_USED)) { - device_printf(sc->sc_dev, - "unused DMA intr CH=%d, CS=%x\n", ch->ch, cs); + /* Again, we can't complain here. The same logic applies. */ + if (!(cs & (CS_INT | CS_ERR))) return; - } if (cs & CS_ERR) { debug = bus_read_4(sc->sc_mem, BCM_DMA_DEBUG(ch->ch)); @@ -715,7 +714,7 @@ bcm_dma_attach(device_t dev) continue; sc->sc_irq[rid] = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_ACTIVE); + RF_ACTIVE | RF_SHAREABLE); if (sc->sc_irq[rid] == NULL) { device_printf(dev, "cannot allocate interrupt\n"); err = ENXIO; Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_dma.h ============================================================================== --- stable/12/sys/arm/broadcom/bcm2835/bcm2835_dma.h Thu Dec 12 19:17:30 2019 (r355664) +++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_dma.h Thu Dec 12 19:21:16 2019 (r355665) @@ -42,6 +42,10 @@ /* Peripheral DREQ Signals (4.2.1.3) */ #define BCM_DMA_DREQ_NONE 0 +/* + * XXX This doesn't seem to work for the Raspberry Pi 4, but the peripheral + * documentation still lists it at 11. + */ #define BCM_DMA_DREQ_EMMC 11 #define BCM_DMA_DREQ_SDHOST 13 Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c ============================================================================== --- stable/12/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Thu Dec 12 19:17:30 2019 (r355664) +++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Thu Dec 12 19:21:16 2019 (r355665) @@ -227,7 +227,7 @@ ft5406ts_init(void *arg) return; } - touchbuf = VCBUS_TO_PHYS(msg.body.resp.address); + touchbuf = VCBUS_TO_ARMC(msg.body.resp.address); sc->touch_buf = (uint8_t*)pmap_mapdev(touchbuf, FT5406_WINDOW_SIZE); /* 60Hz */ Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox.c ============================================================================== --- stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox.c Thu Dec 12 19:17:30 2019 (r355664) +++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox.c Thu Dec 12 19:21:16 2019 (r355665) @@ -303,7 +303,7 @@ bcm2835_mbox_dma_cb(void *arg, bus_dma_segment_t *segs if (err) return; addr = (bus_addr_t *)arg; - *addr = PHYS_TO_VCBUS(segs[0].ds_addr); + *addr = ARMC_TO_VCBUS(segs[0].ds_addr); } static void * @@ -314,7 +314,7 @@ bcm2835_mbox_init_dma(device_t dev, size_t len, bus_dm int err; err = bus_dma_tag_create(bus_get_dma_tag(dev), 16, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + bcm283x_dmabus_peripheral_lowaddr(), BUS_SPACE_MAXADDR, NULL, NULL, len, 1, len, 0, NULL, NULL, tag); if (err != 0) { device_printf(dev, "can't create DMA tag\n"); @@ -534,7 +534,7 @@ bcm2835_mbox_fb_init(struct bcm2835_fb_config *fb) fb->xoffset = msg.offset.body.resp.x; fb->yoffset = msg.offset.body.resp.y; fb->pitch = msg.pitch.body.resp.pitch; - fb->base = VCBUS_TO_PHYS(msg.buffer.body.resp.fb_address); + fb->base = VCBUS_TO_ARMC(msg.buffer.body.resp.fb_address); fb->size = msg.buffer.body.resp.fb_size; } Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h ============================================================================== --- stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h Thu Dec 12 19:17:30 2019 (r355664) +++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h Thu Dec 12 19:21:16 2019 (r355665) @@ -118,6 +118,7 @@ int bcm2835_mbox_set_power_state(uint32_t, boolean_t); #define BCM2835_MBOX_CLOCK_ID_SDRAM 0x00000008 #define BCM2835_MBOX_CLOCK_ID_PIXEL 0x00000009 #define BCM2835_MBOX_CLOCK_ID_PWM 0x0000000a +#define BCM2838_MBOX_CLOCK_ID_EMMC2 0x0000000c #define BCM2835_MBOX_TAG_GET_CLOCK_RATE 0x00030002 #define BCM2835_MBOX_TAG_SET_CLOCK_RATE 0x00038002 Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- stable/12/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Dec 12 19:17:30 2019 (r355664) +++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Dec 12 19:21:16 2019 (r355665) @@ -58,13 +58,37 @@ __FBSDID("$FreeBSD$"); #include "bcm2835_dma.h" #include -#include "bcm2835_vcbus.h" +#ifdef NOTYET +#include +#endif +#include #define BCM2835_DEFAULT_SDHCI_FREQ 50 +#define BCM2838_DEFAULT_SDHCI_FREQ 100 #define BCM_SDHCI_BUFFER_SIZE 512 -#define NUM_DMA_SEGS 2 +/* + * NUM_DMA_SEGS is the number of DMA segments we want to accommodate on average. + * We add in a number of segments based on how much we may need to spill into + * another segment due to crossing page boundaries. e.g. up to PAGE_SIZE, an + * extra page is needed as we can cross a page boundary exactly once. + */ +#define NUM_DMA_SEGS 1 +#define NUM_DMA_SPILL_SEGS \ + ((((NUM_DMA_SEGS * BCM_SDHCI_BUFFER_SIZE) - 1) / PAGE_SIZE) + 1) +#define ALLOCATED_DMA_SEGS (NUM_DMA_SEGS + NUM_DMA_SPILL_SEGS) +#define BCM_DMA_MAXSIZE (NUM_DMA_SEGS * BCM_SDHCI_BUFFER_SIZE) +#define BCM_SDHCI_SLOT_LEFT(slot) \ + ((slot)->curcmd->data->len - (slot)->offset) + +#define BCM_SDHCI_SEGSZ_LEFT(slot) \ + min(BCM_DMA_MAXSIZE, \ + rounddown(BCM_SDHCI_SLOT_LEFT(slot), BCM_SDHCI_BUFFER_SIZE)) + +#define DATA_PENDING_MASK (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL) +#define DATA_XFER_MASK (DATA_PENDING_MASK | SDHCI_INT_DATA_END) + #ifdef DEBUG static int bcm2835_sdhci_debug = 0; @@ -84,10 +108,38 @@ SYSCTL_INT(_hw_sdhci, OID_AUTO, bcm2835_sdhci_debug, C static int bcm2835_sdhci_hs = 1; static int bcm2835_sdhci_pio_mode = 0; +struct bcm_mmc_conf { + int clock_id; + int clock_src; + int default_freq; + int quirks; + int emmc_dreq; +}; + +struct bcm_mmc_conf bcm2835_sdhci_conf = { + .clock_id = BCM2835_MBOX_CLOCK_ID_EMMC, + .clock_src = -1, + .default_freq = BCM2835_DEFAULT_SDHCI_FREQ, + .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | + SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | SDHCI_QUIRK_DONT_SET_HISPD_BIT | + SDHCI_QUIRK_MISSING_CAPS, + .emmc_dreq = BCM_DMA_DREQ_EMMC, +}; + +struct bcm_mmc_conf bcm2838_emmc2_conf = { + .clock_id = BCM2838_MBOX_CLOCK_ID_EMMC2, + .clock_src = -1, + .default_freq = BCM2838_DEFAULT_SDHCI_FREQ, + .quirks = 0, + .emmc_dreq = BCM_DMA_DREQ_NONE, +}; + static struct ofw_compat_data compat_data[] = { - {"broadcom,bcm2835-sdhci", 1}, - {"brcm,bcm2835-sdhci", 1}, - {"brcm,bcm2835-mmc", 1}, + {"broadcom,bcm2835-sdhci", (uintptr_t)&bcm2835_sdhci_conf}, + {"brcm,bcm2835-sdhci", (uintptr_t)&bcm2835_sdhci_conf}, + {"brcm,bcm2835-mmc", (uintptr_t)&bcm2835_sdhci_conf}, + {"brcm,bcm2711-emmc2", (uintptr_t)&bcm2838_emmc2_conf}, + {"brcm,bcm2838-emmc2", (uintptr_t)&bcm2838_emmc2_conf}, {NULL, 0} }; @@ -107,12 +159,18 @@ struct bcm_sdhci_softc { bus_dma_tag_t sc_dma_tag; bus_dmamap_t sc_dma_map; vm_paddr_t sc_sdhci_buffer_phys; - uint32_t cmd_and_mode; - bus_addr_t dmamap_seg_addrs[NUM_DMA_SEGS]; - bus_size_t dmamap_seg_sizes[NUM_DMA_SEGS]; + bus_addr_t dmamap_seg_addrs[ALLOCATED_DMA_SEGS]; + bus_size_t dmamap_seg_sizes[ALLOCATED_DMA_SEGS]; int dmamap_seg_count; int dmamap_seg_index; int dmamap_status; + uint32_t blksz_and_count; + uint32_t cmd_and_mode; + bool need_update_blk; +#ifdef NOTYET + device_t clkman; +#endif + struct bcm_mmc_conf * conf; }; static int bcm_sdhci_probe(device_t); @@ -122,6 +180,7 @@ static void bcm_sdhci_intr(void *); static int bcm_sdhci_get_ro(device_t, device_t); static void bcm_sdhci_dma_intr(int ch, void *arg); +static void bcm_sdhci_start_dma(struct sdhci_slot *slot); static void bcm_sdhci_dmacb(void *arg, bus_dma_segment_t *segs, int nseg, int err) @@ -129,6 +188,8 @@ bcm_sdhci_dmacb(void *arg, bus_dma_segment_t *segs, in struct bcm_sdhci_softc *sc = arg; int i; + /* Sanity check: we can only ever have one mapping at a time. */ + KASSERT(sc->dmamap_seg_count == 0, ("leaked DMA segment")); sc->dmamap_status = err; sc->dmamap_seg_count = nseg; @@ -166,8 +227,12 @@ bcm_sdhci_attach(device_t dev) sc->sc_dev = dev; sc->sc_req = NULL; - err = bcm2835_mbox_set_power_state(BCM2835_MBOX_POWER_ID_EMMC, - TRUE); + sc->conf = (struct bcm_mmc_conf *)ofw_bus_search_compatible(dev, + compat_data)->ocd_data; + if (sc->conf == 0) + return (ENXIO); + + err = bcm2835_mbox_set_power_state(BCM2835_MBOX_POWER_ID_EMMC, TRUE); if (err != 0) { if (bootverbose) device_printf(dev, "Unable to enable the power\n"); @@ -175,8 +240,7 @@ bcm_sdhci_attach(device_t dev) } default_freq = 0; - err = bcm2835_mbox_get_clock_rate(BCM2835_MBOX_CLOCK_ID_EMMC, - &default_freq); + err = bcm2835_mbox_get_clock_rate(sc->conf->clock_id, &default_freq); if (err == 0) { /* Convert to MHz */ default_freq /= 1000000; @@ -188,11 +252,31 @@ bcm_sdhci_attach(device_t dev) default_freq = cell / 1000000; } if (default_freq == 0) - default_freq = BCM2835_DEFAULT_SDHCI_FREQ; + default_freq = sc->conf->default_freq; if (bootverbose) device_printf(dev, "SDHCI frequency: %dMHz\n", default_freq); +#ifdef NOTYET + if (sc->conf->clock_src > 0) { + uint32_t f; + sc->clkman = devclass_get_device( + devclass_find("bcm2835_clkman"), 0); + if (sc->clkman == NULL) { + device_printf(dev, "cannot find Clock Manager\n"); + return (ENXIO); + } + f = bcm2835_clkman_set_frequency(sc->clkman, + sc->conf->clock_src, default_freq); + if (f == 0) + return (EINVAL); + + if (bootverbose) + device_printf(dev, "Clock source frequency: %dMHz\n", + f); + } +#endif + rid = 0; sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -207,7 +291,7 @@ bcm_sdhci_attach(device_t dev) rid = 0; sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_ACTIVE); + RF_ACTIVE | RF_SHAREABLE); if (!sc->sc_irq_res) { device_printf(dev, "cannot allocate interrupt\n"); err = ENXIO; @@ -228,24 +312,27 @@ bcm_sdhci_attach(device_t dev) if (bcm2835_sdhci_hs) sc->sc_slot.caps |= SDHCI_CAN_DO_HISPD; sc->sc_slot.caps |= (default_freq << SDHCI_CLOCK_BASE_SHIFT); - sc->sc_slot.quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK - | SDHCI_QUIRK_BROKEN_TIMEOUT_VAL - | SDHCI_QUIRK_DONT_SET_HISPD_BIT - | SDHCI_QUIRK_MISSING_CAPS; - + sc->sc_slot.quirks = sc->conf->quirks; + sdhci_init_slot(dev, &sc->sc_slot, 0); sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_ANY); if (sc->sc_dma_ch == BCM_DMA_CH_INVALID) goto fail; - bcm_dma_setup_intr(sc->sc_dma_ch, bcm_sdhci_dma_intr, sc); + err = bcm_dma_setup_intr(sc->sc_dma_ch, bcm_sdhci_dma_intr, sc); + if (err != 0) { + device_printf(dev, + "cannot setup dma interrupt handler\n"); + err = ENXIO; + goto fail; + } /* Allocate bus_dma resources. */ err = bus_dma_tag_create(bus_get_dma_tag(dev), - 1, 0, BUS_SPACE_MAXADDR_32BIT, + 1, 0, bcm283x_dmabus_peripheral_lowaddr(), BUS_SPACE_MAXADDR, NULL, NULL, - BCM_SDHCI_BUFFER_SIZE, NUM_DMA_SEGS, BCM_SDHCI_BUFFER_SIZE, + BCM_DMA_MAXSIZE, ALLOCATED_DMA_SEGS, BCM_SDHCI_BUFFER_SIZE, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_dma_tag); @@ -269,6 +356,10 @@ bcm_sdhci_attach(device_t dev) sdhci_start_slot(&sc->sc_slot); + /* Seed our copies. */ + sc->blksz_and_count = SDHCI_READ_4(dev, &sc->sc_slot, SDHCI_BLOCK_SIZE); + sc->cmd_and_mode = SDHCI_READ_4(dev, &sc->sc_slot, SDHCI_TRANSFER_MODE); + return (0); fail: @@ -319,7 +410,7 @@ WR4(struct bcm_sdhci_softc *sc, bus_size_t off, uint32 /* * The Arasan HC has a bug where it may lose the content of * consecutive writes to registers that are within two SD-card - * clock cycles of each other (a clock domain crossing problem). + * clock cycles of each other (a clock domain crossing problem). */ if (sc->sc_slot.clock > 0) DELAY(((2 * 1000000) / sc->sc_slot.clock) + 1); @@ -338,17 +429,21 @@ static uint16_t bcm_sdhci_read_2(device_t dev, struct sdhci_slot *slot, bus_size_t off) { struct bcm_sdhci_softc *sc = device_get_softc(dev); - uint32_t val = RD4(sc, off & ~3); + uint32_t val32; /* - * Standard 32-bit handling of command and transfer mode. + * Standard 32-bit handling of command and transfer mode, as + * well as block size and count. */ - if (off == SDHCI_TRANSFER_MODE) { - return (sc->cmd_and_mode >> 16); - } else if (off == SDHCI_COMMAND_FLAGS) { - return (sc->cmd_and_mode & 0x0000ffff); - } - return ((val >> (off & 3)*8) & 0xffff); + if ((off == SDHCI_BLOCK_SIZE || off == SDHCI_BLOCK_COUNT) && + sc->need_update_blk) + val32 = sc->blksz_and_count; + else if (off == SDHCI_TRANSFER_MODE || off == SDHCI_COMMAND_FLAGS) + val32 = sc->cmd_and_mode; + else + val32 = RD4(sc, off & ~3); + + return ((val32 >> (off & 3)*8) & 0xffff); } static uint32_t @@ -369,7 +464,8 @@ bcm_sdhci_read_multi_4(device_t dev, struct sdhci_slot } static void -bcm_sdhci_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint8_t val) +bcm_sdhci_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint8_t val) { struct bcm_sdhci_softc *sc = device_get_softc(dev); uint32_t val32 = RD4(sc, off & ~3); @@ -379,27 +475,54 @@ bcm_sdhci_write_1(device_t dev, struct sdhci_slot *slo } static void -bcm_sdhci_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint16_t val) +bcm_sdhci_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint16_t val) { struct bcm_sdhci_softc *sc = device_get_softc(dev); uint32_t val32; - if (off == SDHCI_COMMAND_FLAGS) + + /* + * If we have a queued up 16bit value for blk size or count, use and + * update the saved value rather than doing any real register access. + * If we did not touch either since the last write, then read from + * register as at least block count can change. + * Similarly, if we are about to issue a command, always use the saved + * value for transfer mode as we can never write that without issuing + * a command. + */ + if ((off == SDHCI_BLOCK_SIZE || off == SDHCI_BLOCK_COUNT) && + sc->need_update_blk) + val32 = sc->blksz_and_count; + else if (off == SDHCI_COMMAND_FLAGS) val32 = sc->cmd_and_mode; else val32 = RD4(sc, off & ~3); + val32 &= ~(0xffff << (off & 3)*8); val32 |= (val << (off & 3)*8); + if (off == SDHCI_TRANSFER_MODE) sc->cmd_and_mode = val32; - else { - WR4(sc, off & ~3, val32); - if (off == SDHCI_COMMAND_FLAGS) + else if (off == SDHCI_BLOCK_SIZE || off == SDHCI_BLOCK_COUNT) { + sc->blksz_and_count = val32; + sc->need_update_blk = true; + } else { + if (off == SDHCI_COMMAND_FLAGS) { + /* If we saved blk writes, do them now before cmd. */ + if (sc->need_update_blk) { + WR4(sc, SDHCI_BLOCK_SIZE, sc->blksz_and_count); + sc->need_update_blk = false; + } + /* Always save cmd and mode registers. */ sc->cmd_and_mode = val32; + } + WR4(sc, off & ~3, val32); } } static void -bcm_sdhci_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint32_t val) +bcm_sdhci_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint32_t val) { struct bcm_sdhci_softc *sc = device_get_softc(dev); WR4(sc, off, val); @@ -419,27 +542,35 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) { struct sdhci_slot *slot; vm_paddr_t pdst, psrc; - int err, idx, len, sync_op; + int err, idx, len, sync_op, width; slot = &sc->sc_slot; + mtx_assert(&slot->mtx, MA_OWNED); idx = sc->dmamap_seg_index++; len = sc->dmamap_seg_sizes[idx]; slot->offset += len; + width = (len & 0xf ? BCM_DMA_32BIT : BCM_DMA_128BIT); if (slot->curcmd->data->flags & MMC_DATA_READ) { - bcm_dma_setup_src(sc->sc_dma_ch, BCM_DMA_DREQ_EMMC, - BCM_DMA_SAME_ADDR, BCM_DMA_32BIT); + /* + * Peripherals on the AXI bus do not need DREQ pacing for reads + * from the ARM core, so we can safely set this to NONE. + */ + bcm_dma_setup_src(sc->sc_dma_ch, BCM_DMA_DREQ_NONE, + BCM_DMA_SAME_ADDR, BCM_DMA_32BIT); bcm_dma_setup_dst(sc->sc_dma_ch, BCM_DMA_DREQ_NONE, - BCM_DMA_INC_ADDR, - (len & 0xf) ? BCM_DMA_32BIT : BCM_DMA_128BIT); + BCM_DMA_INC_ADDR, width); psrc = sc->sc_sdhci_buffer_phys; pdst = sc->dmamap_seg_addrs[idx]; sync_op = BUS_DMASYNC_PREREAD; } else { + /* + * The ordering here is important, because the last write to + * dst/src in the dma control block writes the real dreq value. + */ bcm_dma_setup_src(sc->sc_dma_ch, BCM_DMA_DREQ_NONE, - BCM_DMA_INC_ADDR, - (len & 0xf) ? BCM_DMA_32BIT : BCM_DMA_128BIT); - bcm_dma_setup_dst(sc->sc_dma_ch, BCM_DMA_DREQ_EMMC, + BCM_DMA_INC_ADDR, width); + bcm_dma_setup_dst(sc->sc_dma_ch, sc->conf->emmc_dreq, BCM_DMA_SAME_ADDR, BCM_DMA_32BIT); psrc = sc->dmamap_seg_addrs[idx]; pdst = sc->sc_sdhci_buffer_phys; @@ -453,9 +584,9 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) */ if (idx == 0) { bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); - slot->intmask &= ~(SDHCI_INT_DATA_AVAIL | - SDHCI_INT_SPACE_AVAIL | SDHCI_INT_DATA_END); - bcm_sdhci_write_4(sc->sc_dev, &sc->sc_slot, SDHCI_SIGNAL_ENABLE, + + slot->intmask &= ~DATA_XFER_MASK; + bcm_sdhci_write_4(sc->sc_dev, slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } @@ -468,15 +599,47 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) } static void +bcm_sdhci_dma_exit(struct bcm_sdhci_softc *sc) +{ + struct sdhci_slot *slot = &sc->sc_slot; + + mtx_assert(&slot->mtx, MA_OWNED); + + /* Re-enable interrupts */ + slot->intmask |= DATA_XFER_MASK; + bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, + slot->intmask); +} + +static void +bcm_sdhci_dma_unload(struct bcm_sdhci_softc *sc) +{ + struct sdhci_slot *slot = &sc->sc_slot; + + if (sc->dmamap_seg_count == 0) + return; + if ((slot->curcmd->data->flags & MMC_DATA_READ) != 0) + bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, + BUS_DMASYNC_POSTREAD); + else + bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sc_dma_tag, sc->sc_dma_map); + + sc->dmamap_seg_count = 0; + sc->dmamap_seg_index = 0; +} + +static void bcm_sdhci_dma_intr(int ch, void *arg) { struct bcm_sdhci_softc *sc = (struct bcm_sdhci_softc *)arg; struct sdhci_slot *slot = &sc->sc_slot; - uint32_t reg, mask; - int left, sync_op; + uint32_t reg; mtx_lock(&slot->mtx); - + if (slot->curcmd == NULL) + goto out; /* * If there are more segments for the current dma, start the next one. * Otherwise unload the dma map and decide what to do next based on the @@ -484,93 +647,64 @@ bcm_sdhci_dma_intr(int ch, void *arg) */ if (sc->dmamap_seg_index < sc->dmamap_seg_count) { bcm_sdhci_start_dma_seg(sc); - mtx_unlock(&slot->mtx); - return; + goto out; } - if (slot->curcmd->data->flags & MMC_DATA_READ) { - sync_op = BUS_DMASYNC_POSTREAD; - mask = SDHCI_INT_DATA_AVAIL; - } else { - sync_op = BUS_DMASYNC_POSTWRITE; - mask = SDHCI_INT_SPACE_AVAIL; - } - bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); - bus_dmamap_unload(sc->sc_dma_tag, sc->sc_dma_map); + bcm_sdhci_dma_unload(sc); - sc->dmamap_seg_count = 0; - sc->dmamap_seg_index = 0; + /* + * If we had no further segments pending, we need to determine how to + * proceed next. If the 'data/space pending' bit is already set and we + * can continue via DMA, do so. Otherwise, re-enable interrupts and + * return. + */ + reg = bcm_sdhci_read_4(slot->bus, slot, SDHCI_INT_STATUS) & + DATA_XFER_MASK; + if ((reg & DATA_PENDING_MASK) != 0 && + BCM_SDHCI_SEGSZ_LEFT(slot) >= BCM_SDHCI_BUFFER_SIZE) { + /* ACK any pending interrupts */ + bcm_sdhci_write_4(slot->bus, slot, SDHCI_INT_STATUS, + DATA_PENDING_MASK); - left = min(BCM_SDHCI_BUFFER_SIZE, - slot->curcmd->data->len - slot->offset); - - /* DATA END? */ - reg = bcm_sdhci_read_4(slot->bus, slot, SDHCI_INT_STATUS); - - if (reg & SDHCI_INT_DATA_END) { - /* ACK for all outstanding interrupts */ - bcm_sdhci_write_4(slot->bus, slot, SDHCI_INT_STATUS, reg); - - /* enable INT */ - slot->intmask |= SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL - | SDHCI_INT_DATA_END; - bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, - slot->intmask); - - /* finish this data */ - sdhci_finish_data(slot); - } - else { - /* already available? */ - if (reg & mask) { - - /* ACK for DATA_AVAIL or SPACE_AVAIL */ - bcm_sdhci_write_4(slot->bus, slot, - SDHCI_INT_STATUS, mask); - - /* continue next DMA transfer */ - if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, - (uint8_t *)slot->curcmd->data->data + - slot->offset, left, bcm_sdhci_dmacb, sc, - BUS_DMA_NOWAIT) != 0 || sc->dmamap_status != 0) { - slot->curcmd->error = MMC_ERR_NO_MEMORY; - sdhci_finish_data(slot); - } else { - bcm_sdhci_start_dma_seg(sc); - } - } else { - /* wait for next data by INT */ - - /* enable INT */ - slot->intmask |= SDHCI_INT_DATA_AVAIL | - SDHCI_INT_SPACE_AVAIL | SDHCI_INT_DATA_END; - bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, - slot->intmask); + bcm_sdhci_start_dma(slot); + if (slot->curcmd->error != 0) { + /* We won't recover from this error for this command. */ + bcm_sdhci_dma_unload(sc); + bcm_sdhci_dma_exit(sc); + sdhci_finish_data(slot); } + } else if ((reg & SDHCI_INT_DATA_END) != 0) { + bcm_sdhci_dma_exit(sc); + bcm_sdhci_write_4(slot->bus, slot, SDHCI_INT_STATUS, + reg); + slot->flags &= ~PLATFORM_DATA_STARTED; + sdhci_finish_data(slot); + } else { + bcm_sdhci_dma_exit(sc); } - +out: mtx_unlock(&slot->mtx); } static void -bcm_sdhci_read_dma(device_t dev, struct sdhci_slot *slot) +bcm_sdhci_start_dma(struct sdhci_slot *slot) { struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); + uint8_t *buf; size_t left; - if (sc->dmamap_seg_count != 0) { - device_printf(sc->sc_dev, "DMA in use\n"); - return; - } + mtx_assert(&slot->mtx, MA_OWNED); - left = min(BCM_SDHCI_BUFFER_SIZE, - slot->curcmd->data->len - slot->offset); + left = BCM_SDHCI_SEGSZ_LEFT(slot); + buf = (uint8_t *)slot->curcmd->data->data + slot->offset; + KASSERT(left != 0, + ("%s: DMA handling incorrectly indicated", __func__)); - KASSERT((left & 3) == 0, - ("%s: len = %zu, not word-aligned", __func__, left)); - - if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, - (uint8_t *)slot->curcmd->data->data + slot->offset, left, + /* + * No need to check segment count here; if we've not yet unloaded + * previous segments, we'll catch that in bcm_sdhci_dmacb. + */ + if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, buf, left, bcm_sdhci_dmacb, sc, BUS_DMA_NOWAIT) != 0 || sc->dmamap_status != 0) { slot->curcmd->error = MMC_ERR_NO_MEMORY; @@ -581,50 +715,29 @@ bcm_sdhci_read_dma(device_t dev, struct sdhci_slot *sl bcm_sdhci_start_dma_seg(sc); } -static void -bcm_sdhci_write_dma(device_t dev, struct sdhci_slot *slot) -{ - struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); - size_t left; - - if (sc->dmamap_seg_count != 0) { - device_printf(sc->sc_dev, "DMA in use\n"); - return; - } - - left = min(BCM_SDHCI_BUFFER_SIZE, - slot->curcmd->data->len - slot->offset); - - KASSERT((left & 3) == 0, - ("%s: len = %zu, not word-aligned", __func__, left)); - - if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, - (uint8_t *)slot->curcmd->data->data + slot->offset, left, - bcm_sdhci_dmacb, sc, BUS_DMA_NOWAIT) != 0 || - sc->dmamap_status != 0) { - slot->curcmd->error = MMC_ERR_NO_MEMORY; - return; - } - - /* DMA start */ - bcm_sdhci_start_dma_seg(sc); -} - static int bcm_sdhci_will_handle_transfer(device_t dev, struct sdhci_slot *slot) { - size_t left; +#ifdef INVARIANTS + struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); +#endif /* - * Do not use DMA for transfers less than block size or with a length - * that is not a multiple of four. + * This indicates that we somehow let a data interrupt slip by into the + * SDHCI framework, when it should not have. This really needs to be + * caught and fixed ASAP, as it really shouldn't happen. */ - left = min(BCM_DMA_BLOCK_SIZE, - slot->curcmd->data->len - slot->offset); - if (left < BCM_DMA_BLOCK_SIZE) + KASSERT(sc->dmamap_seg_count == 0, + ("data pending interrupt pushed through SDHCI framework")); + + /* + * Do not use DMA for transfers less than our block size. Checking + * alignment serves little benefit, as we round transfer sizes down to + * a multiple of the block size and push the transfer back to + * SDHCI-driven PIO once we're below the block size. + */ + if (BCM_SDHCI_SEGSZ_LEFT(slot) < BCM_DMA_BLOCK_SIZE) return (0); - if (left & 0x03) - return (0); return (1); } @@ -635,16 +748,30 @@ bcm_sdhci_start_transfer(device_t dev, struct sdhci_sl { /* DMA transfer FIFO 1KB */ - if (slot->curcmd->data->flags & MMC_DATA_READ) - bcm_sdhci_read_dma(dev, slot); - else - bcm_sdhci_write_dma(dev, slot); + bcm_sdhci_start_dma(slot); } static void bcm_sdhci_finish_transfer(device_t dev, struct sdhci_slot *slot) { + struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); + /* + * Clean up. Interrupts are clearly enabled, because we received an + * SDHCI_INT_DATA_END to get this far -- just make sure we don't leave + * anything laying around. + */ + if (sc->dmamap_seg_count != 0) { + /* + * Our segment math should have worked out such that we would + * never finish the transfer without having used up all of the + * segments. If we haven't, that means we must have erroneously + * regressed to SDHCI-driven PIO to finish the operation and + * this is certainly caused by developer-error. + */ + bcm_sdhci_dma_unload(sc); + } + sdhci_finish_data(slot); } @@ -692,6 +819,9 @@ static driver_t bcm_sdhci_driver = { DRIVER_MODULE(sdhci_bcm, simplebus, bcm_sdhci_driver, bcm_sdhci_devclass, NULL, NULL); +#ifdef NOTYET +MODULE_DEPEND(sdhci_bcm, bcm2835_clkman, 1, 1, 1); +#endif SDHCI_DEPEND(sdhci_bcm); #ifndef MMCCAM MMC_DECLARE_BRIDGE(sdhci_bcm); Copied and modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c (from r354876, head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c) ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c Wed Nov 20 05:04:44 2019 (r354876, copy source) +++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c Thu Dec 12 19:21:16 2019 (r355665) @@ -67,7 +67,7 @@ struct bcm283x_memory_mapping { vm_paddr_t vcbus_start; }; -#if defined(SOC_BCM2835) || defined(SOC_BCM2836) +#ifdef SOC_BCM2835 static struct bcm283x_memory_mapping bcm2835_memmap[] = { { /* SDRAM */ @@ -85,6 +85,24 @@ static struct bcm283x_memory_mapping bcm2835_memmap[] }; #endif +#ifdef SOC_BCM2836 +static struct bcm283x_memory_mapping bcm2836_memmap[] = { + { + /* SDRAM */ + .armc_start = 0x00000000, + .armc_size = BCM2836_ARM_IO_BASE, + .vcbus_start = BCM2836_VCBUS_SDRAM_BASE, + }, + { + /* Peripherals */ + .armc_start = BCM2836_ARM_IO_BASE, + .armc_size = BCM28XX_ARM_IO_SIZE, + .vcbus_start = BCM2836_VCBUS_IO_BASE, + }, + { 0, 0, 0 }, +}; +#endif + #ifdef SOC_BRCM_BCM2837 static struct bcm283x_memory_mapping bcm2837_memmap[] = { { @@ -142,7 +160,7 @@ static struct bcm283x_memory_soc_cfg { #endif #ifdef SOC_BCM2836 { - .memmap = bcm2835_memmap, + .memmap = bcm2836_memmap, .soc_compat = "brcm,bcm2836", .busdma_lowaddr = BUS_SPACE_MAXADDR_32BIT, }, @@ -156,6 +174,11 @@ static struct bcm283x_memory_soc_cfg { }, #endif #ifdef SOC_BRCM_BCM2838 + { + .memmap = bcm2838_memmap, + .soc_compat = "brcm,bcm2711", + .busdma_lowaddr = BCM2838_PERIPH_MAXADDR, + }, { .memmap = bcm2838_memmap, .soc_compat = "brcm,bcm2838", Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h ============================================================================== --- stable/12/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h Thu Dec 12 19:17:30 2019 (r355664) +++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h Thu Dec 12 19:21:16 2019 (r355665) @@ -35,47 +35,47 @@ #ifndef _BCM2835_VCBUS_H_ #define _BCM2835_VCBUS_H_ -/* - * ARM64 define its SOC options in opt_soc.h - */ -#if defined(__aarch64__) -#include "opt_soc.h" -#endif - #define BCM2835_VCBUS_SDRAM_CACHED 0x40000000 -#define BCM2835_VCBUS_IO_BASE 0x7E000000 #define BCM2835_VCBUS_SDRAM_UNCACHED 0xC0000000 -#if defined(SOC_BCM2835) #define BCM2835_ARM_IO_BASE 0x20000000 +#define BCM2835_VCBUS_IO_BASE 0x7E000000 #define BCM2835_VCBUS_SDRAM_BASE BCM2835_VCBUS_SDRAM_CACHED -#else -#define BCM2835_ARM_IO_BASE 0x3f000000 -#define BCM2835_VCBUS_SDRAM_BASE BCM2835_VCBUS_SDRAM_UNCACHED -#endif -#define BCM2835_ARM_IO_SIZE 0x01000000 -/* - * Convert physical address to VC bus address. Should be used - * when submitting address over mailbox interface - */ -#define PHYS_TO_VCBUS(pa) ((pa) + BCM2835_VCBUS_SDRAM_BASE) +#define BCM2836_ARM_IO_BASE 0x3f000000 +#define BCM2836_VCBUS_IO_BASE BCM2835_VCBUS_IO_BASE +#define BCM2836_VCBUS_SDRAM_BASE BCM2835_VCBUS_SDRAM_UNCACHED -/* Check whether pa bellong top IO window */ -#define BCM2835_ARM_IS_IO(pa) (((pa) >= BCM2835_ARM_IO_BASE) && \ - ((pa) < BCM2835_ARM_IO_BASE + BCM2835_ARM_IO_SIZE)) +#define BCM2837_ARM_IO_BASE BCM2836_ARM_IO_BASE +#define BCM2837_VCBUS_IO_BASE BCM2835_VCBUS_IO_BASE +#define BCM2837_VCBUS_SDRAM_BASE BCM2835_VCBUS_SDRAM_UNCACHED -/* - * Convert physical address in IO space to VC bus address. - */ -#define IO_TO_VCBUS(pa) ((pa - BCM2835_ARM_IO_BASE) + \ - BCM2835_VCBUS_IO_BASE) +#define BCM2838_ARM_IO_BASE 0xfe000000 +#define BCM2838_VCBUS_IO_BASE BCM2835_VCBUS_IO_BASE +#define BCM2838_VCBUS_SDRAM_BASE BCM2835_VCBUS_SDRAM_UNCACHED /* - * Convert address from VC bus space to physical. Should be used - * when address is returned by VC over mailbox interface. e.g. - * framebuffer base + * Max allowed SDRAM mapping for most peripherals. The Raspberry Pi 4 has more + * than 1 GB of SDRAM, but only the lowest 1 GB is mapped into the "Legacy + * Master view" of the address space accessible by the DMA engine. Technically, + * we can slide this window around to whatever similarly sized range is + * convenient, but this is the most useful window given how busdma(9) works and + * that the window must be reconfigured for all channels in a given DMA engine. + * The DMA lite engine's window can be configured separately from the 30-bit DMA + * engine. */ -#define VCBUS_TO_PHYS(vca) ((vca) & ~(BCM2835_VCBUS_SDRAM_BASE)) +#define BCM2838_PERIPH_MAXADDR 0x3fffffff + +#define BCM28XX_ARM_IO_SIZE 0x01000000 + +vm_paddr_t bcm283x_armc_to_vcbus(vm_paddr_t pa); +vm_paddr_t bcm283x_vcbus_to_armc(vm_paddr_t vca); +bus_addr_t bcm283x_dmabus_peripheral_lowaddr(void); + +#define ARMC_TO_VCBUS(pa) bcm283x_armc_to_vcbus(pa) +#define VCBUS_TO_ARMC(vca) bcm283x_vcbus_to_armc(vca) + +/* Compatibility name for vchiq arm interface. */ +#define PHYS_TO_VCBUS ARMC_TO_VCBUS #endif /* _BCM2835_VCBUS_H_ */ Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2836.c ============================================================================== --- stable/12/sys/arm/broadcom/bcm2835/bcm2836.c Thu Dec 12 19:17:30 2019 (r355664) +++ stable/12/sys/arm/broadcom/bcm2835/bcm2836.c Thu Dec 12 19:21:16 2019 (r355665) @@ -658,6 +658,8 @@ bcm_lintc_probe(device_t dev) if (!ofw_bus_is_compatible(dev, "brcm,bcm2836-l1-intc")) return (ENXIO); + if (!ofw_bus_has_prop(dev, "interrupt-controller")) + return (ENXIO); device_set_desc(dev, "BCM2836 Interrupt Controller"); return (BUS_PROBE_DEFAULT); } Modified: stable/12/sys/arm/broadcom/bcm2835/files.bcm283x ============================================================================== --- stable/12/sys/arm/broadcom/bcm2835/files.bcm283x Thu Dec 12 19:17:30 2019 (r355664) +++ stable/12/sys/arm/broadcom/bcm2835/files.bcm283x Thu Dec 12 19:21:16 2019 (r355665) @@ -14,6 +14,7 @@ arm/broadcom/bcm2835/bcm2835_rng.c optional random arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu Dec 12 22:00:11 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F8D41DBC4B; Thu, 12 Dec 2019 22:00:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Ynlv1vB2z49X7; Thu, 12 Dec 2019 22:00:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BA1422BB; Thu, 12 Dec 2019 22:00:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBCM0B4O088522; Thu, 12 Dec 2019 22:00:11 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBCM0AhI088521; Thu, 12 Dec 2019 22:00:10 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912122200.xBCM0AhI088521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 12 Dec 2019 22:00:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355674 - in stable/12/sys/fs: nfs nfsserver X-SVN-Group: stable-12 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in stable/12/sys/fs: nfs nfsserver X-SVN-Commit-Revision: 355674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 22:00:11 -0000 Author: rmacklem Date: Thu Dec 12 22:00:10 2019 New Revision: 355674 URL: https://svnweb.freebsd.org/changeset/base/355674 Log: MFC: r354989 Fix the pNFS server's reporting of SpaceUsed (va_bytes). The pNFS server currently reports SpaceUsed (va_bytes) for the metadata file. This in not correct, since the metadata file is always empty and, as such, va_bytes is just the allocation for the empty file. This patch adds va_bytes to the list of attributes acquired from the DS for a file, so that it includes the allocated data size and is updated when the file is written. For files created on a pNFS server before this patch is applied, the va_bytes value is estimated by rounding va_size up to a multiple of BLKDEV_IOSIZE. Once the file is written after this patch has been applied to the metadata server, the va_bytes returned for the file will be correct. This patch only affects a pNFS metadata server. Found during testing of the NFSv4.2 pNFS server for the Allocate operation. (Not yet in head/current.) Modified: stable/12/sys/fs/nfs/nfsrvstate.h stable/12/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/nfs/nfsrvstate.h ============================================================================== --- stable/12/sys/fs/nfs/nfsrvstate.h Thu Dec 12 21:33:00 2019 (r355673) +++ stable/12/sys/fs/nfs/nfsrvstate.h Thu Dec 12 22:00:10 2019 (r355674) @@ -355,14 +355,24 @@ struct nfsdevice { }; /* - * This structure holds the va_size, va_filerev, va_atime and va_mtime for the - * DS file and is stored in the metadata file's extended attribute pnfsd.dsattr. + * This structure holds the va_size, va_filerev, va_atime, va_mtime and + * va_bytes for the DS file and is stored in the metadata file's extended + * attribute pnfsd.dsattr. + * opnfsdsattr was missing the va_bytes field and, as such, it was updated. */ +struct opnfsdsattr { + uint64_t dsa_filerev; + uint64_t dsa_size; + struct timespec dsa_atime; + struct timespec dsa_mtime; +}; + struct pnfsdsattr { uint64_t dsa_filerev; uint64_t dsa_size; struct timespec dsa_atime; struct timespec dsa_mtime; + uint64_t dsa_bytes; }; /* Modified: stable/12/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/12/sys/fs/nfsserver/nfs_nfsdport.c Thu Dec 12 21:33:00 2019 (r355673) +++ stable/12/sys/fs/nfsserver/nfs_nfsdport.c Thu Dec 12 22:00:10 2019 (r355674) @@ -277,7 +277,8 @@ nfsvno_getattr(struct vnode *vp, struct nfsvattr *nvap } /* - * Acquire the Change, Size and TimeModify attributes, as required. + * Acquire the Change, Size, TimeAccess, TimeModify and SpaceUsed + * attributes, as required. * This needs to be done for regular files if: * - non-NFSv4 RPCs or * - when attrbitp == NULL or @@ -292,7 +293,8 @@ nfsvno_getattr(struct vnode *vp, struct nfsvattr *nvap NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_CHANGE) || NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_SIZE) || NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_TIMEACCESS) || - NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_TIMEMODIFY))) { + NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_TIMEMODIFY) || + NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_SPACEUSED))) { error = nfsrv_proxyds(nd, vp, 0, 0, nd->nd_cred, p, NFSPROC_GETATTR, NULL, NULL, NULL, &na, NULL); if (error == 0) @@ -312,6 +314,7 @@ nfsvno_getattr(struct vnode *vp, struct nfsvattr *nvap nvap->na_mtime = na.na_mtime; nvap->na_filerev = na.na_filerev; nvap->na_size = na.na_size; + nvap->na_bytes = na.na_bytes; } NFSD_DEBUG(4, "nfsvno_getattr: gotattr=%d err=%d chg=%ju\n", gotattr, error, (uintmax_t)na.na_filerev); @@ -3880,6 +3883,7 @@ nfsrv_dscreate(struct vnode *dvp, struct vattr *vap, s dsa->dsa_size = va.va_size; dsa->dsa_atime = va.va_atime; dsa->dsa_mtime = va.va_mtime; + dsa->dsa_bytes = va.va_bytes; } } if (error == 0) { @@ -4404,6 +4408,7 @@ nfsrv_proxyds(struct nfsrv_descript *nd, struct vnode struct vnode *dvp[NFSDEV_MAXMIRRORS]; struct nfsdevice *ds; struct pnfsdsattr dsattr; + struct opnfsdsattr odsattr; char *buf; int buflen, error, failpos, i, mirrorcnt, origmircnt, trycnt; @@ -4428,15 +4433,31 @@ nfsrv_proxyds(struct nfsrv_descript *nd, struct vnode error = vn_extattr_get(vp, IO_NODELOCKED, EXTATTR_NAMESPACE_SYSTEM, "pnfsd.dsattr", &buflen, buf, p); - if (error == 0 && buflen != sizeof(dsattr)) - error = ENXIO; if (error == 0) { - NFSBCOPY(buf, &dsattr, buflen); - nap->na_filerev = dsattr.dsa_filerev; - nap->na_size = dsattr.dsa_size; - nap->na_atime = dsattr.dsa_atime; - nap->na_mtime = dsattr.dsa_mtime; - + if (buflen == sizeof(odsattr)) { + NFSBCOPY(buf, &odsattr, buflen); + nap->na_filerev = odsattr.dsa_filerev; + nap->na_size = odsattr.dsa_size; + nap->na_atime = odsattr.dsa_atime; + nap->na_mtime = odsattr.dsa_mtime; + /* + * Fake na_bytes by rounding up na_size. + * Since we don't know the block size, just + * use BLKDEV_IOSIZE. + */ + nap->na_bytes = (odsattr.dsa_size + + BLKDEV_IOSIZE - 1) & ~(BLKDEV_IOSIZE - 1); + } else if (buflen == sizeof(dsattr)) { + NFSBCOPY(buf, &dsattr, buflen); + nap->na_filerev = dsattr.dsa_filerev; + nap->na_size = dsattr.dsa_size; + nap->na_atime = dsattr.dsa_atime; + nap->na_mtime = dsattr.dsa_mtime; + nap->na_bytes = dsattr.dsa_bytes; + } else + error = ENXIO; + } + if (error == 0) { /* * If nfsrv_pnfsgetdsattr is 0 or nfsrv_checkdsattr() * returns 0, just return now. nfsrv_checkdsattr() @@ -4808,6 +4829,7 @@ nfsrv_setextattr(struct vnode *vp, struct nfsvattr *na dsattr.dsa_size = nap->na_size; dsattr.dsa_atime = nap->na_atime; dsattr.dsa_mtime = nap->na_mtime; + dsattr.dsa_bytes = nap->na_bytes; error = vn_extattr_set(vp, IO_NODELOCKED, EXTATTR_NAMESPACE_SYSTEM, "pnfsd.dsattr", sizeof(dsattr), (char *)&dsattr, p); if (error != 0) @@ -4983,12 +5005,13 @@ nfsrv_writedsdorpc(struct nfsmount *nmp, fhandle_t *fh nd->nd_bpos = mtod(m, char *) + m->m_len; NFSD_DEBUG(4, "nfsrv_writedsdorpc: lastmb len=%d\n", m->m_len); - /* Do a Getattr for Size, Change and Modify Time. */ + /* Do a Getattr for the attributes that change upon writing. */ NFSZERO_ATTRBIT(&attrbits); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SIZE); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_CHANGE); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEACCESS); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEMODIFY); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SPACEUSED); NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_GETATTR); (void) nfsrv_putattrbit(nd, &attrbits); @@ -5167,12 +5190,13 @@ nfsrv_setattrdsdorpc(fhandle_t *fhp, struct ucred *cre nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID); nfscl_fillsattr(nd, &nap->na_vattr, vp, NFSSATTR_FULL, 0); - /* Do a Getattr for Size, Change, Access Time and Modify Time. */ + /* Do a Getattr for the attributes that change due to writing. */ NFSZERO_ATTRBIT(&attrbits); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SIZE); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_CHANGE); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEACCESS); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEMODIFY); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SPACEUSED); NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_GETATTR); (void) nfsrv_putattrbit(nd, &attrbits); @@ -5469,7 +5493,7 @@ nfsrv_setacldsrpc(fhandle_t *fhp, struct ucred *cred, } /* - * Getattr call to the DS for the Modify, Size and Change attributes. + * Getattr call to the DS for the attributes that change due to writing. */ static int nfsrv_getattrdsrpc(fhandle_t *fhp, struct ucred *cred, NFSPROC_T *p, @@ -5488,6 +5512,7 @@ nfsrv_getattrdsrpc(fhandle_t *fhp, struct ucred *cred, NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_CHANGE); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEACCESS); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEMODIFY); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SPACEUSED); (void) nfsrv_putattrbit(nd, &attrbits); error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); From owner-svn-src-stable@freebsd.org Fri Dec 13 03:29:55 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 771AF1E1192; Fri, 13 Dec 2019 03:29:55 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Yx4M2J3hz4RFK; Fri, 13 Dec 2019 03:29:55 +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 4A0E760F4; Fri, 13 Dec 2019 03:29:55 +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 xBD3Ttgh088976; Fri, 13 Dec 2019 03:29:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBD3TtOk088975; Fri, 13 Dec 2019 03:29:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912130329.xBD3TtOk088975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 13 Dec 2019 03: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: r355689 - in stable: 11/sys/kern 12/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/kern 12/sys/kern X-SVN-Commit-Revision: 355689 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2019 03:29:55 -0000 Author: kevans Date: Fri Dec 13 03:29:54 2019 New Revision: 355689 URL: https://svnweb.freebsd.org/changeset/base/355689 Log: MFC r343777, r352244-r352245: kenv fix + assertions r343777: Fix zapping of static hints and env in init_static_kenv(). Environments are terminated by 2 NULs, but only 1 NUL was zapped. Zapping only 1 NUL just splits the first string into an empty string and a corrupted string. All other strings in static hints and env remained live early in the boot when they were supposed to be disabled. Support calling init_static_kenv() very early in the boot, so as to use the env very early in the boot. Then the pointer to the loader env may change after the first call due to enabling paging or otherwise remapping the pointer. Another call is needed to register the change. Don't use the previous pointer in this (or any) later call. r352244: kenv: assert that an empty static buffer passed in is "empty" Garbage in the passed-in buffer can cause problems if any attempts to read the kenv are inadvertently made between init_static_kenv and the first kern_setenv -- assuming there is one. This is cheap and easy, so do it. This also helps rule out some class of bugs as one tries to debug; tunables fetch from the static environment up until SI_SUB_KMEM + 1, and many of these buffers are global ~4k buffers that rely on BSS clearing while others just grab a page of free memory and use it (e.g. xen). r352245: Follow up r352244: kenv: tighten up assertions As I like to forget: static kenv var formatting is actually such that an empty environment would be double null bytes. We should make sure that a non-zero buffer has at least enough for this, though most of the current usage is with a 4k buffer. Modified: stable/11/sys/kern/kern_environment.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/kern/kern_environment.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/kern/kern_environment.c ============================================================================== --- stable/11/sys/kern/kern_environment.c Fri Dec 13 02:20:26 2019 (r355688) +++ stable/11/sys/kern/kern_environment.c Fri Dec 13 03:29:54 2019 (r355689) @@ -249,6 +249,33 @@ init_static_kenv(char *buf, size_t len) KASSERT(!dynamic_kenv, ("kenv: dynamic_kenv already initialized")); /* + * Suitably sized means it must be able to hold at least one empty + * variable, otherwise things go belly up if a kern_getenv call is + * made without a prior call to kern_setenv as we have a malformed + * environment. + */ + KASSERT(len == 0 || len >= 2, + ("kenv: static env must be initialized or suitably sized")); + KASSERT(len == 0 || (*buf == '\0' && *(buf + 1) == '\0'), + ("kenv: sized buffer must be initially empty")); + + /* + * We may be called twice, with the second call needed to relocate + * md_envp after enabling paging. md_envp is then garbage if it is + * not null and the relocation will move it. Discard it so as to + * not crash using its old value in our first call to kern_getenv(). + * + * The second call gives the same environment as the first except + * in silly configurations where the static env disables itself. + * + * Other env calls don't handle possibly-garbage pointers, so must + * not be made between enabling paging and calling here. + */ + md_envp = NULL; + md_env_len = 0; + md_env_pos = 0; + + /* * Give the static environment a chance to disable the loader(8) * environment first. This is done with loader_env.disabled=1. * @@ -284,12 +311,16 @@ init_static_kenv(char *buf, size_t len) md_env_pos = 0; eval = kern_getenv("static_env.disabled"); - if (eval != NULL && strcmp(eval, "1") == 0) - *static_env = '\0'; + if (eval != NULL && strcmp(eval, "1") == 0) { + static_env[0] = '\0'; + static_env[1] = '\0'; + } eval = kern_getenv("static_hints.disabled"); - if (eval != NULL && strcmp(eval, "1") == 0) - *static_hints = '\0'; + if (eval != NULL && strcmp(eval, "1") == 0) { + static_hints[0] = '\0'; + static_hints[1] = '\0'; + } /* * Now we see if we need to tear the loader environment back down due From owner-svn-src-stable@freebsd.org Fri Dec 13 03:29:55 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0C5A1E1196; Fri, 13 Dec 2019 03:29:55 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Yx4M4lRBz4RFL; Fri, 13 Dec 2019 03:29:55 +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 9E0D660F5; Fri, 13 Dec 2019 03:29:55 +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 xBD3Tt2J088982; Fri, 13 Dec 2019 03:29:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBD3TthP088981; Fri, 13 Dec 2019 03:29:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912130329.xBD3TthP088981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 13 Dec 2019 03:29:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355689 - in stable: 11/sys/kern 12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/kern 12/sys/kern X-SVN-Commit-Revision: 355689 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2019 03:29:55 -0000 Author: kevans Date: Fri Dec 13 03:29:54 2019 New Revision: 355689 URL: https://svnweb.freebsd.org/changeset/base/355689 Log: MFC r343777, r352244-r352245: kenv fix + assertions r343777: Fix zapping of static hints and env in init_static_kenv(). Environments are terminated by 2 NULs, but only 1 NUL was zapped. Zapping only 1 NUL just splits the first string into an empty string and a corrupted string. All other strings in static hints and env remained live early in the boot when they were supposed to be disabled. Support calling init_static_kenv() very early in the boot, so as to use the env very early in the boot. Then the pointer to the loader env may change after the first call due to enabling paging or otherwise remapping the pointer. Another call is needed to register the change. Don't use the previous pointer in this (or any) later call. r352244: kenv: assert that an empty static buffer passed in is "empty" Garbage in the passed-in buffer can cause problems if any attempts to read the kenv are inadvertently made between init_static_kenv and the first kern_setenv -- assuming there is one. This is cheap and easy, so do it. This also helps rule out some class of bugs as one tries to debug; tunables fetch from the static environment up until SI_SUB_KMEM + 1, and many of these buffers are global ~4k buffers that rely on BSS clearing while others just grab a page of free memory and use it (e.g. xen). r352245: Follow up r352244: kenv: tighten up assertions As I like to forget: static kenv var formatting is actually such that an empty environment would be double null bytes. We should make sure that a non-zero buffer has at least enough for this, though most of the current usage is with a 4k buffer. Modified: stable/12/sys/kern/kern_environment.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/kern/kern_environment.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/kern/kern_environment.c ============================================================================== --- stable/12/sys/kern/kern_environment.c Fri Dec 13 02:20:26 2019 (r355688) +++ stable/12/sys/kern/kern_environment.c Fri Dec 13 03:29:54 2019 (r355689) @@ -251,6 +251,33 @@ init_static_kenv(char *buf, size_t len) KASSERT(!dynamic_kenv, ("kenv: dynamic_kenv already initialized")); /* + * Suitably sized means it must be able to hold at least one empty + * variable, otherwise things go belly up if a kern_getenv call is + * made without a prior call to kern_setenv as we have a malformed + * environment. + */ + KASSERT(len == 0 || len >= 2, + ("kenv: static env must be initialized or suitably sized")); + KASSERT(len == 0 || (*buf == '\0' && *(buf + 1) == '\0'), + ("kenv: sized buffer must be initially empty")); + + /* + * We may be called twice, with the second call needed to relocate + * md_envp after enabling paging. md_envp is then garbage if it is + * not null and the relocation will move it. Discard it so as to + * not crash using its old value in our first call to kern_getenv(). + * + * The second call gives the same environment as the first except + * in silly configurations where the static env disables itself. + * + * Other env calls don't handle possibly-garbage pointers, so must + * not be made between enabling paging and calling here. + */ + md_envp = NULL; + md_env_len = 0; + md_env_pos = 0; + + /* * Give the static environment a chance to disable the loader(8) * environment first. This is done with loader_env.disabled=1. * @@ -275,12 +302,16 @@ init_static_kenv(char *buf, size_t len) md_env_pos = 0; eval = kern_getenv("static_env.disabled"); - if (eval != NULL && strcmp(eval, "1") == 0) - *kern_envp = '\0'; + if (eval != NULL && strcmp(eval, "1") == 0) { + kern_envp[0] = '\0'; + kern_envp[1] = '\0'; + } } eval = kern_getenv("static_hints.disabled"); - if (eval != NULL && strcmp(eval, "1") == 0) - *static_hints = '\0'; + if (eval != NULL && strcmp(eval, "1") == 0) { + static_hints[0] = '\0'; + static_hints[1] = '\0'; + } } static void From owner-svn-src-stable@freebsd.org Fri Dec 13 04:03:03 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EEF0A1E18CD; Fri, 13 Dec 2019 04:03:03 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Yxpb63t3z4SWm; Fri, 13 Dec 2019 04:03:03 +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 CB64A6812; Fri, 13 Dec 2019 04:03:03 +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 xBD433ae011977; Fri, 13 Dec 2019 04:03:03 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBD4333s011974; Fri, 13 Dec 2019 04:03:03 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912130403.xBD4333s011974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 13 Dec 2019 04:03: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: r355690 - in stable: 11/sys/kern 11/sys/sys 12/sys/kern 12/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/kern 11/sys/sys 12/sys/kern 12/sys/sys X-SVN-Commit-Revision: 355690 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2019 04:03:04 -0000 Author: kevans Date: Fri Dec 13 04:03:03 2019 New Revision: 355690 URL: https://svnweb.freebsd.org/changeset/base/355690 Log: MFC r352350: rangelock: add rangelock_cookie_assert A future change to posixshm to add file sealing will move locking out of shm_dotruncate as kern_shm_open() will require the lock to be held across the dotruncate until the seal is actually applied. For this, the cookie is passed into shm_dotruncate_locked which asserts RCA_WLOCKED. Modified: stable/11/sys/kern/kern_rangelock.c stable/11/sys/sys/rangelock.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/kern/kern_rangelock.c stable/12/sys/sys/rangelock.h Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/kern/kern_rangelock.c ============================================================================== --- stable/11/sys/kern/kern_rangelock.c Fri Dec 13 03:29:54 2019 (r355689) +++ stable/11/sys/kern/kern_rangelock.c Fri Dec 13 04:03:03 2019 (r355690) @@ -246,3 +246,35 @@ rangelock_wlock(struct rangelock *lock, off_t start, o return (rangelock_enqueue(lock, start, end, RL_LOCK_WRITE, ilk)); } + +#ifdef INVARIANT_SUPPORT +void +_rangelock_cookie_assert(void *cookie, int what, const char *file, int line) +{ + struct rl_q_entry *entry; + int flags; + + MPASS(cookie != NULL); + entry = cookie; + flags = entry->rl_q_flags; + switch (what) { + case RCA_LOCKED: + if ((flags & RL_LOCK_GRANTED) == 0) + panic("rangelock not held @ %s:%d\n", file, line); + break; + case RCA_RLOCKED: + if ((flags & (RL_LOCK_GRANTED | RL_LOCK_READ)) != + (RL_LOCK_GRANTED | RL_LOCK_READ)) + panic("rangelock not rlocked @ %s:%d\n", file, line); + break; + case RCA_WLOCKED: + if ((flags & (RL_LOCK_GRANTED | RL_LOCK_WRITE)) != + (RL_LOCK_GRANTED | RL_LOCK_WRITE)) + panic("rangelock not wlocked @ %s:%d\n", file, line); + break; + default: + panic("Unknown rangelock assertion: %d @ %s:%d", what, file, + line); + } +} +#endif /* INVARIANT_SUPPORT */ Modified: stable/11/sys/sys/rangelock.h ============================================================================== --- stable/11/sys/sys/rangelock.h Fri Dec 13 03:29:54 2019 (r355689) +++ stable/11/sys/sys/rangelock.h Fri Dec 13 04:03:03 2019 (r355690) @@ -76,6 +76,29 @@ void *rangelock_rlock(struct rangelock *lock, off_t st void *rangelock_wlock(struct rangelock *lock, off_t start, off_t end, struct mtx *ilk); void rlqentry_free(struct rl_q_entry *rlqe); +#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) +void _rangelock_cookie_assert(void *cookie, int what, const char *file, + int line); +#endif + +#ifdef INVARIANTS +#define rangelock_cookie_assert_(cookie, what, file, line) \ + _rangelock_cookie_assert((cookie), (what), (file), (line)) +#else +#define rangelock_cookie_assert_(cookie, what, file, line) (void)0 +#endif + +#define rangelock_cookie_assert(cookie, what) \ + rangelock_cookie_assert_((cookie), (what), __FILE__, __LINE__) + +/* + * Assertion flags. + */ +#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) +#define RCA_LOCKED 0x0001 +#define RCA_RLOCKED 0x0002 +#define RCA_WLOCKED 0x0004 +#endif #endif /* _KERNEL */ From owner-svn-src-stable@freebsd.org Fri Dec 13 04:03:04 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 860DA1E18D8; Fri, 13 Dec 2019 04:03:04 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Yxpc32xrz4SWn; Fri, 13 Dec 2019 04:03:04 +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 61CC26813; Fri, 13 Dec 2019 04:03:04 +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 xBD434iA011984; Fri, 13 Dec 2019 04:03:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBD434Qn011982; Fri, 13 Dec 2019 04:03:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912130403.xBD434Qn011982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 13 Dec 2019 04:03:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355690 - in stable: 11/sys/kern 11/sys/sys 12/sys/kern 12/sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/kern 11/sys/sys 12/sys/kern 12/sys/sys X-SVN-Commit-Revision: 355690 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2019 04:03:04 -0000 Author: kevans Date: Fri Dec 13 04:03:03 2019 New Revision: 355690 URL: https://svnweb.freebsd.org/changeset/base/355690 Log: MFC r352350: rangelock: add rangelock_cookie_assert A future change to posixshm to add file sealing will move locking out of shm_dotruncate as kern_shm_open() will require the lock to be held across the dotruncate until the seal is actually applied. For this, the cookie is passed into shm_dotruncate_locked which asserts RCA_WLOCKED. Modified: stable/12/sys/kern/kern_rangelock.c stable/12/sys/sys/rangelock.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/kern/kern_rangelock.c stable/11/sys/sys/rangelock.h Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/kern/kern_rangelock.c ============================================================================== --- stable/12/sys/kern/kern_rangelock.c Fri Dec 13 03:29:54 2019 (r355689) +++ stable/12/sys/kern/kern_rangelock.c Fri Dec 13 04:03:03 2019 (r355690) @@ -248,3 +248,35 @@ rangelock_wlock(struct rangelock *lock, off_t start, o return (rangelock_enqueue(lock, start, end, RL_LOCK_WRITE, ilk)); } + +#ifdef INVARIANT_SUPPORT +void +_rangelock_cookie_assert(void *cookie, int what, const char *file, int line) +{ + struct rl_q_entry *entry; + int flags; + + MPASS(cookie != NULL); + entry = cookie; + flags = entry->rl_q_flags; + switch (what) { + case RCA_LOCKED: + if ((flags & RL_LOCK_GRANTED) == 0) + panic("rangelock not held @ %s:%d\n", file, line); + break; + case RCA_RLOCKED: + if ((flags & (RL_LOCK_GRANTED | RL_LOCK_READ)) != + (RL_LOCK_GRANTED | RL_LOCK_READ)) + panic("rangelock not rlocked @ %s:%d\n", file, line); + break; + case RCA_WLOCKED: + if ((flags & (RL_LOCK_GRANTED | RL_LOCK_WRITE)) != + (RL_LOCK_GRANTED | RL_LOCK_WRITE)) + panic("rangelock not wlocked @ %s:%d\n", file, line); + break; + default: + panic("Unknown rangelock assertion: %d @ %s:%d", what, file, + line); + } +} +#endif /* INVARIANT_SUPPORT */ Modified: stable/12/sys/sys/rangelock.h ============================================================================== --- stable/12/sys/sys/rangelock.h Fri Dec 13 03:29:54 2019 (r355689) +++ stable/12/sys/sys/rangelock.h Fri Dec 13 04:03:03 2019 (r355690) @@ -78,6 +78,29 @@ void *rangelock_rlock(struct rangelock *lock, off_t st void *rangelock_wlock(struct rangelock *lock, off_t start, off_t end, struct mtx *ilk); void rlqentry_free(struct rl_q_entry *rlqe); +#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) +void _rangelock_cookie_assert(void *cookie, int what, const char *file, + int line); +#endif + +#ifdef INVARIANTS +#define rangelock_cookie_assert_(cookie, what, file, line) \ + _rangelock_cookie_assert((cookie), (what), (file), (line)) +#else +#define rangelock_cookie_assert_(cookie, what, file, line) (void)0 +#endif + +#define rangelock_cookie_assert(cookie, what) \ + rangelock_cookie_assert_((cookie), (what), __FILE__, __LINE__) + +/* + * Assertion flags. + */ +#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) +#define RCA_LOCKED 0x0001 +#define RCA_RLOCKED 0x0002 +#define RCA_WLOCKED 0x0004 +#endif #endif /* _KERNEL */ From owner-svn-src-stable@freebsd.org Fri Dec 13 05:29:27 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C4471E2E2E; Fri, 13 Dec 2019 05:29:27 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47YzkH2Fdbz4XGb; Fri, 13 Dec 2019 05:29:27 +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 4870C75FE; Fri, 13 Dec 2019 05:29:27 +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 xBD5TRAW059691; Fri, 13 Dec 2019 05:29:27 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBD5TRCD059690; Fri, 13 Dec 2019 05:29:27 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201912130529.xBD5TRCD059690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 13 Dec 2019 05:29:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355698 - stable/12/sys/x86/x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: stable/12/sys/x86/x86 X-SVN-Commit-Revision: 355698 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2019 05:29:27 -0000 Author: scottl Date: Fri Dec 13 05:29:26 2019 New Revision: 355698 URL: https://svnweb.freebsd.org/changeset/base/355698 Log: Merge r355134,355375,355589 Clean up and clarify meta commentary on TAA. Add a state to denote that TSX doesn't exist on the CPU. x86: Add missed break to TAA status sysctl Fix the TAA state machine to do the right thing when the TAA migitation is available in microcode and the operator has set the sysctl to automatic mode. Sponsored by: Intel Modified: stable/12/sys/x86/x86/cpu_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/x86/cpu_machdep.c ============================================================================== --- stable/12/sys/x86/x86/cpu_machdep.c Fri Dec 13 05:13:25 2019 (r355697) +++ stable/12/sys/x86/x86/cpu_machdep.c Fri Dec 13 05:29:26 2019 (r355698) @@ -1164,11 +1164,15 @@ SYSCTL_PROC(_hw, OID_AUTO, mds_disable, CTLTYPE_INT | int x86_taa_enable; int x86_taa_state; enum { - TAA_NONE = 0, - TAA_TSX_DISABLE = 1, - TAA_VERW = 2, - TAA_AUTO = 3, - TAA_TAA_NO = 4 + TAA_NONE = 0, /* No mitigation enabled */ + TAA_TSX_DISABLE = 1, /* Disable TSX via MSR */ + TAA_VERW = 2, /* Use VERW mitigation */ + TAA_AUTO = 3, /* Automatically select the mitigation */ + + /* The states below are not selectable by the operator */ + + TAA_TAA_UC = 4, /* Mitigation present in microcode */ + TAA_NOT_PRESENT = 5 /* TSX is not present */ }; static void @@ -1192,15 +1196,14 @@ x86_taa_recalculate(void) if ((cpu_stdext_feature & CPUID_STDEXT_HLE) == 0 || (cpu_stdext_feature & CPUID_STDEXT_RTM) == 0) { /* TSX is not present */ - x86_taa_state = 0; + x86_taa_state = TAA_NOT_PRESENT; return; } /* Check to see what mitigation options the CPU gives us */ if (cpu_ia32_arch_caps & IA32_ARCH_CAP_TAA_NO) { /* CPU is not suseptible to TAA */ - taa_need = TAA_NONE; - taa_state = TAA_TAA_NO; + taa_need = TAA_TAA_UC; } else if (cpu_ia32_arch_caps & IA32_ARCH_CAP_TSX_CTRL) { /* * CPU can turn off TSX. This is the next best option @@ -1307,8 +1310,11 @@ sysctl_taa_state_handler(SYSCTL_HANDLER_ARGS) case TAA_VERW: state = "VERW"; break; - case TAA_TAA_NO: - state = "Not vulnerable"; + case TAA_TAA_UC: + state = "Mitigated in microcode"; + break; + case TAA_NOT_PRESENT: + state = "TSX not present"; break; default: state = "unknown"; From owner-svn-src-stable@freebsd.org Fri Dec 13 06:54:41 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5E091E52AD; Fri, 13 Dec 2019 06:54:41 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Z1cd4pwzz4fy2; Fri, 13 Dec 2019 06:54:41 +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 9C39B8626; Fri, 13 Dec 2019 06:54:41 +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 xBD6sf4A016969; Fri, 13 Dec 2019 06:54:41 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBD6sfLW016968; Fri, 13 Dec 2019 06:54:41 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201912130654.xBD6sfLW016968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 13 Dec 2019 06:54: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: r355701 - stable/11/sys/x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: stable/11/sys/x86/x86 X-SVN-Commit-Revision: 355701 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2019 06:54:41 -0000 Author: scottl Date: Fri Dec 13 06:54:41 2019 New Revision: 355701 URL: https://svnweb.freebsd.org/changeset/base/355701 Log: Merge r355134,355375,355589 Clean up and clarify meta commentary on TAA. Add a state to denote that TSX doesn't exist on the CPU. x86: Add missed break to TAA status sysctl Fix the TAA state machine to do the right thing when the TAA migitation is available in microcode and the operator has set the sysctl to automatic mode. Sponsored by: Intel Modified: stable/11/sys/x86/x86/cpu_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/cpu_machdep.c ============================================================================== --- stable/11/sys/x86/x86/cpu_machdep.c Fri Dec 13 05:54:38 2019 (r355700) +++ stable/11/sys/x86/x86/cpu_machdep.c Fri Dec 13 06:54:41 2019 (r355701) @@ -1192,11 +1192,15 @@ SYSCTL_PROC(_hw, OID_AUTO, mds_disable, CTLTYPE_INT | int x86_taa_enable; int x86_taa_state; enum { - TAA_NONE = 0, - TAA_TSX_DISABLE = 1, - TAA_VERW = 2, - TAA_AUTO = 3, - TAA_TAA_NO = 4 + TAA_NONE = 0, /* No mitigation enabled */ + TAA_TSX_DISABLE = 1, /* Disable TSX via MSR */ + TAA_VERW = 2, /* Use VERW mitigation */ + TAA_AUTO = 3, /* Automatically select the mitigation */ + + /* The states below are not selectable by the operator */ + + TAA_TAA_UC = 4, /* Mitigation present in microcode */ + TAA_NOT_PRESENT = 5 /* TSX is not present */ }; static void @@ -1220,15 +1224,14 @@ x86_taa_recalculate(void) if ((cpu_stdext_feature & CPUID_STDEXT_HLE) == 0 || (cpu_stdext_feature & CPUID_STDEXT_RTM) == 0) { /* TSX is not present */ - x86_taa_state = 0; + x86_taa_state = TAA_NOT_PRESENT; return; } /* Check to see what mitigation options the CPU gives us */ if (cpu_ia32_arch_caps & IA32_ARCH_CAP_TAA_NO) { /* CPU is not suseptible to TAA */ - taa_need = TAA_NONE; - taa_state = TAA_TAA_NO; + taa_need = TAA_TAA_UC; } else if (cpu_ia32_arch_caps & IA32_ARCH_CAP_TSX_CTRL) { /* * CPU can turn off TSX. This is the next best option @@ -1335,8 +1338,11 @@ sysctl_taa_state_handler(SYSCTL_HANDLER_ARGS) case TAA_VERW: state = "VERW"; break; - case TAA_TAA_NO: - state = "Not vulnerable"; + case TAA_TAA_UC: + state = "Mitigated in microcode"; + break; + case TAA_NOT_PRESENT: + state = "TSX not present"; break; default: state = "unknown"; From owner-svn-src-stable@freebsd.org Fri Dec 13 09:19:24 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBAD81E7EDD; Fri, 13 Dec 2019 09:19:24 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Z4qc5mh3z3HkN; Fri, 13 Dec 2019 09:19:24 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C17CB9EBA; Fri, 13 Dec 2019 09:19:24 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBD9JODx098982; Fri, 13 Dec 2019 09:19:24 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBD9JORN098981; Fri, 13 Dec 2019 09:19:24 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201912130919.xBD9JORN098981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Fri, 13 Dec 2019 09:19:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355704 - stable/12/sys/mips/mips X-SVN-Group: stable-12 X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: stable/12/sys/mips/mips X-SVN-Commit-Revision: 355704 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2019 09:19:25 -0000 Author: rlibby Date: Fri Dec 13 09:19:24 2019 New Revision: 355704 URL: https://svnweb.freebsd.org/changeset/base/355704 Log: MFC r355343: mips busdma: bzero map on alloc Modified: stable/12/sys/mips/mips/busdma_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/mips/mips/busdma_machdep.c ============================================================================== --- stable/12/sys/mips/mips/busdma_machdep.c Fri Dec 13 08:41:37 2019 (r355703) +++ stable/12/sys/mips/mips/busdma_machdep.c Fri Dec 13 09:19:24 2019 (r355704) @@ -155,8 +155,6 @@ struct bus_dmamap { bus_dma_tag_t dmat; struct memdesc mem; int flags; - void *origbuffer; - void *allocbuffer; TAILQ_ENTRY(bus_dmamap) freelist; STAILQ_ENTRY(bus_dmamap) links; bus_dmamap_callback_t *callback; @@ -204,11 +202,8 @@ dmamap_ctor(void *mem, int size, void *arg, int flags) dmat->map_count++; + bzero(map, sizeof(*map)); map->dmat = dmat; - map->flags = 0; - map->slist = NULL; - map->allocbuffer = NULL; - map->sync_count = 0; STAILQ_INIT(&map->bpages); return (0); From owner-svn-src-stable@freebsd.org Fri Dec 13 20:45:46 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5278D1D670C; Fri, 13 Dec 2019 20:45:46 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ZN3Z1SlSz4Txs; Fri, 13 Dec 2019 20:45:46 +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 2D6A419E0E; Fri, 13 Dec 2019 20:45:46 +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 xBDKjkKH012942; Fri, 13 Dec 2019 20:45:46 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBDKjked012941; Fri, 13 Dec 2019 20:45:46 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912132045.xBDKjked012941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 13 Dec 2019 20:45: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: r355731 - stable/11/crypto/openssh X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/crypto/openssh X-SVN-Commit-Revision: 355731 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2019 20:45:46 -0000 Author: emaste Date: Fri Dec 13 20:45:45 2019 New Revision: 355731 URL: https://svnweb.freebsd.org/changeset/base/355731 Log: sftp: disallow creation (of empty files) in read-only mode Direct commit to stable/11; already fixed in newer OpenSSH in 12 and later. PR: 233801 Reported by: Dani Obtained from: OpenBSD 1.111 Security: CVE-2017-15906 Modified: stable/11/crypto/openssh/sftp-server.c Modified: stable/11/crypto/openssh/sftp-server.c ============================================================================== --- stable/11/crypto/openssh/sftp-server.c Fri Dec 13 20:38:58 2019 (r355730) +++ stable/11/crypto/openssh/sftp-server.c Fri Dec 13 20:45:45 2019 (r355731) @@ -691,8 +691,8 @@ process_open(u_int32_t id) logit("open \"%s\" flags %s mode 0%o", name, string_from_portable(pflags), mode); if (readonly && - ((flags & O_ACCMODE) == O_WRONLY || - (flags & O_ACCMODE) == O_RDWR)) { + ((flags & O_ACCMODE) != O_RDONLY || + (flags & (O_CREAT|O_TRUNC)) != 0)) { verbose("Refusing open request in read-only mode"); status = SSH2_FX_PERMISSION_DENIED; } else { From owner-svn-src-stable@freebsd.org Sat Dec 14 03:14:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01D071E01D0; Sat, 14 Dec 2019 03:14: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ZXhS6zJdz3P7r; Sat, 14 Dec 2019 03:14: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 EA5151E6DC; Sat, 14 Dec 2019 03:14: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 xBE3EmD0044530; Sat, 14 Dec 2019 03:14:48 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBE3Ekm3044517; Sat, 14 Dec 2019 03:14:46 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201912140314.xBE3Ekm3044517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 14 Dec 2019 03:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355745 - stable/12/contrib/openresolv X-SVN-Group: stable-12 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/12/contrib/openresolv X-SVN-Commit-Revision: 355745 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2019 03:14:49 -0000 Author: pfg Date: Sat Dec 14 03:14:46 2019 New Revision: 355745 URL: https://svnweb.freebsd.org/changeset/base/355745 Log: MFC 354924: MFV 354917, 354918, 354919 openresolv: update to version 3.9.2 Added: stable/12/contrib/openresolv/LICENSE - copied unchanged from r354924, head/contrib/openresolv/LICENSE stable/12/contrib/openresolv/README.md - copied unchanged from r354924, head/contrib/openresolv/README.md Deleted: stable/12/contrib/openresolv/README Modified: stable/12/contrib/openresolv/Makefile stable/12/contrib/openresolv/configure stable/12/contrib/openresolv/dnsmasq.in stable/12/contrib/openresolv/libc.in stable/12/contrib/openresolv/named.in stable/12/contrib/openresolv/pdns_recursor.in stable/12/contrib/openresolv/pdnsd.in stable/12/contrib/openresolv/resolvconf.conf stable/12/contrib/openresolv/resolvconf.conf.5.in stable/12/contrib/openresolv/resolvconf.in stable/12/contrib/openresolv/unbound.in Copied: stable/12/contrib/openresolv/LICENSE (from r354924, head/contrib/openresolv/LICENSE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/contrib/openresolv/LICENSE Sat Dec 14 03:14:46 2019 (r355745, copy of r354924, head/contrib/openresolv/LICENSE) @@ -0,0 +1,23 @@ +Copyright (c) 2007-2019 Roy Marples +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. Modified: stable/12/contrib/openresolv/Makefile ============================================================================== --- stable/12/contrib/openresolv/Makefile Sat Dec 14 02:06:07 2019 (r355744) +++ stable/12/contrib/openresolv/Makefile Sat Dec 14 03:14:46 2019 (r355745) @@ -10,6 +10,7 @@ SYSCONFDIR?= /etc LIBEXECDIR?= /libexec/resolvconf VARDIR?= /var/run/resolvconf +ECHO?= echo INSTALL?= install SED?= sed @@ -20,7 +21,7 @@ DOCMODE?= 0644 MANMODE?= 0444 RESOLVCONF= resolvconf resolvconf.8 resolvconf.conf.5 -SUBSCRIBERS= libc dnsmasq named pdnsd unbound +SUBSCRIBERS= libc dnsmasq named pdnsd pdns_recursor unbound TARGET= ${RESOLVCONF} ${SUBSCRIBERS} SRCS= ${TARGET:C,$,.in,} # pmake SRCS:= ${TARGET:=.in} # gmake @@ -42,7 +43,7 @@ DISTINFOSIGN= ${DISTINFO}.asc CKSUM?= cksum -a SHA256 PGP?= netpgp -FOSSILID?= current +GITREF?= HEAD .SUFFIXES: .in @@ -79,15 +80,17 @@ maninstall: install: proginstall maninstall -import: +dist-git: + git archive --prefix=${DISTPREFIX}/ ${GITREF} | xz >${DISTFILE} + +dist-inst: + mkdir /tmp/${DISTPREFIX} + cp -RPp * /tmp/${DISTPREFIX} + (cd /tmp/${DISTPREFIX}; make clean) + tar -cvjpf ${DISTFILE} -C /tmp ${DISTPREFIX} rm -rf /tmp/${DISTPREFIX} - ${INSTALL} -d /tmp/${DISTPREFIX} - cp README ${SRCS} /tmp/${DISTPREFIX} -dist: - fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ} - gunzip -c ${DISTFILEGZ} | xz >${DISTFILE} - rm ${DISTFILEGZ} +dist: dist-git distinfo: dist rm -f ${DISTINFO} ${DISTINFOSIGN} @@ -96,3 +99,20 @@ distinfo: dist ${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO} chmod 644 ${DISTINFOSIGN} ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN} + +import: dist + rm -rf /tmp/${DISTPREFIX} + ${INSTALL} -d /tmp/${DISTPREFIX} + tar xvJpf ${DISTFILE} -C /tmp + +_import-src: + rm -rf ${DESTDIR}/* + ${INSTALL} -d ${DESTDIR} + cp LICENSE README.md ${SRCS} resolvconf.conf ${DESTDIR}; + cp resolvconf.8.in resolvconf.conf.5.in ${DESTDIR}; + @${ECHO} + @${ECHO} "=============================================================" + @${ECHO} "openresolv-${VERSION} imported to ${DESTDIR}" + +import-src: + ${MAKE} _import-src DESTDIR=`if [ -n "${DESTDIR}" ]; then echo "${DESTDIR}"; else echo /tmp/${DISTPREFIX}; fi` Copied: stable/12/contrib/openresolv/README.md (from r354924, head/contrib/openresolv/README.md) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/contrib/openresolv/README.md Sat Dec 14 03:14:46 2019 (r355745, copy of r354924, head/contrib/openresolv/README.md) @@ -0,0 +1,64 @@ +# openresolv + +openresolv is a [resolvconf](https://en.wikipedia.org/wiki/Resolvconf) +implementation which manages `/etc/resolv.conf`. + +`/etc/resolv.conf` is a file that holds the configuration for the local +resolution of domain names. +Normally this file is either static or maintained by a local daemon, +normally a DHCP daemon. But what happens if more than one thing wants to +control the file? +Say you have wired and wireless interfaces to different subnets and run a VPN +or two on top of that, how do you say which one controls the file? +It's also not as easy as just adding and removing the nameservers each client +knows about as different clients could add the same nameservers. + +Enter resolvconf, the middleman between the network configuration services and +`/etc/resolv.conf`. +resolvconf itself is just a script that stores, removes and lists a full +`resolv.conf` generated for the interface. It then calls all the helper scripts +it knows about so it can configure the real `/etc/resolv.conf` and optionally +any local nameservers other than libc. + +## Reasons for using openresolv + +Why openresolv over the +[Debian implementation](http://qref.sourceforge.net/Debian/reference/ch-gateway.en.html#s-dns-resolvconf)? +Here's some reasons: + * Works with + [POSIX shell and userland](http://www.opengroup.org/onlinepubs/009695399) + * Does not need awk, grep or sed which means we can work without `/usr` + mounted + * Works with other init systems than Debians' out of the box + * Available as a 2 clause + [BSD license](http://www.freebsd.org/copyright/freebsd-license.html) + * Prefer configs via IF_METRIC for dynamic ordering + * Configures zones for local resolvers other than libc + +The last point is quite important, especially when running VPN systems. +Take the following resolv.conf files which have been generated by a +[DHCP client](../dhcpcd) and sent to resolvconf: + +``` +# resolv.conf from bge0 +search foo.com +nameserver 1.2.3.4 + +# resolv.conf from tap0 +domain bar.org +nameserver 5.6.7.8 +``` + +In this instance, queries for foo.com will go to 1.2.3.4 and queries for +bar.org will go to 5.6.7.8. +This does require the resolvers to be configured to pickup the resolvconf +generated configuration for them though. +openresolv ships with helpers for: + * [unbound](http://www.unbound.net/) + * [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) + * [ISC BIND](http://www.isc.org/software/bind) + * [PowerDNS Recursor](http://wiki.powerdns.com/trac) + +See the +[configuration section](https://roy.marples.name/projects/openresolv/config) +for more details. Modified: stable/12/contrib/openresolv/configure ============================================================================== --- stable/12/contrib/openresolv/configure Sat Dec 14 02:06:07 2019 (r355744) +++ stable/12/contrib/openresolv/configure Sat Dec 14 03:14:46 2019 (r355745) @@ -44,42 +44,8 @@ for x do esac done -if [ -z "$LIBEXECDIR" ]; then - printf "Checking for directory /libexec ... " - if [ -d /libexec ]; then - echo "yes" - LIBEXECDIR=$PREFIX/libexec/resolvconf - else - echo "no" - LIBEXECDIR=$PREFIX/lib/resolvconf - fi -fi -if [ -z "$RUNDIR" ]; then - printf "Checking for directory /run ... " - if [ -d /run ]; then - echo "yes" - RUNDIR=/run - else - echo "no" - RUNDIR=/var/run - fi -fi - : ${SED:=sed} -: ${SYSCONFDIR:=$PREFIX/etc} -: ${SBINDIR:=$PREFIX/sbin} -: ${LIBEXECDIR:=$PREFIX/libexec/resolvconf} -: ${STATEDIR:=/var} -: ${RUNDIR:=$STATEDIR/run} -: ${MANDIR:=${PREFIX:-/usr}/share/man} - -eval SYSCONFDIR="$SYSCONFDIR" -eval SBINDIR="$SBINDIR" -eval LIBEXECDIR="$LIBEXECDIR" -eval VARDIR="$RUNDIR/resolvconf" -eval MANDIR="$MANDIR" - CONFIG_MK=config.mk if [ -z "$BUILD" ]; then @@ -121,7 +87,19 @@ rm -rf $CONFIG_MK echo "# $OS" >$CONFIG_MK case "$OS" in -freebsd*) +dragonfly*) + # This means /usr HAS to be mounted not via dhcpcd + : ${LIBEXECDIR:=${PREFIX:-/usr}/libexec/resolvconf} + ;; +linux*) + # cksum does't support -a and netpgp is rare + echo "CKSUM= sha256sum --tag" >>$CONFIG_MK + echo "PGP= gpg2" >>$CONFIG_MK + ;; +esac + +case "$OS" in +dragonfly*|freebsd*) # On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled # regardless of if it's not running. # So we force onestatus to work around this silly bug. @@ -129,12 +107,42 @@ freebsd*) STATUSARG="onestatus" fi ;; -linux*) - # cksum does't support -a and netpgp is rare - echo "CKSUM= sha256sum --tag" >>$CONFIG_MK - echo "PGP= gpg2" >>$CONFIG_MK - ;; esac + + +if [ -z "$LIBEXECDIR" ]; then + printf "Checking for directory /libexec ... " + if [ -d /libexec ]; then + echo "yes" + LIBEXECDIR=$PREFIX/libexec/resolvconf + else + echo "no" + LIBEXECDIR=$PREFIX/lib/resolvconf + fi +fi +if [ -z "$RUNDIR" ]; then + printf "Checking for directory /run ... " + if [ -d /run ]; then + echo "yes" + RUNDIR=/run + else + echo "no" + RUNDIR=/var/run + fi +fi + +: ${SYSCONFDIR:=$PREFIX/etc} +: ${SBINDIR:=$PREFIX/sbin} +: ${LIBEXECDIR:=$PREFIX/libexec/resolvconf} +: ${STATEDIR:=/var} +: ${RUNDIR:=$STATEDIR/run} +: ${MANDIR:=${PREFIX:-/usr}/share/man} + +eval SYSCONFDIR="$SYSCONFDIR" +eval SBINDIR="$SBINDIR" +eval LIBEXECDIR="$LIBEXECDIR" +eval VARDIR="$RUNDIR/resolvconf" +eval MANDIR="$MANDIR" for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RESTARTCMD RCDIR STATUSARG do Modified: stable/12/contrib/openresolv/dnsmasq.in ============================================================================== --- stable/12/contrib/openresolv/dnsmasq.in Sat Dec 14 02:06:07 2019 (r355744) +++ stable/12/contrib/openresolv/dnsmasq.in Sat Dec 14 03:14:46 2019 (r355745) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2016 Roy Marples +# Copyright (c) 2007-2019 Roy Marples # All rights reserved # dnsmasq subscriber for resolvconf @@ -28,7 +28,7 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$dnsmasq_conf" -a -z "$dnsmasq_resolv" ] && exit 0 +[ -z "${dnsmasq_conf}${dnsmasq_resolv}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " @@ -98,7 +98,7 @@ for d in $DOMAINS; do empty=false i=0 IFS=: set -- $n - while [ -n "$1" -o -n "$2" ]; do + while [ -n "$1" ] || [ -n "$2" ]; do addr="$1" shift if [ -z "$addr" ]; then @@ -184,7 +184,7 @@ if $changed; then eval $dnsmasq_restart elif [ -n "$RESTARTCMD" ]; then set -- ${dnsmasq_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${dnsmasq_service} fi @@ -206,4 +206,6 @@ if $dbus; then dbus-send --system --dest=uk.org.thekelleys.dnsmasq \ /uk/org/thekelleys/dnsmasq uk.org.thekelleys.$method \ $dbusdest + dbus-send --system --dest=uk.org.thekelleys.dnsmasq \ + /uk/org/thekelleys/dnsmasq uk.org.thekelleys.ClearCache fi Modified: stable/12/contrib/openresolv/libc.in ============================================================================== --- stable/12/contrib/openresolv/libc.in Sat Dec 14 02:06:07 2019 (r355744) +++ stable/12/contrib/openresolv/libc.in Sat Dec 14 03:14:46 2019 (r355745) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2016 Roy Marples +# Copyright (c) 2007-2019 Roy Marples # All rights reserved # libc subscriber for resolvconf @@ -36,9 +36,9 @@ NL=" # sed may not be available, and this is faster on small files key_get_value() { - local key="$1" x= line= - + key="$1" shift + if [ $# -eq 0 ]; then while read -r line; do case "$line" in @@ -58,8 +58,6 @@ key_get_value() keys_remove() { - local key x line found - while read -r line; do found=false for key do @@ -79,7 +77,7 @@ local_nameservers="127.* 0.0.0.0 255.255.255.255 ::1" if [ -f "$SYSCONFDIR"/resolvconf.conf ]; then . "$SYSCONFDIR"/resolvconf.conf elif [ -d "$SYSCONFDIR"/resolvconf ]; then - SYSCONFDIR="$SYSCONFDIR/resolvconf/resolv.conf.d" + SYSCONFDIR="$SYSCONFDIR/resolvconf" base="$SYSCONFDIR/resolv.conf.d/base" if [ -f "$base" ]; then prepend_nameservers="$(key_get_value "nameserver " "$base")" @@ -98,10 +96,12 @@ fi : ${resolv_conf:=/etc/resolv.conf} : ${libc_service:=nscd} : ${list_resolv:=@SBINDIR@/resolvconf -l} -if [ "${resolv_conf_head-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.head ]; then +if [ "${resolv_conf_head-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.head ] +then resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)" fi -if [ "${resolv_conf_tail-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.tail ]; then +if [ "${resolv_conf_tail-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.tail ] +then resolv_conf_tail="$(cat "$SYSCONFDIR"/resolv.conf.tail)" fi @@ -110,7 +110,7 @@ signature="# Generated by resolvconf" uniqify() { - local result= + result= while [ -n "$1" ]; do case " $result " in *" $1 "*);; @@ -126,7 +126,7 @@ case "${resolv_conf_passthrough:-NO}" in backup=false newest= for conf in "$IFACEDIR"/*; do - if [ -z "$newest" -o "$conf" -nt "$newest" ]; then + if [ -z "$newest" ] || [ "$conf" -nt "$newest" ]; then newest="$conf" fi done @@ -178,7 +178,7 @@ case "${resolv_conf_passthrough:-NO}" in fi [ -n "$domain" ] && newconf="${newconf}domain $domain$NL" - if [ -n "$newsearch" -a "$newsearch" != "$domain" ]; then + if [ -n "$newsearch" ] && [ "$newsearch" != "$domain" ]; then newconf="${newconf}search $newsearch$NL" fi for n in $newns; do @@ -232,7 +232,7 @@ if [ -n "$libc_restart" ]; then eval $libc_restart elif [ -n "$RESTARTCMD" ]; then set -- ${libc_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${libc_service} fi Modified: stable/12/contrib/openresolv/named.in ============================================================================== --- stable/12/contrib/openresolv/named.in Sat Dec 14 02:06:07 2019 (r355744) +++ stable/12/contrib/openresolv/named.in Sat Dec 14 03:14:46 2019 (r355745) @@ -28,14 +28,14 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$named_zones" -a -z "$named_options" ] && exit 0 +[ -z "${named_zones}${named_options}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " # Platform specific kludges -if [ -z "$named_service" -a -z "$named_restart" -a \ - -d "$RCDIR" -a ! -x "$RCDIR"/named ] +if [ -z "${named_service}${named_restart}" ] && + [ -d "$RCDIR" ] && ! [ -x "$RCDIR"/named ] then if [ -x "$RCDIR"/bind9 ]; then # Debian and derivatives @@ -111,7 +111,7 @@ if $changed; then eval $named_restart elif [ -n "$RESTARTCMD" ]; then set -- ${named_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${named_service} fi Modified: stable/12/contrib/openresolv/pdns_recursor.in ============================================================================== --- stable/12/contrib/openresolv/pdns_recursor.in Sat Dec 14 02:06:07 2019 (r355744) +++ stable/12/contrib/openresolv/pdns_recursor.in Sat Dec 14 03:14:46 2019 (r355745) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2009-2011 Roy Marples +# Copyright (c) 2009-2019 Roy Marples # All rights reserved # PowerDNS Recursor subscriber for resolvconf @@ -33,17 +33,14 @@ NL=" " -: ${pdns_service:=pdns_recursor} +: ${pdns_service:=pdns-recursor} newzones= -# pds_recursor does not present support global forward servers, which -# does limit it's usefulness somewhat. -# If it did, the below code can be enabled, or something like it. -#for n in $NAMESERVERS; do -# newzones="$newzones${newzones:+,}$n" -#done -#[ -n "$newzones" ] && newzones=".=$newzones$NL" +for n in $NAMESERVERS; do + newzones="$newzones${newzones:+,}$n" +done +[ -n "$newzones" ] && newzones="+.=$newzones$NL" for d in $DOMAINS; do newns= @@ -71,7 +68,7 @@ then eval $pdns_restart elif [ -n "$RESTARTCMD" ]; then set -- ${pdns_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${pdns_service} fi Modified: stable/12/contrib/openresolv/pdnsd.in ============================================================================== --- stable/12/contrib/openresolv/pdnsd.in Sat Dec 14 02:06:07 2019 (r355744) +++ stable/12/contrib/openresolv/pdnsd.in Sat Dec 14 03:14:46 2019 (r355745) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2010-2013 Roy Marples +# Copyright (c) 2010-2018 Roy Marples # All rights reserved # pdnsd subscriber for resolvconf @@ -28,7 +28,7 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$pdnsd_conf" -a -z "$pdnsd_resolv" ] && exit 0 +[ -z "${pdnsd_conf}${pdnsd_resolv}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " @@ -41,14 +41,16 @@ signature_end="# End of resolvconf" # but sed may not always be available at the time. remove_markers() { - local m1="$1" m2="$2" x= line= in_marker=0 + m1="$1" + m2="$2" + in_marker=0 shift; shift if type sed >/dev/null 2>&1; then sed "/^$m1/,/^$m2/d" $@ else - for x; do - while read -r line; do + for x do + while read line; do case "$line" in "$m1"*) in_marker=1;; "$m2"*) in_marker=0;; Modified: stable/12/contrib/openresolv/resolvconf.conf ============================================================================== --- stable/12/contrib/openresolv/resolvconf.conf Sat Dec 14 02:06:07 2019 (r355744) +++ stable/12/contrib/openresolv/resolvconf.conf Sat Dec 14 03:14:46 2019 (r355745) @@ -4,4 +4,4 @@ resolv_conf=/etc/resolv.conf # If you run a local name server, you should uncomment the below line and # configure your subscribers configuration files below. -#name_servers=127.0.0.1 \ No newline at end of file +#name_servers=127.0.0.1 Modified: stable/12/contrib/openresolv/resolvconf.conf.5.in ============================================================================== --- stable/12/contrib/openresolv/resolvconf.conf.5.in Sat Dec 14 02:06:07 2019 (r355744) +++ stable/12/contrib/openresolv/resolvconf.conf.5.in Sat Dec 14 03:14:46 2019 (r355745) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 29, 2016 +.Dd September 8, 2019 .Dt RESOLVCONF.CONF 5 .Os .Sh NAME @@ -64,19 +64,25 @@ Defaults to YES. .It Sy interface_order These interfaces will always be processed first. If unset, defaults to the following:- -.D1 lo lo[0-9]* +.Bd -compact -literal -offset indent +lo lo[0-9]* +.Ed .It Sy dynamic_order These interfaces will be processed next, unless they have a metric. If unset, defaults to the following:- -.D1 tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]* +.Bd -compact -literal -offset indent +tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]* +.Ed .It Sy inclusive_interfaces -Ignore any exlcusive marking for these interfaces. +Ignore any exclusive marking for these interfaces. This is handy when 3rd party integrations force the .Nm resolvconf -x option and you want to disable it easily. .It Sy local_nameservers If unset, defaults to the following:- -.D1 127.* 0.0.0.0 255.255.255.255 ::1 +.Bd -compact -literal -offset indent +127.* 0.0.0.0 255.255.255.255 ::1 +.Ed .It Sy search_domains Prepend search domains to the dynamically generated list. .It Sy search_domains_append @@ -118,16 +124,24 @@ The syntax is this: .Va $keyword Ns / Ns Va $match Ns / Ns Va $replacement .Pp Example, given this resolv.conf: -.D1 domain foo.org -.D1 search foo.org dead.beef -.D1 nameserver 1.2.3.4 -.D1 nameserver 2.3.4.5 +.Bd -compact -literal -offset indent +domain foo.org +search foo.org dead.beef +nameserver 1.2.3.4 +nameserver 2.3.4.5 +.Ed and this configuaration: -.D1 replace="search/foo*/bar.com nameserver/1.2.3.4/5.6.7.8 nameserver/2.3.4.5/" +.Bd -compact -literal -offset indent +replace="search/foo*/bar.com" +replace="$replace nameserver/1.2.3.4/5.6.7.8" +replace="$replace nameserver/2.3.4.5/" +.Ed you would get this resolv.conf instead: -.D1 domain foo.org -.D1 search bar.com -.D1 nameserver 5.6.7.8 +.Bd -compact -literal -offset indent +domain foo.org +search bar.com +nameserver 5.6.7.8 +.Ed .It Sy replace_sub Works the same way as .Sy replace @@ -138,9 +152,11 @@ Using the same example resolv.conf and changing to .Sy replace_sub , you would get this resolv.conf instead: -.D1 domain foo.org -.D1 search bar.com dead.beef -.D1 nameserver 5.6.7.8 +.Bd -compact -literal -offset indent +domain foo.org +search bar.com dead.beef +nameserver 5.6.7.8 +.Ed .It Sy state_dir Override the default state directory of .Pa @VARDIR@ . @@ -195,7 +211,8 @@ Prepend search domains to the dynamically generated li openresolv ships with subscribers for the name servers .Xr dnsmasq 8 , .Xr named 8 , -.Xr pdnsd 8 +.Xr pdnsd 8 , +.Xr pdns_recursor 8 , and .Xr unbound 8 . Each subscriber can create configuration files which should be included in @@ -203,7 +220,9 @@ in the subscribers main configuration file. .Pp To disable a subscriber, simply set it's name to NO. For example, to disable the libc subscriber you would set: -.D1 libc=NO +.Bd -compact -literal -offset indent +libc=NO +.Ed .Bl -tag -width indent .It Sy dnsmasq_conf This file tells dnsmasq which name servers to use for specific domains. @@ -211,17 +230,21 @@ This file tells dnsmasq which name servers to use for This file tells dnsmasq which name servers to use for global lookups. .Pp Example resolvconf.conf for dnsmasq: -.D1 name_servers=127.0.0.1 -.D1 dnsmasq_conf=/etc/dnsmasq-conf.conf -.D1 dnsmasq_resolv=/etc/dnsmasq-resolv.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +dnsmasq_conf=/etc/dnsmasq-conf.conf +dnsmasq_resolv=/etc/dnsmasq-resolv.conf +.Ed .Pp Example dnsmasq.conf: -.D1 listen-address=127.0.0.1 -.D1 # If dnsmasq is compiled for DBus then we can take -.D1 # advantage of not having to restart dnsmasq. -.D1 enable-dbus -.D1 conf-file=/etc/dnsmasq-conf.conf -.D1 resolv-file=/etc/dnsmasq-resolv.conf +.Bd -compact -literal -offset indent +listen-address=127.0.0.1 +# If dnsmasq is compiled for DBus then we can take +# advantage of not having to restart dnsmasq. +enable-dbus +conf-file=/etc/dnsmasq-conf.conf +resolv-file=/etc/dnsmasq-resolv.conf +.Ed .It Sy named_options Include this file in the named options block. This file tells named which name servers to use for global lookups. @@ -230,16 +253,21 @@ Include this file in the named global scope, after the This file tells named which name servers to use for specific domains. .Pp Example resolvconf.conf for named: -.D1 name_servers=127.0.0.1 -.D1 named_options=/etc/named-options.conf -.D1 named_zones=/etc/named-zones.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +named_options=/etc/named-options.conf +named_zones=/etc/named-zones.conf +.Ed .Pp Example named.conf: -.D1 options { -.D1 listen-on { 127.0.0.1; }; -.D1 include "/etc/named-options.conf"; -.D1 }; -.D1 include "/etc/named-zones.conf"; +.Bd -compact -literal -offset indent +options { + listen-on { 127.0.0.1; }; + include "/etc/named-options.conf"; +}; + +include "/etc/named-zones.conf"; +.Ed .It Sy pdnsd_conf This is the main pdnsd configuration file which we modify to add our forward domains to. @@ -253,32 +281,54 @@ If this variable is not set then it's written to .Pa pdnsd_conf . .Pp Example resolvconf.conf for pdnsd: -.D1 name_servers=127.0.0.1 -.D1 pdnsd_conf=/etc/pdnsd.conf -.D1 # pdnsd_resolv=/etc/pdnsd-resolv.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +pdnsd_conf=/etc/pdnsd.conf +# pdnsd_resolv=/etc/pdnsd-resolv.conf +.Ed .Pp Example pdnsd.conf: -.D1 global { -.D1 server_ip = 127.0.0.1; -.D1 status_ctl = on; -.D1 } -.D1 server { -.D1 # A server definition is required, even if emtpy. -.D1 label="empty"; -.D1 proxy_only=on; -.D1 # file="/etc/pdnsd-resolv.conf"; -.D1 } +.Bd -compact -literal -offset indent +global { + server_ip = 127.0.0.1; + status_ctl = on; +} +server { + # A server definition is required, even if empty. + label="empty"; + proxy_only=on; + # file="/etc/pdnsd-resolv.conf"; +} +.Ed +.It Sy pdns_zones +This file tells pdns_recursor about specific and global name servers. +.Pp +Example resolvconf.conf for pdns_recursor: +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +pdns_zones=/etc/pdns/recursor-zones.conf +.Ed +.Pp +Example recursor.conf: +.Bd -compact -literal -offset indent +allow-from=127.0.0.0/8, ::1/128 +forward-zones-file=/etc/pdns/recursor-zones.conf +.Ed .It Sy unbound_conf This file tells unbound about specific and global name servers. .It Sy unbound_insecure When set to YES, unbound marks the domains as insecure, thus ignoring DNSSEC. .Pp Example resolvconf.conf for unbound: -.D1 name_servers=127.0.0.1 -.D1 unbound_conf=/etc/unbound-resolvconf.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +unbound_conf=/etc/unbound-resolvconf.conf +.Ed .Pp Example unbound.conf: -.D1 include: /etc/unbound-resolvconf.conf +.Bd -compact -literal -offset indent +include: /etc/unbound-resolvconf.conf +.Ed .El .Sh SUBSCRIBER INTEGRATION Not all distributions store the files the subscribers need in the same @@ -292,7 +342,6 @@ Also, users could equally want to use a different vers installed by default, such as bind8 and bind9. To accommodate this, the subscribers have these files in configurable variables, documented below. -.Pp .Bl -tag -width indent .It Sy dnsmasq_service Name of the dnsmasq service. @@ -310,6 +359,10 @@ Name of the named service. Command to restart the named service. .It Sy pdnsd_restart Command to restart the pdnsd service. +.It Sy pdns_service +Command to restart the pdns_recursor service. +.It Sy pdns_restart +Command to restart the pdns_recursor service. .It Sy unbound_service Name of the unbound service. .It Sy unbound_restart Modified: stable/12/contrib/openresolv/resolvconf.in ============================================================================== --- stable/12/contrib/openresolv/resolvconf.in Sat Dec 14 02:06:07 2019 (r355744) +++ stable/12/contrib/openresolv/resolvconf.in Sat Dec 14 03:14:46 2019 (r355745) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2016 Roy Marples +# Copyright (c) 2007-2019 Roy Marples # All rights reserved # Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. RESOLVCONF="$0" -OPENRESOLV_VERSION="3.9.0" +OPENRESOLV_VERSION="3.9.2" SYSCONFDIR=@SYSCONFDIR@ LIBEXECDIR=@LIBEXECDIR@ VARDIR=@VARDIR@ @@ -125,21 +125,22 @@ usage() # If you think otherwise, capture a DNS trace and you'll see libc # will strip it regardless. # This also solves setting up duplicate zones in our subscribers. -strip_trailing_dots() +# Also strip any comments denoted by #. +resolv_strip() { - local n= d= - - for n; do - printf "$d%s" "${n%.}" - d=" " + space= + for word; do + case "$word" in + \#*) break;; + esac + printf "%s%s" "$space${word%.}" + space=" " done printf "\n" } private_iface() { - local p - # Allow expansion cd "$IFACEDIR" @@ -168,12 +169,15 @@ private_iface() # for domain name servers, search name servers and global nameservers parse_resolv() { - local line= ns= ds= search= d= n= newns= - local new=true iface= private=false p= domain= l= islocal= - + domain= + new=true newns= + ns= + private=false + search= while read -r line; do + stripped_line="$(resolv_strip ${line#* })" case "$line" in "# resolv.conf from "*) if ${new}; then @@ -189,29 +193,32 @@ parse_resolv() "nameserver "*) islocal=false for l in $local_nameservers; do - case "${line#* }" in + case "$stripped_line" in $l) islocal=true - echo "LOCALNAMESERVERS=\"\$LOCALNAMESERVERS ${line#* }\"" break ;; esac done - $islocal || ns="$ns${line#* } " + if $islocal; then + echo "LOCALNAMESERVERS=\"\$LOCALNAMESERVERS $stripped_line\"" + else + ns="$ns$stripped_line " + fi ;; "domain "*) - search="$(strip_trailing_dots ${line#* })" + search="$stripped_line" if [ -z "$domain" ]; then domain="$search" echo "DOMAIN=\"$domain\"" fi ;; "search "*) - search="$(strip_trailing_dots ${line#* })" + search="$stripped_line" ;; *) [ -n "$line" ] && continue - if [ -n "$ns" -a -n "$search" ]; then + if [ -n "$ns" ] && [ -n "$search" ]; then newns= for n in $ns; do newns="$newns${newns:+,}$n" @@ -236,7 +243,7 @@ parse_resolv() uniqify() { - local result= + result= while [ -n "$1" ]; do case " $result " in *" $1 "*);; @@ -249,8 +256,8 @@ uniqify() dirname() { - local dir= OIFS="$IFS" - local IFS=/ + OIFS="$IFS" + IFS=/ set -- $@ IFS="$OIFS" if [ -n "$1" ]; then @@ -267,7 +274,7 @@ dirname() config_mkdirs() { - local e=0 f d + e=0 for f; do [ -n "$f" ] || continue d="$(dirname "$f")" @@ -295,66 +302,86 @@ detect_init() # Detect the running init system. # As systemd and OpenRC can be installed on top of legacy init # systems we try to detect them first. - local status="@STATUSARG@" + status="@STATUSARG@" : ${status:=status} - if [ -x /bin/systemctl -a -S /run/systemd/private ]; then - RESTARTCMD="if /bin/systemctl --quiet is-active \$1.service; then - /bin/systemctl restart \$1.service; -fi" - elif [ -x /usr/bin/systemctl -a -S /run/systemd/private ]; then - RESTARTCMD="if /usr/bin/systemctl --quiet is-active \$1.service; then - /usr/bin/systemctl restart \$1.service; -fi" - elif [ -x /sbin/rc-service -a \ - -s /libexec/rc/init.d/softlevel -o -s /run/openrc/softlevel ] + if [ -x /bin/systemctl ] && [ -S /run/systemd/private ]; then + RESTARTCMD=' + if /bin/systemctl --quiet is-active $1.service + then + /bin/systemctl restart $1.service + fi' + elif [ -x /usr/bin/systemctl ] && [ -S /run/systemd/private ]; then + RESTARTCMD=' + if /usr/bin/systemctl --quiet is-active $1.service + then + /usr/bin/systemctl restart $1.service + fi' + elif [ -x /sbin/rc-service ] && + { [ -s /libexec/rc/init.d/softlevel ] || + [ -s /run/openrc/softlevel ]; } then - RESTARTCMD="/sbin/rc-service -i \$1 -- -Ds restart" + RESTARTCMD='/sbin/rc-service -i $1 -- -Ds restart' elif [ -x /usr/sbin/invoke-rc.d ]; then RCDIR=/etc/init.d - RESTARTCMD="if /usr/sbin/invoke-rc.d --quiet \$1 status 1>/dev/null 2>&1; then - /usr/sbin/invoke-rc.d \$1 restart; -fi" + RESTARTCMD=' + if /usr/sbin/invoke-rc.d --quiet $1 status >/dev/null 2>&1 + then + /usr/sbin/invoke-rc.d $1 restart + fi' elif [ -x /sbin/service ]; then # Old RedHat RCDIR=/etc/init.d - RESTARTCMD="if /sbin/service \$1; then - /sbin/service \$1 restart; -fi" + RESTARTCMD=' + if /sbin/service $1; then + /sbin/service $1 restart + fi' elif [ -x /usr/sbin/service ]; then # Could be FreeBSD - RESTARTCMD="if /usr/sbin/service \$1 $status 1>/dev/null 2>&1; then - /usr/sbin/service \$1 restart; -fi" + RESTARTCMD=" + if /usr/sbin/service \$1 $status >/dev/null 2>&1 + then + /usr/sbin/service \$1 restart + fi" elif [ -x /bin/sv ]; then - RESTARTCMD="/bin/sv status \$1 >/dev/null 2>&1 && /bin/sv try-restart \$1" + RESTARTCMD='/bin/sv status $1 >/dev/null 2>&1 && + /bin/sv try-restart $1' elif [ -x /usr/bin/sv ]; then - RESTARTCMD="/usr/bin/sv status \$1 >/dev/null 2>&1 && /usr/bin/sv try-restart \$1" - elif [ -e /etc/arch-release -a -d /etc/rc.d ]; then *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Sat Dec 14 09:49:37 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A8581E7E0E; Sat, 14 Dec 2019 09:49:37 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ZjS11g04z4Btb; Sat, 14 Dec 2019 09:49:37 +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 3450722CD5; Sat, 14 Dec 2019 09:49:37 +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 xBE9nbM8075074; Sat, 14 Dec 2019 09:49:37 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBE9naWI075072; Sat, 14 Dec 2019 09:49:36 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201912140949.xBE9naWI075072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 14 Dec 2019 09:49:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355748 - in stable/12/libexec: rc/rc.d save-entropy X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/12/libexec: rc/rc.d save-entropy X-SVN-Commit-Revision: 355748 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2019 09:49:37 -0000 Author: delphij Date: Sat Dec 14 09:49:36 2019 New Revision: 355748 URL: https://svnweb.freebsd.org/changeset/base/355748 Log: MFC r345744, r348122, r355247 r345744: random(4): Attempt to persist entropy promptly r348122: save-entropy(8), rc.d/random: Set nodump flag r355247: Reduce disk write load in /usr/libexec/save-entropy. Modified: stable/12/libexec/rc/rc.d/random stable/12/libexec/save-entropy/save-entropy.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.d/random ============================================================================== --- stable/12/libexec/rc/rc.d/random Sat Dec 14 08:28:10 2019 (r355747) +++ stable/12/libexec/rc/rc.d/random Sat Dec 14 09:49:36 2019 (r355748) @@ -25,7 +25,9 @@ save_dev_random() for f ; do debug "saving entropy to $f" dd if=/dev/random of="$f" bs=4096 count=1 status=none && - chmod 600 "$f" + ( chflags nodump "$f" 2>/dev/null || : ) && + chmod 600 "$f" && + fsync "$f" "$(dirname "$f")" done umask ${oumask} } @@ -98,7 +100,7 @@ random_stop() [Nn][Oo]) ;; *) - echo -n 'Writing entropy file:' + echo -n 'Writing entropy file: ' rm -f ${entropy_file} 2> /dev/null oumask=`umask` umask 077 @@ -117,9 +119,7 @@ random_stop() warn 'write failed (read-only fs?)' ;; *) - dd if=/dev/random of=${entropy_file_confirmed} \ - bs=4096 count=1 2> /dev/null || - warn 'write failed (unwriteable file or full fs?)' + save_dev_random "${entropy_file_confirmed}" echo '.' ;; esac @@ -130,7 +130,7 @@ random_stop() [Nn][Oo]) ;; *) - echo -n 'Writing early boot entropy file:' + echo -n 'Writing early boot entropy file: ' rm -f ${entropy_boot_file} 2> /dev/null oumask=`umask` umask 077 @@ -142,9 +142,7 @@ random_stop() warn 'write failed (read-only fs?)' ;; *) - dd if=/dev/random of=${entropy_boot_file_confirmed} \ - bs=4096 count=1 2> /dev/null || - warn 'write failed (unwriteable file or full fs?)' + save_dev_random "${entropy_boot_file_confirmed}" echo '.' ;; esac Modified: stable/12/libexec/save-entropy/save-entropy.sh ============================================================================== --- stable/12/libexec/save-entropy/save-entropy.sh Sat Dec 14 08:28:10 2019 (r355747) +++ stable/12/libexec/save-entropy/save-entropy.sh Sat Dec 14 09:49:36 2019 (r355748) @@ -71,24 +71,63 @@ cd "${entropy_dir}" || { for f in saved-entropy.*; do case "${f}" in saved-entropy.\*) continue ;; esac # No files match - [ ${f#saved-entropy\.} -ge ${entropy_save_num} ] && unlink ${f} + [ ${f#saved-entropy\.} -gt ${entropy_save_num} ] && unlink ${f} done -umask 377 +umask 177 -n=$(( ${entropy_save_num} - 1 )) -while [ ${n} -ge 1 ]; do - if [ -f "saved-entropy.${n}" ]; then - mv "saved-entropy.${n}" "saved-entropy.$(( ${n} + 1 ))" - elif [ -e "saved-entropy.${n}" -o -L "saved-entropy.${n}" ]; then +# Scan slots [1..$entropy_save_num), picking an empty slot or the oldest +# existing file if no empty slot was available. +# +# 1. Find out the first regular file or empty slot (and its serial number) +# +n=1 +while [ ${n} -le ${entropy_save_num} ]; do + save_file="saved-entropy.${n}" + if [ ! -e "${save_file}" -o -f "${save_file}" ]; then + break + else logger -is -t "$0" \ - "${entropy_dir}/saved-entropy.${n}" is not a regular file, and so \ - it will not be rotated. Entropy file rotation is aborted. - exit 1 + "${save_file}" is not a regular file, skipped. fi - n=$(( ${n} - 1 )) + n=$(( ${n} + 1 )) done +# +# 2. Start from (serial number + 1), and check if the slot is empty +# or is an older regular file, update save_file pointer in either +# case, and break early if we found an empty slot. +# +if [ -f ${save_file} ]; then + n=$(( ${n} + 1 )) + while [ ${n} -le ${entropy_save_num} ]; do + next_file=saved-entropy.${n} + if [ -f "${next_file}" ]; then + [ "${next_file}" -ot "${save_file}" ] && \ + save_file="${next_file}" + elif [ ! -e "${next_file}" ]; then + save_file="${next_file}" + break + else + logger -is -t "$0" \ + "${next_file}" is not a regular file, skipped. + fi + n=$(( ${n} + 1 )) + done +fi +# +# 3. Check if the pointer we have in hand is really a regular file or +# an empty slot, and bail out as that means there is no available slot. +# +if [ -e "${save_file}" -a ! -f "${save_file}" ]; then + logger -is -t "$0" \ + No available slot in "${entropy_dir}", save entropy is aborted. + exit 1 +fi -dd if=/dev/random of=saved-entropy.1 bs=${entropy_save_sz} count=1 2>/dev/null +# Save entropy to the selected slot. +chmod 600 "${save_file}" 2>/dev/null || : +dd if=/dev/random of="${save_file}" bs=${entropy_save_sz} count=1 2>/dev/null +chflags nodump "${save_file}" 2>/dev/null || : +fsync "${save_file}" "." exit 0 From owner-svn-src-stable@freebsd.org Sat Dec 14 09:54:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A3261C80ED; Sat, 14 Dec 2019 09:54:31 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ZjYg315Qz4CHT; Sat, 14 Dec 2019 09:54:31 +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 5E47022E90; Sat, 14 Dec 2019 09:54:31 +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 xBE9sVCx081040; Sat, 14 Dec 2019 09:54:31 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBE9sVZh081039; Sat, 14 Dec 2019 09:54:31 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201912140954.xBE9sVZh081039@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 14 Dec 2019 09:54: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: r355749 - stable/11/libexec/save-entropy X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/libexec/save-entropy X-SVN-Commit-Revision: 355749 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2019 09:54:31 -0000 Author: delphij Date: Sat Dec 14 09:54:30 2019 New Revision: 355749 URL: https://svnweb.freebsd.org/changeset/base/355749 Log: MFC r355247: Reduce disk write load in /usr/libexec/save-entropy. Modified: stable/11/libexec/save-entropy/save-entropy.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/save-entropy/save-entropy.sh ============================================================================== --- stable/11/libexec/save-entropy/save-entropy.sh Sat Dec 14 09:49:36 2019 (r355748) +++ stable/11/libexec/save-entropy/save-entropy.sh Sat Dec 14 09:54:30 2019 (r355749) @@ -69,24 +69,61 @@ cd "${entropy_dir}" || { for f in saved-entropy.*; do case "${f}" in saved-entropy.\*) continue ;; esac # No files match - [ ${f#saved-entropy\.} -ge ${entropy_save_num} ] && unlink ${f} + [ ${f#saved-entropy\.} -gt ${entropy_save_num} ] && unlink ${f} done -umask 377 +umask 177 -n=$(( ${entropy_save_num} - 1 )) -while [ ${n} -ge 1 ]; do - if [ -f "saved-entropy.${n}" ]; then - mv "saved-entropy.${n}" "saved-entropy.$(( ${n} + 1 ))" - elif [ -e "saved-entropy.${n}" -o -L "saved-entropy.${n}" ]; then +# Scan slots [1..$entropy_save_num), picking an empty slot or the oldest +# existing file if no empty slot was available. +# +# 1. Find out the first regular file or empty slot (and its serial number) +# +n=1 +while [ ${n} -le ${entropy_save_num} ]; do + save_file="saved-entropy.${n}" + if [ ! -e "${save_file}" -o -f "${save_file}" ]; then + break + else logger -is -t "$0" \ - "${entropy_dir}/saved-entropy.${n}" is not a regular file, and so \ - it will not be rotated. Entropy file rotation is aborted. - exit 1 + "${save_file}" is not a regular file, skipped. fi - n=$(( ${n} - 1 )) + n=$(( ${n} + 1 )) done +# +# 2. Start from (serial number + 1), and check if the slot is empty +# or is an older regular file, update save_file pointer in either +# case, and break early if we found an empty slot. +# +if [ -f ${save_file} ]; then + n=$(( ${n} + 1 )) + while [ ${n} -le ${entropy_save_num} ]; do + next_file=saved-entropy.${n} + if [ -f "${next_file}" ]; then + [ "${next_file}" -ot "${save_file}" ] && \ + save_file="${next_file}" + elif [ ! -e "${next_file}" ]; then + save_file="${next_file}" + break + else + logger -is -t "$0" \ + "${next_file}" is not a regular file, skipped. + fi + n=$(( ${n} + 1 )) + done +fi +# +# 3. Check if the pointer we have in hand is really a regular file or +# an empty slot, and bail out as that means there is no available slot. +# +if [ -e "${save_file}" -a ! -f "${save_file}" ]; then + logger -is -t "$0" \ + No available slot in "${entropy_dir}", save entropy is aborted. + exit 1 +fi -dd if=/dev/random of=saved-entropy.1 bs=${entropy_save_sz} count=1 2>/dev/null +# Save entropy to the selected slot. +chmod 600 "${save_file}" 2>/dev/null || : +dd if=/dev/random of="${save_file}" bs=${entropy_save_sz} count=1 2>/dev/null exit 0 From owner-svn-src-stable@freebsd.org Sat Dec 14 18:32:01 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CB5D1D3E26; Sat, 14 Dec 2019 18:32:01 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Zx2n0V1cz4cJc; Sat, 14 Dec 2019 18:32:01 +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 0C093C74; Sat, 14 Dec 2019 18:32:01 +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 xBEIW0ts086919; Sat, 14 Dec 2019 18:32:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBEIW0PE086918; Sat, 14 Dec 2019 18:32:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912141832.xBEIW0PE086918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 14 Dec 2019 18:32:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355756 - stable/12/usr.bin/gcore X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.bin/gcore X-SVN-Commit-Revision: 355756 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2019 18:32:01 -0000 Author: markj Date: Sat Dec 14 18:32:00 2019 New Revision: 355756 URL: https://svnweb.freebsd.org/changeset/base/355756 Log: MFC r355506: gcore: Avoid using vm_map_entry_t. Modified: stable/12/usr.bin/gcore/elfcore.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/gcore/elfcore.c ============================================================================== --- stable/12/usr.bin/gcore/elfcore.c Sat Dec 14 14:56:34 2019 (r355755) +++ stable/12/usr.bin/gcore/elfcore.c Sat Dec 14 18:32:00 2019 (r355756) @@ -44,8 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include #include @@ -64,8 +62,15 @@ __FBSDID("$FreeBSD$"); * Code for generating ELF core dumps. */ -typedef void (*segment_callback)(vm_map_entry_t, void *); +struct map_entry { + struct map_entry *next; + vm_offset_t start; + vm_offset_t end; + vm_prot_t protection; +}; +typedef void (*segment_callback)(struct map_entry *, void *); + /* Closure for cb_put_phdr(). */ struct phdr_closure { Elf_Phdr *phdr; /* Program header to fill in */ @@ -101,9 +106,9 @@ typedef struct ptrace_lwpinfo elfcore_lwpinfo_t; typedef void* (*notefunc_t)(void *, size_t *); -static void cb_put_phdr(vm_map_entry_t, void *); -static void cb_size_segment(vm_map_entry_t, void *); -static void each_dumpable_segment(vm_map_entry_t, segment_callback, +static void cb_put_phdr(struct map_entry *, void *); +static void cb_size_segment(struct map_entry *, void *); +static void each_dumpable_segment(struct map_entry *, segment_callback, void *closure); static void elf_detach(void); /* atexit() handler. */ static void *elf_note_fpregset(void *, size_t *); @@ -130,12 +135,12 @@ static void *elf_note_procstat_psstrings(void *, size_ static void *elf_note_procstat_rlimit(void *, size_t *); static void *elf_note_procstat_umask(void *, size_t *); static void *elf_note_procstat_vmmap(void *, size_t *); -static void elf_puthdr(int, pid_t, vm_map_entry_t, void *, size_t, size_t, +static void elf_puthdr(int, pid_t, struct map_entry *, void *, size_t, size_t, size_t, int); static void elf_putnote(int, notefunc_t, void *, struct sbuf *); static void elf_putnotes(pid_t, struct sbuf *, size_t *); -static void freemap(vm_map_entry_t); -static vm_map_entry_t readmap(pid_t); +static void freemap(struct map_entry *); +static struct map_entry *readmap(pid_t); static void *procstat_sysctl(void *, int, size_t, size_t *sizep); static pid_t g_pid; /* Pid being dumped, global for elf_detach */ @@ -193,7 +198,7 @@ elf_detach(void) static void elf_coredump(int efd, int fd, pid_t pid) { - vm_map_entry_t map; + struct map_entry *map; struct sseg_closure seginfo; struct sbuf *sb; void *hdr; @@ -294,7 +299,7 @@ elf_coredump(int efd, int fd, pid_t pid) * program header entry. */ static void -cb_put_phdr(vm_map_entry_t entry, void *closure) +cb_put_phdr(struct map_entry *entry, void *closure) { struct phdr_closure *phc = (struct phdr_closure *)closure; Elf_Phdr *phdr = phc->phdr; @@ -324,7 +329,7 @@ cb_put_phdr(vm_map_entry_t entry, void *closure) * the number of segments and their total size. */ static void -cb_size_segment(vm_map_entry_t entry, void *closure) +cb_size_segment(struct map_entry *entry, void *closure) { struct sseg_closure *ssc = (struct sseg_closure *)closure; @@ -338,11 +343,12 @@ cb_size_segment(vm_map_entry_t entry, void *closure) * data. */ static void -each_dumpable_segment(vm_map_entry_t map, segment_callback func, void *closure) +each_dumpable_segment(struct map_entry *map, segment_callback func, + void *closure) { - vm_map_entry_t entry; + struct map_entry *entry; - for (entry = map; entry != NULL; entry = entry->next) + for (entry = map; entry != NULL; entry = entry->next) (*func)(entry, closure); } @@ -438,7 +444,7 @@ elf_putnote(int type, notefunc_t notefunc, void *arg, * Generate the ELF coredump header. */ static void -elf_puthdr(int efd, pid_t pid, vm_map_entry_t map, void *hdr, size_t hdrsize, +elf_puthdr(int efd, pid_t pid, struct map_entry *map, void *hdr, size_t hdrsize, size_t notesz, size_t segoff, int numsegs) { Elf_Ehdr *ehdr, binhdr; @@ -529,11 +535,12 @@ elf_puthdr(int efd, pid_t pid, vm_map_entry_t map, voi * Free the memory map. */ static void -freemap(vm_map_entry_t map) +freemap(struct map_entry *map) { + struct map_entry *next; while (map != NULL) { - vm_map_entry_t next = map->next; + next = map->next; free(map); map = next; } @@ -545,10 +552,10 @@ freemap(vm_map_entry_t map) * returned. The map entries in the list aren't fully filled in; only * the items we need are present. */ -static vm_map_entry_t +static struct map_entry * readmap(pid_t pid) { - vm_map_entry_t ent, *linkp, map; + struct map_entry *ent, **linkp, *map; struct kinfo_vmentry *vmentl, *kve; int i, nitems;