From owner-svn-src-stable@freebsd.org Mon Nov 27 00:26:35 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 640A5DF45AD; Mon, 27 Nov 2017 00:26:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19F8D7CF80; Mon, 27 Nov 2017 00:26:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAR0QYqx026136; Mon, 27 Nov 2017 00:26:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAR0QYpR026135; Mon, 27 Nov 2017 00:26:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201711270026.vAR0QYpR026135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 27 Nov 2017 00:26:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326238 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 326238 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Nov 2017 00:26:35 -0000 Author: markj Date: Mon Nov 27 00:26:33 2017 New Revision: 326238 URL: https://svnweb.freebsd.org/changeset/base/326238 Log: MFC r319824 (by sevan), r320624, r326173: Fixups for the lockstat provider man page. Modified: stable/11/share/man/man4/dtrace_lockstat.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/dtrace_lockstat.4 ============================================================================== --- stable/11/share/man/man4/dtrace_lockstat.4 Sun Nov 26 21:10:47 2017 (r326237) +++ stable/11/share/man/man4/dtrace_lockstat.4 Mon Nov 27 00:26:33 2017 (r326238) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 9, 2017 +.Dd July 3, 2017 .Dt DTRACE_LOCKSTAT 4 .Os .Sh NAME @@ -54,198 +54,247 @@ .Sh DESCRIPTION The DTrace .Nm lockstat -provider allows the tracing of events related to locking on FreeBSD. +provider allows the tracing of events related to locking on +.Fx . .Pp The .Nm lockstat -provider contains DTrace probe for inspecting the kernel's lock +provider contains DTrace probes for inspecting the kernel's lock state transitions. -Tracepoints exist for several types of kernel -locking primitives, including mutexes, spin, reader-writer, -and shared exclusive locks. -An attempt has been made to provide a regular and easy to understand -interface to the +Probes exist for the +.Xr mutex 9 , +.Xr rwlock 9 +and +.Xr sx 9 +lock types. +The +.Xr lockstat 1 +utility can be used to collect and display data collected from the .Nm lockstat provider. -Each type of lock has an +Each type of lock has .Fn acquire and .Fn release -probe which exposes the lock structure that is being operated upon. +probes which expose the lock structure being operated upon, +as well as probes which fire when a thread contends with other threads +for ownership of a lock. .Pp -Whenever an MTX_DEF mutex is acquired the -.Fn lockstat:::adaptive-acquire -probe fires. -The only argument is a pointer to the lock structure which describes -the lock that is being acquired. -.Pp The +.Fn lockstat:::adaptive-acquire +and .Fn lockstat:::adaptive-release -probe fires whenever an adaptive lock is released. +probes fire when an +.Dv MTX_DEF +.Xr mutex 9 +is acquired and released, respectively. The only argument is a pointer to the lock structure which describes -the lock that is being released. +the lock being acquired or released. .Pp The .Fn lockstat:::adaptive-spin -probe fires when an adaptive lock is acquired. +probe fires when a thread spins while waiting for a +.Dv MTX_DEF +.Xr mutex 9 +to be released by another thread. The first argument is a pointer to the lock structure that describes the lock and the second argument is the amount of time, -in nanoseconds, -that the mutex spent spinning. -.Pp +in nanoseconds, that the mutex spent spinning. The .Fn lockstat:::adaptive-block -probe fires whenever thread takes itself off of the CPU -while trying to acquire the lock. +probe fires when a thread takes itself off the CPU while trying to acquire an +.Dv MTX_DEF +.Xr mutex 9 +that is owned by another thread. The first argument is a pointer to the lock structure that describes the lock and the second argument is the length of time, -in nanoseconds, -that the waiting thread was blocked. -The +in nanoseconds, that the waiting thread was blocked. +The .Fn lockstat:::adaptive-block -probe fires only after the lock has been successfully acquired, -after the adaptive-acquire probe fires. -.Pp -Whenever a spin mutex is acquired the -.Fn lockstat:::spin-acquire +and +.Fn lockstat:::adaptive-spin +probes fire only after the lock has been successfully acquired, +and in particular, after the +.Fn lockstat:::adaptive-acquire probe fires. -The only argument is a pointer to the lock structure which describes -the lock that is being acquired. .Pp The +.Fn lockstat:::spin-acquire +and .Fn lockstat:::spin-release -probe fires whenever a spin mutex is released. +probes fire when a +.Dv MTX_SPIN +.Xr mutex 9 +is acquired and released, respectively. The only argument is a pointer to the lock structure which describes -the lock that is being released. +the lock being acquired or released. .Pp The .Fn lockstat:::spin-spin -probe fires when a thread stops spinning waiting for a spin mutex. +probe fires when a thread spins while waiting for a +.Dv MTX_SPIN +.Xr mutex 9 +to be released by another thread. The first argument is a pointer to the lock structure that describes the lock and the second argument is the length of the time spent spinning, in nanoseconds. -.Pp -Whenever a reader-writer lock is acquired the -.Fn lockstat:::rw-acquire +The +.Fn lockstat:::spin-spin +probe fires only after the lock has been successfully acquired, +and in particular, after the +.Fn lockstat:::spin-acquire probe fires. -The only argument is a pointer to the structure which describes -the lock that is being acquired. .Pp The +.Fn lockstat:::rw-acquire +and .Fn lockstat:::rw-release -probe fires whenever a reader-writer lock is released. +probes fire when a +.Xr rwlock 9 +is acquired and released, respectively. +The first argument is a pointer to the structure which describes +the lock being acquired. +The second argument is +.Dv 0 +if the lock is being acquired or released as a writer, and +.Dv 1 +if it is being acquired or released as a reader. .Pp The .Fn lockstat:::rw-block -probe fires whenever a thread removes itself from the CPU while -waiting to acquire the lock. -The first argument is a pointer to the lock structure that describes -the lock and the second argument is the length of time, -in nanoseconds, -that the waiting thread was blocked. -The third argument is 1 if the thread was were spinning while -trying to acquire a read lock, -otherwise it will be 0 indicating that we were spinning for the write lock. -The fourth argument is 1 if we were waiting for a reader to release the lock, -otherwise it will be 0 indicating that we were waiting for a writer -to release the lock. -The fifth argument is the number of readers that held the lock when -we started spinning; in particular, argument 5 is non-zero only -if the fourth argument is 1. -.Pp +probe fires when a thread removes itself from the CPU while +waiting to acquire a +.Xr rwlock 9 . The .Fn lockstat:::rw-spin -probe fires when a reader-writer lock takes itself off the CPU -while waiting for the lock. +probe fires when a thread spins while waiting to acquire a +.Xr rwlock 9 . +Both probes take the same set of arguments. The first argument is a pointer to the lock structure that describes -the lock and the second argument returns an integer count of the -number of spins that were completed. +the lock. +The second argument is the length of time, in nanoseconds, +that the waiting thread was off the CPU or spinning for the lock. +The third argument is +.Dv 0 +if the thread is attempting to acquire the lock as a writer, and +.Dv 1 +if the thread is attempting to acquire the lock as a reader. +The fourth argument is +.Dv 0 +if the thread is waiting for a writer to release the lock, and +.Dv 1 +if the thread is waiting for a reader to release the lock. +The fifth argument is the number of readers that held the lock when +the thread first attempted to acquire the lock. +This argument will be +.Dv 0 +if the fourth argument is +.Dv 0 . .Pp The .Fn lockstat:::rw-upgrade -probe fires whenever a thread tries to upgrade a lock from a +probe fires when a thread successfully upgrades a held +.Xr rwlock 9 read lock to a write lock. -The only argument is a pointer to the structure which describes -the lock that is being acquired. -.Pp +The .Fn lockstat:::rw-downgrade -probe fires whenever a thread tries downgrades a lock from a -read and write lock to a read lock. +probe fires when a thread downgrades a held +.Xr rwlock 9 +write lock to a read lock. The only argument is a pointer to the structure which describes -the lock that is being acquired. +the lock being acquired. .Pp -Whenever a shared-exclusive lock is acquired the -.Fn lockstat:::sx-acquire -probe fires. -The only argument is a pointer to the structure which describes -the lock that is being acquired. -.Pp The +.Fn lockstat:::sx-acquire +and .Fn lockstat:::sx-release -probe fires whenever an adaptive lock is released. -The only argument is a pointer to the lock structure which describes -the lock that is being released. +probes fire when a +.Xr sx 9 +is acquired and released, respectively. +The first argument is a pointer to the structure which describes +the lock being acquired. +The second argument is +.Dv 0 +if the shared lock is being acquired or released, and +.Dv 1 +if the exclusive lock is being acquired or released. .Pp The .Fn lockstat:::sx-block -probe fires whenever a thread takes itself off the CPU while -waiting for the lock. -The first argument is a pointer to the structure that describes -the lock and the second argument is the length of time, -in nanoseconds, -that the waiting thread was blocked. -The third argument is 1 if the thread was were spinning while -trying to acquire a read lock, -otherwise it will be 0 indicating that we were spinning for the write lock. -The fourth argument is 1 if we were waiting for a reader to release the lock, -otherwise it will be 0 indicating that we were waiting for a writer -to release the lock. -The fifth argument is the number of readers that held the lock when -we started spinning; in particular, argument 5 is non-zero only -if the fourth argument is 1. -.Pp +probe fires when a thread takes itself off the CPU while +waiting to acquire a +.Xr sx 9 . The .Fn lockstat:::sx-spin -probe fires when a thread takes itself off of the CPU while -waiting for the lock. -The first argument is a pointer to the structure that describes -the lock and the second argument returns an integer count of the -number of spins that were completed. +probe fires when a thread spins while waiting to acquire a +.Xr sx 9 . +Both probes take the same set of arguments. +The first argument is a pointer to the lock structure that describes +the lock. +The second argument is the length of time, in nanoseconds, +that the waiting thread was off the CPU or spinning for the lock. +The third argument is +.Dv 0 +if the thread is attempting to acquire the lock as a writer, and +.Dv 1 +if the thread is attempting to acquire the lock as a reader. +The fourth argument is +.Dv 0 +if the thread is waiting for a writer to release the lock, and +.Dv 1 +if the thread is waiting for a reader to release the lock. +The fifth argument is the number of readers that held the lock when +the thread first attempted to acquire the lock. +This argument will be +.Dv 0 +if the fourth argument is +.Dv 0 . .Pp The .Fn lockstat:::sx-upgrade -probe fires whenever a thread tries to upgrade a lock from a -shared lock to a shared-exclusive lock. +probe fires when a thread successfully upgrades a held +.Xr sx 9 +shared lock to an exclusive lock. The only argument is a pointer to the structure which describes -the lock that is being upgraded. -.Pp +the lock being acquired. The .Fn lockstat:::sx-downgrade -probe fires whenever a thread downgrades a lock from a -shared-exclusive lock to a shared lock. -The only argument is a pointer to the structure which describes -the lock that is being downgraded. +probe fires when a thread downgrades a held +.Xr sx 9 +exclusive lock to a shared lock. .Pp The .Fn lockstat:::thread-spin -probe fires whenever a thread spins on a spin lock. +probe fires when a thread spins on a thread lock, which is a specialized +.Dv MTX_SPIN +.Xr mutex 9 . The first argument is a pointer to the structure that describes the lock and the second argument is the length of time, -in nanoseconds, -that the thread was spinning. +in nanoseconds, that the thread was spinning. .Sh SEE ALSO .Xr dtrace 1 , .Xr lockstat 1 , .Xr locking 9 , +.Xr mutex 9 , +.Xr rwlock 9 , .Xr SDT 9 , +.Xr sx 9 .Sh HISTORY The .Nm lockstat -provider first appeared in OpenSolaris. -The FreeBSD implementation of the +provider first appeared in Solaris. +The +.Fx +implementation of the .Nm lockstat provider first appeared in .Fx 9. .Sh AUTHORS This manual page was written by .An George V. Neville-Neil Aq Mt gnn@FreeBSD.org . +.Sh BUGS +Probes for +.Xr lockmgr 9 +and +.Xr rmlock 9 +locks have not yet been added. From owner-svn-src-stable@freebsd.org Mon Nov 27 02:43:28 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C216FDF6839; Mon, 27 Nov 2017 02:43:28 +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 8EA2F8026A; Mon, 27 Nov 2017 02:43:28 +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 vAR2hRLU083872; Mon, 27 Nov 2017 02:43:27 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAR2hRtD083871; Mon, 27 Nov 2017 02:43:27 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201711270243.vAR2hRtD083871@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:43:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326240 - stable/11/lib/libc/iconv X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/11/lib/libc/iconv X-SVN-Commit-Revision: 326240 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Nov 2017 02:43:28 -0000 Author: pfg Date: Mon Nov 27 02:43:27 2017 New Revision: 326240 URL: https://svnweb.freebsd.org/changeset/base/326240 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/11/lib/libc/iconv/citrus_none.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/iconv/citrus_none.c ============================================================================== --- stable/11/lib/libc/iconv/citrus_none.c Mon Nov 27 02:28:40 2017 (r326239) +++ stable/11/lib/libc/iconv/citrus_none.c Mon Nov 27 02:43:27 2017 (r326240) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_none.c,v 1.18 2008/06/14 16:01:07 tnozaki Exp $ */ +/* $NetBSD: citrus_none.c,v 1.22 2017/07/13 16:00:30 christos Exp $ */ /*- * Copyright (c) 2002 Citrus Project, @@ -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@freebsd.org Mon Nov 27 02:44:37 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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@freebsd.org Mon Nov 27 03:47:13 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1689DF7931; Mon, 27 Nov 2017 03:47:13 +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 6E13E2478; Mon, 27 Nov 2017 03:47:13 +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 vAR3lCVJ009990; Mon, 27 Nov 2017 03:47:12 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAR3lC8U009989; Mon, 27 Nov 2017 03:47:12 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201711270347.vAR3lC8U009989@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:47:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326242 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 326242 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Nov 2017 03:47:13 -0000 Author: delphij Date: Mon Nov 27 03:47:12 2017 New Revision: 326242 URL: https://svnweb.freebsd.org/changeset/base/326242 Log: MFC r325755: Be more careful when doing calculation with request from userland. Modified: stable/11/sys/kern/kern_proc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_proc.c ============================================================================== --- stable/11/sys/kern/kern_proc.c Mon Nov 27 02:44:36 2017 (r326241) +++ stable/11/sys/kern/kern_proc.c Mon Nov 27 03:47:12 2017 (r326242) @@ -1933,7 +1933,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@freebsd.org Mon Nov 27 03:49:52 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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@freebsd.org Mon Nov 27 15:12:15 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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@freebsd.org Mon Nov 27 15:12:16 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80B31E5406A; Mon, 27 Nov 2017 15:12:16 +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 48CA475984; Mon, 27 Nov 2017 15:12:16 +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 vARFCFB4099491; Mon, 27 Nov 2017 15:12:15 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vARFCFqT098997; Mon, 27 Nov 2017 15:12:15 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201711271512.vARFCFqT098997@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:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326264 - in stable: 10/release/tools 11/release/tools X-SVN-Group: stable-11 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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/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) Changes in other areas also in this revision: 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) Modified: stable/11/release/tools/ec2.conf ============================================================================== --- stable/11/release/tools/ec2.conf Mon Nov 27 15:11:47 2017 (r326263) +++ stable/11/release/tools/ec2.conf Mon Nov 27 15:12:14 2017 (r326264) @@ -90,5 +90,7 @@ vm_extra_pre_umount() { # * firstboot_pkgs (install packages) touch ${DESTDIR}/firstboot + rm -f ${DESTDIR}/etc/resolv.conf + return 0 } Modified: stable/11/release/tools/gce.conf ============================================================================== --- stable/11/release/tools/gce.conf Mon Nov 27 15:11:47 2017 (r326263) +++ stable/11/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/11/release/tools/vagrant-virtualbox.conf ============================================================================== --- stable/11/release/tools/vagrant-virtualbox.conf Mon Nov 27 15:11:47 2017 (r326263) +++ stable/11/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/11/release/tools/vagrant-vmware.conf ============================================================================== --- stable/11/release/tools/vagrant-vmware.conf Mon Nov 27 15:11:47 2017 (r326263) +++ stable/11/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@freebsd.org Tue Nov 28 00:19:06 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 382BFDEE193; Tue, 28 Nov 2017 00:19:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0ECE16BAB9; Tue, 28 Nov 2017 00:19:05 +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 vAS0J5BW051838; Tue, 28 Nov 2017 00:19:05 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAS0J4CC051834; Tue, 28 Nov 2017 00:19:04 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711280019.vAS0J4CC051834@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 00:19:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326298 - in stable/11/cddl: contrib/opensolaris/lib/libzfs/common usr.sbin/zfsd X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/11/cddl: contrib/opensolaris/lib/libzfs/common usr.sbin/zfsd X-SVN-Commit-Revision: 326298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 00:19:06 -0000 Author: asomers Date: Tue Nov 28 00:19:04 2017 New Revision: 326298 URL: https://svnweb.freebsd.org/changeset/base/326298 Log: MFC r322854, r323995, r324568, r324991 r322854: zfsd(8): Close a race condition when onlining a disk paritition When inserting a partitioned disk, devfs and geom will announce the whole disk before they announce the partition. If the partition containing ZFS extends to one of the disk's extents, then zfsd will see a ZFS label on the whole disk and attempt to online it. ZFS is smart enough to activate the partition instead of the whole disk, but only if GEOM has already created the partition's provider. cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Add a zpool_read_all_labels method. It's similar to zpool_read_label, but it will return the number of labels found. cddl/usr.sbin/zfsd/zfsd_event.cc When processing a DevFS CREATE event, only online a VDEV if we can read all four ZFS labels. Reviewed by: mav Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11920 r323995: Close a memory leak when using zpool_read_all_labels X-MFC-With: 322854 Sponsored by: Spectra Logic Corp r324568: Optimize zpool_read_all_labels with AIO Read all labels in parallel instead of sequentially X-MFC-With: 322854 Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D12495 r324991: Fix zpool_read_all_labels when vfs.aio.enable_unsafe=0 Previously, zpool_read_all_labels was trying to do 256KB reads, which are greater than the default MAXPHYS and therefore must go through the slow, unsafe AIO path. Shrink these reads to 112KB so they can use the safe, fast AIO path instead. X-MFC-With: 324568 Sponsored by: Spectra Logic Corp Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c stable/11/cddl/usr.sbin/zfsd/zfsd_event.cc Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Tue Nov 28 00:12:14 2017 (r326297) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Tue Nov 28 00:19:04 2017 (r326298) @@ -774,6 +774,7 @@ extern int zpool_in_use(libzfs_handle_t *, int, pool_s * Label manipulation. */ extern int zpool_read_label(int, nvlist_t **); +extern int zpool_read_all_labels(int, nvlist_t **); extern int zpool_clear_label(int); /* is this zvol valid for use as a dump device? */ Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Tue Nov 28 00:12:14 2017 (r326297) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Tue Nov 28 00:19:04 2017 (r326298) @@ -42,6 +42,7 @@ * using our derived config, and record the results. */ +#include #include #include #include @@ -913,6 +914,90 @@ zpool_read_label(int fd, nvlist_t **config) free(label); *config = NULL; return (-1); +} + +/* + * Given a file descriptor, read the label information and return an nvlist + * describing the configuration, if there is one. + * returns the number of valid labels found + * If a label is found, returns it via config. The caller is responsible for + * freeing it. + */ +int +zpool_read_all_labels(int fd, nvlist_t **config) +{ + struct stat64 statbuf; + struct aiocb aiocbs[VDEV_LABELS]; + struct aiocb *aiocbps[VDEV_LABELS]; + int l; + vdev_phys_t *labels; + uint64_t state, txg, size; + int nlabels = 0; + + *config = NULL; + + if (fstat64(fd, &statbuf) == -1) + return (0); + size = P2ALIGN_TYPED(statbuf.st_size, sizeof (vdev_label_t), uint64_t); + + if ((labels = calloc(VDEV_LABELS, sizeof (vdev_phys_t))) == NULL) + return (0); + + memset(aiocbs, 0, sizeof(aiocbs)); + for (l = 0; l < VDEV_LABELS; l++) { + aiocbs[l].aio_fildes = fd; + aiocbs[l].aio_offset = label_offset(size, l) + VDEV_SKIP_SIZE; + aiocbs[l].aio_buf = &labels[l]; + aiocbs[l].aio_nbytes = sizeof(vdev_phys_t); + aiocbs[l].aio_lio_opcode = LIO_READ; + aiocbps[l] = &aiocbs[l]; + } + + if (lio_listio(LIO_WAIT, aiocbps, VDEV_LABELS, NULL) != 0) { + if (errno == EAGAIN || errno == EINTR || errno == EIO) { + for (l = 0; l < VDEV_LABELS; l++) { + errno = 0; + int r = aio_error(&aiocbs[l]); + if (r != EINVAL) + (void)aio_return(&aiocbs[l]); + } + } + free(labels); + return (0); + } + + for (l = 0; l < VDEV_LABELS; l++) { + nvlist_t *temp = NULL; + + if (aio_return(&aiocbs[l]) != sizeof(vdev_phys_t)) + continue; + + if (nvlist_unpack(labels[l].vp_nvlist, + sizeof (labels[l].vp_nvlist), &temp, 0) != 0) + continue; + + if (nvlist_lookup_uint64(temp, ZPOOL_CONFIG_POOL_STATE, + &state) != 0 || state > POOL_STATE_L2CACHE) { + nvlist_free(temp); + temp = NULL; + continue; + } + + if (state != POOL_STATE_SPARE && state != POOL_STATE_L2CACHE && + (nvlist_lookup_uint64(temp, ZPOOL_CONFIG_POOL_TXG, + &txg) != 0 || txg == 0)) { + nvlist_free(temp); + temp = NULL; + continue; + } + if (temp) + *config = temp; + + nlabels++; + } + + free(labels); + return (nlabels); } typedef struct rdsk_node { Modified: stable/11/cddl/usr.sbin/zfsd/zfsd_event.cc ============================================================================== --- stable/11/cddl/usr.sbin/zfsd/zfsd_event.cc Tue Nov 28 00:12:14 2017 (r326297) +++ stable/11/cddl/usr.sbin/zfsd/zfsd_event.cc Tue Nov 28 00:19:04 2017 (r326298) @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -93,21 +94,32 @@ DevfsEvent::ReadLabel(int devFd, bool &inUse, bool &de pool_state_t poolState; char *poolName; boolean_t b_inuse; + int nlabels; inUse = false; degraded = false; poolName = NULL; if (zpool_in_use(g_zfsHandle, devFd, &poolState, &poolName, &b_inuse) == 0) { - nvlist_t *devLabel; + nvlist_t *devLabel = NULL; inUse = b_inuse == B_TRUE; if (poolName != NULL) free(poolName); - if (zpool_read_label(devFd, &devLabel) != 0 - || devLabel == NULL) + nlabels = zpool_read_all_labels(devFd, &devLabel); + /* + * If we find a disk with fewer than the maximum number of + * labels, it might be the whole disk of a partitioned disk + * where ZFS resides on a partition. In that case, we should do + * nothing and wait for the partition to appear. Or, the disk + * might be damaged. In that case, zfsd should do nothing and + * wait for the sysadmin to decide. + */ + if (nlabels != VDEV_LABELS || devLabel == NULL) { + nvlist_free(devLabel); return (NULL); + } try { Vdev vdev(devLabel); @@ -121,6 +133,7 @@ DevfsEvent::ReadLabel(int devFd, bool &inUse, bool &de exp.GetString().insert(0, context); exp.Log(); + nvlist_free(devLabel); } } return (NULL); From owner-svn-src-stable@freebsd.org Tue Nov 28 00:40:00 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 811DEDEE927; Tue, 28 Nov 2017 00:40: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 519BE6C58F; Tue, 28 Nov 2017 00:40: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 vAS0dxOw060527; Tue, 28 Nov 2017 00:39:59 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAS0dx7X060521; Tue, 28 Nov 2017 00:39:59 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711280039.vAS0dx7X060521@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 00:39:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326299 - in stable/11: 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-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/11: 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: 326299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 00:40:00 -0000 Author: asomers Date: Tue Nov 28 00:39:58 2017 New Revision: 326299 URL: https://svnweb.freebsd.org/changeset/base/326299 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/11/bin/chflags/tests/ - copied from r323275, head/bin/chflags/tests/ stable/11/bin/mkdir/tests/ - copied from r323275, head/bin/mkdir/tests/ stable/11/bin/rcp/tests/ - copied from r323275, head/bin/rcp/tests/ stable/11/bin/rmdir/tests/ - copied from r323275, head/bin/rmdir/tests/ Modified: stable/11/bin/chflags/Makefile stable/11/bin/mkdir/Makefile stable/11/bin/rcp/Makefile stable/11/bin/rmdir/Makefile stable/11/etc/mtree/BSD.tests.dist Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/chflags/Makefile ============================================================================== --- stable/11/bin/chflags/Makefile Tue Nov 28 00:19:04 2017 (r326298) +++ stable/11/bin/chflags/Makefile Tue Nov 28 00:39:58 2017 (r326299) @@ -1,7 +1,12 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PACKAGE=runtime PROG= chflags + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/11/bin/mkdir/Makefile ============================================================================== --- stable/11/bin/mkdir/Makefile Tue Nov 28 00:19:04 2017 (r326298) +++ stable/11/bin/mkdir/Makefile Tue Nov 28 00:39:58 2017 (r326299) @@ -1,7 +1,12 @@ # @(#)Makefile 8.1 (Berkeley) 5/31/93 # $FreeBSD$ +.include + PACKAGE=runtime PROG= mkdir + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/11/bin/rcp/Makefile ============================================================================== --- stable/11/bin/rcp/Makefile Tue Nov 28 00:19:04 2017 (r326298) +++ stable/11/bin/rcp/Makefile Tue Nov 28 00:39:58 2017 (r326299) @@ -1,6 +1,8 @@ # @(#)Makefile 8.1 (Berkeley) 7/19/93 # $FreeBSD$ +.include + PACKAGE=rcmds PROG= rcp SRCS= rcp.c util.c @@ -10,5 +12,8 @@ PACKAGE=rcmds BINOWN= root BINMODE=4555 + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/11/bin/rmdir/Makefile ============================================================================== --- stable/11/bin/rmdir/Makefile Tue Nov 28 00:19:04 2017 (r326298) +++ stable/11/bin/rmdir/Makefile Tue Nov 28 00:39:58 2017 (r326299) @@ -1,7 +1,11 @@ # @(#)Makefile 8.1 (Berkeley) 5/31/93 # $FreeBSD$ +.include + PACKAGE=runtime PROG= rmdir +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Tue Nov 28 00:19:04 2017 (r326298) +++ stable/11/etc/mtree/BSD.tests.dist Tue Nov 28 00:39:58 2017 (r326299) @@ -8,6 +8,8 @@ bin cat .. + chflags + .. chmod .. date @@ -22,6 +24,8 @@ .. ls .. + mkdir + .. mv .. pax @@ -29,6 +33,10 @@ pkill .. pwait + .. + rcp + .. + rmdir .. sh builtins From owner-svn-src-stable@freebsd.org Tue Nov 28 00:41:18 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6985DEEB29; Tue, 28 Nov 2017 00:41:18 +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 B033E6C76E; Tue, 28 Nov 2017 00:41:18 +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 vAS0fH9F063724; Tue, 28 Nov 2017 00:41:17 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAS0fHDh063723; Tue, 28 Nov 2017 00:41:17 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711280041.vAS0fHDh063723@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 00:41:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326300 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 326300 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 00:41:19 -0000 Author: asomers Date: Tue Nov 28 00:41:17 2017 New Revision: 326300 URL: https://svnweb.freebsd.org/changeset/base/326300 Log: MFC r324805: Fix the mps(4) HISTORY section. Looks like a copy/paste error from r302673. Sponsored by: Spectra Logic Corp Modified: stable/11/share/man/man4/mps.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/mps.4 ============================================================================== --- stable/11/share/man/man4/mps.4 Tue Nov 28 00:39:58 2017 (r326299) +++ stable/11/share/man/man4/mps.4 Tue Nov 28 00:41:17 2017 (r326300) @@ -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@freebsd.org Tue Nov 28 00:55:31 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E230BDEF02B; Tue, 28 Nov 2017 00:55:31 +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 B95F36D292; Tue, 28 Nov 2017 00:55:31 +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 vAS0tUon069290; Tue, 28 Nov 2017 00:55:30 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAS0tUZ0069288; Tue, 28 Nov 2017 00:55:30 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201711280055.vAS0tUZ0069288@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Nov 2017 00:55:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326302 - stable/11/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 326302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 00:55:32 -0000 Author: emaste Date: Tue Nov 28 00:55:30 2017 New Revision: 326302 URL: https://svnweb.freebsd.org/changeset/base/326302 Log: MFC r325042: libdtrace: replace "DOODAD" with more descriptive string Previously some unimplemented libdtrace routines printed the function, file and line number, followed by "DOODAD." That is not particularly informative, so replace it with a message reporting the actual issue. Sponsored by: The FreeBSD Foundation Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Tue Nov 28 00:42:44 2017 (r326301) +++ stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Tue Nov 28 00:55:30 2017 (r326302) @@ -229,10 +229,12 @@ prepare_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, for (j = 0; j < nrel; j++) { #if defined(__aarch64__) /* XXX */ -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): aarch64 not implemented\n", + __FUNCTION__, __FILE__, __LINE__); #elif defined(__arm__) /* XXX */ -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): arm not implemented\n", + __FUNCTION__, __FILE__, __LINE__); #elif defined(__i386) || defined(__amd64) rel->r_offset = s->dofs_offset + dofr[j].dofr_offset; @@ -240,7 +242,8 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__L R_386_32); #elif defined(__mips__) /* XXX */ -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): MIPS not implemented\n", + __FUNCTION__, __FILE__, __LINE__); #elif defined(__powerpc__) /* * Add 4 bytes to hit the low half of this 64-bit @@ -252,7 +255,8 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__L R_PPC_REL32); #elif defined(__riscv__) /* XXX */ -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): RISC-V not implemented\n", + __FUNCTION__, __FILE__, __LINE__); #elif defined(__sparc) /* * Add 4 bytes to hit the low half of this 64-bit @@ -838,7 +842,8 @@ static int dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, uint32_t *off) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): aarch64 not implemented\n", __FUNCTION__, __FILE__, + __LINE__); return (0); } #elif defined(__arm__) @@ -847,7 +852,8 @@ static int dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, uint32_t *off) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): arm not implemented\n", __FUNCTION__, __FILE__, + __LINE__); return (0); } #elif defined(__mips__) @@ -856,7 +862,8 @@ static int dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, uint32_t *off) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): MIPS not implemented\n", __FUNCTION__, __FILE__, + __LINE__); return (0); } #elif defined(__powerpc__) @@ -946,7 +953,8 @@ static int dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, uint32_t *off) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): RISC-V implementation required\n", __FUNCTION__, + __FILE__, __LINE__); return (0); } #elif defined(__sparc) Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Tue Nov 28 00:42:44 2017 (r326301) +++ stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Tue Nov 28 00:55:30 2017 (r326302) @@ -426,7 +426,8 @@ dt_proc_attach(dt_proc_t *dpr, int exec) static void dt_proc_waitrun(dt_proc_t *dpr) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): not implemented\n", __FUNCTION__, __FILE__, + __LINE__); #ifdef DOODAD struct ps_prochandle *P = dpr->dpr_proc; const lwpstatus_t *psp = &Pstatus(P)->pr_lwp; From owner-svn-src-stable@freebsd.org Tue Nov 28 00:56:21 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7690DEF0F6; Tue, 28 Nov 2017 00:56:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0C266D3D8; Tue, 28 Nov 2017 00:56:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAS0uKZp069379; Tue, 28 Nov 2017 00:56:20 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAS0uKvU069378; Tue, 28 Nov 2017 00:56:20 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201711280056.vAS0uKvU069378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Nov 2017 00:56:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326303 - stable/11/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 326303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 00:56:22 -0000 Author: emaste Date: Tue Nov 28 00:56:20 2017 New Revision: 326303 URL: https://svnweb.freebsd.org/changeset/base/326303 Log: MFC r326046: dt_modtext: return error on archs lacking an implementation Reported by: mmel Reviewed by: markj Sponsored by: The FreeBSD Foundation Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Tue Nov 28 00:55:30 2017 (r326302) +++ stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Tue Nov 28 00:56:20 2017 (r326303) @@ -844,7 +844,7 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, { printf("%s:%s(%d): aarch64 not implemented\n", __FUNCTION__, __FILE__, __LINE__); - return (0); + return (-1); } #elif defined(__arm__) /* XXX */ @@ -854,7 +854,7 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, { printf("%s:%s(%d): arm not implemented\n", __FUNCTION__, __FILE__, __LINE__); - return (0); + return (-1); } #elif defined(__mips__) /* XXX */ @@ -864,7 +864,7 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, { printf("%s:%s(%d): MIPS not implemented\n", __FUNCTION__, __FILE__, __LINE__); - return (0); + return (-1); } #elif defined(__powerpc__) /* The sentinel is 'xor r3,r3,r3'. */ @@ -955,7 +955,7 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, { printf("%s:%s(%d): RISC-V implementation required\n", __FUNCTION__, __FILE__, __LINE__); - return (0); + return (-1); } #elif defined(__sparc) From owner-svn-src-stable@freebsd.org Tue Nov 28 01:15:12 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D8EDDEF9D1; Tue, 28 Nov 2017 01:15:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB3C06DE7B; Tue, 28 Nov 2017 01:15:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAS1FAjW078022; Tue, 28 Nov 2017 01:15:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAS1FAVD078021; Tue, 28 Nov 2017 01:15:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201711280115.vAS1FAVD078021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 28 Nov 2017 01:15:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326304 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 326304 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 01:15:12 -0000 Author: markj Date: Tue Nov 28 01:15:10 2017 New Revision: 326304 URL: https://svnweb.freebsd.org/changeset/base/326304 Log: MFC r326055: Allow for fictitious physical pages in vm_page_scan_contig(). Modified: stable/11/sys/vm/vm_page.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_page.c ============================================================================== --- stable/11/sys/vm/vm_page.c Tue Nov 28 00:56:20 2017 (r326303) +++ stable/11/sys/vm/vm_page.c Tue Nov 28 01:15:10 2017 (r326304) @@ -2036,8 +2036,10 @@ vm_page_scan_contig(u_long npages, vm_page_t m_start, run_len = 0; m_mtx = NULL; for (m = m_start; m < m_end && run_len < npages; m += m_inc) { - KASSERT((m->flags & (PG_FICTITIOUS | PG_MARKER)) == 0, - ("page %p is PG_FICTITIOUS or PG_MARKER", m)); + KASSERT((m->flags & PG_MARKER) == 0, + ("page %p is PG_MARKER", m)); + KASSERT((m->flags & PG_FICTITIOUS) == 0 || m->wire_count == 1, + ("fictitious page %p has invalid wire count", m)); /* * If the current page would be the start of a run, check its From owner-svn-src-stable@freebsd.org Tue Nov 28 01:15:55 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3ADDDEFAAB; Tue, 28 Nov 2017 01:15:55 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B29B6DFDA; Tue, 28 Nov 2017 01:15:55 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAS1FsMT078110; Tue, 28 Nov 2017 01:15:54 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAS1Fr1e078101; Tue, 28 Nov 2017 01:15:53 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201711280115.vAS1Fr1e078101@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 28 Nov 2017 01:15:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326305 - in stable/11: share/man/man9 sys/kern sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 326305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 01:15:55 -0000 Author: markj Date: Tue Nov 28 01:15:53 2017 New Revision: 326305 URL: https://svnweb.freebsd.org/changeset/base/326305 Log: MFC r326060: Clean up the SYSINIT_FLAGS definitions for rwlock(9) and rmlock(9). Modified: stable/11/share/man/man9/Makefile stable/11/share/man/man9/rmlock.9 stable/11/share/man/man9/rwlock.9 stable/11/share/man/man9/sx.9 stable/11/sys/kern/kern_rmlock.c stable/11/sys/kern/kern_rwlock.c stable/11/sys/sys/rmlock.h stable/11/sys/sys/rwlock.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/Makefile ============================================================================== --- stable/11/share/man/man9/Makefile Tue Nov 28 01:15:10 2017 (r326304) +++ stable/11/share/man/man9/Makefile Tue Nov 28 01:15:53 2017 (r326305) @@ -1446,6 +1446,7 @@ MLINKS+=rmlock.9 rm_assert.9 \ rmlock.9 rm_runlock.9 \ rmlock.9 rm_sleep.9 \ rmlock.9 RM_SYSINIT.9 \ + rmlock.9 RM_SYSINIT_FLAGS.9 \ rmlock.9 rm_try_rlock.9 \ rmlock.9 rm_wlock.9 \ rmlock.9 rm_wowned.9 \ @@ -1478,6 +1479,7 @@ MLINKS+=rwlock.9 rw_assert.9 \ rwlock.9 rw_unlock.9 \ rwlock.9 rw_sleep.9 \ rwlock.9 RW_SYSINIT.9 \ + rwlock.9 RW_SYSINIT_FLAGS.9 \ rwlock.9 rw_try_rlock.9 \ rwlock.9 rw_try_upgrade.9 \ rwlock.9 rw_try_wlock.9 \ @@ -1685,6 +1687,7 @@ MLINKS+=sx.9 sx_assert.9 \ sx.9 sx_slock_sig.9 \ sx.9 sx_sunlock.9 \ sx.9 SX_SYSINIT.9 \ + sx.9 SX_SYSINIT_FLAGS.9 \ sx.9 sx_try_slock.9 \ sx.9 sx_try_upgrade.9 \ sx.9 sx_try_xlock.9 \ Modified: stable/11/share/man/man9/rmlock.9 ============================================================================== --- stable/11/share/man/man9/rmlock.9 Tue Nov 28 01:15:10 2017 (r326304) +++ stable/11/share/man/man9/rmlock.9 Tue Nov 28 01:15:53 2017 (r326305) @@ -26,7 +26,7 @@ .\" $FreeBSD$ .\" .\" Based on rwlock.9 man page -.Dd December 13, 2014 +.Dd November 11, 2017 .Dt RMLOCK 9 .Os .Sh NAME @@ -42,7 +42,8 @@ .Nm rm_wowned , .Nm rm_sleep , .Nm rm_assert , -.Nm RM_SYSINIT +.Nm RM_SYSINIT , +.Nm RM_SYSINIT_FLAGS .Nd kernel reader/writer lock optimized for read-mostly access patterns .Sh SYNOPSIS .In sys/param.h @@ -74,7 +75,8 @@ .Ft void .Fn rm_assert "struct rmlock *rm" "int what" .In sys/kernel.h -.Fn RM_SYSINIT "name" "struct rmlock *rm" "const char *desc" "int opts" +.Fn RM_SYSINIT "name" "struct rmlock *rm" "const char *desc" +.Fn RM_SYSINIT_FLAGS "name" "struct rmlock *rm" "const char *desc" "int flags" .Sh DESCRIPTION Read-mostly locks allow shared access to protected data by multiple threads, or exclusive access by a single thread. Modified: stable/11/share/man/man9/rwlock.9 ============================================================================== --- stable/11/share/man/man9/rwlock.9 Tue Nov 28 01:15:10 2017 (r326304) +++ stable/11/share/man/man9/rwlock.9 Tue Nov 28 01:15:53 2017 (r326305) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 28, 2016 +.Dd November 11, 2017 .Dt RWLOCK 9 .Os .Sh NAME @@ -45,7 +45,8 @@ .Nm rw_initialized , .Nm rw_wowned , .Nm rw_assert , -.Nm RW_SYSINIT +.Nm RW_SYSINIT , +.Nm RW_SYSINIT_FLAGS .Nd kernel reader/writer lock .Sh SYNOPSIS .In sys/param.h @@ -88,6 +89,7 @@ .Fn rw_assert "const struct rwlock *rw" "int what" .In sys/kernel.h .Fn RW_SYSINIT "name" "struct rwlock *rw" "const char *desc" +.Fn RW_SYSINIT_FLAGS "name" "struct rwlock *rw" "const char *desc" "int flags" .Sh DESCRIPTION Reader/writer locks allow shared access to protected data by multiple threads, or exclusive access by a single thread. Modified: stable/11/share/man/man9/sx.9 ============================================================================== --- stable/11/share/man/man9/sx.9 Tue Nov 28 01:15:10 2017 (r326304) +++ stable/11/share/man/man9/sx.9 Tue Nov 28 01:15:53 2017 (r326305) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 28, 2016 +.Dd November 11, 2017 .Dt SX 9 .Os .Sh NAME @@ -49,7 +49,8 @@ .Nm sx_xholder , .Nm sx_xlocked , .Nm sx_assert , -.Nm SX_SYSINIT +.Nm SX_SYSINIT , +.Nm SX_SYSINIT_FLAGS .Nd kernel shared/exclusive lock .Sh SYNOPSIS .In sys/param.h @@ -95,7 +96,8 @@ .Ft void .Fn sx_assert "const struct sx *sx" "int what" .In sys/kernel.h -.Fn SX_SYSINIT "name" "struct sx *sx" "const char *description" +.Fn SX_SYSINIT "name" "struct sx *sx" "const char *desc" +.Fn SX_SYSINIT_FLAGS "name" "struct sx *sx" "const char *desc" "int flags" .Sh DESCRIPTION Shared/exclusive locks are used to protect data that are read far more often than they are written. @@ -295,6 +297,12 @@ but with an additional argument, .Fa name , that is used in generating unique variable names for the related structures associated with the lock and the sysinit routine. +The +.Fn SX_SYSINIT_FLAGS +macro can similarly be used to initialize a given +.Fa sx +lock using +.Fn sx_init_flags . .Pp A thread may not hold both a shared lock and an exclusive lock on the same lock simultaneously; Modified: stable/11/sys/kern/kern_rmlock.c ============================================================================== --- stable/11/sys/kern/kern_rmlock.c Tue Nov 28 01:15:10 2017 (r326304) +++ stable/11/sys/kern/kern_rmlock.c Tue Nov 28 01:15:53 2017 (r326305) @@ -336,17 +336,10 @@ rm_wowned(const struct rmlock *rm) void rm_sysinit(void *arg) { - struct rm_args *args = arg; + struct rm_args *args; - rm_init(args->ra_rm, args->ra_desc); -} - -void -rm_sysinit_flags(void *arg) -{ - struct rm_args_flags *args = arg; - - rm_init_flags(args->ra_rm, args->ra_desc, args->ra_opts); + args = arg; + rm_init_flags(args->ra_rm, args->ra_desc, args->ra_flags); } static int Modified: stable/11/sys/kern/kern_rwlock.c ============================================================================== --- stable/11/sys/kern/kern_rwlock.c Tue Nov 28 01:15:10 2017 (r326304) +++ stable/11/sys/kern/kern_rwlock.c Tue Nov 28 01:15:53 2017 (r326305) @@ -240,16 +240,9 @@ _rw_destroy(volatile uintptr_t *c) void rw_sysinit(void *arg) { - struct rw_args *args = arg; + struct rw_args *args; - rw_init((struct rwlock *)args->ra_rw, args->ra_desc); -} - -void -rw_sysinit_flags(void *arg) -{ - struct rw_args_flags *args = arg; - + args = arg; rw_init_flags((struct rwlock *)args->ra_rw, args->ra_desc, args->ra_flags); } Modified: stable/11/sys/sys/rmlock.h ============================================================================== --- stable/11/sys/sys/rmlock.h Tue Nov 28 01:15:10 2017 (r326304) +++ stable/11/sys/sys/rmlock.h Tue Nov 28 01:15:53 2017 (r326305) @@ -101,35 +101,21 @@ void _rm_assert(const struct rmlock *rm, int what, con struct rm_args { struct rmlock *ra_rm; const char *ra_desc; + int ra_flags; }; -struct rm_args_flags { - struct rmlock *ra_rm; - const char *ra_desc; - int ra_opts; -}; - -#define RM_SYSINIT(name, rm, desc) \ +#define RM_SYSINIT_FLAGS(name, rm, desc, flags) \ static struct rm_args name##_args = { \ (rm), \ (desc), \ + (flags), \ }; \ SYSINIT(name##_rm_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ rm_sysinit, &name##_args); \ SYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ rm_destroy, (rm)) - -#define RM_SYSINIT_FLAGS(name, rm, desc, opts) \ - static struct rm_args name##_args = { \ - (rm), \ - (desc), \ - (opts), \ - }; \ - SYSINIT(name##_rm_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ - rm_sysinit_flags, &name##_args); \ - SYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ - rm_destroy, (rm)) +#define RM_SYSINIT(name, rm, desc) RM_SYSINIT_FLAGS(name, rm, desc, 0) #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) #define RA_LOCKED LA_LOCKED Modified: stable/11/sys/sys/rwlock.h ============================================================================== --- stable/11/sys/sys/rwlock.h Tue Nov 28 01:15:10 2017 (r326304) +++ stable/11/sys/sys/rwlock.h Tue Nov 28 01:15:53 2017 (r326305) @@ -220,35 +220,21 @@ void __rw_assert(const volatile uintptr_t *c, int what struct rw_args { void *ra_rw; const char *ra_desc; -}; - -struct rw_args_flags { - void *ra_rw; - const char *ra_desc; int ra_flags; }; -#define RW_SYSINIT(name, rw, desc) \ +#define RW_SYSINIT_FLAGS(name, rw, desc, flags) \ static struct rw_args name##_args = { \ (rw), \ (desc), \ + (flags), \ }; \ SYSINIT(name##_rw_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ rw_sysinit, &name##_args); \ SYSUNINIT(name##_rw_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ _rw_destroy, __DEVOLATILE(void *, &(rw)->rw_lock)) - -#define RW_SYSINIT_FLAGS(name, rw, desc, flags) \ - static struct rw_args_flags name##_args = { \ - (rw), \ - (desc), \ - (flags), \ - }; \ - SYSINIT(name##_rw_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ - rw_sysinit_flags, &name##_args); \ - SYSUNINIT(name##_rw_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ - _rw_destroy, __DEVOLATILE(void *, &(rw)->rw_lock)) +#define RW_SYSINIT(name, rw, desc) RW_SYSINIT_FLAGS(name, rw, desc, 0) /* * Options passed to rw_init_flags(). From owner-svn-src-stable@freebsd.org Tue Nov 28 01:16:43 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AEDDDEFC28; Tue, 28 Nov 2017 01:16:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 234C06E17C; Tue, 28 Nov 2017 01:16:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAS1Gg6x078207; Tue, 28 Nov 2017 01:16:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAS1GgDi078204; Tue, 28 Nov 2017 01:16:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201711280116.vAS1GgDi078204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 28 Nov 2017 01:16:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326306 - in stable/11/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/pid usr.sbin/dtrace/tests/tools X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/pid usr.sbin/dtrace/tests/tools X-SVN-Commit-Revision: 326306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 01:16:43 -0000 Author: markj Date: Tue Nov 28 01:16:41 2017 New Revision: 326306 URL: https://svnweb.freebsd.org/changeset/base/326306 Log: MFC r326061, r326063: DTrace test fixups. Modified: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.d stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.d ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.d Tue Nov 28 01:15:53 2017 (r326305) +++ stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.d Tue Nov 28 01:16:41 2017 (r326306) @@ -33,6 +33,6 @@ * */ -pid$1:a.out:main:beginning +pid$1:a.out::beginning { } Modified: stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh ============================================================================== --- stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Tue Nov 28 01:15:53 2017 (r326305) +++ stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Tue Nov 28 01:16:41 2017 (r326306) @@ -183,6 +183,9 @@ exclude EXFAIL common/usdt/tst.badguess.ksh exclude EXFAIL common/usdt/tst.guess32.ksh exclude EXFAIL common/usdt/tst.guess64.ksh +# Depends on non-standard static linker behaviour. +exclude EXFAIL common/usdt/tst.eliminate.ksh + # Generated headers include , so _DTRACE_VERSION is always defined. exclude EXFAIL common/usdt/tst.nodtrace.ksh From owner-svn-src-stable@freebsd.org Tue Nov 28 11:06:19 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A6E1E5265C; Tue, 28 Nov 2017 11:06:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 35DFE806A9; Tue, 28 Nov 2017 11:06:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASB6I1t025049; Tue, 28 Nov 2017 11:06:18 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASB6I5F025046; Tue, 28 Nov 2017 11:06:18 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201711281106.vASB6I5F025046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 28 Nov 2017 11:06:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326313 - in stable/11/sys: arm/arm arm64/arm64 arm64/include X-SVN-Group: stable-11 X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in stable/11/sys: arm/arm arm64/arm64 arm64/include X-SVN-Commit-Revision: 326313 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 11:06:19 -0000 Author: andrew Date: Tue Nov 28 11:06:17 2017 New Revision: 326313 URL: https://svnweb.freebsd.org/changeset/base/326313 Log: MFC r326137: Ensure we check the program state set in the trap frame on arm and arm64. This value may be set by userspace so we need to check it before using it. If this is not done correctly on exception return the kernel may continue in kernel mode with all registers set to a userspace controlled value. Fix this by moving the check into set_mcontext, and also add the missing sanitisation from the arm64 set_regs. Discussed with: security-officer@ Sponsored by: DARPA, AFRL Modified: stable/11/sys/arm/arm/machdep.c stable/11/sys/arm64/arm64/machdep.c stable/11/sys/arm64/include/armreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/machdep.c ============================================================================== --- stable/11/sys/arm/arm/machdep.c Tue Nov 28 11:04:47 2017 (r326312) +++ stable/11/sys/arm/arm/machdep.c Tue Nov 28 11:06:17 2017 (r326313) @@ -507,7 +507,17 @@ set_mcontext(struct thread *td, mcontext_t *mcp) mcontext_vfp_t mc_vfp, *vfp; struct trapframe *tf = td->td_frame; const __greg_t *gr = mcp->__gregs; + int spsr; + /* + * Make sure the processor mode has not been tampered with and + * interrupts have not been disabled. + */ + spsr = gr[_REG_CPSR]; + if ((spsr & PSR_MODE) != PSR_USR32_MODE || + (spsr & (PSR_I | PSR_F)) != 0) + return (EINVAL); + #ifdef WITNESS if (mcp->mc_vfp_size != 0 && mcp->mc_vfp_size != sizeof(mc_vfp)) { printf("%s: %s: Malformed mc_vfp_size: %d (0x%08X)\n", @@ -666,22 +676,16 @@ sys_sigreturn(td, uap) } */ *uap; { ucontext_t uc; - int spsr; + int error; if (uap == NULL) return (EFAULT); if (copyin(uap->sigcntxp, &uc, sizeof(uc))) return (EFAULT); - /* - * Make sure the processor mode has not been tampered with and - * interrupts have not been disabled. - */ - spsr = uc.uc_mcontext.__gregs[_REG_CPSR]; - if ((spsr & PSR_MODE) != PSR_USR32_MODE || - (spsr & (PSR_I | PSR_F)) != 0) - return (EINVAL); /* Restore register context. */ - set_mcontext(td, &uc.uc_mcontext); + error = set_mcontext(td, &uc.uc_mcontext); + if (error != 0) + return (error); /* Restore signal mask. */ kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); Modified: stable/11/sys/arm64/arm64/machdep.c ============================================================================== --- stable/11/sys/arm64/arm64/machdep.c Tue Nov 28 11:04:47 2017 (r326312) +++ stable/11/sys/arm64/arm64/machdep.c Tue Nov 28 11:06:17 2017 (r326313) @@ -194,7 +194,8 @@ set_regs(struct thread *td, struct reg *regs) frame->tf_sp = regs->sp; frame->tf_lr = regs->lr; frame->tf_elr = regs->elr; - frame->tf_spsr = regs->spsr; + frame->tf_spsr &= ~PSR_FLAGS; + frame->tf_spsr |= regs->spsr & PSR_FLAGS; memcpy(frame->tf_x, regs->x, sizeof(frame->tf_x)); @@ -332,7 +333,13 @@ int set_mcontext(struct thread *td, mcontext_t *mcp) { struct trapframe *tf = td->td_frame; + uint32_t spsr; + spsr = mcp->mc_gpregs.gp_spsr; + if ((spsr & PSR_M_MASK) != PSR_M_EL0t || + (spsr & (PSR_F | PSR_I | PSR_A | PSR_D)) != 0) + return (EINVAL); + memcpy(tf->tf_x, mcp->mc_gpregs.gp_x, sizeof(tf->tf_x)); tf->tf_sp = mcp->mc_gpregs.gp_sp; @@ -502,19 +509,16 @@ int sys_sigreturn(struct thread *td, struct sigreturn_args *uap) { ucontext_t uc; - uint32_t spsr; + int error; if (uap == NULL) return (EFAULT); if (copyin(uap->sigcntxp, &uc, sizeof(uc))) return (EFAULT); - spsr = uc.uc_mcontext.mc_gpregs.gp_spsr; - if ((spsr & PSR_M_MASK) != PSR_M_EL0t || - (spsr & (PSR_F | PSR_I | PSR_A | PSR_D)) != 0) - return (EINVAL); - - set_mcontext(td, &uc.uc_mcontext); + error = set_mcontext(td, &uc.uc_mcontext); + if (error != 0) + return (error); set_fpcontext(td, &uc.uc_mcontext); /* Restore signal mask. */ Modified: stable/11/sys/arm64/include/armreg.h ============================================================================== --- stable/11/sys/arm64/include/armreg.h Tue Nov 28 11:04:47 2017 (r326312) +++ stable/11/sys/arm64/include/armreg.h Tue Nov 28 11:06:17 2017 (r326313) @@ -439,6 +439,7 @@ #define PSR_C 0x20000000 #define PSR_Z 0x40000000 #define PSR_N 0x80000000 +#define PSR_FLAGS 0xf0000000 /* TCR_EL1 - Translation Control Register */ #define TCR_ASID_16 (1 << 36) From owner-svn-src-stable@freebsd.org Tue Nov 28 16:09:03 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4F34DBAFCD; Tue, 28 Nov 2017 16:09:03 +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 826436AE1C; Tue, 28 Nov 2017 16:09:03 +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 vASG92Vh052429; Tue, 28 Nov 2017 16:09:02 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASG92pd052427; Tue, 28 Nov 2017 16:09:02 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281609.vASG92pd052427@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 16:09:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326316 - in stable/11/sys/dev: pccbb pci X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/11/sys/dev: pccbb pci X-SVN-Commit-Revision: 326316 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 16:09:03 -0000 Author: asomers Date: Tue Nov 28 16:09:02 2017 New Revision: 326316 URL: https://svnweb.freebsd.org/changeset/base/326316 Log: MFC r324457: Remove embedded newlines from sysctl variable descriptions PR: 112556 Submitted by: Willem Jan Withagen (earlier version) Reported by: Willem Jan Withagen, ighighi@gmail.com Sponsored by: Spectra Logic Corp Modified: stable/11/sys/dev/pccbb/pccbb_isa.c stable/11/sys/dev/pci/pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/pccbb/pccbb_isa.c ============================================================================== --- stable/11/sys/dev/pccbb/pccbb_isa.c Tue Nov 28 16:00:27 2017 (r326315) +++ stable/11/sys/dev/pccbb/pccbb_isa.c Tue Nov 28 16:09:02 2017 (r326316) @@ -75,11 +75,11 @@ static SYSCTL_NODE(_hw, OID_AUTO, pcic, CTLFLAG_RD, 0, static int isa_intr_mask = EXCA_INT_MASK_ALLOWED; SYSCTL_INT(_hw_pcic, OID_AUTO, intr_mask, CTLFLAG_RDTUN, &isa_intr_mask, 0, - "Mask of allowable interrupts for this laptop. The default is generally\n\ -correct, but some laptops do not route all the IRQ pins to the bridge to\n\ -save wires. Sometimes you need a more restrictive mask because some of the\n\ -hardware in your laptop may not have a driver so its IRQ might not be\n\ -allocated."); + "Mask of allowable interrupts for this laptop. The default is generally" + " correct, but some laptops do not route all the IRQ pins to the bridge to" + " save wires. Sometimes you need a more restrictive mask because some of" + " the hardware in your laptop may not have a driver so its IRQ might not be" + " allocated."); /* * CL-PD6722's VSENSE method @@ -90,13 +90,13 @@ allocated."); int pcic_pd6722_vsense = 1; SYSCTL_INT(_hw_pcic, OID_AUTO, pd6722_vsense, CTLFLAG_RDTUN, &pcic_pd6722_vsense, 1, - "Select CL-PD6722's VSENSE method. VSENSE is used to determine the\n\ -volatage of inserted cards. The CL-PD6722 has two methods to determine the\n\ -voltage of the card. 0 means assume a 5.0V card and do not check. 1 means\n\ -use the same method that the CL-PD6710 uses (default). 2 means use the\n\ -same method as the CL-PD6729. 2 is documented in the datasheet as being\n\ -the correct way, but 1 seems to give better results on more laptops."); - + "Select CL-PD6722's VSENSE method. VSENSE is used to determine the" + " voltage of inserted cards. The CL-PD6722 has two methods to determine" + " the voltage of the card. 0 means assume a 5.0V card and do not check. 1" + " means use the same method that the CL-PD6710 uses (default). 2 means use" + " the same method as the CL-PD6729. 2 is documented in the datasheet as" + " being the correct way, but 1 seems to give better results on more" + " laptops."); /***************************************************************************** * End of configurable parameters. *****************************************************************************/ Modified: stable/11/sys/dev/pci/pci.c ============================================================================== --- stable/11/sys/dev/pci/pci.c Tue Nov 28 16:00:27 2017 (r326315) +++ stable/11/sys/dev/pci/pci.c Tue Nov 28 16:09:02 2017 (r326316) @@ -321,9 +321,9 @@ SYSCTL_NODE(_hw, OID_AUTO, pci, CTLFLAG_RD, 0, "PCI bu static int pci_enable_io_modes = 1; SYSCTL_INT(_hw_pci, OID_AUTO, enable_io_modes, CTLFLAG_RWTUN, &pci_enable_io_modes, 1, - "Enable I/O and memory bits in the config register. Some BIOSes do not\n\ -enable these bits correctly. We'd like to do this all the time, but there\n\ -are some peripherals that this causes problems with."); + "Enable I/O and memory bits in the config register. Some BIOSes do not" + " enable these bits correctly. We'd like to do this all the time, but" + " there are some peripherals that this causes problems with."); static int pci_do_realloc_bars = 0; SYSCTL_INT(_hw_pci, OID_AUTO, realloc_bars, CTLFLAG_RWTUN, @@ -334,10 +334,10 @@ SYSCTL_INT(_hw_pci, OID_AUTO, realloc_bars, CTLFLAG_RW static int pci_do_power_nodriver = 0; SYSCTL_INT(_hw_pci, OID_AUTO, do_power_nodriver, CTLFLAG_RWTUN, &pci_do_power_nodriver, 0, - "Place a function into D3 state when no driver attaches to it. 0 means\n\ -disable. 1 means conservatively place devices into D3 state. 2 means\n\ -aggressively place devices into D3 state. 3 means put absolutely everything\n\ -in D3 state."); + "Place a function into D3 state when no driver attaches to it. 0 means" + " disable. 1 means conservatively place devices into D3 state. 2 means" + " aggressively place devices into D3 state. 3 means put absolutely" + " everything in D3 state."); int pci_do_power_resume = 1; SYSCTL_INT(_hw_pci, OID_AUTO, do_power_resume, CTLFLAG_RWTUN, @@ -372,9 +372,10 @@ static int pci_usb_takeover = 1; static int pci_usb_takeover = 0; #endif SYSCTL_INT(_hw_pci, OID_AUTO, usb_early_takeover, CTLFLAG_RDTUN, - &pci_usb_takeover, 1, "Enable early takeover of USB controllers.\n\ -Disable this if you depend on BIOS emulation of USB devices, that is\n\ -you use USB devices (like keyboard or mouse) but do not load USB drivers"); + &pci_usb_takeover, 1, + "Enable early takeover of USB controllers. Disable this if you depend on" + " BIOS emulation of USB devices, that is you use USB devices (like" + " keyboard or mouse) but do not load USB drivers"); static int pci_clear_bars; SYSCTL_INT(_hw_pci, OID_AUTO, clear_bars, CTLFLAG_RDTUN, &pci_clear_bars, 0, From owner-svn-src-stable@freebsd.org Tue Nov 28 16:34:57 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16DB5DE303D; Tue, 28 Nov 2017 16:34:57 +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 E51D46D0DD; Tue, 28 Nov 2017 16:34:56 +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 vASGYt0W065787; Tue, 28 Nov 2017 16:34:55 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASGYtOG065786; Tue, 28 Nov 2017 16:34:55 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281634.vASGYtOG065786@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 16:34:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326319 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 326319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 16:34:57 -0000 Author: asomers Date: Tue Nov 28 16:34:55 2017 New Revision: 326319 URL: https://svnweb.freebsd.org/changeset/base/326319 Log: MFC r324940: Fix the error message when creating a zpool on a too-small device Don't check for SPA_MINDEVSIZE in vdev_geom_attach when opening by path. It's redundant with the check in vdev_open, and failing to attach here results in the wrong error message being printed. However, still check for it in some other situations: * When opening by guids, so we don't get bogged down reading from slow devices like floppy drives. * In vdev_geom_read_pool_label for the same reason, because we iterate over all providers. * If the caller requests that we verify the guid, because then we'll have to read from the device before vdev_open verifies the size. PR: 222227 Reported by: Marie Helene Kvello-Aune Reviewed by: avg, mav Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D12531 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Nov 28 16:26:56 2017 (r326318) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Nov 28 16:34:55 2017 (r326319) @@ -193,7 +193,7 @@ vdev_geom_orphan(struct g_consumer *cp) } static struct g_consumer * -vdev_geom_attach(struct g_provider *pp, vdev_t *vd) +vdev_geom_attach(struct g_provider *pp, vdev_t *vd, boolean_t sanity) { struct g_geom *gp; struct g_consumer *cp; @@ -203,14 +203,18 @@ vdev_geom_attach(struct g_provider *pp, vdev_t *vd) ZFS_LOG(1, "Attaching to %s.", pp->name); - if (pp->sectorsize > VDEV_PAD_SIZE || !ISP2(pp->sectorsize)) { - ZFS_LOG(1, "Failing attach of %s. Incompatible sectorsize %d\n", - pp->name, pp->sectorsize); - return (NULL); - } else if (pp->mediasize < SPA_MINDEVSIZE) { - ZFS_LOG(1, "Failing attach of %s. Incompatible mediasize %ju\n", - pp->name, pp->mediasize); - return (NULL); + if (sanity) { + if (pp->sectorsize > VDEV_PAD_SIZE || !ISP2(pp->sectorsize)) { + ZFS_LOG(1, "Failing attach of %s. " + "Incompatible sectorsize %d\n", + pp->name, pp->sectorsize); + return (NULL); + } else if (pp->mediasize < SPA_MINDEVSIZE) { + ZFS_LOG(1, "Failing attach of %s. " + "Incompatible mediasize %ju\n", + pp->name, pp->mediasize); + return (NULL); + } } /* Do we have geom already? No? Create one. */ @@ -587,7 +591,7 @@ vdev_geom_read_pool_label(const char *name, LIST_FOREACH(pp, &gp->provider, provider) { if (pp->flags & G_PF_WITHER) continue; - zcp = vdev_geom_attach(pp, NULL); + zcp = vdev_geom_attach(pp, NULL, B_TRUE); if (zcp == NULL) continue; g_topology_unlock(); @@ -627,7 +631,7 @@ vdev_attach_ok(vdev_t *vd, struct g_provider *pp) struct g_consumer *cp; int nlabels; - cp = vdev_geom_attach(pp, NULL); + cp = vdev_geom_attach(pp, NULL, B_TRUE); if (cp == NULL) { ZFS_LOG(1, "Unable to attach tasting instance to %s.", pp->name); @@ -635,14 +639,12 @@ vdev_attach_ok(vdev_t *vd, struct g_provider *pp) } g_topology_unlock(); nlabels = vdev_geom_read_config(cp, &config); + g_topology_lock(); + vdev_geom_detach(cp, B_TRUE); if (nlabels == 0) { - g_topology_lock(); - vdev_geom_detach(cp, B_TRUE); ZFS_LOG(1, "Unable to read config from %s.", pp->name); return (NO_MATCH); } - g_topology_lock(); - vdev_geom_detach(cp, B_TRUE); pool_guid = 0; (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &pool_guid); @@ -714,7 +716,7 @@ vdev_geom_attach_by_guids(vdev_t *vd) out: if (best_pp) { - cp = vdev_geom_attach(best_pp, vd); + cp = vdev_geom_attach(best_pp, vd, B_TRUE); if (cp == NULL) { printf("ZFS WARNING: Unable to attach to %s.\n", best_pp->name); @@ -768,7 +770,7 @@ vdev_geom_open_by_path(vdev_t *vd, int check_guid) if (pp != NULL) { ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path); if (!check_guid || vdev_attach_ok(vd, pp) == FULL_MATCH) - cp = vdev_geom_attach(pp, vd); + cp = vdev_geom_attach(pp, vd, B_FALSE); } return (cp); From owner-svn-src-stable@freebsd.org Tue Nov 28 16:49:17 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE57FDE3BE3; Tue, 28 Nov 2017 16:49:17 +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 C7B0C6DF4B; Tue, 28 Nov 2017 16:49:17 +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 vASGnGhB070377; Tue, 28 Nov 2017 16:49:16 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASGnGDK070373; Tue, 28 Nov 2017 16:49:16 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201711281649.vASGnGDK070373@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 16:49:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326320 - stable/11/contrib/libc-vis X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/contrib/libc-vis X-SVN-Commit-Revision: 326320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 16:49:18 -0000 Author: brooks Date: Tue Nov 28 16:49:16 2017 New Revision: 326320 URL: https://svnweb.freebsd.org/changeset/base/326320 Log: MFC 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. Modified: stable/11/contrib/libc-vis/unvis.3 stable/11/contrib/libc-vis/vis.3 stable/11/contrib/libc-vis/vis.c stable/11/contrib/libc-vis/vis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/libc-vis/unvis.3 ============================================================================== --- stable/11/contrib/libc-vis/unvis.3 Tue Nov 28 16:34:55 2017 (r326319) +++ stable/11/contrib/libc-vis/unvis.3 Tue Nov 28 16:49:16 2017 (r326320) @@ -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/11/contrib/libc-vis/vis.3 ============================================================================== --- stable/11/contrib/libc-vis/vis.3 Tue Nov 28 16:34:55 2017 (r326319) +++ stable/11/contrib/libc-vis/vis.3 Tue Nov 28 16:49:16 2017 (r326320) @@ -1,4 +1,4 @@ -.\" $NetBSD: vis.3,v 1.45 2016/06/08 15:00:04 wiz Exp $ +.\" $NetBSD: vis.3,v 1.49 2017/08/05 20:22:29 wiz Exp $ .\" $FreeBSD$ .\" .\" Copyright (c) 1989, 1991, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)vis.3 8.1 (Berkeley) 6/9/93 .\" -.Dd January 14, 2015 +.Dd April 22, 2017 .Dt VIS 3 .Os .Sh NAME @@ -243,6 +243,8 @@ 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 ( * , @@ -310,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 @@ -401,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 @@ -408,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 Modified: stable/11/contrib/libc-vis/vis.c ============================================================================== --- stable/11/contrib/libc-vis/vis.c Tue Nov 28 16:34:55 2017 (r326319) +++ stable/11/contrib/libc-vis/vis.c Tue Nov 28 16:49:16 2017 (r326320) @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.71 2016/01/14 20:41:23 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.71 2016/01/14 20:41:23 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$"); @@ -379,6 +379,7 @@ makeextralist(int flags, const char *src) 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'; @@ -408,7 +409,15 @@ istrsenvisx(char **mbdstp, size_t *dlen, const char *m _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 @@ -424,12 +433,12 @@ istrsenvisx(char **mbdstp, size_t *dlen, const char *m /* Allocate space for the wide char strings */ psrc = pdst = extra = NULL; mdst = NULL; - if ((psrc = calloc(mblength + 1, sizeof(*psrc))) == 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((4 * mblength) + 1, sizeof(*mdst))) == NULL) + if ((mdst = calloc((16 * mbslength) + 1, sizeof(*mdst))) == NULL) goto out; *mbdstp = mdst; } @@ -452,13 +461,6 @@ istrsenvisx(char **mbdstp, size_t *dlen, const char *m * 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. */ @@ -470,12 +472,13 @@ istrsenvisx(char **mbdstp, size_t *dlen, const char *m 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. */ @@ -485,6 +488,7 @@ istrsenvisx(char **mbdstp, size_t *dlen, const char *m } 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 Modified: stable/11/contrib/libc-vis/vis.h ============================================================================== --- stable/11/contrib/libc-vis/vis.h Tue Nov 28 16:34:55 2017 (r326319) +++ stable/11/contrib/libc-vis/vis.h Tue Nov 28 16:49:16 2017 (r326320) @@ -1,4 +1,4 @@ -/* $NetBSD: vis.h,v 1.24 2016/01/14 20:42:14 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 From owner-svn-src-stable@freebsd.org Tue Nov 28 16:52:40 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4962EDE3E99; Tue, 28 Nov 2017 16:52: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 2352B6E31B; Tue, 28 Nov 2017 16:52: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 vASGqdGc074191; Tue, 28 Nov 2017 16:52:39 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASGqdG7074187; Tue, 28 Nov 2017 16:52:39 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281652.vASGqdG7074187@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 16:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326321 - in stable/11: cddl/usr.sbin/zfsd lib/libdevdctl X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/11: cddl/usr.sbin/zfsd lib/libdevdctl X-SVN-Commit-Revision: 326321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 16:52:40 -0000 Author: asomers Date: Tue Nov 28 16:52:38 2017 New Revision: 326321 URL: https://svnweb.freebsd.org/changeset/base/326321 Log: MFC r325011, r325016 r325011: zfsd should be able to online an L2ARC that disappears and returns Previously, this didn't work because L2ARC devices' labels don't contain pool GUIDs. Modify zfsd so that the pool GUID won't be required: lib/libdevdctl/guid.h Change INVALID_GUID from a uint64_t constant to a function that returns an invalid Guid object. Remove the void constructor. Nothing uses it, and it violates RAII. cddl/usr.sbin/zfsd/case_file.h cddl/usr.sbin/zfsd/case_file.cc Allow CaseFile::Find to match a CaseFile based on Vdev GUID alone. In CaseFile::ReEvaluate, attempt to online devices even if the newly arrived device has no pool GUID. cddl/usr.sbin/zfsd/vdev_iterator.cc Iterate through a pool's cache devices as well as its regular devices. Reported by: avg Reviewed by: avg Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D12791 r325016: Partially revert r325011: restore Guid's default constructor Reported by: ohartmann X-MFC-With: 325011 Sponsored by: Spectra Logic Corp Modified: stable/11/cddl/usr.sbin/zfsd/case_file.cc stable/11/cddl/usr.sbin/zfsd/case_file.h stable/11/cddl/usr.sbin/zfsd/vdev_iterator.cc stable/11/lib/libdevdctl/guid.h Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/usr.sbin/zfsd/case_file.cc ============================================================================== --- stable/11/cddl/usr.sbin/zfsd/case_file.cc Tue Nov 28 16:49:16 2017 (r326320) +++ stable/11/cddl/usr.sbin/zfsd/case_file.cc Tue Nov 28 16:52:38 2017 (r326321) @@ -102,7 +102,8 @@ CaseFile::Find(Guid poolGUID, Guid vdevGUID) for (CaseFileList::iterator curCase = s_activeCases.begin(); curCase != s_activeCases.end(); curCase++) { - if ((*curCase)->PoolGUID() != poolGUID + if (((*curCase)->PoolGUID() != poolGUID + && Guid::InvalidGuid() != poolGUID) || (*curCase)->VdevGUID() != vdevGUID) continue; @@ -268,7 +269,8 @@ CaseFile::ReEvaluate(const string &devPath, const stri } if (vdev != NULL - && vdev->PoolGUID() == m_poolGUID + && ( vdev->PoolGUID() == m_poolGUID + || vdev->PoolGUID() == Guid::InvalidGuid()) && vdev->GUID() == m_vdevGUID) { zpool_vdev_online(pool, vdev->GUIDString().c_str(), Modified: stable/11/cddl/usr.sbin/zfsd/case_file.h ============================================================================== --- stable/11/cddl/usr.sbin/zfsd/case_file.h Tue Nov 28 16:49:16 2017 (r326320) +++ stable/11/cddl/usr.sbin/zfsd/case_file.h Tue Nov 28 16:52:38 2017 (r326321) @@ -89,6 +89,8 @@ class CaseFile (public) * \brief Find a CaseFile object by a vdev's pool/vdev GUID tuple. * * \param poolGUID Pool GUID for the vdev of the CaseFile to find. + * If InvalidGuid, then only match the vdev GUID + * instead of both pool and vdev GUIDs. * \param vdevGUID Vdev GUID for the vdev of the CaseFile to find. * * \return If found, a pointer to a valid CaseFile object. Modified: stable/11/cddl/usr.sbin/zfsd/vdev_iterator.cc ============================================================================== --- stable/11/cddl/usr.sbin/zfsd/vdev_iterator.cc Tue Nov 28 16:49:16 2017 (r326320) +++ stable/11/cddl/usr.sbin/zfsd/vdev_iterator.cc Tue Nov 28 16:52:38 2017 (r326321) @@ -76,7 +76,9 @@ void VdevIterator::Reset() { nvlist_t *rootVdev; + nvlist **cache_child; int result; + uint_t cache_children; result = nvlist_lookup_nvlist(m_poolConfig, ZPOOL_CONFIG_VDEV_TREE, @@ -85,6 +87,13 @@ VdevIterator::Reset() throw ZfsdException(m_poolConfig, "Unable to extract " "ZPOOL_CONFIG_VDEV_TREE from pool."); m_vdevQueue.assign(1, rootVdev); + result = nvlist_lookup_nvlist_array(rootVdev, + ZPOOL_CONFIG_L2CACHE, + &cache_child, + &cache_children); + if (result == 0) + for (uint_t c = 0; c < cache_children; c++) + m_vdevQueue.push_back(cache_child[c]); } nvlist_t * Modified: stable/11/lib/libdevdctl/guid.h ============================================================================== --- stable/11/lib/libdevdctl/guid.h Tue Nov 28 16:49:16 2017 (r326320) +++ stable/11/lib/libdevdctl/guid.h Tue Nov 28 16:52:38 2017 (r326321) @@ -62,9 +62,13 @@ class Guid { public: /* Constructors */ + /* Default constructor: an Invalid guid */ Guid(); + /* Construct a guid from a provided integer */ Guid(uint64_t guid); + /* Construct a guid from a string in base 8, 10, or 16 */ Guid(const std::string &guid); + static Guid InvalidGuid(); /* Assignment */ Guid& operator=(const Guid& rhs); @@ -80,8 +84,9 @@ class Guid operator uint64_t() const; operator bool() const; - static const uint64_t INVALID_GUID = 0; protected: + static const uint64_t INVALID_GUID = 0; + /* The integer value of the GUID. */ uint64_t m_GUID; }; @@ -97,6 +102,12 @@ inline Guid::Guid(uint64_t guid) : m_GUID(guid) { +} + +inline Guid +Guid::InvalidGuid() +{ + return (Guid(INVALID_GUID)); } inline Guid& From owner-svn-src-stable@freebsd.org Tue Nov 28 17:04:24 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45986DE737A; Tue, 28 Nov 2017 17:04:24 +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 D7AF26EAB3; Tue, 28 Nov 2017 17:04:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASH4Me0078602; Tue, 28 Nov 2017 17:04:22 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASH4MCK078598; Tue, 28 Nov 2017 17:04:22 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281704.vASH4MCK078598@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:04:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326322 - in stable/11: lib/libc/sys sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/11: lib/libc/sys sys/kern X-SVN-Commit-Revision: 326322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 17:04:24 -0000 Author: asomers Date: Tue Nov 28 17:04:22 2017 New Revision: 326322 URL: https://svnweb.freebsd.org/changeset/base/326322 Log: MFC r322258, r324941, r324956, r325018 r322258: Make p1003_1b.aio_listio_max a tunable p1003_1b.aio_listio_max is now a tunable. Its value is reflected in the sysctl of the same name, and the sysconf(3) variable _SC_AIO_LISTIO_MAX. Its value will be bounded from below by the compile-time constant AIO_LISTIO_MAX and from above by the compile-time constant MAX_AIO_QUEUE_PER_PROC and the tunable vfs.aio.max_aio_queue. Reviewed by: jhb, kib Relnotes: yes Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11601 r324941: Remove artificial restriction on lio_listio's operation count In r322258 I made p1003_1b.aio_listio_max a tunable. However, further investigation shows that there was never any good reason for that limit to exist in the first place. It's used in two completely different ways: * To size a UMA zone, which globally limits the number of concurrent aio_suspend calls. * To artifically limit the number of operations in a single lio_listio call. There doesn't seem to be any memory allocation associated with this limit. This change does two things: * Properly names aio_suspend's UMA zone, and sizes it based on a new constant. * Eliminates the artifical restriction on lio_listio. Instead, lio_listio calls will now be limited by the more generous max_aio_queue_per_proc. The old p1003_1b.aio_listio_max is now an alias for vfs.aio.max_aio_queue_per_proc, so sysconf(3) will still work with _SC_AIO_LISTIO_MAX. Reported by: bde Reviewed by: jhb Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D12120 r324956: Bump man page revision dates for r324941 Reported by: jhb X-MFC-with: 324941 Sponsored by: Spectra Logic Corp r325018: Fix aio_suspend in 32-bit emulation An off-by-one error has been present since the system call was first present in 185878. It additionally became a memory corruption bug after change 324941. The failure is actually revealed by our existing AIO tests. However, apparently nobody's been running those in 32-bit emulation mode. Reported by: Coverity, cem CID: 1382114 X-MFC-With: 324941 Sponsored by: Spectra Logic Corp Modified: stable/11/lib/libc/sys/aio_suspend.2 stable/11/lib/libc/sys/lio_listio.2 stable/11/sys/kern/posix4_mib.c stable/11/sys/kern/vfs_aio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/aio_suspend.2 ============================================================================== --- stable/11/lib/libc/sys/aio_suspend.2 Tue Nov 28 16:52:38 2017 (r326321) +++ stable/11/lib/libc/sys/aio_suspend.2 Tue Nov 28 17:04:22 2017 (r326322) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 2, 1999 +.Dd Oct 23, 2017 .Dt AIO_SUSPEND 2 .Os .Sh NAME @@ -85,10 +85,10 @@ expired before any I/O requests completed. The .Fa iocbs argument -contains more than -.Dv AIO_LISTIO_MAX -asynchronous I/O requests, or at least one of the requests is not -valid. +contains more asynchronous I/O requests than the +.Va vfs.aio.max_aio_queue_per_proc +.Xr sysctl 8 +variable, or at least one of the requests is not valid. .It Bq Er EINTR the suspend was interrupted by a signal. .El Modified: stable/11/lib/libc/sys/lio_listio.2 ============================================================================== --- stable/11/lib/libc/sys/lio_listio.2 Tue Nov 28 16:52:38 2017 (r326321) +++ stable/11/lib/libc/sys/lio_listio.2 Tue Nov 28 17:04:22 2017 (r326322) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd Oct 23, 2017 .Dt LIO_LISTIO 2 .Os .Sh NAME @@ -161,7 +161,7 @@ function will fail if: There are not enough resources to enqueue the requests. .It Bq Er EAGAIN The request would cause the system-wide limit -.Dv AIO_MAX +.Dv {AIO_MAX} to be exceeded. .It Bq Er EINVAL The @@ -173,7 +173,7 @@ nor or .Fa nent is greater than -.Dv AIO_LISTIO_MAX . +.Dv {AIO_LISTIO_MAX} . .It Bq Er EINVAL The asynchronous notification method in .Fa sig->sigev_notify Modified: stable/11/sys/kern/posix4_mib.c ============================================================================== --- stable/11/sys/kern/posix4_mib.c Tue Nov 28 16:52:38 2017 (r326321) +++ stable/11/sys/kern/posix4_mib.c Tue Nov 28 17:04:22 2017 (r326322) @@ -91,7 +91,6 @@ P1B_SYSCTL(CTL_P1003_1B_FSYNC, fsync); P1B_SYSCTL(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, shared_memory_objects); P1B_SYSCTL(CTL_P1003_1B_SYNCHRONIZED_IO, synchronized_io); P1B_SYSCTL(CTL_P1003_1B_TIMERS, timers); -P1B_SYSCTL(CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max); P1B_SYSCTL(CTL_P1003_1B_AIO_MAX, aio_max); P1B_SYSCTL(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, aio_prio_delta_max); P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max); Modified: stable/11/sys/kern/vfs_aio.c ============================================================================== --- stable/11/sys/kern/vfs_aio.c Tue Nov 28 16:52:38 2017 (r326321) +++ stable/11/sys/kern/vfs_aio.c Tue Nov 28 17:04:22 2017 (r326322) @@ -90,11 +90,11 @@ static uint64_t jobseqno; #endif #ifndef MAX_AIO_QUEUE_PER_PROC -#define MAX_AIO_QUEUE_PER_PROC 256 /* Bigger than AIO_LISTIO_MAX */ +#define MAX_AIO_QUEUE_PER_PROC 256 #endif #ifndef MAX_AIO_QUEUE -#define MAX_AIO_QUEUE 1024 /* Bigger than AIO_LISTIO_MAX */ +#define MAX_AIO_QUEUE 1024 /* Bigger than MAX_AIO_QUEUE_PER_PROC */ #endif #ifndef MAX_BUF_AIO @@ -102,8 +102,10 @@ static uint64_t jobseqno; #endif FEATURE(aio, "Asynchronous I/O"); +SYSCTL_DECL(_p1003_1b); static MALLOC_DEFINE(M_LIO, "lio", "listio aio control block list"); +static MALLOC_DEFINE(M_AIOS, "aios", "aio_suspend aio control block list"); static SYSCTL_NODE(_vfs, OID_AUTO, aio, CTLFLAG_RW, 0, "Async IO management"); @@ -168,6 +170,15 @@ static int max_buf_aio = MAX_BUF_AIO; SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0, "Maximum buf aio requests per process (stored in the process)"); +/* + * Though redundant with vfs.aio.max_aio_queue_per_proc, POSIX requires + * sysconf(3) to support AIO_LISTIO_MAX, and we implement that with + * vfs.aio.aio_listio_max. + */ +SYSCTL_INT(_p1003_1b, CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max, + CTLFLAG_RD | CTLFLAG_CAPRD, &max_aio_queue_per_proc, + 0, "Maximum aio requests for a single lio_listio call"); + #ifdef COMPAT_FREEBSD6 typedef struct oaiocb { int aio_fildes; /* File descriptor */ @@ -328,10 +339,9 @@ static int filt_lio(struct knote *kn, long hint); * kaio Per process async io info * aiop async io process data * aiocb async io jobs - * aiol list io job pointer - internal to aio_suspend XXX * aiolio list io jobs */ -static uma_zone_t kaio_zone, aiop_zone, aiocb_zone, aiol_zone, aiolio_zone; +static uma_zone_t kaio_zone, aiop_zone, aiocb_zone, aiolio_zone; /* kqueue filters for aio */ static struct filterops aio_filtops = { @@ -405,14 +415,11 @@ aio_onceonly(void) NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); aiocb_zone = uma_zcreate("AIOCB", sizeof(struct kaiocb), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - aiol_zone = uma_zcreate("AIOL", AIO_LISTIO_MAX*sizeof(intptr_t) , NULL, - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); aiolio_zone = uma_zcreate("AIOLIO", sizeof(struct aioliojob), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); aiod_lifetime = AIOD_LIFETIME_DEFAULT; jobrefid = 1; p31b_setcfg(CTL_P1003_1B_ASYNCHRONOUS_IO, _POSIX_ASYNCHRONOUS_IO); - p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, AIO_LISTIO_MAX); p31b_setcfg(CTL_P1003_1B_AIO_MAX, MAX_AIO_QUEUE); p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, 0); @@ -1943,7 +1950,7 @@ sys_aio_suspend(struct thread *td, struct aio_suspend_ struct aiocb **ujoblist; int error; - if (uap->nent < 0 || uap->nent > AIO_LISTIO_MAX) + if (uap->nent < 0 || uap->nent > max_aio_queue_per_proc) return (EINVAL); if (uap->timeout) { @@ -1954,11 +1961,11 @@ sys_aio_suspend(struct thread *td, struct aio_suspend_ } else tsp = NULL; - ujoblist = uma_zalloc(aiol_zone, M_WAITOK); + ujoblist = malloc(uap->nent * sizeof(ujoblist[0]), M_AIOS, M_WAITOK); error = copyin(uap->aiocbp, ujoblist, uap->nent * sizeof(ujoblist[0])); if (error == 0) error = kern_aio_suspend(td, uap->nent, ujoblist, tsp); - uma_zfree(aiol_zone, ujoblist); + free(ujoblist, M_AIOS); return (error); } @@ -2151,7 +2158,7 @@ kern_lio_listio(struct thread *td, int mode, struct ai if ((mode != LIO_NOWAIT) && (mode != LIO_WAIT)) return (EINVAL); - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > max_aio_queue_per_proc) return (EINVAL); if (p->p_aioinfo == NULL) @@ -2283,7 +2290,7 @@ freebsd6_lio_listio(struct thread *td, struct freebsd6 return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > max_aio_queue_per_proc) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2320,7 +2327,7 @@ sys_lio_listio(struct thread *td, struct lio_listio_ar return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > max_aio_queue_per_proc) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2785,7 +2792,7 @@ freebsd32_aio_suspend(struct thread *td, struct freebs uint32_t *ujoblist32; int error, i; - if (uap->nent < 0 || uap->nent > AIO_LISTIO_MAX) + if (uap->nent < 0 || uap->nent > max_aio_queue_per_proc) return (EINVAL); if (uap->timeout) { @@ -2798,17 +2805,17 @@ freebsd32_aio_suspend(struct thread *td, struct freebs } else tsp = NULL; - ujoblist = uma_zalloc(aiol_zone, M_WAITOK); + ujoblist = malloc(uap->nent * sizeof(ujoblist[0]), M_AIOS, M_WAITOK); ujoblist32 = (uint32_t *)ujoblist; error = copyin(uap->aiocbp, ujoblist32, uap->nent * sizeof(ujoblist32[0])); if (error == 0) { - for (i = uap->nent; i > 0; i--) + for (i = uap->nent - 1; i >= 0; i--) ujoblist[i] = PTRIN(ujoblist32[i]); error = kern_aio_suspend(td, uap->nent, ujoblist, tsp); } - uma_zfree(aiol_zone, ujoblist); + free(ujoblist, M_AIOS); return (error); } @@ -2911,7 +2918,7 @@ freebsd6_freebsd32_lio_listio(struct thread *td, return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > max_aio_queue_per_proc) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2957,7 +2964,7 @@ freebsd32_lio_listio(struct thread *td, struct freebsd return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > max_aio_queue_per_proc) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { From owner-svn-src-stable@freebsd.org Tue Nov 28 17:07:22 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89CEADE7598; Tue, 28 Nov 2017 17:07:22 +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 6426F6EDDF; Tue, 28 Nov 2017 17:07:22 +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 vASH7LHe078765; Tue, 28 Nov 2017 17:07:21 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASH7Lxq078764; Tue, 28 Nov 2017 17:07:21 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281707.vASH7Lxq078764@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:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326323 - stable/11/sys/dev/mpr X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/sys/dev/mpr X-SVN-Commit-Revision: 326323 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 17:07:22 -0000 Author: asomers Date: Tue Nov 28 17:07:21 2017 New Revision: 326323 URL: https://svnweb.freebsd.org/changeset/base/326323 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/11/sys/dev/mpr/mpr_mapping.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mpr/mpr_mapping.c ============================================================================== --- stable/11/sys/dev/mpr/mpr_mapping.c Tue Nov 28 17:04:22 2017 (r326322) +++ stable/11/sys/dev/mpr/mpr_mapping.c Tue Nov 28 17:07:21 2017 (r326323) @@ -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@freebsd.org Tue Nov 28 17:20:55 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Nov 28 17:25:25 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Nov 28 17:27:01 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Nov 28 17:30:27 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Nov 28 17:33:12 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Nov 28 18:18:40 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Nov 28 18:27:26 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Nov 28 18:36:00 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Nov 28 18:45:00 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Nov 28 19:09:06 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 987D3DEBA7F; Tue, 28 Nov 2017 19:09:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 648EC73E09; Tue, 28 Nov 2017 19:09:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASJ95cI030151; Tue, 28 Nov 2017 19:09:05 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASJ952a030150; Tue, 28 Nov 2017 19:09:05 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201711281909.vASJ952a030150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 28 Nov 2017 19:09:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326337 - stable/11/usr.sbin/syslogd X-SVN-Group: stable-11 X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: stable/11/usr.sbin/syslogd X-SVN-Commit-Revision: 326337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 19:09:06 -0000 Author: glebius Date: Tue Nov 28 19:09:05 2017 New Revision: 326337 URL: https://svnweb.freebsd.org/changeset/base/326337 Log: Revert r326103, as it appeared to be incorrect. Modified: stable/11/usr.sbin/syslogd/syslogd.c Modified: stable/11/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/11/usr.sbin/syslogd/syslogd.c Tue Nov 28 18:44:58 2017 (r326336) +++ stable/11/usr.sbin/syslogd/syslogd.c Tue Nov 28 19:09:05 2017 (r326337) @@ -972,7 +972,7 @@ static void logmsg(int pri, const char *msg, const char *from, int flags) { struct filed *f; - int i, j, fac, msglen, omask, prilev; + int i, fac, msglen, omask, prilev; const char *timestamp; char prog[NAME_MAX+1]; char buf[MAXLINE+1]; @@ -1018,19 +1018,6 @@ logmsg(int pri, const char *msg, const char *from, int } prilev = LOG_PRI(pri); - - /* skip hostname, see RFC 3164 */ - for (i = 0, j = 0; i < NAME_MAX; i++) { - if (isspace(msg[i])) { - j = i + 1; - } - if (msg[i] == ':') - break; - } - if (j <= msglen) { - msg += j; - msglen -= j; - } /* extract program name */ for (i = 0; i < NAME_MAX; i++) { From owner-svn-src-stable@freebsd.org Tue Nov 28 19:46:49 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Nov 28 19:57:17 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Wed Nov 29 05:35:29 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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@freebsd.org Wed Nov 29 14:24:06 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3845E55309; Wed, 29 Nov 2017 14:24:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD4BF761EE; Wed, 29 Nov 2017 14:24:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vATEO4Df017236; Wed, 29 Nov 2017 14:24:04 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vATEO499017235; Wed, 29 Nov 2017 14:24:04 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201711291424.vATEO499017235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 29 Nov 2017 14:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326365 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 326365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Nov 2017 14:24:06 -0000 Author: markj Date: Wed Nov 29 14:24:04 2017 New Revision: 326365 URL: https://svnweb.freebsd.org/changeset/base/326365 Log: MFC r326093: Use the right variable for the IP header parameter to tcp:::send. Modified: stable/11/sys/netinet/tcp_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_subr.c ============================================================================== --- stable/11/sys/netinet/tcp_subr.c Wed Nov 29 12:49:22 2017 (r326364) +++ stable/11/sys/netinet/tcp_subr.c Wed Nov 29 14:24:04 2017 (r326365) @@ -1133,16 +1133,20 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcph if (flags & TH_RST) TCP_PROBE5(accept__refused, NULL, NULL, m, tp, nth); - TCP_PROBE5(send, NULL, tp, m, tp, nth); #ifdef INET6 - if (isipv6) - (void) ip6_output(m, NULL, NULL, 0, NULL, NULL, inp); + if (isipv6) { + TCP_PROBE5(send, NULL, tp, ip6, tp, nth); + (void)ip6_output(m, NULL, NULL, 0, NULL, NULL, inp); + } #endif /* INET6 */ #if defined(INET) && defined(INET6) else #endif #ifdef INET - (void) ip_output(m, NULL, NULL, 0, NULL, inp); + { + TCP_PROBE5(send, NULL, tp, ip, tp, nth); + (void)ip_output(m, NULL, NULL, 0, NULL, inp); + } #endif } From owner-svn-src-stable@freebsd.org Wed Nov 29 14:25:19 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F563E553C3; Wed, 29 Nov 2017 14:25:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 182A876364; Wed, 29 Nov 2017 14:25:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vATEPIDC017333; Wed, 29 Nov 2017 14:25:18 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vATEPIS2017332; Wed, 29 Nov 2017 14:25:18 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201711291425.vATEPIS2017332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 29 Nov 2017 14:25:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326366 - stable/11/cddl/usr.sbin/dtrace/tests/tools X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/cddl/usr.sbin/dtrace/tests/tools X-SVN-Commit-Revision: 326366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Nov 2017 14:25:19 -0000 Author: markj Date: Wed Nov 29 14:25:17 2017 New Revision: 326366 URL: https://svnweb.freebsd.org/changeset/base/326366 Log: MFC r326096: Annotate pragma/err.invalidlibdep.ksh as EXFAIL. Modified: stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh ============================================================================== --- stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Wed Nov 29 14:24:04 2017 (r326365) +++ stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Wed Nov 29 14:25:17 2017 (r326366) @@ -148,6 +148,11 @@ exclude EXFAIL common/pid/tst.provregex4.ksh exclude EXFAIL common/pid/tst.weak1.d exclude EXFAIL common/pid/tst.weak2.d +# This test appears to be invalid. dtrace is supposed to press on if a +# depends_on pragma cannot be satisfied, per the comment above +# dt_load_libs_dir() in libdtrace. +exclude EXFAIL common/pragma/err.invalidlibdep.ksh + # This test checks for a leading tab on a line before #define. That is illegal # on Solaris, but the clang pre-processor on FreeBSD is happy with code like # that. From owner-svn-src-stable@freebsd.org Wed Nov 29 14:45:29 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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@freebsd.org Wed Nov 29 14:45:29 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2E1DE55E4D; 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 825DF77153; 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 vATEjSkf025864; 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 vATEjShK025862; Wed, 29 Nov 2017 14:45:28 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201711291445.vATEjShK025862@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-11@freebsd.org Subject: svn commit: r326368 - in stable: 10/release/doc/share/xml 11/release/doc/share/xml X-SVN-Group: stable-11 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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/11/release/doc/share/xml/errata.xml stable/11/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/10/release/doc/share/xml/errata.xml stable/10/release/doc/share/xml/security.xml Modified: stable/11/release/doc/share/xml/errata.xml ============================================================================== --- stable/11/release/doc/share/xml/errata.xml Wed Nov 29 14:34:05 2017 (r326367) +++ stable/11/release/doc/share/xml/errata.xml Wed Nov 29 14:45:28 2017 (r326368) @@ -19,9 +19,27 @@ - No notices -   -   + FreeBSD-EN-17:07.vnet + 10 August 2017 + VNET kernel panic with asynchronous + I/O + + + + FreeBSD-EN-17:08.pf + 10 August 2017 + &man.pf.4; housekeeping thread causes kernel + panic + + + + FreeBSD-EN-17:10.tzdata + 2 November 2017 + Timezone database information + update Modified: stable/11/release/doc/share/xml/security.xml ============================================================================== --- stable/11/release/doc/share/xml/security.xml Wed Nov 29 14:34:05 2017 (r326367) +++ stable/11/release/doc/share/xml/security.xml Wed Nov 29 14:45:28 2017 (r326368) @@ -19,9 +19,39 @@ - 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:10.kldstat + 15 November 2017 + Information leak + + + + FreeBSD-SA-17:11.openssl + 29 November 2017 + Multiple vulnerabilities From owner-svn-src-stable@freebsd.org Wed Nov 29 20:38:22 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BACA7DBB453; Wed, 29 Nov 2017 20:38:22 +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 8440E63A1E; Wed, 29 Nov 2017 20:38:22 +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 vATKcLlp074521; Wed, 29 Nov 2017 20:38:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vATKcLi3074520; Wed, 29 Nov 2017 20:38:21 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201711292038.vATKcLi3074520@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:38:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326373 - stable/11/usr.sbin/freebsd-update X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/freebsd-update X-SVN-Commit-Revision: 326373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Nov 2017 20:38:22 -0000 Author: emaste Date: Wed Nov 29 20:38:21 2017 New Revision: 326373 URL: https://svnweb.freebsd.org/changeset/base/326373 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/11/usr.sbin/freebsd-update/freebsd-update.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- stable/11/usr.sbin/freebsd-update/freebsd-update.sh Wed Nov 29 20:15:29 2017 (r326372) +++ stable/11/usr.sbin/freebsd-update/freebsd-update.sh Wed Nov 29 20:38:21 2017 (r326373) @@ -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@freebsd.org Wed Nov 29 20:44:42 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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@freebsd.org Thu Nov 30 00:24:29 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50399DEE18C; Thu, 30 Nov 2017 00:24:29 +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 1C0696AC7A; Thu, 30 Nov 2017 00:24:29 +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 vAU0OSca071378; Thu, 30 Nov 2017 00:24:28 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAU0OSZ2071377; Thu, 30 Nov 2017 00:24:28 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201711300024.vAU0OSZ2071377@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:24:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326379 - stable/11/contrib/binutils/bfd X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/contrib/binutils/bfd X-SVN-Commit-Revision: 326379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 00:24:29 -0000 Author: emaste Date: Thu Nov 30 00:24:28 2017 New Revision: 326379 URL: https://svnweb.freebsd.org/changeset/base/326379 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/11/contrib/binutils/bfd/peXXigen.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/binutils/bfd/peXXigen.c ============================================================================== --- stable/11/contrib/binutils/bfd/peXXigen.c Wed Nov 29 23:52:31 2017 (r326378) +++ stable/11/contrib/binutils/bfd/peXXigen.c Thu Nov 30 00:24:28 2017 (r326379) @@ -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@freebsd.org Thu Nov 30 00:25:27 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Nov 30 00:26:46 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBB25DEE36E; Thu, 30 Nov 2017 00:26:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7BEE6AF2A; Thu, 30 Nov 2017 00:26:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAU0QjgX071598; Thu, 30 Nov 2017 00:26:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAU0QjEW071597; Thu, 30 Nov 2017 00:26:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201711300026.vAU0QjEW071597@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:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326381 - stable/11/contrib/binutils/bfd X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/contrib/binutils/bfd X-SVN-Commit-Revision: 326381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 00:26:47 -0000 Author: emaste Date: Thu Nov 30 00:26:45 2017 New Revision: 326381 URL: https://svnweb.freebsd.org/changeset/base/326381 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/11/contrib/binutils/bfd/ihex.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/binutils/bfd/ihex.c ============================================================================== --- stable/11/contrib/binutils/bfd/ihex.c Thu Nov 30 00:25:25 2017 (r326380) +++ stable/11/contrib/binutils/bfd/ihex.c Thu Nov 30 00:26:45 2017 (r326381) @@ -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@freebsd.org Thu Nov 30 00:27:50 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Nov 30 07:42:58 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 567D6DFBA94; Thu, 30 Nov 2017 07:42:58 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0971E79D28; Thu, 30 Nov 2017 07:42:57 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAU7gvpI067847; Thu, 30 Nov 2017 07:42:57 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAU7gujR067843; Thu, 30 Nov 2017 07:42:56 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201711300742.vAU7gujR067843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 30 Nov 2017 07:42:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326388 - stable/11/sys/netpfil/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netpfil/ipfw X-SVN-Commit-Revision: 326388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 07:42:58 -0000 Author: ae Date: Thu Nov 30 07:42:56 2017 New Revision: 326388 URL: https://svnweb.freebsd.org/changeset/base/326388 Log: MFC r326086: Add ipfw_add_protected_rule() function that creates rule with 65535 number in the reserved set 31. Use this function to create default rule. MFC r326115: Rework rule ranges matching. Use comparison rule id with UINT32_MAX to match all rules with the same rule number. MFC r326116: Move ipfw_send_pkt() from ip_fw_dynamic.c into ip_fw2.c. It is not specific for dynamic states function and called also from generic code. MFC r326117: Check that address family of state matches address family of packet. If it is not matched avoid comparing other state fields. MFC r326118: Modify ipfw's dynamic states KPI. Hide the locking logic used in the dynamic states implementation from generic code. Rename ipfw_install_state() and ipfw_lookup_dyn_rule() function to have similar names: ipfw_dyn_install_state() and ipfw_dyn_lookup_state(). Move dynamic rule counters updating to the ipfw_dyn_lookup_state() function. Now this function return NULL when there is no state and pointer to the parent rule when state is found. Thus now there is no need to return pointer to dynamic rule, and no need to hold bucket lock for this state. Remove ipfw_dyn_unlock() function. Differential Revision: https://reviews.freebsd.org/D11657 Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c stable/11/sys/netpfil/ipfw/ip_fw_private.h stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw2.c Thu Nov 30 07:24:33 2017 (r326387) +++ stable/11/sys/netpfil/ipfw/ip_fw2.c Thu Nov 30 07:42:56 2017 (r326388) @@ -468,7 +468,156 @@ verify_path(struct in_addr src, struct ifnet *ifp, u_i #endif /* __FreeBSD__ */ } +/* + * Generate a TCP packet, containing either a RST or a keepalive. + * When flags & TH_RST, we are sending a RST packet, because of a + * "reset" action matched the packet. + * Otherwise we are sending a keepalive, and flags & TH_ + * The 'replyto' mbuf is the mbuf being replied to, if any, and is required + * so that MAC can label the reply appropriately. + */ +struct mbuf * +ipfw_send_pkt(struct mbuf *replyto, struct ipfw_flow_id *id, u_int32_t seq, + u_int32_t ack, int flags) +{ + struct mbuf *m = NULL; /* stupid compiler */ + struct ip *h = NULL; /* stupid compiler */ #ifdef INET6 + struct ip6_hdr *h6 = NULL; +#endif + struct tcphdr *th = NULL; + int len, dir; + + MGETHDR(m, M_NOWAIT, MT_DATA); + if (m == NULL) + return (NULL); + + M_SETFIB(m, id->fib); +#ifdef MAC + if (replyto != NULL) + mac_netinet_firewall_reply(replyto, m); + else + mac_netinet_firewall_send(m); +#else + (void)replyto; /* don't warn about unused arg */ +#endif + + switch (id->addr_type) { + case 4: + len = sizeof(struct ip) + sizeof(struct tcphdr); + break; +#ifdef INET6 + case 6: + len = sizeof(struct ip6_hdr) + sizeof(struct tcphdr); + break; +#endif + default: + /* XXX: log me?!? */ + FREE_PKT(m); + return (NULL); + } + dir = ((flags & (TH_SYN | TH_RST)) == TH_SYN); + + m->m_data += max_linkhdr; + m->m_flags |= M_SKIP_FIREWALL; + m->m_pkthdr.len = m->m_len = len; + m->m_pkthdr.rcvif = NULL; + bzero(m->m_data, len); + + switch (id->addr_type) { + case 4: + h = mtod(m, struct ip *); + + /* prepare for checksum */ + h->ip_p = IPPROTO_TCP; + h->ip_len = htons(sizeof(struct tcphdr)); + if (dir) { + h->ip_src.s_addr = htonl(id->src_ip); + h->ip_dst.s_addr = htonl(id->dst_ip); + } else { + h->ip_src.s_addr = htonl(id->dst_ip); + h->ip_dst.s_addr = htonl(id->src_ip); + } + + th = (struct tcphdr *)(h + 1); + break; +#ifdef INET6 + case 6: + h6 = mtod(m, struct ip6_hdr *); + + /* prepare for checksum */ + h6->ip6_nxt = IPPROTO_TCP; + h6->ip6_plen = htons(sizeof(struct tcphdr)); + if (dir) { + h6->ip6_src = id->src_ip6; + h6->ip6_dst = id->dst_ip6; + } else { + h6->ip6_src = id->dst_ip6; + h6->ip6_dst = id->src_ip6; + } + + th = (struct tcphdr *)(h6 + 1); + break; +#endif + } + + if (dir) { + th->th_sport = htons(id->src_port); + th->th_dport = htons(id->dst_port); + } else { + th->th_sport = htons(id->dst_port); + th->th_dport = htons(id->src_port); + } + th->th_off = sizeof(struct tcphdr) >> 2; + + if (flags & TH_RST) { + if (flags & TH_ACK) { + th->th_seq = htonl(ack); + th->th_flags = TH_RST; + } else { + if (flags & TH_SYN) + seq++; + th->th_ack = htonl(seq); + th->th_flags = TH_RST | TH_ACK; + } + } else { + /* + * Keepalive - use caller provided sequence numbers + */ + th->th_seq = htonl(seq); + th->th_ack = htonl(ack); + th->th_flags = TH_ACK; + } + + switch (id->addr_type) { + case 4: + th->th_sum = in_cksum(m, len); + + /* finish the ip header */ + h->ip_v = 4; + h->ip_hl = sizeof(*h) >> 2; + h->ip_tos = IPTOS_LOWDELAY; + h->ip_off = htons(0); + h->ip_len = htons(len); + h->ip_ttl = V_ip_defttl; + h->ip_sum = 0; + break; +#ifdef INET6 + case 6: + th->th_sum = in6_cksum(m, IPPROTO_TCP, sizeof(*h6), + sizeof(struct tcphdr)); + + /* finish the ip6 header */ + h6->ip6_vfc |= IPV6_VERSION; + h6->ip6_hlim = IPV6_DEFHLIM; + break; +#endif + } + + return (m); +} + +#ifdef INET6 /* * ipv6 specific rules here... */ @@ -973,7 +1122,7 @@ ipfw_chk(struct ip_fw_args *args) */ int dyn_dir = MATCH_UNKNOWN; uint16_t dyn_name = 0; - ipfw_dyn_rule *q = NULL; + struct ip_fw *q = NULL; struct ip_fw_chain *chain = &V_layer3_chain; /* @@ -2158,7 +2307,7 @@ do { \ */ case O_LIMIT: case O_KEEP_STATE: - if (ipfw_install_state(chain, f, + if (ipfw_dyn_install_state(chain, f, (ipfw_insn_limit *)cmd, args, tablearg)) { /* error or limit violation */ retval = IP_FW_DENY; @@ -2198,28 +2347,25 @@ do { \ if ((dyn_dir == MATCH_UNKNOWN || (dyn_name != 0 && dyn_name != cmd->arg1)) && - (q = ipfw_lookup_dyn_rule(&args->f_id, - &dyn_dir, proto == IPPROTO_TCP ? - TCP(ulp): NULL, + (q = ipfw_dyn_lookup_state(&args->f_id, + ulp, pktlen, &dyn_dir, (dyn_name = cmd->arg1))) != NULL) { /* - * Found dynamic entry, update stats - * and jump to the 'action' part of - * the parent rule by setting - * f, cmd, l and clearing cmdlen. + * Found dynamic entry, jump to the + * 'action' part of the parent rule + * by setting f, cmd, l and clearing + * cmdlen. */ - IPFW_INC_DYN_COUNTER(q, pktlen); + f = q; /* XXX we would like to have f_pos * readily accessible in the dynamic * rule, instead of having to * lookup q->rule. */ - f = q->rule; f_pos = ipfw_find_rule(chain, - f->rulenum, f->id); + f->rulenum, f->id); cmd = ACTION_PTR(f); l = f->cmd_len - f->act_ofs; - ipfw_dyn_unlock(q); cmdlen = 0; match = 1; break; @@ -2431,8 +2577,7 @@ do { \ case O_FORWARD_IP: if (args->eh) /* not valid on layer2 pkts */ break; - if (q == NULL || q->rule != f || - dyn_dir == MATCH_FORWARD) { + if (q != f || dyn_dir == MATCH_FORWARD) { struct sockaddr_in *sa; sa = &(((ipfw_insn_sa *)cmd)->sa); @@ -2492,8 +2637,7 @@ do { \ case O_FORWARD_IP6: if (args->eh) /* not valid on layer2 pkts */ break; - if (q == NULL || q->rule != f || - dyn_dir == MATCH_FORWARD) { + if (q != f || dyn_dir == MATCH_FORWARD) { struct sockaddr_in6 *sin6; sin6 = &(((ipfw_insn_sa6 *)cmd)->sa); @@ -2842,11 +2986,6 @@ vnet_ipfw_init(const void *unused) ipfw_init_srv(chain); ipfw_init_counters(); - /* insert the default rule and create the initial map */ - chain->n_rules = 1; - chain->map = malloc(sizeof(struct ip_fw *), M_IPFW, M_WAITOK | M_ZERO); - rule = ipfw_alloc_rule(chain, sizeof(struct ip_fw)); - /* Set initial number of tables */ V_fw_tables_max = default_fw_tables; error = ipfw_init_tables(chain, first); @@ -2857,19 +2996,16 @@ vnet_ipfw_init(const void *unused) return (ENOSPC); } + IPFW_LOCK_INIT(chain); + /* fill and insert the default rule */ - rule->act_ofs = 0; - rule->rulenum = IPFW_DEFAULT_RULE; + rule = ipfw_alloc_rule(chain, sizeof(struct ip_fw)); rule->cmd_len = 1; - rule->set = RESVD_SET; rule->cmd[0].len = 1; rule->cmd[0].opcode = default_to_accept ? O_ACCEPT : O_DENY; - chain->default_rule = chain->map[0] = rule; - chain->id = rule->id = 1; - /* Pre-calculate rules length for legacy dump format */ - chain->static_len = sizeof(struct ip_fw_rule0); + chain->default_rule = rule; + ipfw_add_protected_rule(chain, rule, 0); - IPFW_LOCK_INIT(chain); ipfw_dyn_init(chain); ipfw_eaction_init(chain, first); #ifdef LINEAR_SKIPTO Modified: stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c Thu Nov 30 07:24:33 2017 (r326387) +++ stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c Thu Nov 30 07:42:56 2017 (r326388) @@ -251,7 +251,7 @@ SYSEND #ifdef INET6 static __inline int -hash_packet6(struct ipfw_flow_id *id) +hash_packet6(const struct ipfw_flow_id *id) { u_int32_t i; i = (id->dst_ip6.__u6_addr.__u6_addr32[2]) ^ @@ -268,7 +268,7 @@ hash_packet6(struct ipfw_flow_id *id) * and we want to find both in the same bucket. */ static __inline int -hash_packet(struct ipfw_flow_id *id, int buckets) +hash_packet(const struct ipfw_flow_id *id, int buckets) { u_int32_t i; @@ -476,8 +476,8 @@ static struct opcode_obj_rewrite dyn_opcodes[] = { * Print customizable flow id description via log(9) facility. */ static void -print_dyn_rule_flags(struct ipfw_flow_id *id, int dyn_type, int log_flags, - char *prefix, char *postfix) +print_dyn_rule_flags(const struct ipfw_flow_id *id, int dyn_type, + int log_flags, char *prefix, char *postfix) { struct in_addr da; #ifdef INET6 @@ -511,12 +511,14 @@ print_dyn_rule_flags(struct ipfw_flow_id *id, int dyn_ static void dyn_update_proto_state(ipfw_dyn_rule *q, const struct ipfw_flow_id *id, - const struct tcphdr *tcp, int dir) + const void *ulp, int dir) { + const struct tcphdr *tcp; uint32_t ack; u_char flags; if (id->proto == IPPROTO_TCP) { + tcp = (const struct tcphdr *)ulp; flags = id->_flags & (TH_FIN | TH_SYN | TH_RST); #define BOTH_SYN (TH_SYN | (TH_SYN << 8)) #define BOTH_FIN (TH_FIN | (TH_FIN << 8)) @@ -592,8 +594,8 @@ dyn_update_proto_state(ipfw_dyn_rule *q, const struct * Lookup a dynamic rule, locked version. */ static ipfw_dyn_rule * -lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int i, int *match_direction, - struct tcphdr *tcp, uint16_t kidx) +lookup_dyn_rule_locked(const struct ipfw_flow_id *pkt, const void *ulp, + int i, int *match_direction, uint16_t kidx) { /* * Stateful ipfw extensions. @@ -609,6 +611,9 @@ lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int i if (q->dyn_type == O_LIMIT_PARENT) continue; + if (pkt->addr_type != q->id.addr_type) + continue; + if (pkt->proto != q->id.proto) continue; @@ -657,41 +662,35 @@ lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int i } /* update state according to flags */ - dyn_update_proto_state(q, pkt, tcp, dir); + dyn_update_proto_state(q, pkt, ulp, dir); done: if (match_direction != NULL) *match_direction = dir; return (q); } -ipfw_dyn_rule * -ipfw_lookup_dyn_rule(struct ipfw_flow_id *pkt, int *match_direction, - struct tcphdr *tcp, uint16_t kidx) +struct ip_fw * +ipfw_dyn_lookup_state(const struct ipfw_flow_id *pkt, const void *ulp, + int pktlen, int *match_direction, uint16_t kidx) { + struct ip_fw *rule; ipfw_dyn_rule *q; int i; i = hash_packet(pkt, V_curr_dyn_buckets); IPFW_BUCK_LOCK(i); - q = lookup_dyn_rule_locked(pkt, i, match_direction, tcp, kidx); + q = lookup_dyn_rule_locked(pkt, ulp, i, match_direction, kidx); if (q == NULL) - IPFW_BUCK_UNLOCK(i); - /* NB: return table locked when q is not NULL */ - return q; + rule = NULL; + else { + rule = q->rule; + IPFW_INC_DYN_COUNTER(q, pktlen); + } + IPFW_BUCK_UNLOCK(i); + return (rule); } -/* - * Unlock bucket mtx - * @p - pointer to dynamic rule - */ -void -ipfw_dyn_unlock(ipfw_dyn_rule *q) -{ - - IPFW_BUCK_UNLOCK(q->bucket); -} - static int resize_dynamic_table(struct ip_fw_chain *chain, int nbuckets) { @@ -784,7 +783,7 @@ resize_dynamic_table(struct ip_fw_chain *chain, int nb * - "parent" rules for the above (O_LIMIT_PARENT). */ static ipfw_dyn_rule * -add_dyn_rule(struct ipfw_flow_id *id, int i, uint8_t dyn_type, +add_dyn_rule(const struct ipfw_flow_id *id, int i, uint8_t dyn_type, struct ip_fw *rule, uint16_t kidx) { ipfw_dyn_rule *r; @@ -834,8 +833,8 @@ add_dyn_rule(struct ipfw_flow_id *id, int i, uint8_t d * If the lookup fails, then install one. */ static ipfw_dyn_rule * -lookup_dyn_parent(struct ipfw_flow_id *pkt, int *pindex, struct ip_fw *rule, - uint16_t kidx) +lookup_dyn_parent(const struct ipfw_flow_id *pkt, int *pindex, + struct ip_fw *rule, uint16_t kidx) { ipfw_dyn_rule *q; int i, is_v6; @@ -879,7 +878,7 @@ lookup_dyn_parent(struct ipfw_flow_id *pkt, int *pinde * session limitations are enforced. */ int -ipfw_install_state(struct ip_fw_chain *chain, struct ip_fw *rule, +ipfw_dyn_install_state(struct ip_fw_chain *chain, struct ip_fw *rule, ipfw_insn_limit *cmd, struct ip_fw_args *args, uint32_t tablearg) { ipfw_dyn_rule *q; @@ -892,7 +891,7 @@ ipfw_install_state(struct ip_fw_chain *chain, struct i IPFW_BUCK_LOCK(i); - q = lookup_dyn_rule_locked(&args->f_id, i, NULL, NULL, cmd->o.arg1); + q = lookup_dyn_rule_locked(&args->f_id, NULL, i, NULL, cmd->o.arg1); if (q != NULL) { /* should never occur */ DEB( if (last_log != time_uptime) { @@ -1018,155 +1017,6 @@ ipfw_install_state(struct ip_fw_chain *chain, struct i dyn_update_proto_state(q, &args->f_id, NULL, MATCH_FORWARD); IPFW_BUCK_UNLOCK(i); return (0); -} - -/* - * Generate a TCP packet, containing either a RST or a keepalive. - * When flags & TH_RST, we are sending a RST packet, because of a - * "reset" action matched the packet. - * Otherwise we are sending a keepalive, and flags & TH_ - * The 'replyto' mbuf is the mbuf being replied to, if any, and is required - * so that MAC can label the reply appropriately. - */ -struct mbuf * -ipfw_send_pkt(struct mbuf *replyto, struct ipfw_flow_id *id, u_int32_t seq, - u_int32_t ack, int flags) -{ - struct mbuf *m = NULL; /* stupid compiler */ - int len, dir; - struct ip *h = NULL; /* stupid compiler */ -#ifdef INET6 - struct ip6_hdr *h6 = NULL; -#endif - struct tcphdr *th = NULL; - - MGETHDR(m, M_NOWAIT, MT_DATA); - if (m == NULL) - return (NULL); - - M_SETFIB(m, id->fib); -#ifdef MAC - if (replyto != NULL) - mac_netinet_firewall_reply(replyto, m); - else - mac_netinet_firewall_send(m); -#else - (void)replyto; /* don't warn about unused arg */ -#endif - - switch (id->addr_type) { - case 4: - len = sizeof(struct ip) + sizeof(struct tcphdr); - break; -#ifdef INET6 - case 6: - len = sizeof(struct ip6_hdr) + sizeof(struct tcphdr); - break; -#endif - default: - /* XXX: log me?!? */ - FREE_PKT(m); - return (NULL); - } - dir = ((flags & (TH_SYN | TH_RST)) == TH_SYN); - - m->m_data += max_linkhdr; - m->m_flags |= M_SKIP_FIREWALL; - m->m_pkthdr.len = m->m_len = len; - m->m_pkthdr.rcvif = NULL; - bzero(m->m_data, len); - - switch (id->addr_type) { - case 4: - h = mtod(m, struct ip *); - - /* prepare for checksum */ - h->ip_p = IPPROTO_TCP; - h->ip_len = htons(sizeof(struct tcphdr)); - if (dir) { - h->ip_src.s_addr = htonl(id->src_ip); - h->ip_dst.s_addr = htonl(id->dst_ip); - } else { - h->ip_src.s_addr = htonl(id->dst_ip); - h->ip_dst.s_addr = htonl(id->src_ip); - } - - th = (struct tcphdr *)(h + 1); - break; -#ifdef INET6 - case 6: - h6 = mtod(m, struct ip6_hdr *); - - /* prepare for checksum */ - h6->ip6_nxt = IPPROTO_TCP; - h6->ip6_plen = htons(sizeof(struct tcphdr)); - if (dir) { - h6->ip6_src = id->src_ip6; - h6->ip6_dst = id->dst_ip6; - } else { - h6->ip6_src = id->dst_ip6; - h6->ip6_dst = id->src_ip6; - } - - th = (struct tcphdr *)(h6 + 1); - break; -#endif - } - - if (dir) { - th->th_sport = htons(id->src_port); - th->th_dport = htons(id->dst_port); - } else { - th->th_sport = htons(id->dst_port); - th->th_dport = htons(id->src_port); - } - th->th_off = sizeof(struct tcphdr) >> 2; - - if (flags & TH_RST) { - if (flags & TH_ACK) { - th->th_seq = htonl(ack); - th->th_flags = TH_RST; - } else { - if (flags & TH_SYN) - seq++; - th->th_ack = htonl(seq); - th->th_flags = TH_RST | TH_ACK; - } - } else { - /* - * Keepalive - use caller provided sequence numbers - */ - th->th_seq = htonl(seq); - th->th_ack = htonl(ack); - th->th_flags = TH_ACK; - } - - switch (id->addr_type) { - case 4: - th->th_sum = in_cksum(m, len); - - /* finish the ip header */ - h->ip_v = 4; - h->ip_hl = sizeof(*h) >> 2; - h->ip_tos = IPTOS_LOWDELAY; - h->ip_off = htons(0); - h->ip_len = htons(len); - h->ip_ttl = V_ip_defttl; - h->ip_sum = 0; - break; -#ifdef INET6 - case 6: - th->th_sum = in6_cksum(m, IPPROTO_TCP, sizeof(*h6), - sizeof(struct tcphdr)); - - /* finish the ip6 header */ - h6->ip6_vfc |= IPV6_VERSION; - h6->ip6_hlim = IPV6_DEFHLIM; - break; -#endif - } - - return (m); } /* Modified: stable/11/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw_private.h Thu Nov 30 07:24:33 2017 (r326387) +++ stable/11/sys/netpfil/ipfw/ip_fw_private.h Thu Nov 30 07:42:56 2017 (r326388) @@ -183,15 +183,14 @@ struct ip_fw_chain; struct sockopt_data; int ipfw_is_dyn_rule(struct ip_fw *rule); void ipfw_expire_dyn_rules(struct ip_fw_chain *, ipfw_range_tlv *); -void ipfw_dyn_unlock(ipfw_dyn_rule *q); struct tcphdr; struct mbuf *ipfw_send_pkt(struct mbuf *, struct ipfw_flow_id *, u_int32_t, u_int32_t, int); -int ipfw_install_state(struct ip_fw_chain *chain, struct ip_fw *rule, +int ipfw_dyn_install_state(struct ip_fw_chain *chain, struct ip_fw *rule, ipfw_insn_limit *cmd, struct ip_fw_args *args, uint32_t tablearg); -ipfw_dyn_rule *ipfw_lookup_dyn_rule(struct ipfw_flow_id *pkt, - int *match_direction, struct tcphdr *tcp, uint16_t kidx); +struct ip_fw *ipfw_dyn_lookup_state(const struct ipfw_flow_id *pkt, + const void *ulp, int pktlen, int *match_direction, uint16_t kidx); void ipfw_remove_dyn_children(struct ip_fw *rule); void ipfw_get_dynamic(struct ip_fw_chain *chain, char **bp, const char *ep); int ipfw_dump_states(struct ip_fw_chain *chain, struct sockopt_data *sd); @@ -625,6 +624,8 @@ void ipfw_destroy_skipto_cache(struct ip_fw_chain *cha int ipfw_find_rule(struct ip_fw_chain *chain, uint32_t key, uint32_t id); int ipfw_ctl3(struct sockopt *sopt); int ipfw_chk(struct ip_fw_args *args); +int ipfw_add_protected_rule(struct ip_fw_chain *chain, struct ip_fw *rule, + int locked); void ipfw_reap_add(struct ip_fw_chain *chain, struct ip_fw **head, struct ip_fw *rule); void ipfw_reap_rules(struct ip_fw *head); Modified: stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c Thu Nov 30 07:24:33 2017 (r326387) +++ stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c Thu Nov 30 07:42:56 2017 (r326388) @@ -790,6 +790,30 @@ commit_rules(struct ip_fw_chain *chain, struct rule_ch return (0); } +int +ipfw_add_protected_rule(struct ip_fw_chain *chain, struct ip_fw *rule, + int locked) +{ + struct ip_fw **map; + + map = get_map(chain, 1, locked); + if (map == NULL) + return (ENOMEM); + if (chain->n_rules > 0) + bcopy(chain->map, map, + chain->n_rules * sizeof(struct ip_fw *)); + map[chain->n_rules] = rule; + rule->rulenum = IPFW_DEFAULT_RULE; + rule->set = RESVD_SET; + rule->id = chain->id + 1; + /* We add rule in the end of chain, no need to update skipto cache */ + map = swap_map(chain, map, chain->n_rules + 1); + chain->static_len += RULEUSIZE0(rule); + IPFW_UH_WUNLOCK(chain); + free(map, M_IPFW); + return (0); +} + /* * Adds @rule to the list of rules to reap */ @@ -997,10 +1021,9 @@ delete_range(struct ip_fw_chain *chain, ipfw_range_tlv if ((rt->flags & IPFW_RCFLAG_RANGE) != 0) { start = ipfw_find_rule(chain, rt->start_rule, 0); - end = ipfw_find_rule(chain, rt->end_rule, 0); - if (rt->end_rule != IPFW_DEFAULT_RULE) - while (chain->map[end]->rulenum == rt->end_rule) - end++; + if (rt->end_rule >= IPFW_DEFAULT_RULE) + rt->end_rule = IPFW_DEFAULT_RULE - 1; + end = ipfw_find_rule(chain, rt->end_rule, UINT32_MAX); } /* Allocate new map of the same size */ @@ -2377,9 +2400,9 @@ dump_config(struct ip_fw_chain *chain, ip_fw3_opheader if ((rnum = hdr->start_rule) > IPFW_DEFAULT_RULE) rnum = IPFW_DEFAULT_RULE; da.b = ipfw_find_rule(chain, rnum, 0); - rnum = hdr->end_rule; - rnum = (rnum < IPFW_DEFAULT_RULE) ? rnum+1 : IPFW_DEFAULT_RULE; - da.e = ipfw_find_rule(chain, rnum, 0) + 1; + rnum = (hdr->end_rule < IPFW_DEFAULT_RULE) ? + hdr->end_rule + 1: IPFW_DEFAULT_RULE; + da.e = ipfw_find_rule(chain, rnum, UINT32_MAX) + 1; } if (hdr->flags & IPFW_CFG_GET_STATIC) { From owner-svn-src-stable@freebsd.org Thu Nov 30 14:19:49 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33C6DE57744; Thu, 30 Nov 2017 14:19:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00B6D65A19; Thu, 30 Nov 2017 14:19:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAUEJlVg033703; Thu, 30 Nov 2017 14:19:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAUEJlaj033700; Thu, 30 Nov 2017 14:19:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711301419.vAUEJlaj033700@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:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326396 - in stable/11: lib/libc/sys sys/kern sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11: lib/libc/sys sys/kern sys/sys X-SVN-Commit-Revision: 326396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 14:19:49 -0000 Author: kib Date: Thu Nov 30 14:19:47 2017 New Revision: 326396 URL: https://svnweb.freebsd.org/changeset/base/326396 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/11/lib/libc/sys/procctl.2 stable/11/sys/kern/kern_procctl.c stable/11/sys/sys/procctl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/procctl.2 ============================================================================== --- stable/11/lib/libc/sys/procctl.2 Thu Nov 30 14:06:54 2017 (r326395) +++ stable/11/lib/libc/sys/procctl.2 Thu Nov 30 14:19:47 2017 (r326396) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 27, 2016 +.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/11/sys/kern/kern_procctl.c ============================================================================== --- stable/11/sys/kern/kern_procctl.c Thu Nov 30 14:06:54 2017 (r326395) +++ stable/11/sys/kern/kern_procctl.c Thu Nov 30 14:19:47 2017 (r326396) @@ -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/11/sys/sys/procctl.h ============================================================================== --- stable/11/sys/sys/procctl.h Thu Nov 30 14:06:54 2017 (r326395) +++ stable/11/sys/sys/procctl.h Thu Nov 30 14:19:47 2017 (r326396) @@ -83,6 +83,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@freebsd.org Thu Nov 30 14:38:08 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Nov 30 15:54:16 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A9D2E5F4D2; Thu, 30 Nov 2017 15:54:16 +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 AAFAE69D84; Thu, 30 Nov 2017 15:54: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 vAUFsEBu005387; Thu, 30 Nov 2017 15:54:14 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAUFsEkO005386; Thu, 30 Nov 2017 15:54:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201711301554.vAUFsEkO005386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 30 Nov 2017 15:54:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326404 - stable/11/release/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/arm X-SVN-Commit-Revision: 326404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 15:54:16 -0000 Author: gjb Date: Thu Nov 30 15:54:14 2017 New Revision: 326404 URL: https://svnweb.freebsd.org/changeset/base/326404 Log: Correct a mismerge of r325861, committed as r326017, to fix the RPI2 SoC image build. This is a direct commit to stable/11. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/arm/RPI2.conf Modified: stable/11/release/arm/RPI2.conf ============================================================================== --- stable/11/release/arm/RPI2.conf Thu Nov 30 15:48:35 2017 (r326403) +++ stable/11/release/arm/RPI2.conf Thu Nov 30 15:54:14 2017 (r326404) @@ -6,7 +6,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDED_TARGET="arm" EMBEDDEDBUILD=1 -EMBEDDEDPORTS="sysutils/u-boot-rpi2" +EMBEDDEDPORTS="sysutils/u-boot-rpi2 sysutils/rpi-firmware" FAT_SIZE="50m" FAT_TYPE="16" IMAGE_SIZE="1536M" @@ -18,8 +18,11 @@ WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x2000000" arm_install_uboot() { UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi2" - UBOOT_FILES="bootcode.bin config.txt fixup.dat fixup_cd.dat \ - fixup_x.dat start.elf start_cd.elf start_x.elf u-boot.bin" + RPI_FIRMWARE_DIR="/usr/local/share/rpi-firmware" + UBOOT_FILES="u-boot.bin" + RPI_FIRMWARE_FILES="bootcode.bin config.txt \ + fixup.dat fixup_cd.dat fixup_db.dat fixup_x.dat \ + start.elf start_cd.elf start_db.elf start_x.elf" FATMOUNT="${DESTDIR%${KERNEL}}/fat" UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" @@ -27,6 +30,10 @@ arm_install_uboot() { chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} for _UF in ${UBOOT_FILES}; do chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/${_UF} \ + ${FATMOUNT}/${_UF} + done + for _UF in ${RPI_FIRMWARE_FILES}; do + chroot ${CHROOTDIR} cp -p ${RPI_FIRMWARE_DIR}/${_UF} \ ${FATMOUNT}/${_UF} done chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ From owner-svn-src-stable@freebsd.org Thu Nov 30 21:21:24 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 270A6DBB1A9; Thu, 30 Nov 2017 21:21:24 +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 E79E776906; Thu, 30 Nov 2017 21:21:23 +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 vAULLNcd043470; Thu, 30 Nov 2017 21:21:23 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAULLN49043469; Thu, 30 Nov 2017 21:21:23 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201711302121.vAULLN49043469@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:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326413 - stable/11/sbin/pfctl X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/11/sbin/pfctl X-SVN-Commit-Revision: 326413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 21:21:24 -0000 Author: kp Date: Thu Nov 30 21:21:22 2017 New Revision: 326413 URL: https://svnweb.freebsd.org/changeset/base/326413 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/11/sbin/pfctl/parse.y Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/pfctl/parse.y ============================================================================== --- stable/11/sbin/pfctl/parse.y Thu Nov 30 20:53:57 2017 (r326412) +++ stable/11/sbin/pfctl/parse.y Thu Nov 30 21:21:22 2017 (r326413) @@ -4386,8 +4386,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@freebsd.org Thu Nov 30 21:32:29 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Nov 30 21:38:10 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E23CBDBB95F; Thu, 30 Nov 2017 21:38:10 +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 AF39D77513; Thu, 30 Nov 2017 21:38:10 +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 vAULc9XX049194; Thu, 30 Nov 2017 21:38:09 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAULc9vC049193; Thu, 30 Nov 2017 21:38:09 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201711302138.vAULc9vC049193@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:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326415 - stable/11/etc/rc.d X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/11/etc/rc.d X-SVN-Commit-Revision: 326415 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 21:38:11 -0000 Author: kp Date: Thu Nov 30 21:38:09 2017 New Revision: 326415 URL: https://svnweb.freebsd.org/changeset/base/326415 Log: MFC r320696: Allow ipsec to run in vnet jails ipsec is usable in vnet jails, so allow it to run there. PR: 211364 Submitted by: Matthias Meyser Modified: stable/11/etc/rc.d/ipsec Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.d/ipsec ============================================================================== --- stable/11/etc/rc.d/ipsec Thu Nov 30 21:32:28 2017 (r326414) +++ stable/11/etc/rc.d/ipsec Thu Nov 30 21:38:09 2017 (r326415) @@ -6,7 +6,7 @@ # PROVIDE: ipsec # REQUIRE: FILESYSTEMS # BEFORE: DAEMON mountcritremote -# KEYWORD: nojail +# KEYWORD: nojailvnet . /etc/rc.subr From owner-svn-src-stable@freebsd.org Fri Dec 1 11:06:52 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87249DFC0E2; Fri, 1 Dec 2017 11:06:52 +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 6163B7B9CF; Fri, 1 Dec 2017 11:06:52 +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 vB1B6pdi090235; Fri, 1 Dec 2017 11:06:51 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB1B6pGu090234; Fri, 1 Dec 2017 11:06:51 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201712011106.vB1B6pGu090234@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:06:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326425 - stable/11/sys/cddl/compat/opensolaris/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/cddl/compat/opensolaris/kern X-SVN-Commit-Revision: 326425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Dec 2017 11:06:52 -0000 Author: avg Date: Fri Dec 1 11:06:51 2017 New Revision: 326425 URL: https://svnweb.freebsd.org/changeset/base/326425 Log: MFC r326067: make illumos uiocopy use vn_io_fault_uiomove Modified: stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c ============================================================================== --- stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c Fri Dec 1 10:53:08 2017 (r326424) +++ stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c Fri Dec 1 11:06:51 2017 (r326425) @@ -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@freebsd.org Fri Dec 1 11:11:26 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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@freebsd.org Fri Dec 1 11:14:00 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02D94DFC5E7; Fri, 1 Dec 2017 11:14:00 +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 CE51E7C41D; Fri, 1 Dec 2017 11:13:59 +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 vB1BDwBR094817; Fri, 1 Dec 2017 11:13:58 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB1BDwTw094816; Fri, 1 Dec 2017 11:13:58 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201712011113.vB1BDwTw094816@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:13:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326427 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 326427 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Dec 2017 11:14:00 -0000 Author: avg Date: Fri Dec 1 11:13:58 2017 New Revision: 326427 URL: https://svnweb.freebsd.org/changeset/base/326427 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/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 1 11:11:25 2017 (r326426) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 1 11:13:58 2017 (r326427) @@ -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, From owner-svn-src-stable@freebsd.org Fri Dec 1 11:14:16 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Dec 2017 11:14:16 -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, From owner-svn-src-stable@freebsd.org Fri Dec 1 17:15:15 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05534E656FC; Fri, 1 Dec 2017 17:15:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2D0868FCE; Fri, 1 Dec 2017 17:15:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB1HFD2X061518; Fri, 1 Dec 2017 17:15:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB1HFDSf061517; Fri, 1 Dec 2017 17:15:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201712011715.vB1HFDSf061517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 1 Dec 2017 17:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326431 - stable/11/sys/boot/common X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/boot/common X-SVN-Commit-Revision: 326431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Dec 2017 17:15:15 -0000 Author: emaste Date: Fri Dec 1 17:15:13 2017 New Revision: 326431 URL: https://svnweb.freebsd.org/changeset/base/326431 Log: MFC r324703: loader.mk: clean md.o even if MD_IMAGE_SIZE not defined We don't normally provide special handling for optionally-included src files, but md.o depends on both md.c and the value of ${MD_IMAGE_SIZE}. Previously if one built with MD_IMAGE_SIZE, executed "make clean", and then built with a different MD_IMAGE_SIZE md.o would not be rebuilt. Reported by: Zakary Nafziger Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/boot/common/Makefile.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/common/Makefile.inc ============================================================================== --- stable/11/sys/boot/common/Makefile.inc Fri Dec 1 11:32:05 2017 (r326430) +++ stable/11/sys/boot/common/Makefile.inc Fri Dec 1 17:15:13 2017 (r326431) @@ -50,6 +50,8 @@ SRCS+= bcache.c .if defined(MD_IMAGE_SIZE) CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE} SRCS+= md.c +.else +CLEANFILES+= md.o .endif # Machine-independant ISA PnP From owner-svn-src-stable@freebsd.org Sat Dec 2 18:00:03 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03D2BE659BD; Sat, 2 Dec 2017 18:00:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4DDE780DD; Sat, 2 Dec 2017 18:00:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB2I016J081003; Sat, 2 Dec 2017 18:00:01 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB2I01Am081002; Sat, 2 Dec 2017 18:00:01 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712021800.vB2I01Am081002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 2 Dec 2017 18:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326476 - stable/11/etc/mtree X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: stable/11/etc/mtree X-SVN-Commit-Revision: 326476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Dec 2017 18:00:03 -0000 Author: dim Date: Sat Dec 2 18:00:01 2017 New Revision: 326476 URL: https://svnweb.freebsd.org/changeset/base/326476 Log: MFC r312450 (by emaste): Remove obsolete /usr/lib/debug/usr/lib/private dir Missed in r282420 Reported by: dim Modified: stable/11/etc/mtree/BSD.debug.dist Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.debug.dist ============================================================================== --- stable/11/etc/mtree/BSD.debug.dist Sat Dec 2 17:39:04 2017 (r326475) +++ stable/11/etc/mtree/BSD.debug.dist Sat Dec 2 18:00:01 2017 (r326476) @@ -40,8 +40,6 @@ .. i18n .. - private - .. .. libexec bsdinstall From owner-svn-src-stable@freebsd.org Sat Dec 2 18:41:02 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B264DE66C03; Sat, 2 Dec 2017 18:41:02 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 78FAD7955F; Sat, 2 Dec 2017 18:41:02 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB2If1Jl098309; Sat, 2 Dec 2017 18:41:01 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB2If1H7098308; Sat, 2 Dec 2017 18:41:01 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201712021841.vB2If1H7098308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Sat, 2 Dec 2017 18:41:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r326477 - stable/11/sbin/geom/class/part X-SVN-Group: stable-11 X-SVN-Commit-Author: marcel X-SVN-Commit-Paths: stable/11/sbin/geom/class/part X-SVN-Commit-Revision: 326477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Dec 2017 18:41:02 -0000 Author: marcel Date: Sat Dec 2 18:41:01 2017 New Revision: 326477 URL: https://svnweb.freebsd.org/changeset/base/326477 Log: MFC r324369 Fix alignment of 'last' in autofill. Modified: stable/11/sbin/geom/class/part/geom_part.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/11/sbin/geom/class/part/geom_part.c Sat Dec 2 18:00:01 2017 (r326476) +++ stable/11/sbin/geom/class/part/geom_part.c Sat Dec 2 18:41:01 2017 (r326477) @@ -534,7 +534,7 @@ gpart_autofill(struct gctl_req *req) last = (off_t)strtoimax(s, NULL, 0); grade = ~0ULL; a_first = ALIGNUP(first + offset, alignment); - last = ALIGNDOWN(last + offset, alignment); + last = ALIGNDOWN(last + offset + 1, alignment) - 1; if (a_first < start) a_first = start; while ((pp = find_provider(gp, first)) != NULL) {