From owner-svn-src-stable-10@freebsd.org Mon Nov 27 02:44:37 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8906DF68E3; Mon, 27 Nov 2017 02:44:37 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 74F57803DC; Mon, 27 Nov 2017 02:44:37 +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 vAR2ia7U083968; Mon, 27 Nov 2017 02:44:36 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAR2ia0h083967; Mon, 27 Nov 2017 02:44:36 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201711270244.vAR2ia0h083967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 27 Nov 2017 02:44:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326241 - stable/10/lib/libc/iconv X-SVN-Group: stable-10 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/10/lib/libc/iconv X-SVN-Commit-Revision: 326241 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Nov 2017 02:44:37 -0000 Author: pfg Date: Mon Nov 27 02:44:36 2017 New Revision: 326241 URL: https://svnweb.freebsd.org/changeset/base/326241 Log: MFC r326028: iconv: Fix a pointer mismatch. Catch NULL pointer earlier, check for empty string later. Apparently this fixes a GCC8 warning. Obtained from: NetBSD (CVS Rev. 1.21, 1.22) through DragonFlyBSD Modified: stable/10/lib/libc/iconv/citrus_none.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/iconv/citrus_none.c ============================================================================== --- stable/10/lib/libc/iconv/citrus_none.c Mon Nov 27 02:43:27 2017 (r326240) +++ stable/10/lib/libc/iconv/citrus_none.c Mon Nov 27 02:44:36 2017 (r326241) @@ -164,7 +164,7 @@ _citrus_NONE_stdenc_mbtowc(struct _citrus_stdenc * __r struct iconv_hooks *hooks) { - if (s == NULL) { + if (*s == NULL) { *nresult = 0; return (0); } @@ -176,7 +176,7 @@ _citrus_NONE_stdenc_mbtowc(struct _citrus_stdenc * __r if (pwc != NULL) *pwc = (_wc_t)(unsigned char) **s; - *nresult = *s == '\0' ? 0 : 1; + *nresult = **s == '\0' ? 0 : 1; if ((hooks != NULL) && (hooks->wc_hook != NULL)) hooks->wc_hook(*pwc, hooks->data); From owner-svn-src-stable-10@freebsd.org Mon Nov 27 03:49:52 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D96DCDF7AB6; Mon, 27 Nov 2017 03:49:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A60A2270C; Mon, 27 Nov 2017 03:49:52 +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 vAR3npvd010122; Mon, 27 Nov 2017 03:49:51 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAR3npp1010121; Mon, 27 Nov 2017 03:49:51 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201711270349.vAR3npp1010121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 27 Nov 2017 03:49:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326243 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 326243 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Nov 2017 03:49:53 -0000 Author: delphij Date: Mon Nov 27 03:49:51 2017 New Revision: 326243 URL: https://svnweb.freebsd.org/changeset/base/326243 Log: MFC r325755: Be more careful when doing calculation with request from userland. Modified: stable/10/sys/kern/kern_proc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_proc.c ============================================================================== --- stable/10/sys/kern/kern_proc.c Mon Nov 27 03:47:12 2017 (r326242) +++ stable/10/sys/kern/kern_proc.c Mon Nov 27 03:49:51 2017 (r326243) @@ -1858,7 +1858,7 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS) if (error != 0 || req->newptr == NULL) return (error); - if (req->newlen + sizeof(struct pargs) > ps_arg_cache_limit) + if (req->newlen > ps_arg_cache_limit - sizeof(struct pargs)) return (ENOMEM); newpa = pargs_alloc(req->newlen); error = SYSCTL_IN(req, newpa->ar_args, req->newlen); From owner-svn-src-stable-10@freebsd.org Mon Nov 27 15:12:15 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F19A6E54063; Mon, 27 Nov 2017 15:12:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB4A975982; Mon, 27 Nov 2017 15:12:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vARFCEDZ098992; Mon, 27 Nov 2017 15:12:14 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vARFCEw6098988; Mon, 27 Nov 2017 15:12:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201711271512.vARFCEw6098988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 27 Nov 2017 15:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326264 - in stable: 10/release/tools 11/release/tools X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release/tools 11/release/tools X-SVN-Commit-Revision: 326264 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Nov 2017 15:12:16 -0000 Author: gjb Date: Mon Nov 27 15:12:14 2017 New Revision: 326264 URL: https://svnweb.freebsd.org/changeset/base/326264 Log: MFC r326068: Remove /etc/resolv.conf from virtual machine images, which is copied from the build host. It is renamed to /etc/resolv.conf.bak on boot, so never used anyway. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/tools/ec2.conf stable/10/release/tools/gce.conf stable/10/release/tools/vagrant-virtualbox.conf stable/10/release/tools/vagrant-vmware.conf Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/release/tools/ec2.conf stable/11/release/tools/gce.conf stable/11/release/tools/vagrant-virtualbox.conf stable/11/release/tools/vagrant-vmware.conf Directory Properties: stable/11/ (props changed) Modified: stable/10/release/tools/ec2.conf ============================================================================== --- stable/10/release/tools/ec2.conf Mon Nov 27 15:11:47 2017 (r326263) +++ stable/10/release/tools/ec2.conf Mon Nov 27 15:12:14 2017 (r326264) @@ -82,5 +82,7 @@ vm_extra_pre_umount() { # * firstboot_pkgs (install packages) touch ${DESTDIR}/firstboot + rm -f ${DESTDIR}/etc/resolv.conf + return 0 } Modified: stable/10/release/tools/gce.conf ============================================================================== --- stable/10/release/tools/gce.conf Mon Nov 27 15:11:47 2017 (r326263) +++ stable/10/release/tools/gce.conf Mon Nov 27 15:12:14 2017 (r326264) @@ -89,5 +89,7 @@ EOF touch ${DESTDIR}/firstboot + rm -f ${DESTDIR}/etc/resolv.conf + return 0 } Modified: stable/10/release/tools/vagrant-virtualbox.conf ============================================================================== --- stable/10/release/tools/vagrant-virtualbox.conf Mon Nov 27 15:11:47 2017 (r326263) +++ stable/10/release/tools/vagrant-virtualbox.conf Mon Nov 27 15:12:14 2017 (r326264) @@ -15,4 +15,5 @@ vm_extra_pre_umount () { # Setup the Vagrant common items vagrant_common + rm -f ${DESTDIR}/etc/resolv.conf } Modified: stable/10/release/tools/vagrant-vmware.conf ============================================================================== --- stable/10/release/tools/vagrant-vmware.conf Mon Nov 27 15:11:47 2017 (r326263) +++ stable/10/release/tools/vagrant-vmware.conf Mon Nov 27 15:12:14 2017 (r326264) @@ -19,4 +19,5 @@ vm_extra_pre_umount () { # Setup the Vagrant common items vagrant_common + rm -f ${DESTDIR}/etc/resolv.conf } From owner-svn-src-stable-10@freebsd.org Tue Nov 28 17:20:55 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAA36DE7C96; Tue, 28 Nov 2017 17:20:55 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 480FF6F7A4; Tue, 28 Nov 2017 17:20:55 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASHKsWx083584; Tue, 28 Nov 2017 17:20:54 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASHKs1p083578; Tue, 28 Nov 2017 17:20:54 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201711281720.vASHKs1p083578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 28 Nov 2017 17:20:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326324 - stable/10/contrib/libc-vis X-SVN-Group: stable-10 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/10/contrib/libc-vis X-SVN-Commit-Revision: 326324 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 17:20:55 -0000 Author: brooks Date: Tue Nov 28 17:20:53 2017 New Revision: 326324 URL: https://svnweb.freebsd.org/changeset/base/326324 Log: MFC r301679 (partial), r309626, r326307 r301679: Update to a June 8th snapshot of (un)vis form NetBSD. This adds stravis() and some new encoding flags VIS_SHELL, VIS_META, and VIS_NOLOCALE. Assorted cleanups and fixes includeing a manpage typo[0]. NOTE: The symbol for stravis() is not exported in this merge. r309626: strvis(3): Avoid internal state of multibyte functions being tainted. The mbtoc(3) and wctomb(3) functions use internal state which may be tainted before the call to strvis(3). In this context we can just use the thread-safe versions mbrtoc(3) and wcrtomb(3) which allow passing our own state from our stack. r326307: Update vis(3) the latest from NetBSD. This adds VIS_DQ for compatiblity with OpenBSD. Correct by an off-by-one error and a read buffer overflow detected using asan. PR: 210013 [0] Submitted by: pi [0] Modified: stable/10/contrib/libc-vis/unvis.3 stable/10/contrib/libc-vis/unvis.c stable/10/contrib/libc-vis/vis.3 stable/10/contrib/libc-vis/vis.c stable/10/contrib/libc-vis/vis.h Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libc-vis/unvis.3 ============================================================================== --- stable/10/contrib/libc-vis/unvis.3 Tue Nov 28 17:07:21 2017 (r326323) +++ stable/10/contrib/libc-vis/unvis.3 Tue Nov 28 17:20:53 2017 (r326324) @@ -1,4 +1,4 @@ -.\" $NetBSD: unvis.3,v 1.27 2012/12/15 07:34:36 wiz Exp $ +.\" $NetBSD: unvis.3,v 1.29 2017/10/24 19:14:55 abhinav Exp $ .\" $FreeBSD$ .\" .\" Copyright (c) 1989, 1991, 1993 @@ -35,7 +35,10 @@ .Os .Sh NAME .Nm unvis , -.Nm strunvis +.Nm strunvis , +.Nm strnunvis , +.Nm strunvisx , +.Nm strnunvisx .Nd decode a visual representation of characters .Sh LIBRARY .Lb libc @@ -184,7 +187,7 @@ char out; while ((ch = getchar()) != EOF) { again: - switch(unvis(\*[Am]out, ch, \*[Am]state, 0)) { + switch(unvis(&out, ch, &state, 0)) { case 0: case UNVIS_NOCHAR: break; @@ -198,7 +201,7 @@ again: errx(EXIT_FAILURE, "Bad character sequence!"); } } -if (unvis(\*[Am]out, '\e0', \*[Am]state, UNVIS_END) == UNVIS_VALID) +if (unvis(&out, '\e0', &state, UNVIS_END) == UNVIS_VALID) (void)putchar(out); .Ed .Sh ERRORS Modified: stable/10/contrib/libc-vis/unvis.c ============================================================================== --- stable/10/contrib/libc-vis/unvis.c Tue Nov 28 17:07:21 2017 (r326323) +++ stable/10/contrib/libc-vis/unvis.c Tue Nov 28 17:20:53 2017 (r326324) @@ -1,4 +1,4 @@ -/* $NetBSD: unvis.c,v 1.41 2012/12/15 04:29:53 matt Exp $ */ +/* $NetBSD: unvis.c,v 1.44 2014/09/26 15:43:36 roy Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)unvis.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: unvis.c,v 1.41 2012/12/15 04:29:53 matt Exp $"); +__RCSID("$NetBSD: unvis.c,v 1.44 2014/09/26 15:43:36 roy Exp $"); #endif #endif /* LIBC_SCCS and not lint */ __FBSDID("$FreeBSD$"); @@ -322,6 +322,12 @@ unvis(char *cp, int c, int *astate, int flag) */ *astate = SS(0, S_GROUND); return UNVIS_NOCHAR; + default: + if (isgraph(c)) { + *cp = c; + *astate = SS(0, S_GROUND); + return UNVIS_VALID; + } } goto bad; Modified: stable/10/contrib/libc-vis/vis.3 ============================================================================== --- stable/10/contrib/libc-vis/vis.3 Tue Nov 28 17:07:21 2017 (r326323) +++ stable/10/contrib/libc-vis/vis.3 Tue Nov 28 17:20:53 2017 (r326324) @@ -1,4 +1,4 @@ -.\" $NetBSD: vis.3,v 1.39 2013/02/20 20:05:26 christos Exp $ +.\" $NetBSD: vis.3,v 1.49 2017/08/05 20:22:29 wiz Exp $ .\" $FreeBSD$ .\" .\" Copyright (c) 1989, 1991, 1993 @@ -30,13 +30,14 @@ .\" .\" @(#)vis.3 8.1 (Berkeley) 6/9/93 .\" -.Dd February 19, 2013 +.Dd April 22, 2017 .Dt VIS 3 .Os .Sh NAME .Nm vis , .Nm nvis , .Nm strvis , +.Nm stravis , .Nm strnvis , .Nm strvisx , .Nm strnvisx , @@ -60,6 +61,8 @@ .Ft int .Fn strvis "char *dst" "const char *src" "int flag" .Ft int +.Fn stravis "char **dst" "const char *src" "int flag" +.Ft int .Fn strnvis "char *dst" "size_t dlen" "const char *src" "int flag" .Ft int .Fn strvisx "char *dst" "const char *src" "size_t len" "int flag" @@ -112,6 +115,7 @@ encoding format (explained below). .Pp The .Fn strvis , +.Fn stravis , .Fn strnvis , .Fn strvisx , and @@ -158,6 +162,9 @@ forms return the number of characters in (not including the trailing .Dv NUL ) . The +.Fn stravis +function allocates space dynamically to hold the string. +The .Dq Nm n versions of the functions also take an additional argument .Fa dlen @@ -236,15 +243,37 @@ except space, tab, and newline are encoded (see The following flags alter this: .Bl -tag -width VIS_WHITEX +.It Dv VIS_DQ +Also encode double quotes .It Dv VIS_GLOB Also encode the magic characters .Ql ( * , .Ql \&? , -.Ql \&[ +.Ql \&[ , and .Ql # ) recognized by .Xr glob 3 . +.It Dv VIS_SHELL +Also encode the meta characters used by shells (in addition to the glob +characters): +.Ql ( ' , +.Ql ` , +.Ql \&" , +.Ql \&; , +.Ql & , +.Ql < , +.Ql > , +.Ql \&( , +.Ql \&) , +.Ql \&| , +.Ql \&] , +.Ql \e , +.Ql $ , +.Ql \&! , +.Ql \&^ , +and +.Ql ~ ) . .It Dv VIS_SP Also encode space. .It Dv VIS_TAB @@ -253,11 +282,10 @@ Also encode tab. Also encode newline. .It Dv VIS_WHITE Synonym for -.Dv VIS_SP -\&| -.Dv VIS_TAB -\&| -.Dv VIS_NL . +.Dv VIS_SP | VIS_TAB | VIS_NL . +.It Dv VIS_META +Synonym for +.Dv VIS_WHITE | VIS_GLOB | VIS_SHELL . .It Dv VIS_SAFE Only encode .Dq unsafe @@ -284,7 +312,7 @@ warning on the use of the .Dv VIS_NOSLASH flag below). .Pp -There are four forms of encoding. +There are six forms of encoding. All forms use the backslash character .Ql \e to introduce a special @@ -375,6 +403,9 @@ If .Fa nextc is an octal digit, the latter representation is used to avoid ambiguity. +.Pp +Non-printable characters without C-style +backslash sequences use the default representation. .It Dv VIS_OCTAL Use a three digit octal sequence. The form is @@ -382,6 +413,11 @@ The form is where .Em d represents an octal digit. +.It Dv VIS_CSTYLE \&| Dv VIS_OCTAL +Same as +.Dv VIS_CSTYLE +except that non-printable characters without C-style +backslash sequences use a three digit octal sequence. .It Dv VIS_HTTPSTYLE Use URI encoding as described in RFC 1738. The form is @@ -417,6 +453,11 @@ The encoding conversion is influenced by the setting o environment variable which defines the set of characters that can be copied without encoding. .Pp +If +.Dv VIS_NOLOCALE +is set, processing is done assuming the C locale and overriding +any other environment settings. +.Pp When 8-bit data is present in the input, .Ev LC_CTYPE must be set to the correct locale or to the C locale. @@ -512,7 +553,7 @@ appeared in .Nx 6.0 and .Fx 9.2 . -Myltibyte character support was added in +Multibyte character support was added in .Nx 7.0 and .Fx 9.2 . Modified: stable/10/contrib/libc-vis/vis.c ============================================================================== --- stable/10/contrib/libc-vis/vis.c Tue Nov 28 17:07:21 2017 (r326323) +++ stable/10/contrib/libc-vis/vis.c Tue Nov 28 17:20:53 2017 (r326324) @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $ */ +/* $NetBSD: vis.c,v 1.74 2017/11/27 16:37:21 christos Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $"); +__RCSID("$NetBSD: vis.c,v 1.74 2017/11/27 16:37:21 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -97,15 +97,42 @@ static wchar_t *do_svis(wchar_t *, wint_t, int, wint_t #undef BELL #define BELL L'\a' + +#if defined(LC_C_LOCALE) +#define iscgraph(c) isgraph_l(c, LC_C_LOCALE) +#else +/* Keep it simple for now, no locale stuff */ +#define iscgraph(c) isgraph(c) +#ifdef notyet +#include +static int +iscgraph(int c) { + int rv; + char *ol; + ol = setlocale(LC_CTYPE, "C"); + rv = isgraph(c); + if (ol) + setlocale(LC_CTYPE, ol); + return rv; +} +#endif +#endif + +#define ISGRAPH(flags, c) \ + (((flags) & VIS_NOLOCALE) ? iscgraph(c) : iswgraph(c)) + #define iswoctal(c) (((u_char)(c)) >= L'0' && ((u_char)(c)) <= L'7') #define iswwhite(c) (c == L' ' || c == L'\t' || c == L'\n') #define iswsafe(c) (c == L'\b' || c == BELL || c == L'\r') #define xtoa(c) L"0123456789abcdef"[c] #define XTOA(c) L"0123456789ABCDEF"[c] -#define MAXEXTRAS 10 +#define MAXEXTRAS 30 +static const wchar_t char_shell[] = L"'`\";&<>()|{}]\\$!^~"; +static const wchar_t char_glob[] = L"*?[#"; + #if !HAVE_NBTOOL_CONFIG_H #ifndef __NetBSD__ /* @@ -213,8 +240,23 @@ do_mbyte(wchar_t *dst, wint_t c, int flags, wint_t nex *dst++ = L'0'; } return dst; + /* We cannot encode these characters in VIS_CSTYLE + * because they special meaning */ + case L'n': + case L'r': + case L'b': + case L'a': + case L'v': + case L't': + case L'f': + case L's': + case L'0': + case L'M': + case L'^': + case L'$': /* vis(1) -l */ + break; default: - if (iswgraph(c)) { + if (ISGRAPH(flags, c) && !iswoctal(c)) { *dst++ = L'\\'; *dst++ = c; return dst; @@ -266,7 +308,7 @@ do_svis(wchar_t *dst, wint_t c, int flags, wint_t next uint64_t bmsk, wmsk; iswextra = wcschr(extra, c) != NULL; - if (!iswextra && (iswgraph(c) || iswwhite(c) || + if (!iswextra && (ISGRAPH(flags, c) || iswwhite(c) || ((flags & VIS_SAFE) && iswsafe(c)))) { *dst++ = c; return dst; @@ -310,29 +352,34 @@ makeextralist(int flags, const char *src) { wchar_t *dst, *d; size_t len; + const wchar_t *s; + mbstate_t mbstate; + bzero(&mbstate, sizeof(mbstate)); len = strlen(src); if ((dst = calloc(len + MAXEXTRAS, sizeof(*dst))) == NULL) return NULL; - if (mbstowcs(dst, src, len) == (size_t)-1) { + if ((flags & VIS_NOLOCALE) || mbsrtowcs(dst, &src, len, &mbstate) == (size_t)-1) { size_t i; for (i = 0; i < len; i++) - dst[i] = (wint_t)(u_char)src[i]; + dst[i] = (wchar_t)(u_char)src[i]; d = dst + len; } else d = dst + wcslen(dst); - if (flags & VIS_GLOB) { - *d++ = L'*'; - *d++ = L'?'; - *d++ = L'['; - *d++ = L'#'; - } + if (flags & VIS_GLOB) + for (s = char_glob; *s; *d++ = *s++) + continue; + if (flags & VIS_SHELL) + for (s = char_shell; *s; *d++ = *s++) + continue; + if (flags & VIS_SP) *d++ = L' '; if (flags & VIS_TAB) *d++ = L'\t'; if (flags & VIS_NL) *d++ = L'\n'; + if (flags & VIS_DQ) *d++ = L'"'; if ((flags & VIS_NOSLASH) == 0) *d++ = L'\\'; *d = L'\0'; @@ -345,7 +392,7 @@ makeextralist(int flags, const char *src) * All user-visible functions call this one. */ static int -istrsenvisx(char *mbdst, size_t *dlen, const char *mbsrc, size_t mblength, +istrsenvisx(char **mbdstp, size_t *dlen, const char *mbsrc, size_t mblength, int flags, const char *mbextra, int *cerr_ptr) { wchar_t *dst, *src, *pdst, *psrc, *start, *extra; @@ -353,14 +400,24 @@ istrsenvisx(char *mbdst, size_t *dlen, const char *mbs uint64_t bmsk, wmsk; wint_t c; visfun_t f; - int clen = 0, cerr = 0, error = -1, i, shft; + int clen = 0, cerr, error = -1, i, shft; + char *mbdst, *mdst; ssize_t mbslength, maxolen; + mbstate_t mbstate; - _DIAGASSERT(mbdst != NULL); + _DIAGASSERT(mbdstp != NULL); _DIAGASSERT(mbsrc != NULL || mblength == 0); _DIAGASSERT(mbextra != NULL); + mbslength = (ssize_t)mblength; /* + * When inputing a single character, must also read in the + * next character for nextc, the look-ahead character. + */ + if (mbslength == 1) + mbslength++; + + /* * Input (mbsrc) is a char string considered to be multibyte * characters. The input loop will read this string pulling * one character, possibly multiple bytes, from mbsrc and @@ -375,16 +432,28 @@ istrsenvisx(char *mbdst, size_t *dlen, const char *mbs /* Allocate space for the wide char strings */ psrc = pdst = extra = NULL; - if ((psrc = calloc(mblength + 1, sizeof(*psrc))) == NULL) + mdst = NULL; + if ((psrc = calloc(mbslength + 1, sizeof(*psrc))) == NULL) return -1; - if ((pdst = calloc((4 * mblength) + 1, sizeof(*pdst))) == NULL) + if ((pdst = calloc((16 * mbslength) + 1, sizeof(*pdst))) == NULL) goto out; + if (*mbdstp == NULL) { + if ((mdst = calloc((16 * mbslength) + 1, sizeof(*mdst))) == NULL) + goto out; + *mbdstp = mdst; + } + + mbdst = *mbdstp; dst = pdst; src = psrc; - /* Use caller's multibyte conversion error flag. */ - if (cerr_ptr) - cerr = *cerr_ptr; + if (flags & VIS_NOLOCALE) { + /* Do one byte at a time conversion */ + cerr = 1; + } else { + /* Use caller's multibyte conversion error flag. */ + cerr = cerr_ptr ? *cerr_ptr : 0; + } /* * Input loop. @@ -392,29 +461,24 @@ istrsenvisx(char *mbdst, size_t *dlen, const char *mbs * stop at NULs because we may be processing a block of data * that includes NULs. */ - mbslength = (ssize_t)mblength; - /* - * When inputing a single character, must also read in the - * next character for nextc, the look-ahead character. - */ - if (mbslength == 1) - mbslength++; + bzero(&mbstate, sizeof(mbstate)); while (mbslength > 0) { /* Convert one multibyte character to wchar_t. */ if (!cerr) - clen = mbtowc(src, mbsrc, MB_LEN_MAX); + clen = mbrtowc(src, mbsrc, MB_LEN_MAX, &mbstate); if (cerr || clen < 0) { /* Conversion error, process as a byte instead. */ *src = (wint_t)(u_char)*mbsrc; clen = 1; cerr = 1; } - if (clen == 0) + if (clen == 0) { /* * NUL in input gives 0 return value. process * as single NUL byte and keep going. */ clen = 1; + } /* Advance buffer character pointer. */ src++; /* Advance input pointer by number of bytes read. */ @@ -424,6 +488,7 @@ istrsenvisx(char *mbdst, size_t *dlen, const char *mbs } len = src - psrc; src = psrc; + /* * In the single character input case, we will have actually * processed two characters, c and nextc. Reset len back to @@ -439,7 +504,7 @@ istrsenvisx(char *mbdst, size_t *dlen, const char *mbs errno = ENOSPC; goto out; } - *mbdst = '\0'; /* can't create extra, return "" */ + *mbdst = '\0'; /* can't create extra, return "" */ error = 0; goto out; } @@ -473,9 +538,10 @@ istrsenvisx(char *mbdst, size_t *dlen, const char *mbs len = wcslen(start); maxolen = dlen ? *dlen : (wcslen(start) * MB_LEN_MAX + 1); olen = 0; + bzero(&mbstate, sizeof(mbstate)); for (dst = start; len > 0; len--) { if (!cerr) - clen = wctomb(mbdst, *dst); + clen = wcrtomb(mbdst, *dst, &mbstate); if (cerr || clen < 0) { /* * Conversion error, process as a byte(s) instead. @@ -511,9 +577,11 @@ istrsenvisx(char *mbdst, size_t *dlen, const char *mbs /* Terminate the output string. */ *mbdst = '\0'; - /* Pass conversion error flag out. */ - if (cerr_ptr) - *cerr_ptr = cerr; + if (flags & VIS_NOLOCALE) { + /* Pass conversion error flag out. */ + if (cerr_ptr) + *cerr_ptr = cerr; + } free(extra); free(pdst); @@ -524,14 +592,15 @@ out: free(extra); free(pdst); free(psrc); + free(mdst); return error; } static int -istrsenvisxl(char *mbdst, size_t *dlen, const char *mbsrc, +istrsenvisxl(char **mbdstp, size_t *dlen, const char *mbsrc, int flags, const char *mbextra, int *cerr_ptr) { - return istrsenvisx(mbdst, dlen, mbsrc, + return istrsenvisx(mbdstp, dlen, mbsrc, mbsrc != NULL ? strlen(mbsrc) : 0, flags, mbextra, cerr_ptr); } @@ -554,7 +623,7 @@ svis(char *mbdst, int c, int flags, int nextc, const c cc[0] = c; cc[1] = nextc; - ret = istrsenvisx(mbdst, NULL, cc, 1, flags, mbextra, NULL); + ret = istrsenvisx(&mbdst, NULL, cc, 1, flags, mbextra, NULL); if (ret < 0) return NULL; return mbdst + ret; @@ -569,7 +638,7 @@ snvis(char *mbdst, size_t dlen, int c, int flags, int cc[0] = c; cc[1] = nextc; - ret = istrsenvisx(mbdst, &dlen, cc, 1, flags, mbextra, NULL); + ret = istrsenvisx(&mbdst, &dlen, cc, 1, flags, mbextra, NULL); if (ret < 0) return NULL; return mbdst + ret; @@ -578,33 +647,33 @@ snvis(char *mbdst, size_t dlen, int c, int flags, int int strsvis(char *mbdst, const char *mbsrc, int flags, const char *mbextra) { - return istrsenvisxl(mbdst, NULL, mbsrc, flags, mbextra, NULL); + return istrsenvisxl(&mbdst, NULL, mbsrc, flags, mbextra, NULL); } int strsnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags, const char *mbextra) { - return istrsenvisxl(mbdst, &dlen, mbsrc, flags, mbextra, NULL); + return istrsenvisxl(&mbdst, &dlen, mbsrc, flags, mbextra, NULL); } int strsvisx(char *mbdst, const char *mbsrc, size_t len, int flags, const char *mbextra) { - return istrsenvisx(mbdst, NULL, mbsrc, len, flags, mbextra, NULL); + return istrsenvisx(&mbdst, NULL, mbsrc, len, flags, mbextra, NULL); } int strsnvisx(char *mbdst, size_t dlen, const char *mbsrc, size_t len, int flags, const char *mbextra) { - return istrsenvisx(mbdst, &dlen, mbsrc, len, flags, mbextra, NULL); + return istrsenvisx(&mbdst, &dlen, mbsrc, len, flags, mbextra, NULL); } int strsenvisx(char *mbdst, size_t dlen, const char *mbsrc, size_t len, int flags, const char *mbextra, int *cerr_ptr) { - return istrsenvisx(mbdst, &dlen, mbsrc, len, flags, mbextra, cerr_ptr); + return istrsenvisx(&mbdst, &dlen, mbsrc, len, flags, mbextra, cerr_ptr); } #endif @@ -621,7 +690,7 @@ vis(char *mbdst, int c, int flags, int nextc) cc[0] = c; cc[1] = nextc; - ret = istrsenvisx(mbdst, NULL, cc, 1, flags, "", NULL); + ret = istrsenvisx(&mbdst, NULL, cc, 1, flags, "", NULL); if (ret < 0) return NULL; return mbdst + ret; @@ -636,7 +705,7 @@ nvis(char *mbdst, size_t dlen, int c, int flags, int n cc[0] = c; cc[1] = nextc; - ret = istrsenvisx(mbdst, &dlen, cc, 1, flags, "", NULL); + ret = istrsenvisx(&mbdst, &dlen, cc, 1, flags, "", NULL); if (ret < 0) return NULL; return mbdst + ret; @@ -653,15 +722,22 @@ nvis(char *mbdst, size_t dlen, int c, int flags, int n int strvis(char *mbdst, const char *mbsrc, int flags) { - return istrsenvisxl(mbdst, NULL, mbsrc, flags, "", NULL); + return istrsenvisxl(&mbdst, NULL, mbsrc, flags, "", NULL); } int strnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags) { - return istrsenvisxl(mbdst, &dlen, mbsrc, flags, "", NULL); + return istrsenvisxl(&mbdst, &dlen, mbsrc, flags, "", NULL); } +int +stravis(char **mbdstp, const char *mbsrc, int flags) +{ + *mbdstp = NULL; + return istrsenvisxl(mbdstp, NULL, mbsrc, flags, "", NULL); +} + /* * strvisx - visually encode characters from src into dst * @@ -676,19 +752,19 @@ strnvis(char *mbdst, size_t dlen, const char *mbsrc, i int strvisx(char *mbdst, const char *mbsrc, size_t len, int flags) { - return istrsenvisx(mbdst, NULL, mbsrc, len, flags, "", NULL); + return istrsenvisx(&mbdst, NULL, mbsrc, len, flags, "", NULL); } int strnvisx(char *mbdst, size_t dlen, const char *mbsrc, size_t len, int flags) { - return istrsenvisx(mbdst, &dlen, mbsrc, len, flags, "", NULL); + return istrsenvisx(&mbdst, &dlen, mbsrc, len, flags, "", NULL); } int strenvisx(char *mbdst, size_t dlen, const char *mbsrc, size_t len, int flags, int *cerr_ptr) { - return istrsenvisx(mbdst, &dlen, mbsrc, len, flags, "", cerr_ptr); + return istrsenvisx(&mbdst, &dlen, mbsrc, len, flags, "", cerr_ptr); } #endif Modified: stable/10/contrib/libc-vis/vis.h ============================================================================== --- stable/10/contrib/libc-vis/vis.h Tue Nov 28 17:07:21 2017 (r326323) +++ stable/10/contrib/libc-vis/vis.h Tue Nov 28 17:20:53 2017 (r326324) @@ -1,4 +1,4 @@ -/* $NetBSD: vis.h,v 1.21 2013/02/20 17:01:15 christos Exp $ */ +/* $NetBSD: vis.h,v 1.25 2017/04/23 01:57:36 christos Exp $ */ /* $FreeBSD$ */ /*- @@ -52,6 +52,7 @@ #define VIS_NL 0x0010 /* also encode newline */ #define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL) #define VIS_SAFE 0x0020 /* only encode "unsafe" characters */ +#define VIS_DQ 0x8000 /* also encode double quotes */ /* * other @@ -64,6 +65,9 @@ #define VIS_HTTP1866 0x0400 /* http-style &#num; or &string; */ #define VIS_NOESCAPE 0x0800 /* don't decode `\' */ #define _VIS_END 0x1000 /* for unvis */ +#define VIS_SHELL 0x2000 /* encode shell special characters [not glob] */ +#define VIS_META (VIS_WHITE | VIS_GLOB | VIS_SHELL) +#define VIS_NOLOCALE 0x4000 /* encode using the C locale */ /* * unvis return codes @@ -89,6 +93,7 @@ char *svis(char *, int, int, int, const char *); char *snvis(char *, size_t, int, int, int, const char *); int strvis(char *, const char *, int); +int stravis(char **, const char *, int); int strnvis(char *, size_t, const char *, int); int strsvis(char *, const char *, int, const char *); From owner-svn-src-stable-10@freebsd.org Tue Nov 28 17:25:25 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E912DE7E68; Tue, 28 Nov 2017 17:25:25 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A3666FBA9; Tue, 28 Nov 2017 17:25:24 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASHPOTg087429; Tue, 28 Nov 2017 17:25:24 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASHPO2M087428; Tue, 28 Nov 2017 17:25:24 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281725.vASHPO2M087428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 28 Nov 2017 17:25:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326325 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 326325 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 17:25:25 -0000 Author: asomers Date: Tue Nov 28 17:25:24 2017 New Revision: 326325 URL: https://svnweb.freebsd.org/changeset/base/326325 Log: MFC r322546: Fix some ZFS debugging messages sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Be more careful about the use of provider names vs vdev names in ZFS_LOG statements. Sponsored by: Spectra Logic Corp Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Nov 28 17:20:53 2017 (r326324) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Nov 28 17:25:24 2017 (r326325) @@ -747,7 +747,7 @@ vdev_geom_open_by_guids(vdev_t *vd) ZFS_LOG(1, "Attach by guid [%ju:%ju] succeeded, provider %s.", (uintmax_t)spa_guid(vd->vdev_spa), - (uintmax_t)vd->vdev_guid, vd->vdev_path); + (uintmax_t)vd->vdev_guid, cp->provider->name); } else { ZFS_LOG(1, "Search by guid [%ju:%ju] failed.", (uintmax_t)spa_guid(vd->vdev_spa), @@ -849,12 +849,12 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t * VERIFY(tsd_set(zfs_geom_probe_vdev_key, NULL) == 0); if (cp == NULL) { - ZFS_LOG(1, "Provider %s not found.", vd->vdev_path); + ZFS_LOG(1, "Vdev %s not found.", vd->vdev_path); error = ENOENT; } else if (cp->provider->sectorsize > VDEV_PAD_SIZE || !ISP2(cp->provider->sectorsize)) { ZFS_LOG(1, "Provider %s has unsupported sectorsize.", - vd->vdev_path); + cp->provider->name); vdev_geom_close_locked(vd); error = EINVAL; @@ -872,7 +872,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t * } if (error != 0) { printf("ZFS WARNING: Unable to open %s for writing (error=%d).\n", - vd->vdev_path, error); + cp->provider->name, error); vdev_geom_close_locked(vd); cp = NULL; } From owner-svn-src-stable-10@freebsd.org Tue Nov 28 17:27:01 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0B8EDE7F21; Tue, 28 Nov 2017 17:27:01 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7AA246FD08; Tue, 28 Nov 2017 17:27:01 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASHR0RT087547; Tue, 28 Nov 2017 17:27:00 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASHR07v087544; Tue, 28 Nov 2017 17:27:00 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281727.vASHR07v087544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 28 Nov 2017 17:27:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326326 - stable/10/etc/periodic/security X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/etc/periodic/security X-SVN-Commit-Revision: 326326 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 17:27:01 -0000 Author: asomers Date: Tue Nov 28 17:27:00 2017 New Revision: 326326 URL: https://svnweb.freebsd.org/changeset/base/326326 Log: MFC r322868: Fix 100.chksetuid and 110.neggrpperm for mountpoints with spaces Also, fix them for mountpoints with tabs. PR: 48325 Reported by: pguyot@kallisys.net, aaron@baugher.biz Modified: stable/10/etc/periodic/security/100.chksetuid stable/10/etc/periodic/security/110.neggrpperm stable/10/etc/periodic/security/security.functions Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/periodic/security/100.chksetuid ============================================================================== --- stable/10/etc/periodic/security/100.chksetuid Tue Nov 28 17:25:24 2017 (r326325) +++ stable/10/etc/periodic/security/100.chksetuid Tue Nov 28 17:27:00 2017 (r326326) @@ -45,7 +45,13 @@ if check_yesno_period security_status_chksetuid_enable then echo "" echo 'Checking setuid files and devices:' - MP=`mount -t ufs,zfs | awk '$0 !~ /no(suid|exec)/ { print $3 }'` + IFS=$'\n' # Don't split mount points with spaces or tabs + MP=`mount -t ufs,zfs | awk ' + $0 !~ /no(suid|exec)/ { + sub(/^.* on \//, "/"); + sub(/ \(.*\)/, ""); + print $0 + }'` find -sx $MP /dev/null \( ! -fstype local \) -prune -o -type f \ \( -perm -u+x -or -perm -g+x -or -perm -o+x \) \ \( -perm -u+s -or -perm -g+s \) -exec ls -liTd \{\} \+ | Modified: stable/10/etc/periodic/security/110.neggrpperm ============================================================================== --- stable/10/etc/periodic/security/110.neggrpperm Tue Nov 28 17:25:24 2017 (r326325) +++ stable/10/etc/periodic/security/110.neggrpperm Tue Nov 28 17:27:00 2017 (r326326) @@ -43,7 +43,13 @@ if check_yesno_period security_status_neggrpperm_enabl then echo "" echo 'Checking negative group permissions:' - MP=`mount -t ufs,zfs | awk '$0 !~ /no(suid|exec)/ { print $3 }'` + IFS=$'\n' # Don't split mount points with spaces or tabs + MP=`mount -t ufs,zfs | awk ' + $0 !~ /no(suid|exec)/ { + sub(/^.* on \//, "/"); + sub(/ \(.*\)/, ""); + print $0 + }'` n=$(find -sx $MP /dev/null \( ! -fstype local \) -prune -o -type f \ \( \( ! -perm +010 -and -perm +001 \) -or \ \( ! -perm +020 -and -perm +002 \) -or \ Modified: stable/10/etc/periodic/security/security.functions ============================================================================== --- stable/10/etc/periodic/security/security.functions Tue Nov 28 17:25:24 2017 (r326325) +++ stable/10/etc/periodic/security/security.functions Tue Nov 28 17:27:00 2017 (r326326) @@ -48,6 +48,7 @@ rc=0 # LABEL is the base name of the ${LOG}/${label}.{today,yesterday} files. check_diff() { + unset IFS rc=0 if [ "$1" = "new_only" ]; then shift From owner-svn-src-stable-10@freebsd.org Tue Nov 28 17:30:27 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B6F6DE8121; Tue, 28 Nov 2017 17:30:27 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33B6C70076; Tue, 28 Nov 2017 17:30:27 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASHUQ1K087844; Tue, 28 Nov 2017 17:30:26 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASHUQho087843; Tue, 28 Nov 2017 17:30:26 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281730.vASHUQho087843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 28 Nov 2017 17:30:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326327 - stable/10/cddl/compat/opensolaris/misc X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/cddl/compat/opensolaris/misc X-SVN-Commit-Revision: 326327 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 17:30:27 -0000 Author: asomers Date: Tue Nov 28 17:30:25 2017 New Revision: 326327 URL: https://svnweb.freebsd.org/changeset/base/326327 Log: MFC r323193: Honor all options of "zfs mount -o" The existing code in zmount incorrectly parses the comma-delimited option string. The result is that nmount only honors the last option. AFAICT the parsing has been broken ever since ZFS's initial import in change 168404. PR: 222078 Reviewed by: avg Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D12232 Modified: stable/10/cddl/compat/opensolaris/misc/zmount.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/compat/opensolaris/misc/zmount.c ============================================================================== --- stable/10/cddl/compat/opensolaris/misc/zmount.c Tue Nov 28 17:27:00 2017 (r326326) +++ stable/10/cddl/compat/opensolaris/misc/zmount.c Tue Nov 28 17:30:25 2017 (r326327) @@ -74,7 +74,7 @@ zmount(const char *spec, const char *dir, int mflag, c char *dataptr, int datalen, char *optptr, int optlen) { struct iovec *iov; - char *optstr, *os, *p; + char *optstr, *os, *p, *tofree; int iovlen, rv; assert(spec != NULL); @@ -87,7 +87,7 @@ zmount(const char *spec, const char *dir, int mflag, c assert(optptr != NULL); assert(optlen > 0); - optstr = strdup(optptr); + tofree = optstr = strdup(optptr); assert(optstr != NULL); iov = NULL; @@ -98,11 +98,9 @@ zmount(const char *spec, const char *dir, int mflag, c build_iovec(&iov, &iovlen, "fspath", __DECONST(char *, dir), (size_t)-1); build_iovec(&iov, &iovlen, "from", __DECONST(char *, spec), (size_t)-1); - for (p = optstr; p != NULL; strsep(&p, ",/ ")) { - if (*p != '\0') - build_iovec(&iov, &iovlen, p, NULL, (size_t)-1); - } + while ((p = strsep(&optstr, ",/")) != NULL) + build_iovec(&iov, &iovlen, p, NULL, (size_t)-1); rv = nmount(iov, iovlen, 0); - free(optstr); + free(tofree); return (rv); } From owner-svn-src-stable-10@freebsd.org Tue Nov 28 17:33:12 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 511A8DE834D; Tue, 28 Nov 2017 17:33:12 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19ADC7046E; Tue, 28 Nov 2017 17:33:12 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASHXBnP091633; Tue, 28 Nov 2017 17:33:11 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASHXBYv091632; Tue, 28 Nov 2017 17:33:11 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281733.vASHXBYv091632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 28 Nov 2017 17:33:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326328 - stable/10/sys/cddl/compat/opensolaris/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/sys/cddl/compat/opensolaris/sys X-SVN-Commit-Revision: 326328 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 17:33:12 -0000 Author: asomers Date: Tue Nov 28 17:33:10 2017 New Revision: 326328 URL: https://svnweb.freebsd.org/changeset/base/326328 Log: MFC r323194: Fix remounting ZFS filesystem with "zfs mount" "zfs mount -o" passes a list of mount options directly to nmount(2) after sanity checking them. In particular, zfs(8) will refuse to mount an already existing file system unless "remount" is specified in the option list. However, the "remount" option only exists in Illumos. FreeBSD's equivalent is "update". PR: 221985 Reviewed by: avg Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D12233 Modified: stable/10/sys/cddl/compat/opensolaris/sys/mntent.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/compat/opensolaris/sys/mntent.h ============================================================================== --- stable/10/sys/cddl/compat/opensolaris/sys/mntent.h Tue Nov 28 17:30:25 2017 (r326327) +++ stable/10/sys/cddl/compat/opensolaris/sys/mntent.h Tue Nov 28 17:33:10 2017 (r326328) @@ -46,7 +46,7 @@ #define MNTOPT_NODEVICES "nodevices" /* Device-special disallowed */ #define MNTOPT_SETUID "setuid" /* Set uid allowed */ #define MNTOPT_NOSETUID "nosetuid" /* Set uid not allowed */ -#define MNTOPT_REMOUNT "remount" /* Change mount options */ +#define MNTOPT_REMOUNT "update" /* Change mount options */ #define MNTOPT_ATIME "atime" /* update atime for files */ #define MNTOPT_NOATIME "noatime" /* do not update atime for files */ #define MNTOPT_XATTR "xattr" /* enable extended attributes */ From owner-svn-src-stable-10@freebsd.org Tue Nov 28 18:18:40 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9066DEA615; Tue, 28 Nov 2017 18:18:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B045971FF9; Tue, 28 Nov 2017 18:18:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASIId9r008846; Tue, 28 Nov 2017 18:18:39 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASIIdjt008841; Tue, 28 Nov 2017 18:18:39 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281818.vASIIdjt008841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 28 Nov 2017 18:18:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326332 - in stable/10: bin/chflags bin/chflags/tests bin/mkdir bin/mkdir/tests bin/rcp bin/rcp/tests bin/rmdir bin/rmdir/tests etc/mtree X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/10: bin/chflags bin/chflags/tests bin/mkdir bin/mkdir/tests bin/rcp bin/rcp/tests bin/rmdir bin/rmdir/tests etc/mtree X-SVN-Commit-Revision: 326332 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 18:18:41 -0000 Author: asomers Date: Tue Nov 28 18:18:39 2017 New Revision: 326332 URL: https://svnweb.freebsd.org/changeset/base/326332 Log: MFC r323275, r324112 r323275: Add basic tests for chflags, mkdir, rcp, and rmdir Add basic command line parsing test coverage for these utilities. The tests were automatically generated based on their man pages. These tests can be expanded by hand for more thorough coverage. The aim is to generate very basic amount of test coverage for all the utilities in the base system. Submitted by: shivansh Reviewed by: asomers, brooks Sponsored by: Google, Inc (GSoC 2017) Differential Revision: https://reviews.freebsd.org/D12036 r324112: Fix Makefile entries from r323275 Reported by: Vladimir Zakharov Reviewed by: ngie X-MFC-With: 323275 Added: stable/10/bin/chflags/tests/ - copied from r323275, head/bin/chflags/tests/ stable/10/bin/mkdir/tests/ - copied from r323275, head/bin/mkdir/tests/ stable/10/bin/rcp/tests/ - copied from r323275, head/bin/rcp/tests/ stable/10/bin/rmdir/tests/ - copied from r323275, head/bin/rmdir/tests/ Modified: stable/10/bin/chflags/Makefile stable/10/bin/mkdir/Makefile stable/10/bin/rcp/Makefile stable/10/bin/rmdir/Makefile stable/10/etc/mtree/BSD.tests.dist Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/chflags/Makefile ============================================================================== --- stable/10/bin/chflags/Makefile Tue Nov 28 18:08:14 2017 (r326331) +++ stable/10/bin/chflags/Makefile Tue Nov 28 18:18:39 2017 (r326332) @@ -1,6 +1,12 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + +PACKAGE=runtime PROG= chflags + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/10/bin/mkdir/Makefile ============================================================================== --- stable/10/bin/mkdir/Makefile Tue Nov 28 18:08:14 2017 (r326331) +++ stable/10/bin/mkdir/Makefile Tue Nov 28 18:18:39 2017 (r326332) @@ -1,6 +1,12 @@ # @(#)Makefile 8.1 (Berkeley) 5/31/93 # $FreeBSD$ +.include + +PACKAGE=runtime PROG= mkdir + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/10/bin/rcp/Makefile ============================================================================== --- stable/10/bin/rcp/Makefile Tue Nov 28 18:08:14 2017 (r326331) +++ stable/10/bin/rcp/Makefile Tue Nov 28 18:18:39 2017 (r326332) @@ -1,6 +1,9 @@ # @(#)Makefile 8.1 (Berkeley) 7/19/93 # $FreeBSD$ +.include + +PACKAGE=rcmds PROG= rcp SRCS= rcp.c util.c CFLAGS+=-DBINDIR=${BINDIR} @@ -8,5 +11,8 @@ CFLAGS+=-DBINDIR=${BINDIR} BINOWN= root BINMODE=4555 PRECIOUSPROG= + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/10/bin/rmdir/Makefile ============================================================================== --- stable/10/bin/rmdir/Makefile Tue Nov 28 18:08:14 2017 (r326331) +++ stable/10/bin/rmdir/Makefile Tue Nov 28 18:18:39 2017 (r326332) @@ -1,6 +1,11 @@ # @(#)Makefile 8.1 (Berkeley) 5/31/93 # $FreeBSD$ +.include + +PACKAGE=runtime PROG= rmdir +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Tue Nov 28 18:08:14 2017 (r326331) +++ stable/10/etc/mtree/BSD.tests.dist Tue Nov 28 18:18:39 2017 (r326332) @@ -8,6 +8,8 @@ bin cat .. + chflags + .. chmod .. date @@ -22,11 +24,17 @@ .. ls .. + mkdir + .. mv .. pax .. pkill + .. + rcp + .. + rmdir .. sh builtins From owner-svn-src-stable-10@freebsd.org Tue Nov 28 18:27:26 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEA04DEA9B9; Tue, 28 Nov 2017 18:27:26 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97DF572632; Tue, 28 Nov 2017 18:27:26 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASIRPnd013197; Tue, 28 Nov 2017 18:27:25 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASIRPhX013196; Tue, 28 Nov 2017 18:27:25 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281827.vASIRPhX013196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 28 Nov 2017 18:27:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326334 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 326334 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 18:27:26 -0000 Author: asomers Date: Tue Nov 28 18:27:25 2017 New Revision: 326334 URL: https://svnweb.freebsd.org/changeset/base/326334 Log: MFC r323813: MFV r323789: 8473 scrub does not detect errors on active spares illumos/illumos-gate@554675eee75dd2d7398d960aa5c81083ceb8505a https://github.com/illumos/illumos-gate/commit/554675eee75dd2d7398d960aa5c81083ceb8505a https://www.illumos.org/issues/8473 Scrubbing is supposed to detect and repair all errors in the pool. However, it wrongly ignores active spare devices. The problem can easily be reproduced in OpenZFS at git rev 0ef125d with these commands: truncate -s 64m /tmp/a /tmp/b /tmp/c sudo zpool create testpool mirror /tmp/a /tmp/b spare /tmp/c sudo zpool replace testpool /tmp/a /tmp/c /bin/dd if=/dev/zero bs=1024k count=63 oseek=1 conv=notrunc of=/tmp/c sync sudo zpool scrub testpool zpool status testpool # Will show 0 errors, which is wrong sudo zpool offline testpool /tmp/a sudo zpool scrub testpool zpool status testpool # Will show errors on /tmp/c, # which should've already been fixed FreeBSD head is partially affected: the first scrub will detect some errors, but the second scrub will detect more. Reviewed by: Andy Stormont Reviewed by: Matt Ahrens Reviewed by: George Wilson Approved by: Richard Lowe Sponsored by: Spectra Logic Corp Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Tue Nov 28 18:23:17 2017 (r326333) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Tue Nov 28 18:27:25 2017 (r326334) @@ -29,6 +29,9 @@ #include #include +#include +#include +#include #include #include #include @@ -51,7 +54,7 @@ typedef struct mirror_map { int *mm_preferred; int mm_preferred_cnt; int mm_children; - boolean_t mm_replacing; + boolean_t mm_resilvering; boolean_t mm_root; mirror_child_t mm_child[]; } mirror_map_t; @@ -124,13 +127,13 @@ vdev_mirror_map_size(int children) } static inline mirror_map_t * -vdev_mirror_map_alloc(int children, boolean_t replacing, boolean_t root) +vdev_mirror_map_alloc(int children, boolean_t resilvering, boolean_t root) { mirror_map_t *mm; mm = kmem_zalloc(vdev_mirror_map_size(children), KM_SLEEP); mm->mm_children = children; - mm->mm_replacing = replacing; + mm->mm_resilvering = resilvering; mm->mm_root = root; mm->mm_preferred = (int *)((uintptr_t)mm + offsetof(mirror_map_t, mm_child[children])); @@ -222,9 +225,39 @@ vdev_mirror_map_init(zio_t *zio) mc->mc_offset = DVA_GET_OFFSET(&dva[c]); } } else { - mm = vdev_mirror_map_alloc(vd->vdev_children, - (vd->vdev_ops == &vdev_replacing_ops || - vd->vdev_ops == &vdev_spare_ops), B_FALSE); + /* + * If we are resilvering, then we should handle scrub reads + * differently; we shouldn't issue them to the resilvering + * device because it might not have those blocks. + * + * We are resilvering iff: + * 1) We are a replacing vdev (ie our name is "replacing-1" or + * "spare-1" or something like that), and + * 2) The pool is currently being resilvered. + * + * We cannot simply check vd->vdev_resilver_txg, because it's + * not set in this path. + * + * Nor can we just check our vdev_ops; there are cases (such as + * when a user types "zpool replace pool odev spare_dev" and + * spare_dev is in the spare list, or when a spare device is + * automatically used to replace a DEGRADED device) when + * resilvering is complete but both the original vdev and the + * spare vdev remain in the pool. That behavior is intentional. + * It helps implement the policy that a spare should be + * automatically removed from the pool after the user replaces + * the device that originally failed. + * + * If a spa load is in progress, then spa_dsl_pool may be + * uninitialized. But we shouldn't be resilvering during a spa + * load anyway. + */ + boolean_t replacing = (vd->vdev_ops == &vdev_replacing_ops || + vd->vdev_ops == &vdev_spare_ops) && + spa_load_state(vd->vdev_spa) == SPA_LOAD_NONE && + dsl_scan_resilvering(vd->vdev_spa->spa_dsl_pool); + mm = vdev_mirror_map_alloc(vd->vdev_children, replacing, + B_FALSE); for (c = 0; c < mm->mm_children; c++) { mc = &mm->mm_child[c]; mc->mc_vd = vd->vdev_child[c]; @@ -454,7 +487,7 @@ vdev_mirror_io_start(zio_t *zio) mm = vdev_mirror_map_init(zio); if (zio->io_type == ZIO_TYPE_READ) { - if ((zio->io_flags & ZIO_FLAG_SCRUB) && !mm->mm_replacing && + if ((zio->io_flags & ZIO_FLAG_SCRUB) && !mm->mm_resilvering && mm->mm_children > 1) { /* * For scrubbing reads we need to allocate a read @@ -594,7 +627,7 @@ vdev_mirror_io_done(zio_t *zio) if (good_copies && spa_writeable(zio->io_spa) && (unexpected_errors || (zio->io_flags & ZIO_FLAG_RESILVER) || - ((zio->io_flags & ZIO_FLAG_SCRUB) && mm->mm_replacing))) { + ((zio->io_flags & ZIO_FLAG_SCRUB) && mm->mm_resilvering))) { /* * Use the good data we have in hand to repair damaged children. */ From owner-svn-src-stable-10@freebsd.org Tue Nov 28 18:36:00 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44768DEAD33; Tue, 28 Nov 2017 18:36:00 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DD2C72ADD; Tue, 28 Nov 2017 18:36:00 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASIZxMG017179; Tue, 28 Nov 2017 18:35:59 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASIZwxn017174; Tue, 28 Nov 2017 18:35:58 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281835.vASIZwxn017174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 28 Nov 2017 18:35:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326335 - in stable/10/cddl/contrib/opensolaris: cmd/zdb cmd/ztest lib/libzpool/common lib/libzpool/common/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/10/cddl/contrib/opensolaris: cmd/zdb cmd/ztest lib/libzpool/common lib/libzpool/common/sys X-SVN-Commit-Revision: 326335 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 18:36:00 -0000 Author: asomers Date: Tue Nov 28 18:35:58 2017 New Revision: 326335 URL: https://svnweb.freebsd.org/changeset/base/326335 Log: MFC r324220: MFC r316858 7280 Allow changing global libzpool variables in zdb 7280 Allow changing global libzpool variables in zdb and ztest through command line illumos/illumos-gate@0e60744c982adecd0a1f146f5637475d07ab1069 https://github.com/illumos/illumos-gate/commit/0e60744c982adecd0a1f146f5637475d07ab1069 https://www.illumos.org/issues/7280 zdb is very handy for diagnosing problems with a pool in a safe and quick way. When a pool is in a bad shape, we often want to disable some fail-safes, or adjust some tunables in order to open them. In the kernel, this is done by changing public variables in mdb. The goal of this feature is to add the same capability to zdb and ztest, so that they can change libzpool tuneables from the command line. Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Approved by: Robert Mustacchi Author: Pavel Zakharov Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.8 stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/10/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h stable/10/cddl/contrib/opensolaris/lib/libzpool/common/util.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.8 ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Tue Nov 28 18:27:25 2017 (r326334) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Tue Nov 28 18:35:58 2017 (r326335) @@ -33,6 +33,7 @@ .Op Fl U Ar cache .Op Fl I Ar inflight I/Os .Op Fl x Ar dumpdir +.Op Fl o Ar var=value .Ar poolname .Op Ar object ... .Nm @@ -252,6 +253,10 @@ Limit the number of outstanding checksum I/Os to the s The default value is 200. This option affects the performance of the .Fl c option. +.It Fl o Ar var=value +Set the given global libzpool variable to the provided value. The value must be +an unsigned 32-bit integer. Currently only little-endian systems are supported +to avoid accidentally setting the high 32 bits of 64-bit variables. .It Fl P Print numbers in an unscaled form more amenable to parsing, eg. 1000000 rather than 1M. Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Tue Nov 28 18:27:25 2017 (r326334) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Tue Nov 28 18:35:58 2017 (r326335) @@ -119,7 +119,8 @@ usage(void) { (void) fprintf(stderr, "Usage: %s [-CumMdibcsDvhLXFPAG] [-t txg] [-e [-p path...]] " - "[-U config] [-I inflight I/Os] [-x dumpdir] poolname [object...]\n" + "[-U config] [-I inflight I/Os] [-x dumpdir] [-o var=value] " + "poolname [object...]\n" " %s [-divPA] [-e -p path...] [-U config] dataset " "[object...]\n" " %s -mM [-LXFPA] [-t txg] [-e [-p path...]] [-U config] " @@ -181,6 +182,8 @@ usage(void) "checksumming I/Os [default is 200]\n"); (void) fprintf(stderr, " -G dump zfs_dbgmsg buffer before " "exiting\n"); + (void) fprintf(stderr, " -o = set global " + "variable to an unsigned 32-bit integer value\n"); (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) " "to make only that option verbose\n"); (void) fprintf(stderr, "Default is to dump everything non-verbosely\n"); @@ -3649,7 +3652,7 @@ main(int argc, char **argv) spa_config_path = spa_config_path_env; while ((c = getopt(argc, argv, - "bcdhilmMI:suCDRSAFLXx:evp:t:U:PG")) != -1) { + "bcdhilmMI:suCDRSAFLXx:evp:t:U:PGo:")) != -1) { switch (c) { case 'b': case 'c': @@ -3717,6 +3720,11 @@ main(int argc, char **argv) break; case 'x': vn_dumpdir = optarg; + break; + case 'o': + error = set_global_var(optarg); + if (error != 0) + usage(); break; default: usage(); Modified: stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Nov 28 18:27:25 2017 (r326334) +++ stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Nov 28 18:35:58 2017 (r326335) @@ -584,6 +584,8 @@ usage(boolean_t requested) "\t[-F freezeloops (default: %llu)] max loops in spa_freeze()\n" "\t[-P passtime (default: %llu sec)] time per pass\n" "\t[-B alt_ztest (default: )] alternate ztest path\n" + "\t[-o variable=value] ... set global variable to an unsigned\n" + "\t 32-bit integer value\n" "\t[-h] (print help)\n" "", zo->zo_pool, @@ -619,7 +621,7 @@ process_options(int argc, char **argv) bcopy(&ztest_opts_defaults, zo, sizeof (*zo)); while ((opt = getopt(argc, argv, - "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:hF:B:")) != EOF) { + "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:hF:B:o:")) != EOF) { value = 0; switch (opt) { case 'v': @@ -705,6 +707,10 @@ process_options(int argc, char **argv) break; case 'B': (void) strlcpy(altdir, optarg, sizeof (altdir)); + break; + case 'o': + if (set_global_var(optarg) != 0) + usage(B_FALSE); break; case 'h': usage(B_TRUE); Modified: stable/10/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Tue Nov 28 18:27:25 2017 (r326334) +++ stable/10/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Tue Nov 28 18:35:58 2017 (r326335) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ /* @@ -581,6 +581,7 @@ extern void kernel_fini(void); struct spa; extern void nicenum(uint64_t num, char *buf, size_t); extern void show_pool_stats(struct spa *); +extern int set_global_var(char *arg); typedef struct callb_cpr { kmutex_t *cc_lockp; Modified: stable/10/cddl/contrib/opensolaris/lib/libzpool/common/util.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzpool/common/util.c Tue Nov 28 18:27:25 2017 (r326334) +++ stable/10/cddl/contrib/opensolaris/lib/libzpool/common/util.c Tue Nov 28 18:35:58 2017 (r326335) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016 by Delphix. All rights reserved. */ #include @@ -31,6 +32,7 @@ #include #include #include +#include /* * Routines needed by more than one client of libzpool. @@ -127,4 +129,59 @@ show_pool_stats(spa_t *spa) show_vdev_stats(NULL, ZPOOL_CONFIG_SPARES, nvroot, 0); nvlist_free(config); +} + +/* + * Sets given global variable in libzpool to given unsigned 32-bit value. + * arg: "=" + */ +int +set_global_var(char *arg) +{ + void *zpoolhdl; + char *varname = arg, *varval; + u_longlong_t val; + +#ifndef _LITTLE_ENDIAN + /* + * On big endian systems changing a 64-bit variable would set the high + * 32 bits instead of the low 32 bits, which could cause unexpected + * results. + */ + fprintf(stderr, "Setting global variables is only supported on " + "little-endian systems\n", varname); + return (ENOTSUP); +#endif + if ((varval = strchr(arg, '=')) != NULL) { + *varval = '\0'; + varval++; + val = strtoull(varval, NULL, 0); + if (val > UINT32_MAX) { + fprintf(stderr, "Value for global variable '%s' must " + "be a 32-bit unsigned integer\n", varname); + return (EOVERFLOW); + } + } else { + return (EINVAL); + } + + zpoolhdl = dlopen("libzpool.so", RTLD_LAZY); + if (zpoolhdl != NULL) { + uint32_t *var; + var = dlsym(zpoolhdl, varname); + if (var == NULL) { + fprintf(stderr, "Global variable '%s' does not exist " + "in libzpool.so\n", varname); + return (EINVAL); + } + *var = (uint32_t)val; + + dlclose(zpoolhdl); + } else { + fprintf(stderr, "Failed to open libzpool.so to set global " + "variable\n"); + return (EIO); + } + + return (0); } From owner-svn-src-stable-10@freebsd.org Tue Nov 28 18:45:00 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29900DEB180; Tue, 28 Nov 2017 18:45:00 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 033D073127; Tue, 28 Nov 2017 18:44:59 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASIiwhr021165; Tue, 28 Nov 2017 18:44:59 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASIiwhF021163; Tue, 28 Nov 2017 18:44:58 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281844.vASIiwhF021163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 28 Nov 2017 18:44:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326336 - stable/10/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/cddl/contrib/opensolaris/cmd/zdb X-SVN-Commit-Revision: 326336 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 18:45:00 -0000 Author: asomers Date: Tue Nov 28 18:44:58 2017 New Revision: 326336 URL: https://svnweb.freebsd.org/changeset/base/326336 Log: MFC r324221: MFV r316861: 6866 zdb -l should return non-zero if it fails to find any label illumos/illumos-gate@64723e361134b2a2c45341334174f9d34002f8d0 https://github.com/illumos/illumos-gate/commit/64723e361134b2a2c45341334174f9d34002f8d0 https://www.illumos.org/issues/6866 Need this for #6865. To be generally more scripting-friendly, overload this issue with adding '-q' option which should skip printing any label information. Reviewed by: Matthew Ahrens Reviewed by: John Kennedy Approved by: Robert Mustacchi Author: Yuri Pankov Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.8 stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.8 ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Tue Nov 28 18:35:58 2017 (r326335) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Tue Nov 28 18:44:58 2017 (r326336) @@ -15,11 +15,12 @@ .\" Copyright 2012, Richard Lowe. .\" Copyright (c) 2012, Marcelo Araujo . .\" Copyright (c) 2012, 2014 by Delphix. All rights reserved. +.\" Copyright 2016 Nexenta Systems, Inc. .\" All Rights Reserved. .\" .\" $FreeBSD$ .\" -.Dd July 26, 2014 +.Dd October 1, 2017 .Dt ZDB 8 .Os .Sh NAME @@ -27,7 +28,7 @@ .Nd Display zpool debugging and consistency information .Sh SYNOPSIS .Nm -.Op Fl CumdibcsDvhLMXFPA +.Op Fl CmdibcsDvhLMXFPA .Op Fl e Op Fl p Ar path... .Op Fl t Ar txg .Op Fl U Ar cache @@ -64,7 +65,7 @@ .Ar poolname .Nm .Fl l -.Op Fl uA +.Op Fl Aqu .Ar device .Nm .Fl C @@ -156,9 +157,14 @@ dataset. If specified multiple times, display counts of each intent log transaction type. .It Fl l Ar device -Display the vdev labels from the specified device. +Read the vdev labels from the specified device. +Return 0 if a valid label was found, 1 if an error occurred, and 2 if no valid +labels were found. If the .Fl u +option is also specified, also display the uberblocks on this device. +If the +.Fl q option is also specified, also display the uberblocks on this device. .It Fl L Disable leak tracing and the loading of space maps. Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Tue Nov 28 18:35:58 2017 (r326335) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Tue Nov 28 18:44:58 2017 (r326336) @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2016 Nexenta Systems, Inc. */ #include @@ -118,7 +119,7 @@ static void usage(void) { (void) fprintf(stderr, - "Usage: %s [-CumMdibcsDvhLXFPAG] [-t txg] [-e [-p path...]] " + "Usage: %s [-CmMdibcsDvhLXFPAG] [-t txg] [-e [-p path...]] " "[-U config] [-I inflight I/Os] [-x dumpdir] [-o var=value] " "poolname [object...]\n" " %s [-divPA] [-e -p path...] [-U config] dataset " @@ -128,7 +129,7 @@ usage(void) " %s -R [-A] [-e [-p path...]] poolname " "vdev:offset:size[:flags]\n" " %s -S [-PA] [-e [-p path...]] [-U config] poolname\n" - " %s -l [-uA] device\n" + " %s -l [-Aqu] device\n" " %s -C [-A] [-U config]\n\n", cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname); @@ -139,7 +140,6 @@ usage(void) (void) fprintf(stderr, " If object numbers are specified, only " "those objects are dumped\n\n"); (void) fprintf(stderr, " Options to control amount of output:\n"); - (void) fprintf(stderr, " -u uberblock\n"); (void) fprintf(stderr, " -d dataset(s)\n"); (void) fprintf(stderr, " -i intent logs\n"); (void) fprintf(stderr, " -C config (or cachefile if alone)\n"); @@ -153,7 +153,7 @@ usage(void) (void) fprintf(stderr, " -D dedup statistics\n"); (void) fprintf(stderr, " -S simulate dedup to measure effect\n"); (void) fprintf(stderr, " -v verbose (applies to all others)\n"); - (void) fprintf(stderr, " -l dump label contents\n"); + (void) fprintf(stderr, " -l read label contents\n"); (void) fprintf(stderr, " -L disable leak tracking (do not " "load spacemaps)\n"); (void) fprintf(stderr, " -R read and display block from a " @@ -184,6 +184,8 @@ usage(void) "exiting\n"); (void) fprintf(stderr, " -o = set global " "variable to an unsigned 32-bit integer value\n"); + (void) fprintf(stderr, " -q don't print label contents\n"); + (void) fprintf(stderr, " -u uberblock\n"); (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) " "to make only that option verbose\n"); (void) fprintf(stderr, "Default is to dump everything non-verbosely\n"); @@ -2203,84 +2205,94 @@ dump_label_uberblocks(vdev_label_t *lbl, uint64_t ashi } } -static void +static int dump_label(const char *dev) { int fd; vdev_label_t label; - char *path, *buf = label.vl_vdev_phys.vp_nvlist; + char path[MAXPATHLEN]; + char *buf = label.vl_vdev_phys.vp_nvlist; size_t buflen = sizeof (label.vl_vdev_phys.vp_nvlist); struct stat64 statbuf; uint64_t psize, ashift; - int len = strlen(dev) + 1; + boolean_t label_found = B_FALSE; - if (strncmp(dev, ZFS_DISK_ROOTD, strlen(ZFS_DISK_ROOTD)) == 0) { - len++; - path = malloc(len); - (void) snprintf(path, len, "%s%s", ZFS_RDISK_ROOTD, - dev + strlen(ZFS_DISK_ROOTD)); - } else { - path = strdup(dev); - } + (void) strlcpy(path, dev, sizeof (path)); + if (dev[0] == '/') { + if (strncmp(dev, ZFS_DISK_ROOTD, + strlen(ZFS_DISK_ROOTD)) == 0) { + (void) snprintf(path, sizeof (path), "%s%s", + ZFS_RDISK_ROOTD, dev + strlen(ZFS_DISK_ROOTD)); + } + } else if (stat64(path, &statbuf) != 0) { + char *s; - if ((fd = open64(path, O_RDONLY)) < 0) { - (void) printf("cannot open '%s': %s\n", path, strerror(errno)); - free(path); - exit(1); + (void) snprintf(path, sizeof (path), "%s%s", ZFS_RDISK_ROOTD, + dev); + if ((s = strrchr(dev, 's')) == NULL || !isdigit(*(s + 1))) + (void) strlcat(path, "s0", sizeof (path)); } - if (fstat64(fd, &statbuf) != 0) { + if (stat64(path, &statbuf) != 0) { (void) printf("failed to stat '%s': %s\n", path, strerror(errno)); - free(path); - (void) close(fd); exit(1); } if (S_ISBLK(statbuf.st_mode)) { (void) printf("cannot use '%s': character device required\n", path); - free(path); - (void) close(fd); exit(1); } + if ((fd = open64(path, O_RDONLY)) < 0) { + (void) printf("cannot open '%s': %s\n", path, strerror(errno)); + exit(1); + } + psize = statbuf.st_size; psize = P2ALIGN(psize, (uint64_t)sizeof (vdev_label_t)); for (int l = 0; l < VDEV_LABELS; l++) { nvlist_t *config = NULL; - (void) printf("--------------------------------------------\n"); - (void) printf("LABEL %d\n", l); - (void) printf("--------------------------------------------\n"); + if (!dump_opt['q']) { + (void) printf("------------------------------------\n"); + (void) printf("LABEL %d\n", l); + (void) printf("------------------------------------\n"); + } if (pread64(fd, &label, sizeof (label), vdev_label_offset(psize, l, 0)) != sizeof (label)) { - (void) printf("failed to read label %d\n", l); + if (!dump_opt['q']) + (void) printf("failed to read label %d\n", l); continue; } if (nvlist_unpack(buf, buflen, &config, 0) != 0) { - (void) printf("failed to unpack label %d\n", l); + if (!dump_opt['q']) + (void) printf("failed to unpack label %d\n", l); ashift = SPA_MINBLOCKSHIFT; } else { nvlist_t *vdev_tree = NULL; - dump_nvlist(config, 4); + if (!dump_opt['q']) + dump_nvlist(config, 4); if ((nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &vdev_tree) != 0) || (nvlist_lookup_uint64(vdev_tree, ZPOOL_CONFIG_ASHIFT, &ashift) != 0)) ashift = SPA_MINBLOCKSHIFT; nvlist_free(config); + label_found = B_TRUE; } if (dump_opt['u']) dump_label_uberblocks(&label, ashift); } - free(path); (void) close(fd); + + return (label_found ? 0 : 2); } static uint64_t dataset_feature_count[SPA_FEATURES]; @@ -3652,7 +3664,7 @@ main(int argc, char **argv) spa_config_path = spa_config_path_env; while ((c = getopt(argc, argv, - "bcdhilmMI:suCDRSAFLXx:evp:t:U:PGo:")) != -1) { + "bcdhilmMI:suCDRSAFLXx:evp:t:U:PGo:q")) != -1) { switch (c) { case 'b': case 'c': @@ -3678,6 +3690,7 @@ main(int argc, char **argv) case 'X': case 'e': case 'P': + case 'q': dump_opt[c]++; break; case 'I': @@ -3781,10 +3794,8 @@ main(int argc, char **argv) usage(); } - if (dump_opt['l']) { - dump_label(argv[0]); - return (0); - } + if (dump_opt['l']) + return (dump_label(argv[0])); if (dump_opt['X'] || dump_opt['F']) rewind = ZPOOL_DO_REWIND | From owner-svn-src-stable-10@freebsd.org Tue Nov 28 19:46:49 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E11BFDECAF2; Tue, 28 Nov 2017 19:46:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD34E7555C; Tue, 28 Nov 2017 19:46:49 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASJkmLx046772; Tue, 28 Nov 2017 19:46:48 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASJkmVu046771; Tue, 28 Nov 2017 19:46:48 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281946.vASJkmVu046771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 28 Nov 2017 19:46:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326340 - stable/10/share/man/man4 X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/share/man/man4 X-SVN-Commit-Revision: 326340 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 19:46:50 -0000 Author: asomers Date: Tue Nov 28 19:46:48 2017 New Revision: 326340 URL: https://svnweb.freebsd.org/changeset/base/326340 Log: MFC r324805: Fix the mps(4) HISTORY section. Looks like a copy/paste error from r302673. Sponsored by: Spectra Logic Corp Modified: stable/10/share/man/man4/mps.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/mps.4 ============================================================================== --- stable/10/share/man/man4/mps.4 Tue Nov 28 19:25:01 2017 (r326339) +++ stable/10/share/man/man4/mps.4 Tue Nov 28 19:46:48 2017 (r326340) @@ -356,7 +356,8 @@ These bits have the described effects: .Sh HISTORY The .Nm -driver first appeared in FreeBSD 9.3. +driver first appeared in +.Fx 9.0 . .Sh AUTHORS The .Nm From owner-svn-src-stable-10@freebsd.org Tue Nov 28 19:57:17 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8405CDECF63; Tue, 28 Nov 2017 19:57:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5DAE275C52; Tue, 28 Nov 2017 19:57:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASJvGgP051009; Tue, 28 Nov 2017 19:57:16 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASJvGDR051008; Tue, 28 Nov 2017 19:57:16 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281957.vASJvGDR051008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 28 Nov 2017 19:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326341 - stable/10/sys/dev/mpr X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/sys/dev/mpr X-SVN-Commit-Revision: 326341 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 19:57:17 -0000 Author: asomers Date: Tue Nov 28 19:57:16 2017 New Revision: 326341 URL: https://svnweb.freebsd.org/changeset/base/326341 Log: MFC r325363: Fix mpr(4) panics caused by bad drive mapping tables sys/dev/mpr/mpr_mapping.c If _mapping_process_dpm_pg0 detects inconsistencies in the drive mapping table (stored in the HBA's NVRAM), abort reading it and continue to boot as if the mapping table were blank. I observed such inconsistencies in several HBAs after upgrading firmware from 14.0.0.0 to 15.0.0.0. Reviewed by: slm Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D12901 Modified: stable/10/sys/dev/mpr/mpr_mapping.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mpr/mpr_mapping.c ============================================================================== --- stable/10/sys/dev/mpr/mpr_mapping.c Tue Nov 28 19:46:48 2017 (r326340) +++ stable/10/sys/dev/mpr/mpr_mapping.c Tue Nov 28 19:57:16 2017 (r326341) @@ -2210,7 +2210,7 @@ mpr_mapping_free_memory(struct mpr_softc *sc) free(sc->dpm_pg0, M_MPR); } -static void +static bool _mapping_process_dpm_pg0(struct mpr_softc *sc) { u8 missing_cnt, enc_idx; @@ -2339,7 +2339,7 @@ _mapping_process_dpm_pg0(struct mpr_softc *sc) "%s: Conflict in mapping table for " " enclosure %d\n", __func__, enc_idx); - break; + goto fail; } physical_id = dpm_entry->PhysicalIdentifier.High; @@ -2366,7 +2366,7 @@ _mapping_process_dpm_pg0(struct mpr_softc *sc) mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: " "Conflict in mapping table for device %d\n", __func__, map_idx); - break; + goto fail; } physical_id = dpm_entry->PhysicalIdentifier.High; mt_entry->physical_id = (physical_id << 32) | @@ -2378,6 +2378,18 @@ _mapping_process_dpm_pg0(struct mpr_softc *sc) mt_entry->device_info = MPR_DEV_RESERVED; } } /*close the loop for DPM table */ + return (true); + +fail: + for (entry_num = 0; entry_num < sc->max_dpm_entries; entry_num++) { + sc->dpm_entry_used[entry_num] = 0; + /* + * for IR firmware, it may be necessary to wipe out + * sc->mapping_table volumes tooi + */ + } + sc->num_enc_table_entries = 0; + return (false); } /* @@ -2617,9 +2629,11 @@ retry_read_dpm: } } - if (sc->is_dpm_enable) - _mapping_process_dpm_pg0(sc); - else { + if (sc->is_dpm_enable) { + if (!_mapping_process_dpm_pg0(sc)) + sc->is_dpm_enable = 0; + } + if (! sc->is_dpm_enable) { mpr_dprint(sc, MPR_MAPPING, "%s: DPM processing is disabled. " "Device mappings will not persist across reboots or " "resets.\n", __func__); From owner-svn-src-stable-10@freebsd.org Wed Nov 29 05:35:29 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5828CDF8E9D; Wed, 29 Nov 2017 05:35:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2407165E0E; Wed, 29 Nov 2017 05:35:29 +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 vAT5ZSkB096123; Wed, 29 Nov 2017 05:35:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAT5ZSRn096122; Wed, 29 Nov 2017 05:35:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201711290535.vAT5ZSRn096122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 29 Nov 2017 05:35:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326357 - stable/10/crypto/openssl/crypto/x509v3 X-SVN-Group: stable-10 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/10/crypto/openssl/crypto/x509v3 X-SVN-Commit-Revision: 326357 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Nov 2017 05:35:29 -0000 Author: delphij Date: Wed Nov 29 05:35:28 2017 New Revision: 326357 URL: https://svnweb.freebsd.org/changeset/base/326357 Log: Avoid out-of-bounds read. Security: CVE-2017-3735 Security: FreeBSD-SA-17:11.openssl Obtained from: OpenSSL https://github.com/openssl/openssl/pull/4276 Modified: stable/10/crypto/openssl/crypto/x509v3/v3_addr.c Modified: stable/10/crypto/openssl/crypto/x509v3/v3_addr.c ============================================================================== --- stable/10/crypto/openssl/crypto/x509v3/v3_addr.c Wed Nov 29 05:07:54 2017 (r326356) +++ stable/10/crypto/openssl/crypto/x509v3/v3_addr.c Wed Nov 29 05:35:28 2017 (r326357) @@ -130,10 +130,12 @@ static int length_from_afi(const unsigned afi) */ unsigned int v3_addr_get_afi(const IPAddressFamily *f) { - return ((f != NULL && - f->addressFamily != NULL && f->addressFamily->data != NULL) - ? ((f->addressFamily->data[0] << 8) | (f->addressFamily->data[1])) - : 0); + if (f == NULL + || f->addressFamily == NULL + || f->addressFamily->data == NULL + || f->addressFamily->length < 2) + return 0; + return (f->addressFamily->data[0] << 8) | f->addressFamily->data[1]; } /* From owner-svn-src-stable-10@freebsd.org Wed Nov 29 08:52:39 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97667DFDD16 for ; Wed, 29 Nov 2017 08:52:39 +0000 (UTC) (envelope-from dmitryluhtionov@gmail.com) Received: from mail-wr0-x22d.google.com (mail-wr0-x22d.google.com [IPv6:2a00:1450:400c:c0c::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D5DC6BB42 for ; Wed, 29 Nov 2017 08:52:39 +0000 (UTC) (envelope-from dmitryluhtionov@gmail.com) Received: by mail-wr0-x22d.google.com with SMTP id z34so2627864wrz.10 for ; Wed, 29 Nov 2017 00:52:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=iC8bDUTjzRSH8B1esDPfdNe7JllboarFOL7qxFf8QsM=; b=SGvlCTOGmsZXqkLqW5fIYoXqlmBii1+kR0Ae271bqSDnFTM4cvkIFeQcWEM037HiAy UzaybJ8y3uXvVjyiHOzWxoKcMV+D/hHrXzGcSoPYeNCDW3UIhGTytw1shH2WuUV/erkN yy0sS3hlU4eiOG5QoujJct+wnQvMgnkmPVXD+5D1ndXvwPMkujy6PCZklWNO8VIS7XCO Rd0rlhPrYVzNlktwRg5DEwGXmsBo0hRhXmnQJ0FsmrJi5KkgqIPsZwf1vrYYojVmg9Ni Usg1nOomu3k072v+/ZOyTJgLZyC+0Ybb89bmN0UHDjvMgoBMR6Q29xYUJroE0s36cGgS NCYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=iC8bDUTjzRSH8B1esDPfdNe7JllboarFOL7qxFf8QsM=; b=BrkQ7i7/56LDX990hZT6OKibAY74ASjd5i5+Vu1K4DCgCIdGcJBhPEDrWIuqJ0Qf9K novyk0G1EhjgYl/xbcM/jUrUlkFAR6OODPPPLO50eWjl9E3STl+nWQ7DHDDfcJzWeJ/P qrLsU1YNiG7qp9XCwzKCC3ZosEVUvNwgCnLDUq69b+6gFarBVYoHtUXOLQTqKVl5qY/P nAuDtd5cqrpP577OvpqWV6AlDrWn8WgCvktSZmQtdO7PRAtACTHvqXJ6uvWO6NrB71Zf HjLz3fJjhgKKNxottKdFyCvETcl+l49rHzkAXz/5bu7iR1uxr8LanlQmgZ/1FAhMBxSR qwGA== X-Gm-Message-State: AJaThX7hL1oxjRjuWBK+Lc2/tw5Tc+R+QVww7qafQ284SR6CnEzeHPXg IS0LMNmeMJuts7PetBv0ni/81fP4c5MTdUNv26EkXA== X-Google-Smtp-Source: AGs4zMaVEeCNShc2X280Nt6Ve++RtNtgp5gmQexniNDUvRixvufdxFNx4dM6KpBbvQ/jmSsVYDcSL/NTGxb5GrWF5ug= X-Received: by 10.223.177.131 with SMTP id q3mr1813983wra.269.1511945557400; Wed, 29 Nov 2017 00:52:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.164.19 with HTTP; Wed, 29 Nov 2017 00:52:36 -0800 (PST) From: Dmitry Luhtionov Date: Wed, 29 Nov 2017 10:52:36 +0200 Message-ID: Subject: buildworld failed on sparc64 To: svn-src-stable-10@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Nov 2017 08:52:39 -0000 Upgrading from 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r227463:227464: to 10.4-STABLE cc -O2 -pipe -std=gnu99 -I/usr/obj/usr/src/tmp/legacy/usr/include -c /usr/src/usr.bin/rpcgen/rpc_main.c -o rpc_main.o /usr/src/usr.bin/rpcgen/rpc_main.c:85: warning: implicit declaration of function 'nitems' /usr/src/usr.bin/rpcgen/rpc_main.c:85: error: initializer element is not constant /usr/src/usr.bin/rpcgen/rpc_main.c:89: error: initializer element is not constant *** Error code 1 From owner-svn-src-stable-10@freebsd.org Wed Nov 29 14:45:29 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BC47E55E48; Wed, 29 Nov 2017 14:45:29 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6389977152; Wed, 29 Nov 2017 14:45:29 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vATEjSO4025857; Wed, 29 Nov 2017 14:45:28 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vATEjSAi025855; Wed, 29 Nov 2017 14:45:28 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201711291445.vATEjSAi025855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 29 Nov 2017 14:45:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326368 - in stable: 10/release/doc/share/xml 11/release/doc/share/xml X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release/doc/share/xml 11/release/doc/share/xml X-SVN-Commit-Revision: 326368 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Nov 2017 14:45:29 -0000 Author: gjb Date: Wed Nov 29 14:45:28 2017 New Revision: 326368 URL: https://svnweb.freebsd.org/changeset/base/326368 Log: Document SA-17:06 through SA-17:11 and EN-17:07 through EN:17-10. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/share/xml/errata.xml stable/10/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/11/release/doc/share/xml/errata.xml stable/11/release/doc/share/xml/security.xml Modified: stable/10/release/doc/share/xml/errata.xml ============================================================================== --- stable/10/release/doc/share/xml/errata.xml Wed Nov 29 14:34:05 2017 (r326367) +++ stable/10/release/doc/share/xml/errata.xml Wed Nov 29 14:45:28 2017 (r326368) @@ -19,9 +19,11 @@ - No notices. -   -   + FreeBSD-EN-17:10.tzdata + 2 November 2017 + Timezone database information + update Modified: stable/10/release/doc/share/xml/security.xml ============================================================================== --- stable/10/release/doc/share/xml/security.xml Wed Nov 29 14:34:05 2017 (r326367) +++ stable/10/release/doc/share/xml/security.xml Wed Nov 29 14:45:28 2017 (r326368) @@ -19,9 +19,47 @@ - No advisories. -   -   + FreeBSD-SA-17:06.openssh + 10 August 2017 + Denial of Service vulnerability + + + + FreeBSD-SA-17:07.wpa + 16 October 2017 + WPA2 protocol vulnerability + + + + FreeBSD-SA-17:08.ptrace + 15 November 2017 + Kernel data leak via + ptrace(PT_LWPINFO) + + + + FreeBSD-SA-17:09.shm + 15 November 2017 + POSIX shm allows jails to access global + namespace + + + + FreeBSD-SA-17:10.kldstat + 15 November 2017 + Information leak + + + + FreeBSD-SA-17:11.openssl + 29 November 2017 + Multiple vulnerabilities From owner-svn-src-stable-10@freebsd.org Wed Nov 29 20:44:42 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D423DBB66B; Wed, 29 Nov 2017 20:44:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25A0B63E5F; Wed, 29 Nov 2017 20:44:42 +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 vATKifbk078440; Wed, 29 Nov 2017 20:44:41 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vATKifWx078439; Wed, 29 Nov 2017 20:44:41 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201711292044.vATKifWx078439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 29 Nov 2017 20:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326374 - stable/10/usr.sbin/freebsd-update X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/usr.sbin/freebsd-update X-SVN-Commit-Revision: 326374 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Nov 2017 20:44:42 -0000 Author: emaste Date: Wed Nov 29 20:44:40 2017 New Revision: 326374 URL: https://svnweb.freebsd.org/changeset/base/326374 Log: MFC r326082: freebsd-update: do not duplicate patchlist entries PR: 221079 Submitted by: Masachika ISHIZUKA Submitted by: ota@j.email.ne.jp Reviewed by: cperciva Modified: stable/10/usr.sbin/freebsd-update/freebsd-update.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- stable/10/usr.sbin/freebsd-update/freebsd-update.sh Wed Nov 29 20:38:21 2017 (r326373) +++ stable/10/usr.sbin/freebsd-update/freebsd-update.sh Wed Nov 29 20:44:40 2017 (r326374) @@ -1047,7 +1047,7 @@ fetch_make_patchlist () { continue fi echo "${X}|${Y}" - done | uniq + done | sort -u } # Print user-friendly progress statistics From owner-svn-src-stable-10@freebsd.org Thu Nov 30 00:25:27 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 455B0DEE291; Thu, 30 Nov 2017 00:25:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11B026ADC2; Thu, 30 Nov 2017 00:25:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAU0PQ1W071485; Thu, 30 Nov 2017 00:25:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAU0PQU6071484; Thu, 30 Nov 2017 00:25:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201711300025.vAU0PQU6071484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 30 Nov 2017 00:25:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326380 - stable/10/contrib/binutils/bfd X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/contrib/binutils/bfd X-SVN-Commit-Revision: 326380 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 00:25:27 -0000 Author: emaste Date: Thu Nov 30 00:25:25 2017 New Revision: 326380 URL: https://svnweb.freebsd.org/changeset/base/326380 Log: MFC r326136: bfd: avoid crash on corrupt binaries From binutils commits 5a4b0ccc20ba30caef53b01bee2c0aaa5b855339 and 7e1e19887abd24aeb15066b141cdff5541e0ec8e, made available under GPLv2 by Nick Clifton. PR: 198824 Security: CVE-2014-8501 Security: CVE-2014-8502 Modified: stable/10/contrib/binutils/bfd/peXXigen.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/binutils/bfd/peXXigen.c ============================================================================== --- stable/10/contrib/binutils/bfd/peXXigen.c Thu Nov 30 00:24:28 2017 (r326379) +++ stable/10/contrib/binutils/bfd/peXXigen.c Thu Nov 30 00:25:25 2017 (r326380) @@ -448,6 +448,17 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, { int idx; + /* PR 17512: Corrupt PE binaries can cause seg-faults. */ + if (a->NumberOfRvaAndSizes > 16) + { + (*_bfd_error_handler) + (_("%B: aout header specifies an invalid number of data-directory entries: %d"), + abfd, a->NumberOfRvaAndSizes); + /* Paranoia: If the number is corrupt, then assume that the + actual entries themselves might be corrupt as well. */ + a->NumberOfRvaAndSizes = 0; + } + for (idx = 0; idx < 16; idx++) { /* If data directory is empty, rva also should be 0. */ @@ -1426,6 +1437,15 @@ pe_print_edata (bfd * abfd, void * vfile) section->name); return TRUE; } + } + + /* PR 17512: Handle corrupt PE binaries. */ + if (datasize < 36) + { + fprintf (file, + _("\nThere is an export table in %s, but it is too small (%d)\n"), + section->name, (int) datasize); + return TRUE; } fprintf (file, _("\nThere is an export table in %s at 0x%lx\n"), From owner-svn-src-stable-10@freebsd.org Thu Nov 30 00:27:50 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6943CDEE3E5; Thu, 30 Nov 2017 00:27:50 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 357E66B07C; Thu, 30 Nov 2017 00:27:50 +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 vAU0RnTX071702; Thu, 30 Nov 2017 00:27:49 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAU0RnnA071701; Thu, 30 Nov 2017 00:27:49 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201711300027.vAU0RnnA071701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 30 Nov 2017 00:27:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326382 - stable/10/contrib/binutils/bfd X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/contrib/binutils/bfd X-SVN-Commit-Revision: 326382 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 00:27:50 -0000 Author: emaste Date: Thu Nov 30 00:27:49 2017 New Revision: 326382 URL: https://svnweb.freebsd.org/changeset/base/326382 Log: MFC r326135: bfd: fix segfault in the ihex parser on malformed ihex file From binutils commit 0102ea8cec5fc509bba6c91df61b7ce23a799d32, made available under GPLv2 by Nick Clifton. PR: 198824 Security: CVE-2014-8503 Modified: stable/10/contrib/binutils/bfd/ihex.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/binutils/bfd/ihex.c ============================================================================== --- stable/10/contrib/binutils/bfd/ihex.c Thu Nov 30 00:26:45 2017 (r326381) +++ stable/10/contrib/binutils/bfd/ihex.c Thu Nov 30 00:27:49 2017 (r326382) @@ -320,7 +320,7 @@ ihex_scan (bfd *abfd) { if (! ISHEX (buf[i])) { - ihex_bad_byte (abfd, lineno, hdr[i], error); + ihex_bad_byte (abfd, lineno, buf[i], error); goto error_return; } } From owner-svn-src-stable-10@freebsd.org Thu Nov 30 14:38:08 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C11EE57EFB; Thu, 30 Nov 2017 14:38:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66558663C4; Thu, 30 Nov 2017 14:38:08 +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 vAUEc78x041762; Thu, 30 Nov 2017 14:38:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAUEc7OJ041759; Thu, 30 Nov 2017 14:38:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711301438.vAUEc7OJ041759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 30 Nov 2017 14:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326397 - in stable/10: lib/libc/sys sys/kern sys/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/10: lib/libc/sys sys/kern sys/sys X-SVN-Commit-Revision: 326397 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 14:38:08 -0000 Author: kib Date: Thu Nov 30 14:38:07 2017 New Revision: 326397 URL: https://svnweb.freebsd.org/changeset/base/326397 Log: MFC r326122: Kill all descendants of the reaper, even if they are descendants of a subordinate reaper. Also, mark reapers when listing pids. PR: 223745 Modified: stable/10/lib/libc/sys/procctl.2 stable/10/sys/kern/kern_procctl.c stable/10/sys/sys/procctl.h Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/procctl.2 ============================================================================== --- stable/10/lib/libc/sys/procctl.2 Thu Nov 30 14:19:47 2017 (r326396) +++ stable/10/lib/libc/sys/procctl.2 Thu Nov 30 14:38:07 2017 (r326397) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 21, 2015 +.Dd November 21, 2017 .Dt PROCCTL 2 .Os .Sh NAME @@ -211,7 +211,7 @@ of the process. The .Fa pi_flags field returns the following flags, further describing the descendant: -.Bl -tag -width "Dv REAPER_PIDINFO_VALID" +.Bl -tag -width "Dv REAPER_PIDINFO_REAPER" .It Dv REAPER_PIDINFO_VALID Set to indicate that the .Vt procctl_reaper_pidinfo @@ -226,6 +226,9 @@ of the returned array. The .Fa pi_pid field identifies the direct child of the reaper. +.It Dv REAPER_PIDINFO_REAPER +The reported process is itself a reaper. +The descendants of the subordinate reaper are not reported. .El .It Dv PROC_REAP_KILL Request to deliver a signal to some subset of the descendants of the reaper. Modified: stable/10/sys/kern/kern_procctl.c ============================================================================== --- stable/10/sys/kern/kern_procctl.c Thu Nov 30 14:19:47 2017 (r326396) +++ stable/10/sys/kern/kern_procctl.c Thu Nov 30 14:38:07 2017 (r326397) @@ -221,6 +221,8 @@ reap_getpids(struct thread *td, struct proc *p, struct pip->pi_flags = REAPER_PIDINFO_VALID; if (proc_realparent(p2) == reap) pip->pi_flags |= REAPER_PIDINFO_CHILD; + if ((p2->p_treeflag & P_TREE_REAPER) != 0) + pip->pi_flags |= REAPER_PIDINFO_REAPER; i++; } sx_sunlock(&proctree_lock); @@ -231,20 +233,60 @@ reap_getpids(struct thread *td, struct proc *p, struct return (error); } +static void +reap_kill_proc(struct thread *td, struct proc *p2, ksiginfo_t *ksi, + struct procctl_reaper_kill *rk, int *error) +{ + int error1; + + PROC_LOCK(p2); + error1 = p_cansignal(td, p2, rk->rk_sig); + if (error1 == 0) { + pksignal(p2, rk->rk_sig, ksi); + rk->rk_killed++; + *error = error1; + } else if (*error == ESRCH) { + rk->rk_fpid = p2->p_pid; + *error = error1; + } + PROC_UNLOCK(p2); +} + +struct reap_kill_tracker { + struct proc *parent; + TAILQ_ENTRY(reap_kill_tracker) link; +}; + +TAILQ_HEAD(reap_kill_tracker_head, reap_kill_tracker); + +static void +reap_kill_sched(struct reap_kill_tracker_head *tracker, struct proc *p2) +{ + struct reap_kill_tracker *t; + + t = malloc(sizeof(struct reap_kill_tracker), M_TEMP, M_WAITOK); + t->parent = p2; + TAILQ_INSERT_TAIL(tracker, t, link); +} + static int reap_kill(struct thread *td, struct proc *p, struct procctl_reaper_kill *rk) { struct proc *reap, *p2; ksiginfo_t ksi; - int error, error1; + struct reap_kill_tracker_head tracker; + struct reap_kill_tracker *t; + int error; sx_assert(&proctree_lock, SX_LOCKED); if (IN_CAPABILITY_MODE(td)) return (ECAPMODE); - if (rk->rk_sig <= 0 || rk->rk_sig > _SIG_MAXSIG) + if (rk->rk_sig <= 0 || rk->rk_sig > _SIG_MAXSIG || + (rk->rk_flags & ~(REAPER_KILL_CHILDREN | + REAPER_KILL_SUBTREE)) != 0 || (rk->rk_flags & + (REAPER_KILL_CHILDREN | REAPER_KILL_SUBTREE)) == + (REAPER_KILL_CHILDREN | REAPER_KILL_SUBTREE)) return (EINVAL); - if ((rk->rk_flags & ~(REAPER_KILL_CHILDREN | REAPER_KILL_SUBTREE)) != 0) - return (EINVAL); PROC_UNLOCK(p); reap = (p->p_treeflag & P_TREE_REAPER) == 0 ? p->p_reaper : p; ksiginfo_init(&ksi); @@ -255,26 +297,33 @@ reap_kill(struct thread *td, struct proc *p, struct pr error = ESRCH; rk->rk_killed = 0; rk->rk_fpid = -1; - for (p2 = (rk->rk_flags & REAPER_KILL_CHILDREN) != 0 ? - LIST_FIRST(&reap->p_children) : LIST_FIRST(&reap->p_reaplist); - p2 != NULL; - p2 = (rk->rk_flags & REAPER_KILL_CHILDREN) != 0 ? - LIST_NEXT(p2, p_sibling) : LIST_NEXT(p2, p_reapsibling)) { - if ((rk->rk_flags & REAPER_KILL_SUBTREE) != 0 && - p2->p_reapsubtree != rk->rk_subtree) - continue; - PROC_LOCK(p2); - error1 = p_cansignal(td, p2, rk->rk_sig); - if (error1 == 0) { - pksignal(p2, rk->rk_sig, &ksi); - rk->rk_killed++; - error = error1; - } else if (error == ESRCH) { - error = error1; - rk->rk_fpid = p2->p_pid; + if ((rk->rk_flags & REAPER_KILL_CHILDREN) != 0) { + for (p2 = LIST_FIRST(&reap->p_children); p2 != NULL; + p2 = LIST_NEXT(p2, p_sibling)) { + reap_kill_proc(td, p2, &ksi, rk, &error); + /* + * Do not end the loop on error, signal + * everything we can. + */ } - PROC_UNLOCK(p2); - /* Do not end the loop on error, signal everything we can. */ + } else { + TAILQ_INIT(&tracker); + reap_kill_sched(&tracker, reap); + while ((t = TAILQ_FIRST(&tracker)) != NULL) { + MPASS((t->parent->p_treeflag & P_TREE_REAPER) != 0); + TAILQ_REMOVE(&tracker, t, link); + for (p2 = LIST_FIRST(&t->parent->p_reaplist); p2 != NULL; + p2 = LIST_NEXT(p2, p_reapsibling)) { + if (t->parent == reap && + (rk->rk_flags & REAPER_KILL_SUBTREE) != 0 && + p2->p_reapsubtree != rk->rk_subtree) + continue; + if ((p2->p_treeflag & P_TREE_REAPER) != 0) + reap_kill_sched(&tracker, p2); + reap_kill_proc(td, p2, &ksi, rk, &error); + } + free(t, M_TEMP); + } } PROC_LOCK(p); return (error); Modified: stable/10/sys/sys/procctl.h ============================================================================== --- stable/10/sys/sys/procctl.h Thu Nov 30 14:19:47 2017 (r326396) +++ stable/10/sys/sys/procctl.h Thu Nov 30 14:38:07 2017 (r326397) @@ -77,6 +77,7 @@ struct procctl_reaper_pidinfo { #define REAPER_PIDINFO_VALID 0x00000001 #define REAPER_PIDINFO_CHILD 0x00000002 +#define REAPER_PIDINFO_REAPER 0x00000004 struct procctl_reaper_pids { u_int rp_count; From owner-svn-src-stable-10@freebsd.org Thu Nov 30 21:32:29 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F18DCDBB6DC; Thu, 30 Nov 2017 21:32:29 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE9DA77084; Thu, 30 Nov 2017 21:32:29 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAULWSar048779; Thu, 30 Nov 2017 21:32:28 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAULWSdN048778; Thu, 30 Nov 2017 21:32:28 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201711302132.vAULWSdN048778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 30 Nov 2017 21:32:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326414 - stable/10/sbin/pfctl X-SVN-Group: stable-10 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/10/sbin/pfctl X-SVN-Commit-Revision: 326414 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 21:32:30 -0000 Author: kp Date: Thu Nov 30 21:32:28 2017 New Revision: 326414 URL: https://svnweb.freebsd.org/changeset/base/326414 Log: MFC r325850: pfctl: teach route-to to deal with interfaces with multiple addresses The route_host parsing code set the interface name, but only for the first node_host in the list. If that one happened to be the inet6 address and the rule wanted an inet address it'd get removed by remove_invalid_hosts() later on, and we'd have no interface name. We must set the interface name for all node_host entries in the list, not just the first one. PR: 223208 Modified: stable/10/sbin/pfctl/parse.y Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/pfctl/parse.y ============================================================================== --- stable/10/sbin/pfctl/parse.y Thu Nov 30 21:21:22 2017 (r326413) +++ stable/10/sbin/pfctl/parse.y Thu Nov 30 21:32:28 2017 (r326414) @@ -4310,8 +4310,11 @@ route_host : STRING { $$->tail = $$; } | '(' STRING host ')' { + struct node_host *n; + $$ = $3; - $$->ifname = $2; + for (n = $3; n != NULL; n = n->next) + n->ifname = $2; } ; From owner-svn-src-stable-10@freebsd.org Fri Dec 1 11:11:26 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92A2BDFC4B7; Fri, 1 Dec 2017 11:11:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C88C7C004; Fri, 1 Dec 2017 11:11:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB1BBPL0093730; Fri, 1 Dec 2017 11:11:25 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB1BBPnF093729; Fri, 1 Dec 2017 11:11:25 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201712011111.vB1BBPnF093729@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 1 Dec 2017 11:11:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326426 - stable/10/sys/cddl/compat/opensolaris/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/10/sys/cddl/compat/opensolaris/kern X-SVN-Commit-Revision: 326426 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Dec 2017 11:11:26 -0000 Author: avg Date: Fri Dec 1 11:11:25 2017 New Revision: 326426 URL: https://svnweb.freebsd.org/changeset/base/326426 Log: MFC r326067: make illumos uiocopy use vn_io_fault_uiomove Modified: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c ============================================================================== --- stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c Fri Dec 1 11:06:51 2017 (r326425) +++ stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c Fri Dec 1 11:11:25 2017 (r326426) @@ -42,6 +42,7 @@ #include #include +#include /* * same as uiomove() but doesn't modify uio structure. @@ -50,63 +51,42 @@ int uiocopy(void *p, size_t n, enum uio_rw rw, struct uio *uio, size_t *cbytes) { - struct iovec *iov; - ulong_t cnt; - int error, iovcnt; + struct iovec small_iovec[1]; + struct uio small_uio_clone; + struct uio *uio_clone; + int error; - iovcnt = uio->uio_iovcnt; - *cbytes = 0; - - for (iov = uio->uio_iov; n > 0 && iovcnt > 0; iov++, iovcnt--) { - cnt = MIN(iov->iov_len, n); - if (cnt == 0) - continue; - - switch (uio->uio_segflg) { - case UIO_USERSPACE: - if (rw == UIO_READ) - error = copyout(p, iov->iov_base, cnt); - else - error = copyin(iov->iov_base, p, cnt); - if (error) - return (error); - break; - case UIO_SYSSPACE: - if (uio->uio_rw == UIO_READ) - bcopy(p, iov->iov_base, cnt); - else - bcopy(iov->iov_base, p, cnt); - break; - } - - p = (caddr_t)p + cnt; - n -= cnt; - *cbytes += cnt; + ASSERT3U(uio->uio_rw, ==, rw); + if (uio->uio_iovcnt == 1) { + small_uio_clone = *uio; + small_iovec[0] = *uio->uio_iov; + small_uio_clone.uio_iov = small_iovec; + uio_clone = &small_uio_clone; + } else { + uio_clone = cloneuio(uio); } - return (0); + + error = vn_io_fault_uiomove(p, n, uio_clone); + *cbytes = uio->uio_resid - uio_clone->uio_resid; + if (uio_clone != &small_uio_clone) + free(uio_clone, M_IOV); + return (error); } /* * Drop the next n chars out of *uiop. */ void -uioskip(uio_t *uiop, size_t n) +uioskip(uio_t *uio, size_t n) { - if (n > uiop->uio_resid) + enum uio_seg segflg; + + /* For the full compatibility with illumos. */ + if (n > uio->uio_resid) return; - while (n != 0) { - register iovec_t *iovp = uiop->uio_iov; - register size_t niovb = MIN(iovp->iov_len, n); - if (niovb == 0) { - uiop->uio_iov++; - uiop->uio_iovcnt--; - continue; - } - iovp->iov_base += niovb; - uiop->uio_loffset += niovb; - iovp->iov_len -= niovb; - uiop->uio_resid -= niovb; - n -= niovb; - } + segflg = uio->uio_segflg; + uio->uio_segflg = UIO_NOCOPY; + uiomove(NULL, n, uio->uio_rw, uio); + uio->uio_segflg = segflg; } From owner-svn-src-stable-10@freebsd.org Fri Dec 1 11:14:16 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 214DBDFC65B; Fri, 1 Dec 2017 11:14:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 850E07C5D3; Fri, 1 Dec 2017 11:14:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB1BEDc3095018; Fri, 1 Dec 2017 11:14:13 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB1BEDhI095017; Fri, 1 Dec 2017 11:14:13 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201712011114.vB1BEDhI095017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 1 Dec 2017 11:14:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326428 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 326428 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Dec 2017 11:14:17 -0000 Author: avg Date: Fri Dec 1 11:14:13 2017 New Revision: 326428 URL: https://svnweb.freebsd.org/changeset/base/326428 Log: MFC r326070: zfs_write: fix problem with writes appearing to succeed when over quota The problem happens when the writes have offsets and sizes aligned with a filesystem's recordsize (maximum block size). In this scenario dmu_tx_assign() would fail because of being over the quota, but the uio would already be modified in the code path where we copy data from the uio into a borrowed ARC buffer. That makes an appearance of a partial write, so zfs_write() would return success and the uio would be modified consistently with writing a single block. That bug can result in a data loss because the writes over the quota would appear to succeed while the actual data is being discarded. This commit fixes the bug by ensuring that the uio is not changed until after all error checks are done. To achieve that the code now uses uiocopy() + uioskip() as in the original illumos design. We can do that now that uiocopy() has been updated in r326067 to use vn_io_fault_uiomove(). Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 1 11:13:58 2017 (r326427) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 1 11:14:13 2017 (r326428) @@ -1036,31 +1036,18 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t * holding up the transaction if the data copy hangs * up on a pagefault (e.g., from an NFS server mapping). */ -#ifdef illumos size_t cbytes; -#endif abuf = dmu_request_arcbuf(sa_get_db(zp->z_sa_hdl), max_blksz); ASSERT(abuf != NULL); ASSERT(arc_buf_size(abuf) == max_blksz); -#ifdef illumos if (error = uiocopy(abuf->b_data, max_blksz, UIO_WRITE, uio, &cbytes)) { dmu_return_arcbuf(abuf); break; } ASSERT(cbytes == max_blksz); -#else - ssize_t resid = uio->uio_resid; - error = vn_io_fault_uiomove(abuf->b_data, max_blksz, uio); - if (error != 0) { - uio->uio_offset -= resid - uio->uio_resid; - uio->uio_resid = resid; - dmu_return_arcbuf(abuf); - break; - } -#endif } /* @@ -1138,10 +1125,8 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t dmu_assign_arcbuf(sa_get_db(zp->z_sa_hdl), woff, abuf, tx); } -#ifdef illumos ASSERT(tx_bytes <= uio->uio_resid); uioskip(uio, tx_bytes); -#endif } if (tx_bytes && vn_has_cached_data(vp)) { update_pages(vp, woff, tx_bytes, zfsvfs->z_os,