From owner-svn-src-stable@freebsd.org Sun Mar 18 02:59:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD3F1F59492; Sun, 18 Mar 2018 02:59:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D89D7A3B0; Sun, 18 Mar 2018 02:59:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 774591ADA5; Sun, 18 Mar 2018 02:59:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2I2xEwf049035; Sun, 18 Mar 2018 02:59:14 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2I2xEvV049034; Sun, 18 Mar 2018 02:59:14 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803180259.w2I2xEvV049034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 02:59: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: r331114 - stable/11/sys/dev/efidev X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/efidev X-SVN-Commit-Revision: 331114 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: Sun, 18 Mar 2018 02:59:15 -0000 Author: eadler Date: Sun Mar 18 02:59:14 2018 New Revision: 331114 URL: https://svnweb.freebsd.org/changeset/base/331114 Log: MFC r330843: efirtc: Pass a dummy tmcap pointer to efi_get_time_locked As noted in the comment, UEFI spec claims the capabilities pointer is optional, but some implementations will choke and attempt to dereference it without checking. This specific problem was found on a Lenovo Thinkpad X220 that would panic in efirtc_identify. Requested by: kevans Modified: stable/11/sys/dev/efidev/efirt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/efidev/efirt.c ============================================================================== --- stable/11/sys/dev/efidev/efirt.c Sat Mar 17 21:58:41 2018 (r331113) +++ stable/11/sys/dev/efidev/efirt.c Sun Mar 18 02:59:14 2018 (r331114) @@ -260,12 +260,19 @@ efi_get_time_locked(struct efi_tm *tm, struct efi_tmca int efi_get_time(struct efi_tm *tm) { + struct efi_tmcap dummy; int error; if (efi_runtime == NULL) return (ENXIO); EFI_TIME_LOCK() - error = efi_get_time_locked(tm, NULL); + /* + * UEFI spec states that the Capabilities argument to GetTime is + * optional, but some UEFI implementations choke when passed a NULL + * pointer. Pass a dummy efi_dmcap, even though we won't use it, + * to workaround such implementations. + */ + error = efi_get_time_locked(tm, &dummy); EFI_TIME_UNLOCK() return (error); } From owner-svn-src-stable@freebsd.org Sun Mar 18 11:26:08 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AD03F4A5F8; Sun, 18 Mar 2018 11:26:08 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF11F6BB59; Sun, 18 Mar 2018 11:26:07 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA0841FE5A; Sun, 18 Mar 2018 11:26:07 +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 w2IBQ7wb006069; Sun, 18 Mar 2018 11:26:07 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IBQ70S006067; Sun, 18 Mar 2018 11:26:07 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803181126.w2IBQ70S006067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 18 Mar 2018 11:26: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: r331117 - in stable/10/sys: net netpfil/pf X-SVN-Group: stable-10 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in stable/10/sys: net netpfil/pf X-SVN-Commit-Revision: 331117 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: Sun, 18 Mar 2018 11:26:08 -0000 Author: kp Date: Sun Mar 18 11:26:07 2018 New Revision: 331117 URL: https://svnweb.freebsd.org/changeset/base/331117 Log: MFC r329950: pf: Cope with overly large net.pf.states_hashsize If the user configures a states_hashsize or source_nodes_hashsize value we may not have enough memory to allocate this. This used to lock up pf, because these allocations used M_WAITOK. Cope with this by attempting the allocation with M_NOWAIT and falling back to the default sizes (with M_WAITOK) if these fail. PR: 209475 Submitted by: Fehmi Noyan Isi Modified: stable/10/sys/net/pfvar.h stable/10/sys/netpfil/pf/pf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/pfvar.h ============================================================================== --- stable/10/sys/net/pfvar.h Sun Mar 18 11:25:39 2018 (r331116) +++ stable/10/sys/net/pfvar.h Sun Mar 18 11:26:07 2018 (r331117) @@ -1458,6 +1458,7 @@ struct pf_idhash { extern u_long pf_hashmask; extern u_long pf_srchashmask; #define PF_HASHSIZ (32768) +#define PF_SRCHASHSIZ (PF_HASHSIZ/4) VNET_DECLARE(struct pf_keyhash *, pf_keyhash); VNET_DECLARE(struct pf_idhash *, pf_idhash); #define V_pf_keyhash VNET(pf_keyhash) Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Sun Mar 18 11:25:39 2018 (r331116) +++ stable/10/sys/netpfil/pf/pf.c Sun Mar 18 11:26:07 2018 (r331117) @@ -781,7 +781,7 @@ pf_initialize() pf_hashsize = PF_HASHSIZ; TUNABLE_ULONG_FETCH("net.pf.source_nodes_hashsize", &pf_srchashsize); if (pf_srchashsize == 0 || !powerof2(pf_srchashsize)) - pf_srchashsize = PF_HASHSIZ / 4; + pf_srchashsize = PF_SRCHASHSIZ; V_pf_hashseed = arc4random(); @@ -795,10 +795,25 @@ pf_initialize() V_pf_state_key_z = uma_zcreate("pf state keys", sizeof(struct pf_state_key), pf_state_key_ctor, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - V_pf_keyhash = malloc(pf_hashsize * sizeof(struct pf_keyhash), - M_PFHASH, M_WAITOK | M_ZERO); - V_pf_idhash = malloc(pf_hashsize * sizeof(struct pf_idhash), - M_PFHASH, M_WAITOK | M_ZERO); + + V_pf_keyhash = mallocarray(pf_hashsize, sizeof(struct pf_keyhash), + M_PFHASH, M_NOWAIT | M_ZERO); + V_pf_idhash = mallocarray(pf_hashsize, sizeof(struct pf_idhash), + M_PFHASH, M_NOWAIT | M_ZERO); + if (V_pf_keyhash == NULL || V_pf_idhash == NULL) { + printf("pf: Unable to allocate memory for " + "state_hashsize %lu.\n", pf_hashsize); + + free(V_pf_keyhash, M_PFHASH); + free(V_pf_idhash, M_PFHASH); + + pf_hashsize = PF_HASHSIZ; + V_pf_keyhash = mallocarray(pf_hashsize, + sizeof(struct pf_keyhash), M_PFHASH, M_WAITOK | M_ZERO); + V_pf_idhash = mallocarray(pf_hashsize, + sizeof(struct pf_idhash), M_PFHASH, M_WAITOK | M_ZERO); + } + pf_hashmask = pf_hashsize - 1; for (i = 0, kh = V_pf_keyhash, ih = V_pf_idhash; i <= pf_hashmask; i++, kh++, ih++) { @@ -813,8 +828,18 @@ pf_initialize() V_pf_limits[PF_LIMIT_SRC_NODES].zone = V_pf_sources_z; uma_zone_set_max(V_pf_sources_z, PFSNODE_HIWAT); uma_zone_set_warning(V_pf_sources_z, "PF source nodes limit reached"); - V_pf_srchash = malloc(pf_srchashsize * sizeof(struct pf_srchash), - M_PFHASH, M_WAITOK|M_ZERO); + + V_pf_srchash = mallocarray(pf_srchashsize, + sizeof(struct pf_srchash), M_PFHASH, M_NOWAIT | M_ZERO); + if (V_pf_srchash == NULL) { + printf("pf: Unable to allocate memory for " + "source_hashsize %lu.\n", pf_srchashsize); + + pf_srchashsize = PF_SRCHASHSIZ; + V_pf_srchash = mallocarray(pf_srchashsize, + sizeof(struct pf_srchash), M_PFHASH, M_WAITOK | M_ZERO); + } + pf_srchashmask = pf_srchashsize - 1; for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask; i++, sh++) mtx_init(&sh->lock, "pf_srchash", NULL, MTX_DEF); From owner-svn-src-stable@freebsd.org Sun Mar 18 11:25:40 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E998F4A5D6; Sun, 18 Mar 2018 11:25:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 415A26BA65; Sun, 18 Mar 2018 11:25:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C2241FE58; Sun, 18 Mar 2018 11:25:40 +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 w2IBPeRO005991; Sun, 18 Mar 2018 11:25:40 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IBPed4005989; Sun, 18 Mar 2018 11:25:40 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803181125.w2IBPed4005989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 18 Mar 2018 11:25:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331116 - in stable/11/sys: net netpfil/pf X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in stable/11/sys: net netpfil/pf X-SVN-Commit-Revision: 331116 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: Sun, 18 Mar 2018 11:25:40 -0000 Author: kp Date: Sun Mar 18 11:25:39 2018 New Revision: 331116 URL: https://svnweb.freebsd.org/changeset/base/331116 Log: MFC r329950: pf: Cope with overly large net.pf.states_hashsize If the user configures a states_hashsize or source_nodes_hashsize value we may not have enough memory to allocate this. This used to lock up pf, because these allocations used M_WAITOK. Cope with this by attempting the allocation with M_NOWAIT and falling back to the default sizes (with M_WAITOK) if these fail. PR: 209475 Submitted by: Fehmi Noyan Isi Modified: stable/11/sys/net/pfvar.h stable/11/sys/netpfil/pf/pf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/pfvar.h ============================================================================== --- stable/11/sys/net/pfvar.h Sun Mar 18 03:42:57 2018 (r331115) +++ stable/11/sys/net/pfvar.h Sun Mar 18 11:25:39 2018 (r331116) @@ -1463,6 +1463,7 @@ struct pf_idhash { extern u_long pf_hashmask; extern u_long pf_srchashmask; #define PF_HASHSIZ (32768) +#define PF_SRCHASHSIZ (PF_HASHSIZ/4) VNET_DECLARE(struct pf_keyhash *, pf_keyhash); VNET_DECLARE(struct pf_idhash *, pf_idhash); #define V_pf_keyhash VNET(pf_keyhash) Modified: stable/11/sys/netpfil/pf/pf.c ============================================================================== --- stable/11/sys/netpfil/pf/pf.c Sun Mar 18 03:42:57 2018 (r331115) +++ stable/11/sys/netpfil/pf/pf.c Sun Mar 18 11:25:39 2018 (r331116) @@ -784,7 +784,7 @@ pf_initialize() if (pf_hashsize == 0 || !powerof2(pf_hashsize)) pf_hashsize = PF_HASHSIZ; if (pf_srchashsize == 0 || !powerof2(pf_srchashsize)) - pf_srchashsize = PF_HASHSIZ / 4; + pf_srchashsize = PF_SRCHASHSIZ; V_pf_hashseed = arc4random(); @@ -798,10 +798,25 @@ pf_initialize() V_pf_state_key_z = uma_zcreate("pf state keys", sizeof(struct pf_state_key), pf_state_key_ctor, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - V_pf_keyhash = malloc(pf_hashsize * sizeof(struct pf_keyhash), - M_PFHASH, M_WAITOK | M_ZERO); - V_pf_idhash = malloc(pf_hashsize * sizeof(struct pf_idhash), - M_PFHASH, M_WAITOK | M_ZERO); + + V_pf_keyhash = mallocarray(pf_hashsize, sizeof(struct pf_keyhash), + M_PFHASH, M_NOWAIT | M_ZERO); + V_pf_idhash = mallocarray(pf_hashsize, sizeof(struct pf_idhash), + M_PFHASH, M_NOWAIT | M_ZERO); + if (V_pf_keyhash == NULL || V_pf_idhash == NULL) { + printf("pf: Unable to allocate memory for " + "state_hashsize %lu.\n", pf_hashsize); + + free(V_pf_keyhash, M_PFHASH); + free(V_pf_idhash, M_PFHASH); + + pf_hashsize = PF_HASHSIZ; + V_pf_keyhash = mallocarray(pf_hashsize, + sizeof(struct pf_keyhash), M_PFHASH, M_WAITOK | M_ZERO); + V_pf_idhash = mallocarray(pf_hashsize, + sizeof(struct pf_idhash), M_PFHASH, M_WAITOK | M_ZERO); + } + pf_hashmask = pf_hashsize - 1; for (i = 0, kh = V_pf_keyhash, ih = V_pf_idhash; i <= pf_hashmask; i++, kh++, ih++) { @@ -816,8 +831,18 @@ pf_initialize() V_pf_limits[PF_LIMIT_SRC_NODES].zone = V_pf_sources_z; uma_zone_set_max(V_pf_sources_z, PFSNODE_HIWAT); uma_zone_set_warning(V_pf_sources_z, "PF source nodes limit reached"); - V_pf_srchash = malloc(pf_srchashsize * sizeof(struct pf_srchash), - M_PFHASH, M_WAITOK|M_ZERO); + + V_pf_srchash = mallocarray(pf_srchashsize, + sizeof(struct pf_srchash), M_PFHASH, M_NOWAIT | M_ZERO); + if (V_pf_srchash == NULL) { + printf("pf: Unable to allocate memory for " + "source_hashsize %lu.\n", pf_srchashsize); + + pf_srchashsize = PF_SRCHASHSIZ; + V_pf_srchash = mallocarray(pf_srchashsize, + sizeof(struct pf_srchash), M_PFHASH, M_WAITOK | M_ZERO); + } + pf_srchashmask = pf_srchashsize - 1; for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask; i++, sh++) mtx_init(&sh->lock, "pf_srchash", NULL, MTX_DEF); From owner-svn-src-stable@freebsd.org Sun Mar 18 16:57:40 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C587BF6322D; Sun, 18 Mar 2018 16:57:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 76F047B10F; Sun, 18 Mar 2018 16:57:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71ADC231FA; Sun, 18 Mar 2018 16:57:40 +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 w2IGve67076909; Sun, 18 Mar 2018 16:57:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IGveqY076908; Sun, 18 Mar 2018 16:57:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201803181657.w2IGveqY076908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 18 Mar 2018 16:57:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331133 - stable/11/lib/libc/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/lib/libc/sys X-SVN-Commit-Revision: 331133 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: Sun, 18 Mar 2018 16:57:41 -0000 Author: markj Date: Sun Mar 18 16:57:40 2018 New Revision: 331133 URL: https://svnweb.freebsd.org/changeset/base/331133 Log: MFC r331016: Add a space between a section number and a following comma. Modified: stable/11/lib/libc/sys/sendfile.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/sendfile.2 ============================================================================== --- stable/11/lib/libc/sys/sendfile.2 Sun Mar 18 16:52:31 2018 (r331132) +++ stable/11/lib/libc/sys/sendfile.2 Sun Mar 18 16:57:40 2018 (r331133) @@ -129,8 +129,8 @@ Starting with .Nm sending files off the .Xr ffs 7 -filesystem doesn't block on I/O -(see +filesystem does not block on I/O +(see .Sx IMPLEMENTATION NOTES ), so the condition no longer applies. However, it is safe if an application utilizes @@ -140,8 +140,8 @@ and on performs the same action as it did in older .Fx -versions, e.g. -.Xr aio_read 2, +versions, e.g., +.Xr aio_read 2 , .Xr read 2 or .Nm @@ -188,7 +188,7 @@ The .Fx implementation of .Fn sendfile -doesn't block on disk I/O when it sends a file off the +does not block on disk I/O when it sends a file off the .Xr ffs 7 filesystem. The syscall returns success before the actual I/O completes, and data From owner-svn-src-stable@freebsd.org Sun Mar 18 19:05:07 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D0DCF4ADC9; Sun, 18 Mar 2018 19:05:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B70C2817D4; Sun, 18 Mar 2018 19:05:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1FF7246BF; Sun, 18 Mar 2018 19:05:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IJ56UR042686; Sun, 18 Mar 2018 19:05:06 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IJ567l042685; Sun, 18 Mar 2018 19:05:06 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803181905.w2IJ567l042685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 18 Mar 2018 19:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331142 - stable/11/stand X-SVN-Group: stable-11 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: stable/11/stand X-SVN-Commit-Revision: 331142 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: Sun, 18 Mar 2018 19:05:07 -0000 Author: imp Date: Sun Mar 18 19:05:06 2018 New Revision: 331142 URL: https://svnweb.freebsd.org/changeset/base/331142 Log: Direct commit to stable Remove libstand32 here. pc98 is a 32-bit platform, so it shouldn't compile the extra 32-bit copy of libsa. The copy built in libstand is already 32-bit. Add a comment saying we need an empty Makefile.pc98 since otherwise it would pull in Makefile.i386 and there is no EFI on pc98, and the machines are too old to have ZFS or GELI be a viable option (and besides, those don't compile). Note: We also need r331140 to be MFC'd for pc98 build to work in all cases. Modified: stable/11/stand/Makefile.pc98 Modified: stable/11/stand/Makefile.pc98 ============================================================================== --- stable/11/stand/Makefile.pc98 Sun Mar 18 18:58:47 2018 (r331141) +++ stable/11/stand/Makefile.pc98 Sun Mar 18 19:05:06 2018 (r331142) @@ -1,3 +1,4 @@ # $FreeBSD$ -SUBDIR+= libstand32 +# Need an empty file here so Makefile.i386 isn't used (which contains options +# that don't work on pc98). From owner-svn-src-stable@freebsd.org Sun Mar 18 19:07:08 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04EE6F4B14C; Sun, 18 Mar 2018 19:07:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D78481A3A; Sun, 18 Mar 2018 19:07:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 881C9246D5; Sun, 18 Mar 2018 19:07:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IJ77N7042809; Sun, 18 Mar 2018 19:07:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IJ77ZI042808; Sun, 18 Mar 2018 19:07:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201803181907.w2IJ77ZI042808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 18 Mar 2018 19:07:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331143 - stable/11/stand X-SVN-Group: stable-11 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: stable/11/stand X-SVN-Commit-Revision: 331143 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: Sun, 18 Mar 2018 19:07:08 -0000 Author: imp Date: Sun Mar 18 19:07:07 2018 New Revision: 331143 URL: https://svnweb.freebsd.org/changeset/base/331143 Log: MFC: r331140 Merge ahead of schedule to fix pc98 build issues. Modified: stable/11/stand/defs.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/defs.mk ============================================================================== --- stable/11/stand/defs.mk Sun Mar 18 19:05:06 2018 (r331142) +++ stable/11/stand/defs.mk Sun Mar 18 19:07:07 2018 (r331143) @@ -138,6 +138,9 @@ CFLAGS+= -mlittle-endian # Make sure we use the machine link we're about to create CFLAGS+=-I. +all: ${PROG} + +.if !defined(NO_OBJ) _ILINKS=machine .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" _ILINKS+=${MACHINE_CPUARCH} @@ -147,9 +150,6 @@ _ILINKS+=x86 .endif CLEANFILES+=${_ILINKS} -all: ${PROG} - -.if !defined(NO_OBJ) beforedepend: ${_ILINKS} beforebuild: ${_ILINKS} @@ -158,7 +158,7 @@ beforebuild: ${_ILINKS} .for _link in ${_ILINKS} .if !exists(${.OBJDIR}/${_link}) ${OBJS}: ${_link} -.endif +.endif # _link exists .endfor .NOPATH: ${_ILINKS} @@ -177,5 +177,5 @@ ${_ILINKS}: path=`(cd $$path && /bin/pwd)` ; \ ${ECHO} ${.TARGET:T} "->" $$path ; \ ln -fhs $$path ${.TARGET:T} -.endif +.endif # !NO_OBJ .endif # __BOOT_DEFS_MK__ From owner-svn-src-stable@freebsd.org Sun Mar 18 22:19:54 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 930B0F58D41; Sun, 18 Mar 2018 22:19:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 444AF69A5E; Sun, 18 Mar 2018 22:19:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 206A32645F; Sun, 18 Mar 2018 22:19:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IMJriU038488; Sun, 18 Mar 2018 22:19:53 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IMJrXH038478; Sun, 18 Mar 2018 22:19:53 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803182219.w2IMJrXH038478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 22:19: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: r331147 - in stable/11: etc/mtree usr.bin/indent usr.bin/indent/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11: etc/mtree usr.bin/indent usr.bin/indent/tests X-SVN-Commit-Revision: 331147 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: Sun, 18 Mar 2018 22:19:54 -0000 Author: eadler Date: Sun Mar 18 22:19:52 2018 New Revision: 331147 URL: https://svnweb.freebsd.org/changeset/base/331147 Log: MFC r303452,r303482,r303483,r303484,r303485,r303487,r303489,r303498,r303499,r303502,r303523,r303525,r303570,r303571,r303588,r303596,r303597,r303598,r303599,r303600,r303601,r303625,r303629,r303718,r304651,r304684,r304686,r305983,r309217,r309219,r309341,r309342,r309343,r309382,r309415,r309417,r309418,r309419,r310863,r311141,r314613,r318471,r321382,r321383,r321396: indent(1): avoid calling write(2) with a negative second parameter. indent(1): Avoid out of bound access of array codebuf. indent(1): Avoid potential use-after-free. indent(1): Fix breakage caused by single comment following "else". indent(1) simply wasn't taught that "else" may be followed by a comment without any opening brace anywhere on the line, so it was very confused in such cases. indent(1): fix struct termination detection. indent(1): fix struct termination detection. indent(1): Removed whitespace shouldn't be considered in column calculations. indent(1): Support "f" and "F" floating constant suffixes. indent(1): Use NULL instead of zero for pointers. indent(1): Attempt to preserve some consistent style. indent(1): Yet more style issues. indent(1): Consistently indent declarations. indent(1): Bail out if there's no more space on the parser stack. indent(1): Remove dead code relating to unix-style comments. indent(1): Simplify pr_comment(). indent(1): Fix wrapping of some lines in comments. indent(1): Untangle the connection between pr_comment.c and io.c. indent(1): Don't newline on cpp lines like #endif unless -bacc is on. indent(1): replace function call to bzero with memset. indent(1): Rearrange option parsing code to squelch clang's static analyzer. indent(1): Use a dash in the license headers. indent(1): accept offsetof(3) as a keyword. indent(1): add some comments to quiet down Coverity. indent(1): remove dead assignments. indent(1): have the memset invocation somewhat more canonical. indent(1): Capsicumify indent(1): minor off-by-one error. indent(1): fix regression introduced in r303596. indent(1): Avoid out of bound access of array in_buffer indent(1): Don't ignore newlines after comments that follow braces. indent(1): Don't unnecessarily add a blank before a comment ends. indent(1): Do not define opchar unless it will be used. indent(1): Optimize parser stack usage. indent(1): Remove an extra newline added in a previous commit. indent(1): Avoid out-of-bound accesses of arrays. indent(1): Avoid out-of-bound accesses of array ps.p_stack. indent(1): Avoid out of bounds access of array ps.paren_indents indent(1): add a piece missed in r311138. indent(1): Support binary integer literals. indent(1): don't produce unnecessary blank lines. indent(1): rename the profile file. indent(1): better alignment of comments on code. Added: stable/11/usr.bin/indent/tests/Makefile - copied, changed from r314613, head/usr.bin/indent/tests/Makefile stable/11/usr.bin/indent/tests/binary.0 - copied unchanged from r318471, head/usr.bin/indent/tests/binary.0 stable/11/usr.bin/indent/tests/binary.0.stdout - copied unchanged from r318471, head/usr.bin/indent/tests/binary.0.stdout stable/11/usr.bin/indent/tests/comments.0.pro - copied unchanged from r321383, head/usr.bin/indent/tests/comments.0.pro stable/11/usr.bin/indent/tests/elsecomment.0.pro - copied unchanged from r314613, head/usr.bin/indent/tests/elsecomment.0.pro stable/11/usr.bin/indent/tests/functional_test.sh - copied unchanged from r314613, head/usr.bin/indent/tests/functional_test.sh stable/11/usr.bin/indent/tests/label.0.pro - copied unchanged from r314613, head/usr.bin/indent/tests/label.0.pro stable/11/usr.bin/indent/tests/nsac.0.pro - copied unchanged from r314613, head/usr.bin/indent/tests/nsac.0.pro stable/11/usr.bin/indent/tests/sac.0.pro - copied unchanged from r314613, head/usr.bin/indent/tests/sac.0.pro stable/11/usr.bin/indent/tests/surplusbad.0.pro - copied unchanged from r314613, head/usr.bin/indent/tests/surplusbad.0.pro stable/11/usr.bin/indent/tests/types_from_file.0.list - copied unchanged from r314613, head/usr.bin/indent/tests/types_from_file.0.list stable/11/usr.bin/indent/tests/types_from_file.0.pro - copied unchanged from r314613, head/usr.bin/indent/tests/types_from_file.0.pro Deleted: stable/11/usr.bin/indent/tests/elsecomment.pro stable/11/usr.bin/indent/tests/label.pro stable/11/usr.bin/indent/tests/nsac.pro stable/11/usr.bin/indent/tests/sac.pro stable/11/usr.bin/indent/tests/surplusbad.pro stable/11/usr.bin/indent/tests/types_from_file.list stable/11/usr.bin/indent/tests/types_from_file.pro Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/usr.bin/indent/Makefile stable/11/usr.bin/indent/args.c stable/11/usr.bin/indent/indent.c stable/11/usr.bin/indent/indent.h stable/11/usr.bin/indent/indent_codes.h stable/11/usr.bin/indent/indent_globs.h stable/11/usr.bin/indent/io.c stable/11/usr.bin/indent/lexi.c stable/11/usr.bin/indent/parse.c stable/11/usr.bin/indent/pr_comment.c stable/11/usr.bin/indent/tests/comments.0 stable/11/usr.bin/indent/tests/comments.0.stdout Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/etc/mtree/BSD.tests.dist Sun Mar 18 22:19:52 2018 (r331147) @@ -658,6 +658,8 @@ .. ident .. + indent + .. join .. jot Modified: stable/11/usr.bin/indent/Makefile ============================================================================== --- stable/11/usr.bin/indent/Makefile Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/Makefile Sun Mar 18 22:19:52 2018 (r331147) @@ -1,9 +1,15 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= indent SRCS= indent.c io.c lexi.c parse.c pr_comment.c args.c NO_WMISSING_VARIABLE_DECLARATIONS= + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Modified: stable/11/usr.bin/indent/args.c ============================================================================== --- stable/11/usr.bin/indent/args.c Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/args.c Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1985 Sun Microsystems, Inc. @@ -93,6 +93,7 @@ struct pro { } pro[] = { {"T", PRO_SPECIAL, 0, KEY, 0}, + {"P", PRO_SPECIAL, 0, IGN, 0}, {"bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation}, {"badp", PRO_BOOL, false, ON, &blanklines_after_declarations_at_proctop}, {"bad", PRO_BOOL, false, ON, &blanklines_after_declarations}, @@ -225,17 +226,14 @@ scan_profile(FILE *f) } } -const char *param_start; - -static int +static const char * eqin(const char *s1, const char *s2) { while (*s1) { if (*s1++ != *s2++) - return (false); + return (NULL); } - param_start = s2; - return (true); + return (s2); } /* @@ -259,11 +257,12 @@ set_defaults(void) void set_option(char *arg) { - struct pro *p; + struct pro *p; + const char *param_start; arg++; /* ignore leading "-" */ for (p = pro; p->p_name; p++) - if (*p->p_name == *arg && eqin(p->p_name, arg)) + if (*p->p_name == *arg && (param_start = eqin(p->p_name, arg)) != NULL) goto found; errx(1, "%s: unknown parameter \"%s\"", option_source, arg - 1); found: @@ -282,9 +281,9 @@ found: break; case STDIN: - if (input == 0) + if (input == NULL) input = stdin; - if (output == 0) + if (output == NULL) output = stdout; break; Modified: stable/11/usr.bin/indent/indent.c ============================================================================== --- stable/11/usr.bin/indent/indent.c Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/indent.c Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1985 Sun Microsystems, Inc. @@ -52,8 +52,10 @@ static char sccsid[] = "@(#)indent.c 5.17 (Berkeley) 6 #include __FBSDID("$FreeBSD$"); +#include #include #include +#include #include #include #include @@ -65,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include "indent.h" static void bakcopy(void); +static void indent_declaration(int, int); const char *in_name = "Standard Input"; /* will always point to name of input * file */ @@ -77,6 +80,7 @@ char bakfile[MAXPATHLEN] = ""; int main(int argc, char **argv) { + cap_rights_t rights; int dec_ind; /* current indentation for declarations */ int di_stack[20]; /* a stack of structure indentation levels */ @@ -151,11 +155,11 @@ main(int argc, char **argv) scase = ps.pcase = false; squest = 0; - sc_end = 0; - bp_save = 0; - be_save = 0; + sc_end = NULL; + bp_save = NULL; + be_save = NULL; - output = 0; + output = NULL; tabs_to_var = 0; envval = getenv("SIMPLE_BACKUP_SUFFIX"); @@ -240,6 +244,17 @@ main(int argc, char **argv) bakcopy(); } } + + /* Restrict input/output descriptors and enter Capsicum sandbox. */ + cap_rights_init(&rights, CAP_FSTAT, CAP_WRITE); + if (cap_rights_limit(fileno(output), &rights) < 0 && errno != ENOSYS) + err(EXIT_FAILURE, "unable to limit rights for %s", out_name); + cap_rights_init(&rights, CAP_FSTAT, CAP_READ); + if (cap_rights_limit(fileno(input), &rights) < 0 && errno != ENOSYS) + err(EXIT_FAILURE, "unable to limit rights for %s", in_name); + if (cap_enter() < 0 && errno != ENOSYS) + err(EXIT_FAILURE, "unable to enter capability mode"); + if (ps.com_ind <= 1) ps.com_ind = 2; /* dont put normal comments before column 2 */ if (troff) { @@ -327,6 +342,10 @@ main(int argc, char **argv) switch (type_code) { case newline: ++line_no; + if (sc_end != NULL) { /* dump comment, if any */ + *sc_end++ = '\n'; /* newlines are needed in this case */ + goto sw_buffer; + } flushed_nl = true; case form_feed: break; /* form feeds and newlines found here will be @@ -334,7 +353,7 @@ main(int argc, char **argv) case lbrace: /* this is a brace that starts the compound * stmt */ - if (sc_end == 0) { /* ignore buffering if a comment wasn't + if (sc_end == NULL) { /* ignore buffering if a comment wasn't * stored up */ ps.search_brace = false; goto check_type; @@ -347,9 +366,9 @@ main(int argc, char **argv) } case comment: /* we have a comment, so we must copy it into * the buffer */ - if (!flushed_nl || sc_end != 0) { - if (sc_end == 0) { /* if this is the first comment, we - * must set up the buffer */ + if (!flushed_nl || sc_end != NULL) { + if (sc_end == NULL) { /* if this is the first comment, we + * must set up the buffer */ save_com[0] = save_com[1] = ' '; sc_end = &(save_com[2]); } @@ -392,7 +411,7 @@ main(int argc, char **argv) && e_code != s_code && e_code[-1] == '}')) force_nl = false; - if (sc_end == 0) { /* ignore buffering if comment wasn't + if (sc_end == NULL) { /* ignore buffering if comment wasn't * saved up */ ps.search_brace = false; goto check_type; @@ -423,7 +442,7 @@ main(int argc, char **argv) * save_com */ *sc_end++ = ' ';/* add trailing blank, just in case */ buf_end = sc_end; - sc_end = 0; + sc_end = NULL; break; } /* end of switch */ if (type_code != 0) /* we must make this check, just in case there @@ -513,31 +532,38 @@ check_type: break; case lparen: /* got a '(' or '[' */ - ++ps.p_l_follow; /* count parens to make Healy happy */ + /* count parens to make Healy happy */ + if (++ps.p_l_follow == nitems(ps.paren_indents)) { + diag3(0, "Reached internal limit of %d unclosed parens", + nitems(ps.paren_indents)); + ps.p_l_follow--; + } if (ps.want_blank && *token != '[' && - (ps.last_token != ident || proc_calls_space - || (ps.its_a_keyword && (!ps.sizeof_keyword || Bill_Shannon)))) + (ps.last_token != ident || proc_calls_space || + /* offsetof (1) is never allowed a space; sizeof (2) gets + * one iff -bs; all other keywords (>2) always get a space + * before lparen */ + (ps.keyword + Bill_Shannon > 2))) *e_code++ = ' '; - if (ps.in_decl && !ps.block_init) - if (troff && !ps.dumped_decl_indent && !is_procname && ps.last_token == decl) { - ps.dumped_decl_indent = 1; + ps.want_blank = false; + if (ps.in_decl && !ps.block_init && !ps.dumped_decl_indent && + !is_procname) { + /* function pointer declarations */ + if (troff) { sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token); e_code += strlen(e_code); } else { - while ((e_code - s_code) < dec_ind) { - CHECK_SIZE_CODE; - *e_code++ = ' '; - } - *e_code++ = token[0]; + indent_declaration(dec_ind, tabs_to_var); } - else + ps.dumped_decl_indent = true; + } + if (!troff) *e_code++ = token[0]; ps.paren_indents[ps.p_l_follow - 1] = e_code - s_code; if (sp_sw && ps.p_l_follow == 1 && extra_expression_indent && ps.paren_indents[0] < 2 * ps.ind_size) ps.paren_indents[0] = 2 * ps.ind_size; - ps.want_blank = false; if (ps.in_or_st && *token == '(' && ps.tos <= 2) { /* * this is a kluge to make sure that declarations will be @@ -548,19 +574,20 @@ check_type: ps.in_or_st = false; /* turn off flag for structure decl or * initialization */ } - if (ps.sizeof_keyword) - ps.sizeof_mask |= 1 << ps.p_l_follow; + /* parenthesized type following sizeof or offsetof is not a cast */ + if (ps.keyword == 1 || ps.keyword == 2) + ps.not_cast_mask |= 1 << ps.p_l_follow; break; case rparen: /* got a ')' or ']' */ rparen_count--; - if (ps.cast_mask & (1 << ps.p_l_follow) & ~ps.sizeof_mask) { + if (ps.cast_mask & (1 << ps.p_l_follow) & ~ps.not_cast_mask) { ps.last_u_d = true; ps.cast_mask &= (1 << ps.p_l_follow) - 1; ps.want_blank = false; } else ps.want_blank = true; - ps.sizeof_mask &= (1 << ps.p_l_follow) - 1; + ps.not_cast_mask &= (1 << ps.p_l_follow) - 1; if (--ps.p_l_follow < 0) { ps.p_l_follow = 0; diag3(0, "Extra %c", *token); @@ -588,27 +615,30 @@ check_type: break; case unary_op: /* this could be any unary operation */ - if (ps.want_blank) - *e_code++ = ' '; - - if (troff && !ps.dumped_decl_indent && ps.in_decl && !is_procname) { - sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, token); - ps.dumped_decl_indent = 1; - e_code += strlen(e_code); + if (!ps.dumped_decl_indent && ps.in_decl && !is_procname && + !ps.block_init) { + /* pointer declarations */ + if (troff) { + if (ps.want_blank) + *e_code++ = ' '; + sprintf(e_code, "\n.Du %dp+\200p \"%s\"\n", dec_ind * 7, + token); + e_code += strlen(e_code); + } + else { + /* if this is a unary op in a declaration, we should + * indent this token */ + for (i = 0; token[i]; ++i) + /* find length of token */; + indent_declaration(dec_ind - i, tabs_to_var); + } + ps.dumped_decl_indent = true; } - else { + else if (ps.want_blank) + *e_code++ = ' '; + { const char *res = token; - if (ps.in_decl && !ps.block_init) { /* if this is a unary op - * in a declaration, we - * should indent this - * token */ - for (i = 0; token[i]; ++i); /* find length of token */ - while ((e_code - s_code) < (dec_ind - i)) { - CHECK_SIZE_CODE; - *e_code++ = ' '; /* pad it */ - } - } if (troff && token[0] == '-' && token[1] == '>') res = "\\(->"; for (t_ptr = res; *t_ptr; ++t_ptr) { @@ -707,23 +737,25 @@ check_type: break; case semicolon: /* got a ';' */ - ps.in_or_st = false;/* we are not in an initialization or - * structure declaration */ + if (ps.dec_nest == 0) + ps.in_or_st = false;/* we are not in an initialization or + * structure declaration */ scase = false; /* these will only need resetting in an error */ squest = 0; if (ps.last_token == rparen && rparen_count == 0) ps.in_parameter_declaration = 0; ps.cast_mask = 0; - ps.sizeof_mask = 0; + ps.not_cast_mask = 0; ps.block_init = 0; ps.block_init_level = 0; ps.just_saw_decl--; - if (ps.in_decl && s_code == e_code && !ps.block_init) - while ((e_code - s_code) < (dec_ind - 1)) { - CHECK_SIZE_CODE; - *e_code++ = ' '; - } + if (ps.in_decl && s_code == e_code && !ps.block_init && + !ps.dumped_decl_indent) { + /* indent stray semicolons in declarations */ + indent_declaration(dec_ind - 1, tabs_to_var); + ps.dumped_decl_indent = true; + } ps.in_decl = (ps.dec_nest > 0); /* if we were in a first level * structure declaration, we @@ -937,58 +969,25 @@ check_type: if (ps.in_decl) { /* if we are in a declaration, we must indent * identifier */ if (is_procname == 0 || !procnames_start_line) { - if (!ps.block_init) { - if (troff && !ps.dumped_decl_indent) { + if (!ps.block_init && !ps.dumped_decl_indent) { + if (troff) { if (ps.want_blank) *e_code++ = ' '; - ps.want_blank = false; sprintf(e_code, "\n.De %dp+\200p\n", dec_ind * 7); - ps.dumped_decl_indent = 1; e_code += strlen(e_code); - } else { - int cur_dec_ind; - int pos, startpos; - - /* - * in order to get the tab math right for - * indentations that are not multiples of 8 we - * need to modify both startpos and dec_ind - * (cur_dec_ind) here by eight minus the - * remainder of the current starting column - * divided by eight. This seems to be a - * properly working fix - */ - startpos = e_code - s_code; - cur_dec_ind = dec_ind; - pos = startpos; - if ((ps.ind_level * ps.ind_size) % 8 != 0) { - pos += (ps.ind_level * ps.ind_size) % 8; - cur_dec_ind += (ps.ind_level * ps.ind_size) % 8; - } - - if (tabs_to_var) { - while ((pos & ~7) + 8 <= cur_dec_ind) { - CHECK_SIZE_CODE; - *e_code++ = '\t'; - pos = (pos & ~7) + 8; - } - } - while (pos < cur_dec_ind) { - CHECK_SIZE_CODE; - *e_code++ = ' '; - pos++; - } - if (ps.want_blank && e_code - s_code == startpos) - *e_code++ = ' '; - ps.want_blank = false; - } + } else + indent_declaration(dec_ind, tabs_to_var); + ps.dumped_decl_indent = true; + ps.want_blank = false; } } else { if (ps.want_blank) *e_code++ = ' '; ps.want_blank = false; - if (dec_ind && s_code != e_code) + if (dec_ind && s_code != e_code) { + *e_code = '\0'; dump_line(); + } dec_ind = 0; } } @@ -1002,7 +1001,7 @@ check_type: copy_id: if (ps.want_blank) *e_code++ = ' '; - if (troff && ps.its_a_keyword) { + if (troff && ps.keyword) { e_code = chfont(&bodyf, &keywordf, e_code); for (t_ptr = token; *t_ptr; ++t_ptr) { CHECK_SIZE_CODE; @@ -1039,12 +1038,12 @@ check_type: ps.want_blank = (s_code != e_code); /* only put blank after comma * if comma does not start the * line */ - if (ps.in_decl && is_procname == 0 && !ps.block_init) - while ((e_code - s_code) < (dec_ind - 1)) { - CHECK_SIZE_CODE; - *e_code++ = ' '; - } - + if (ps.in_decl && is_procname == 0 && !ps.block_init && + !ps.dumped_decl_indent) { + /* indent leading commas and not the actual identifiers */ + indent_declaration(dec_ind - 1, tabs_to_var); + ps.dumped_decl_indent = true; + } *e_code++ = ','; if (ps.p_l_follow == 0) { if (ps.block_init_level <= 0) @@ -1113,9 +1112,9 @@ check_type: while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t')) e_lab--; - if (e_lab - s_lab == com_end && bp_save == 0) { /* comment on - * preprocessor line */ - if (sc_end == 0) /* if this is the first comment, we + if (e_lab - s_lab == com_end && bp_save == NULL) { + /* comment on preprocessor line */ + if (sc_end == NULL) /* if this is the first comment, we * must set up the buffer */ sc_end = &(save_com[0]); else { @@ -1138,19 +1137,13 @@ check_type: * save_com */ *sc_end++ = ' '; /* add trailing blank, just in case */ buf_end = sc_end; - sc_end = 0; + sc_end = NULL; } *e_lab = '\0'; /* null terminate line */ ps.pcase = false; } - if (strncmp(s_lab, "#if", 3) == 0) { - if (blanklines_around_conditional_compilation) { - int c; - prefix_blankline_requested++; - while ((c = getc(input)) == '\n'); - ungetc(c, input); - } + if (strncmp(s_lab, "#if", 3) == 0) { /* also ifdef, ifndef */ if ((size_t)ifdef_level < nitems(state_stack)) { match_state[ifdef_level].tos = -1; state_stack[ifdef_level++] = ps; @@ -1158,40 +1151,54 @@ check_type: else diag2(1, "#if stack overflow"); } - else if (strncmp(s_lab, "#else", 5) == 0) + else if (strncmp(s_lab, "#el", 3) == 0) { /* else, elif */ if (ifdef_level <= 0) - diag2(1, "Unmatched #else"); + diag2(1, s_lab[3] == 'i' ? "Unmatched #elif" : "Unmatched #else"); else { match_state[ifdef_level - 1] = ps; ps = state_stack[ifdef_level - 1]; } + } else if (strncmp(s_lab, "#endif", 6) == 0) { if (ifdef_level <= 0) diag2(1, "Unmatched #endif"); - else { + else ifdef_level--; - -#ifdef undef - /* - * This match needs to be more intelligent before the - * message is useful - */ - if (match_state[ifdef_level].tos >= 0 - && bcmp(&ps, &match_state[ifdef_level], sizeof ps)) - diag2(0, "Syntactically inconsistent #ifdef alternatives"); -#endif + } else { + struct directives { + int size; + const char *string; } - if (blanklines_around_conditional_compilation) { - postfix_blankline_requested++; - n_real_blanklines = 0; + recognized[] = { + {7, "include"}, + {6, "define"}, + {5, "undef"}, + {4, "line"}, + {5, "error"}, + {6, "pragma"} + }; + int d = nitems(recognized); + while (--d >= 0) + if (strncmp(s_lab + 1, recognized[d].string, recognized[d].size) == 0) + break; + if (d < 0) { + diag2(1, "Unrecognized cpp directive"); + break; } } + if (blanklines_around_conditional_compilation) { + postfix_blankline_requested++; + n_real_blanklines = 0; + } + else { + postfix_blankline_requested = 0; + prefix_blankline_requested = 0; + } break; /* subsequent processing of the newline * character will cause the line to be printed */ case comment: /* we have gotten a / followed by * this is a biggie */ if (flushed_nl) { /* we should force a broken line here */ - flushed_nl = false; dump_line(); ps.want_blank = false; /* dont insert blank at line start */ force_nl = false; @@ -1231,7 +1238,7 @@ bakcopy(void) bakchn = creat(bakfile, 0600); if (bakchn < 0) err(1, "%s", bakfile); - while ((n = read(fileno(input), buff, sizeof buff)) != 0) + while ((n = read(fileno(input), buff, sizeof(buff))) > 0) if (write(bakchn, buff, n) != n) err(1, "%s", bakfile); if (n < 0) @@ -1248,5 +1255,35 @@ bakcopy(void) if (output == NULL) { unlink(bakfile); err(1, "%s", in_name); + } +} + +static void +indent_declaration(int cur_dec_ind, int tabs_to_var) +{ + int pos = e_code - s_code; + char *startpos = e_code; + + /* + * get the tab math right for indentations that are not multiples of 8 + */ + if ((ps.ind_level * ps.ind_size) % 8 != 0) { + pos += (ps.ind_level * ps.ind_size) % 8; + cur_dec_ind += (ps.ind_level * ps.ind_size) % 8; + } + if (tabs_to_var) + while ((pos & ~7) + 8 <= cur_dec_ind) { + CHECK_SIZE_CODE; + *e_code++ = '\t'; + pos = (pos & ~7) + 8; + } + while (pos < cur_dec_ind) { + CHECK_SIZE_CODE; + *e_code++ = ' '; + pos++; + } + if (e_code == startpos && ps.want_blank) { + *e_code++ = ' '; + ps.want_blank = false; } } Modified: stable/11/usr.bin/indent/indent.h ============================================================================== --- stable/11/usr.bin/indent/indent.h Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/indent.h Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2001 Jens Schweikhardt @@ -34,6 +34,7 @@ void addkey(char *, int); int compute_code_target(void); int compute_label_target(void); int count_spaces(int, char *); +int count_spaces_until(int, char *, char *); int lexi(void); void diag2(int, const char *); void diag3(int, const char *, int); Modified: stable/11/usr.bin/indent/indent_codes.h ============================================================================== --- stable/11/usr.bin/indent/indent_codes.h Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/indent_codes.h Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1985 Sun Microsystems, Inc. Modified: stable/11/usr.bin/indent/indent_globs.h ============================================================================== --- stable/11/usr.bin/indent/indent_globs.h Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/indent_globs.h Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1985 Sun Microsystems, Inc. @@ -59,40 +59,46 @@ FILE *output; /* the output file */ #define CHECK_SIZE_CODE \ if (e_code >= l_code) { \ int nsize = l_code-s_code+400; \ + int code_len = e_code-s_code; \ codebuf = (char *) realloc(codebuf, nsize); \ if (codebuf == NULL) \ err(1, NULL); \ - e_code = codebuf + (e_code-s_code) + 1; \ + e_code = codebuf + code_len + 1; \ l_code = codebuf + nsize - 5; \ s_code = codebuf + 1; \ } #define CHECK_SIZE_COM \ if (e_com >= l_com) { \ int nsize = l_com-s_com+400; \ + int com_len = e_com - s_com; \ + int blank_pos = last_bl - s_com; \ combuf = (char *) realloc(combuf, nsize); \ if (combuf == NULL) \ err(1, NULL); \ - e_com = combuf + (e_com-s_com) + 1; \ + e_com = combuf + com_len + 1; \ + last_bl = combuf + blank_pos + 1; \ l_com = combuf + nsize - 5; \ s_com = combuf + 1; \ } #define CHECK_SIZE_LAB \ if (e_lab >= l_lab) { \ int nsize = l_lab-s_lab+400; \ + int label_len = e_lab - s_lab; \ labbuf = (char *) realloc(labbuf, nsize); \ if (labbuf == NULL) \ err(1, NULL); \ - e_lab = labbuf + (e_lab-s_lab) + 1; \ + e_lab = labbuf + label_len + 1; \ l_lab = labbuf + nsize - 5; \ s_lab = labbuf + 1; \ } #define CHECK_SIZE_TOKEN \ if (e_token >= l_token) { \ int nsize = l_token-s_token+400; \ + int token_len = e_token - s_token; \ tokenbuf = (char *) realloc(tokenbuf, nsize); \ if (tokenbuf == NULL) \ err(1, NULL); \ - e_token = tokenbuf + (e_token-s_token) + 1; \ + e_token = tokenbuf + token_len + 1; \ l_token = tokenbuf + nsize - 5; \ s_token = tokenbuf + 1; \ } @@ -227,7 +233,7 @@ struct fstate bodyf; /* major body font */ -#define STACKSIZE 150 +#define STACKSIZE 256 struct parser_state { int last_token; @@ -240,10 +246,10 @@ struct parser_state { * char should be lined up with the / in / followed by * */ int comment_delta, n_comment_delta; - int cast_mask; /* indicates which close parens close off - * casts */ - int sizeof_mask; /* indicates which close parens close off - * sizeof''s */ + int cast_mask; /* indicates which close parens potentially + * close off casts */ + int not_cast_mask; /* indicates which close parens definitely + * close off something else than casts */ int block_init; /* true iff inside a block initialization */ int block_init_level; /* The level of brace nesting in an * initialization */ @@ -313,8 +319,7 @@ struct parser_state { * specially */ int decl_indent; /* column to indent declared identifiers to */ int local_decl_indent; /* like decl_indent but for locals */ - int its_a_keyword; - int sizeof_keyword; + int keyword; /* the type of a keyword or 0 */ int dumped_decl_indent; float case_indent; /* The distance to indent case labels from the * switch statement */ Modified: stable/11/usr.bin/indent/io.c ============================================================================== --- stable/11/usr.bin/indent/io.c Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/io.c Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1985 Sun Microsystems, Inc. @@ -118,6 +118,7 @@ dump_line(void) } while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t')) e_lab--; + *e_lab = '\0'; cur_col = pad_output(1, compute_label_target()); if (s_lab[0] == '#' && (strncmp(s_lab, "#else", 5) == 0 || strncmp(s_lab, "#endif", 6) == 0)) { @@ -201,6 +202,7 @@ dump_line(void) break; case '\\': putc('\\', output); + /* add a backslash to escape the '\' */ default: putc(*follow, output); } @@ -225,8 +227,9 @@ dump_line(void) char *com_st = s_com; target += ps.comment_delta; - while (*com_st == '\t') - com_st++, target += 8; /* ? */ + while (*com_st == '\t') /* consider original indentation in + * case this is a box comment */ + com_st++, target += 8; while (target <= 0) if (*com_st == ' ') target++, com_st++; @@ -242,18 +245,9 @@ dump_line(void) } while (e_com > com_st && isspace(e_com[-1])) e_com--; - cur_col = pad_output(cur_col, target); - if (!ps.box_com) { - if (star_comment_cont && (com_st[1] != '*' || e_com <= com_st + 1)) { - if (com_st[1] == ' ' && com_st[0] == ' ' && e_com > com_st + 1) - com_st[1] = '*'; - else - fwrite(" * ", com_st[0] == '\t' ? 2 : com_st[0] == '*' ? 1 : 3, 1, output); - } - } + (void)pad_output(cur_col, target); fwrite(com_st, e_com - com_st, 1, output); ps.comment_delta = ps.n_comment_delta; - cur_col = count_spaces(cur_col, com_st); ++ps.com_lines; /* count lines with comments */ } } @@ -283,10 +277,11 @@ inhibit_newline: ps.dumped_decl_indent = 0; *(e_lab = s_lab) = '\0'; /* reset buffers */ *(e_code = s_code) = '\0'; - *(e_com = s_com) = '\0'; + *(e_com = s_com = combuf + 1) = '\0'; ps.ind_level = ps.i_l_follow; ps.paren_level = ps.p_l_follow; - paren_target = -ps.paren_indents[ps.paren_level - 1]; + if (ps.paren_level > 0) + paren_target = -ps.paren_indents[ps.paren_level - 1]; not_first_line = 1; } @@ -349,10 +344,10 @@ fill_buffer(void) int i; FILE *f = input; - if (bp_save != 0) { /* there is a partly filled input buffer left */ - buf_ptr = bp_save; /* dont read anything, just switch buffers */ + if (bp_save != NULL) { /* there is a partly filled input buffer left */ + buf_ptr = bp_save; /* do not read anything, just switch buffers */ buf_end = be_save; - bp_save = be_save = 0; + bp_save = be_save = NULL; if (buf_ptr < buf_end) return; /* only return if there is really something in * this buffer */ @@ -379,7 +374,7 @@ fill_buffer(void) } buf_ptr = in_buffer; buf_end = p; - if (p[-2] == '/' && p[-3] == '*') { + if (p - in_buffer > 2 && p[-2] == '/' && p[-3] == '*') { if (in_buffer[3] == 'I' && strncmp(in_buffer, "/**INDENT**", 11) == 0) fill_buffer(); /* flush indent error message */ else { @@ -507,18 +502,15 @@ pad_output(int current, int target) * */ int -count_spaces(int current, char *buffer) +count_spaces_until(int cur, char *buffer, char *end) /* * this routine figures out where the character position will be after * printing the text in buffer starting at column "current" */ { char *buf; /* used to look thru buffer */ - int cur; /* current character counter */ - cur = current; - - for (buf = buffer; *buf != '\0'; ++buf) { + for (buf = buffer; *buf != '\0' && buf != end; ++buf) { switch (*buf) { case '\n': @@ -542,6 +534,12 @@ count_spaces(int current, char *buffer) return (cur); } +int +count_spaces(int cur, char *buffer) +{ + return (count_spaces_until(cur, buffer, NULL)); +} + void diag4(int level, const char *msg, int a, int b) { @@ -636,7 +634,7 @@ parsefont(struct fstate *f, const char *s0) const char *s = s0; int sizedelta = 0; - bzero(f, sizeof *f); + memset(f, '\0', sizeof(*f)); while (*s) { if (isdigit(*s)) f->size = f->size * 10 + *s - '0'; Modified: stable/11/usr.bin/indent/lexi.c ============================================================================== --- stable/11/usr.bin/indent/lexi.c Sun Mar 18 19:50:32 2018 (r331146) +++ stable/11/usr.bin/indent/lexi.c Sun Mar 18 22:19:52 2018 (r331147) @@ -1,4 +1,4 @@ -/* +/*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1985 Sun Microsystems, Inc. @@ -59,7 +59,9 @@ __FBSDID("$FreeBSD$"); #include "indent.h" #define alphanum 1 +#ifdef undef #define opchar 3 +#endif struct templ { const char *rwd; @@ -68,13 +70,13 @@ struct templ { struct templ specials[1000] = { - {"switch", 1}, - {"case", 2}, - {"break", 0}, + {"switch", 7}, + {"case", 8}, + {"break", 9}, {"struct", 3}, {"union", 3}, {"enum", 3}, - {"default", 2}, + {"default", 8}, {"int", 4}, {"char", 4}, {"float", 4}, @@ -90,14 +92,15 @@ struct templ specials[1000] = {"void", 4}, {"const", 4}, {"volatile", 4}, - {"goto", 0}, - {"return", 0}, + {"goto", 9}, + {"return", 9}, {"if", 5}, {"while", 5}, {"for", 5}, {"else", 6}, {"do", 6}, - {"sizeof", 7}, + {"sizeof", 2}, + {"offsetof", 1}, {0, 0} }; @@ -157,19 +160,47 @@ lexi(void) struct templ *p; if (isdigit(*buf_ptr) || (buf_ptr[0] == '.' && isdigit(buf_ptr[1]))) { + enum base { + BASE_2, BASE_8, BASE_10, BASE_16 + }; int seendot = 0, seenexp = 0, seensfx = 0; - if (*buf_ptr == '0' && - (buf_ptr[1] == 'x' || buf_ptr[1] == 'X')) { + enum base in_base = BASE_10; + + if (*buf_ptr == '0') { + if (buf_ptr[1] == 'b' || buf_ptr[1] == 'B') + in_base = BASE_2; + else if (buf_ptr[1] == 'x' || buf_ptr[1] == 'X') + in_base = BASE_16; + else if (isdigit(buf_ptr[1])) + in_base = BASE_8; + } + switch (in_base) { + case BASE_2: *e_token++ = *buf_ptr++; *e_token++ = *buf_ptr++; + while (*buf_ptr == '0' || *buf_ptr == '1') { + CHECK_SIZE_TOKEN; + *e_token++ = *buf_ptr++; + } + break; + case BASE_8: + *e_token++ = *buf_ptr++; + while (*buf_ptr >= '0' && *buf_ptr <= '8') { + CHECK_SIZE_TOKEN; + *e_token++ = *buf_ptr++; + } + break; + case BASE_16: + *e_token++ = *buf_ptr++; + *e_token++ = *buf_ptr++; while (isxdigit(*buf_ptr)) { CHECK_SIZE_TOKEN; *e_token++ = *buf_ptr++; } - } - else + break; + case BASE_10: while (1) { if (*buf_ptr == '.') { if (seendot) @@ -192,16 +223,16 @@ lexi(void) } } } + break; + } while (1) { - if (!(seensfx & 1) && - (*buf_ptr == 'U' || *buf_ptr == 'u')) { + if (!(seensfx & 1) && (*buf_ptr == 'U' || *buf_ptr == 'u')) { CHECK_SIZE_TOKEN; *e_token++ = *buf_ptr++; seensfx |= 1; continue; } - if (!(seensfx & 2) && - (*buf_ptr == 'L' || *buf_ptr == 'l')) { + if (!(seensfx & 2) && (strchr("fFlL", *buf_ptr) != NULL)) { CHECK_SIZE_TOKEN; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Sun Mar 18 22:24:30 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA0A2F592D9; Sun, 18 Mar 2018 22:24:30 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FF4B69ED1; Sun, 18 Mar 2018 22:24:30 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BE26265EA; Sun, 18 Mar 2018 22:24:30 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IMOUlG043259; Sun, 18 Mar 2018 22:24:30 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IMOUIt043258; Sun, 18 Mar 2018 22:24:30 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803182224.w2IMOUIt043258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 22:24: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: r331148 - stable/11/usr.bin/uname X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/uname X-SVN-Commit-Revision: 331148 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: Sun, 18 Mar 2018 22:24:30 -0000 Author: eadler Date: Sun Mar 18 22:24:29 2018 New Revision: 331148 URL: https://svnweb.freebsd.org/changeset/base/331148 Log: MFC r319274: - Add a simple example to uname(1) manual page to show how the hardware platform (returned by -m) can be different from the machine's processor architecture (-p) - Document that make(1) sets universal MACHINE and MACHINE_ARCH variables based on these values Modified: stable/11/usr.bin/uname/uname.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/uname/uname.1 ============================================================================== --- stable/11/usr.bin/uname/uname.1 Sun Mar 18 22:19:52 2018 (r331147) +++ stable/11/usr.bin/uname/uname.1 Sun Mar 18 22:24:29 2018 (r331148) @@ -28,7 +28,7 @@ .\" @(#)uname.1 8.3 (Berkeley) 4/8/94 .\" $FreeBSD$ .\" -.Dd November 20, 2013 +.Dd May 31, 2017 .Dt UNAME 1 .Os .Sh NAME @@ -61,6 +61,11 @@ Write the version of the kernel. .It Fl m Write the type of the current hardware platform to standard output. +.Po Xr make 1 +uses it to set the +.Va MACHINE +variable. +.Pc .It Fl n Write the name of the system to standard output. .It Fl o @@ -69,6 +74,11 @@ This is a synonym for the option, for compatibility with other systems. .It Fl p Write the type of the machine processor architecture to standard output. +.Po Xr make 1 +uses it to set the +.Va MACHINE_ARCH +variable. +.Pc .It Fl r Write the current release level of the operating system to standard output. @@ -106,6 +116,19 @@ will allow the corresponding data to be set to the con of the environment variable. .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +The hardware platform +.Pq Fl m +can be different from the machine's processor architecture +.Pq Fl p , +e.g., on 64-bit PowerPC, +.Fl m +would return +.Va powerpc +and +.Fl p +would return +.Va powerpc64 . .Sh SEE ALSO .Xr feature_present 3 , .Xr getosreldate 3 , From owner-svn-src-stable@freebsd.org Sun Mar 18 22:29:42 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1A1EF59902; Sun, 18 Mar 2018 22:29:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 63B7E6A38B; Sun, 18 Mar 2018 22:29:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59BF2265EF; Sun, 18 Mar 2018 22:29:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IMTgrR043611; Sun, 18 Mar 2018 22:29:42 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IMTgj3043609; Sun, 18 Mar 2018 22:29:42 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803182229.w2IMTgj3043609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 22:29: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: r331149 - in stable/11: sys/dev/pci usr.sbin/pciconf X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11: sys/dev/pci usr.sbin/pciconf X-SVN-Commit-Revision: 331149 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: Sun, 18 Mar 2018 22:29:42 -0000 Author: eadler Date: Sun Mar 18 22:29:41 2018 New Revision: 331149 URL: https://svnweb.freebsd.org/changeset/base/331149 Log: MFC r315190: Add constants and descriptions for some new PCI class definitions Modified: stable/11/sys/dev/pci/pcireg.h stable/11/usr.sbin/pciconf/pciconf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/pci/pcireg.h ============================================================================== --- stable/11/sys/dev/pci/pcireg.h Sun Mar 18 22:24:29 2018 (r331148) +++ stable/11/sys/dev/pci/pcireg.h Sun Mar 18 22:29:41 2018 (r331149) @@ -480,6 +480,11 @@ #define PCIS_DASP_MGMT_CARD 0x20 #define PCIS_DASP_OTHER 0x80 +#define PCIC_ACCEL 0x12 +#define PCIS_ACCEL_PROCESSING 0x00 + +#define PCIC_INSTRUMENT 0x13 + #define PCIC_OTHER 0xff /* Bridge Control Values. */ Modified: stable/11/usr.sbin/pciconf/pciconf.c ============================================================================== --- stable/11/usr.sbin/pciconf/pciconf.c Sun Mar 18 22:24:29 2018 (r331148) +++ stable/11/usr.sbin/pciconf/pciconf.c Sun Mar 18 22:29:41 2018 (r331149) @@ -700,6 +700,9 @@ static struct {PCIC_DASP, PCIS_DASP_PERFCNTRS, "performance counters"}, {PCIC_DASP, PCIS_DASP_COMM_SYNC, "communication synchronizer"}, {PCIC_DASP, PCIS_DASP_MGMT_CARD, "signal processing management"}, + {PCIC_ACCEL, -1, "processing accelerators"}, + {PCIC_ACCEL, PCIS_ACCEL_PROCESSING, "processing accelerators"}, + {PCIC_INSTRUMENT, -1, "non-essential instrumentation"}, {0, 0, NULL} }; From owner-svn-src-stable@freebsd.org Sun Mar 18 22:36:21 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1329F5A0BC; Sun, 18 Mar 2018 22:36:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 650366AAA6; Sun, 18 Mar 2018 22:36:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FD712678F; Sun, 18 Mar 2018 22:36:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IMaLDB048521; Sun, 18 Mar 2018 22:36:21 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IMaLpF048520; Sun, 18 Mar 2018 22:36:21 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803182236.w2IMaLpF048520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 22:36: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: r331150 - stable/11/share/man/man7 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/man/man7 X-SVN-Commit-Revision: 331150 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: Sun, 18 Mar 2018 22:36:21 -0000 Author: eadler Date: Sun Mar 18 22:36:21 2018 New Revision: 331150 URL: https://svnweb.freebsd.org/changeset/base/331150 Log: MFC r325215,r325216: Update tuning(7) some more At this point its unclear how much help tuning(7) is whatsoever but leave it around in case someone decides to spend some time on it. Modified: stable/11/share/man/man7/tuning.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/tuning.7 ============================================================================== --- stable/11/share/man/man7/tuning.7 Sun Mar 18 22:29:41 2018 (r331149) +++ stable/11/share/man/man7/tuning.7 Sun Mar 18 22:36:21 2018 (r331150) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 22, 2017 +.Dd October 30, 2017 .Dt TUNING 7 .Os .Sh NAME @@ -41,8 +41,7 @@ Configuring too little swap can lead to inefficiencies in the VM page scanning code as well as create issues later on if you add more memory to your machine. On larger systems -with multiple SCSI disks (or multiple IDE disks operating on different -controllers), configure swap on each drive. +with multiple disks, configure swap on each drive. The swap partitions on the drives should be approximately the same size. The kernel can handle arbitrary sizes but internal data structures scale to 4 times the largest swap partition. @@ -176,11 +175,6 @@ This means you want to use a large off-center stripe size such as 1152 sectors so sequential I/O does not seek both disks and so meta-data is distributed across both disks rather than concentrated on a single disk. -If -you really need to get sophisticated, we recommend using a real hardware -RAID controller from the list of -.Fx -supported controllers. .Sh SYSCTL TUNING .Xr sysctl 8 variables permit system behavior to be monitored and controlled at @@ -347,9 +341,6 @@ is adhered to. .Pp There are various other buffer-cache and VM page cache related sysctls. We do not recommend modifying these values. -As of -.Fx 4.3 , -the VM system does an extremely good job tuning itself. .Pp The .Va net.inet.tcp.sendspace @@ -547,30 +538,12 @@ and reboot the system. .Va kern.maxusers controls the scaling of a number of static system tables, including defaults for the maximum number of open files, sizing of network memory resources, etc. -As of -.Fx 4.5 , .Va kern.maxusers is automatically sized at boot based on the amount of memory available in the system, and may be determined at run-time by inspecting the value of the read-only .Va kern.maxusers sysctl. -Some sites will require larger or smaller values of -.Va kern.maxusers -and may set it as a loader tunable; values of 64, 128, and 256 are not -uncommon. -We do not recommend going above 256 unless you need a huge number -of file descriptors; many of the tunable values set to their defaults by -.Va kern.maxusers -may be individually overridden at boot-time or run-time as described -elsewhere in this document. -Systems older than -.Fx 4.4 -must set this value via the kernel -.Xr config 8 -option -.Cd maxusers -instead. .Pp The .Va kern.dfldsiz @@ -619,14 +592,6 @@ The option to .Xr netstat 1 may be used to observe network cluster use. -Older versions of -.Fx -do not have this tunable and require that the -kernel -.Xr config 8 -option -.Dv NMBCLUSTERS -be set instead. .Pp More and more programs are using the .Xr sendfile 2 @@ -705,11 +670,6 @@ can be used to monitor this. There are many solutions to saturated disks: increasing memory for caching, mirroring disks, distributing operations across several machines, and so forth. -If disk performance is an issue and you -are using IDE drives, switching to SCSI can help a great deal. -While modern -IDE drives compare with SCSI in raw sequential bandwidth, the moment you -start seeking around the disk SCSI drives usually win. .Pp Finally, you might run out of network suds. Optimize the network path @@ -718,10 +678,7 @@ For example, in .Xr firewall 7 we describe a firewall protecting internal hosts with a topology where the externally visible hosts are not routed through it. -Use 1000BaseT rather -than 100BaseT, depending on your needs. -Most bottlenecks occur at the WAN link (e.g.,\& -modem, T1, DSL, whatever). +Most bottlenecks occur at the WAN link. If expanding the link is not an option it may be possible to use the .Xr dummynet 4 feature to implement peak shaving or other forms of traffic shaping to From owner-svn-src-stable@freebsd.org Sun Mar 18 22:42:33 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE298F5A92A; Sun, 18 Mar 2018 22:42:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 500076B408; Sun, 18 Mar 2018 22:42:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AFC126908; Sun, 18 Mar 2018 22:42:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IMgXCl054051; Sun, 18 Mar 2018 22:42:33 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IMgXx9054050; Sun, 18 Mar 2018 22:42:33 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803182242.w2IMgXx9054050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 22:42:33 +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: r331151 - stable/11/sys/netpfil/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/netpfil/ipfw X-SVN-Commit-Revision: 331151 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: Sun, 18 Mar 2018 22:42:33 -0000 Author: eadler Date: Sun Mar 18 22:42:32 2018 New Revision: 331151 URL: https://svnweb.freebsd.org/changeset/base/331151 Log: MFC r314955: o Typo in the comment fixed. Modified: stable/11/sys/netpfil/ipfw/ip_fw_table.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/ipfw/ip_fw_table.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw_table.c Sun Mar 18 22:36:21 2018 (r331150) +++ stable/11/sys/netpfil/ipfw/ip_fw_table.c Sun Mar 18 22:42:32 2018 (r331151) @@ -406,7 +406,7 @@ prepare_batch_buffer(struct ip_fw_chain *ch, struct ta error = 0; ta_buf_sz = ta->ta_buf_size; if (count == 1) { - /* Sigle add/delete, use on-stack buffer */ + /* Single add/delete, use on-stack buffer */ memset(*ta_buf, 0, TA_BUF_SZ); ta_buf_m = *ta_buf; } else { From owner-svn-src-stable@freebsd.org Sun Mar 18 22:55:08 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A708F5B63B; Sun, 18 Mar 2018 22:55:08 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D94F06BB47; Sun, 18 Mar 2018 22:55:07 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D444B26A80; Sun, 18 Mar 2018 22:55:07 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IMt7Au059014; Sun, 18 Mar 2018 22:55:07 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IMt7Va059013; Sun, 18 Mar 2018 22:55:07 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803182255.w2IMt7Va059013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 18 Mar 2018 22:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331152 - stable/11/sys/dev/flash X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/flash X-SVN-Commit-Revision: 331152 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: Sun, 18 Mar 2018 22:55:08 -0000 Author: eadler Date: Sun Mar 18 22:55:07 2018 New Revision: 331152 URL: https://svnweb.freebsd.org/changeset/base/331152 Log: MFC r303150: [mx25l] add new device id. Modified: stable/11/sys/dev/flash/mx25l.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/flash/mx25l.c ============================================================================== --- stable/11/sys/dev/flash/mx25l.c Sun Mar 18 22:42:32 2018 (r331151) +++ stable/11/sys/dev/flash/mx25l.c Sun Mar 18 22:55:07 2018 (r331152) @@ -137,6 +137,9 @@ struct mx25l_flash_ident flash_devices[] = { /* Atmel */ { "at25df641", 0x1f, 0x4800, 64 * 1024, 128, FL_ERASE_4K }, + + /* GigaDevice */ + { "gd25q64", 0xc8, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, }; static uint8_t From owner-svn-src-stable@freebsd.org Mon Mar 19 02:38:08 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 127E4F6900B; Mon, 19 Mar 2018 02:38:08 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4E9F736EC; Mon, 19 Mar 2018 02:38:07 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB24CBDF; Mon, 19 Mar 2018 02:38:07 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J2c7v9068968; Mon, 19 Mar 2018 02:38:07 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J2c72e068967; Mon, 19 Mar 2018 02:38:07 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190238.w2J2c72e068967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 02:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331154 - stable/11/contrib/tnftp/src X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/contrib/tnftp/src X-SVN-Commit-Revision: 331154 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, 19 Mar 2018 02:38:08 -0000 Author: eadler Date: Mon Mar 19 02:38:07 2018 New Revision: 331154 URL: https://svnweb.freebsd.org/changeset/base/331154 Log: MFC r328525: ftp(1): Use closefrom() instead of individual close()s. Modified: stable/11/contrib/tnftp/src/cmds.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/tnftp/src/cmds.c ============================================================================== --- stable/11/contrib/tnftp/src/cmds.c Mon Mar 19 00:25:10 2018 (r331153) +++ stable/11/contrib/tnftp/src/cmds.c Mon Mar 19 02:38:07 2018 (r331154) @@ -1438,8 +1438,7 @@ shell(int argc, char *argv[]) } oldintr = xsignal(SIGINT, SIG_IGN); if ((pid = fork()) == 0) { - for (pid = 3; pid < 20; pid++) - (void)close(pid); + (void)closefrom(3); (void)xsignal(SIGINT, SIG_DFL); shellp = getenv("SHELL"); if (shellp == NULL) From owner-svn-src-stable@freebsd.org Mon Mar 19 02:43:21 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D869F6964E; Mon, 19 Mar 2018 02:43:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0818873B9D; Mon, 19 Mar 2018 02:43:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01A57D6C; Mon, 19 Mar 2018 02:43:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J2hKuV073761; Mon, 19 Mar 2018 02:43:20 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J2hKZs073759; Mon, 19 Mar 2018 02:43:20 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190243.w2J2hKZs073759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 02:43: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: r331155 - stable/11/contrib/mdocml X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/contrib/mdocml X-SVN-Commit-Revision: 331155 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, 19 Mar 2018 02:43:21 -0000 Author: eadler Date: Mon Mar 19 02:43:20 2018 New Revision: 331155 URL: https://svnweb.freebsd.org/changeset/base/331155 Log: MFC r326601: mdocml: Add IEEE Std 1003.1-2008, 2016 edition Also document IEEE Std 1003.1-2008, 2013 edition in mdoc(7) (as well as the 2016 edition). Modified: stable/11/contrib/mdocml/mdoc.7 stable/11/contrib/mdocml/st.in Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/mdocml/mdoc.7 ============================================================================== --- stable/11/contrib/mdocml/mdoc.7 Mon Mar 19 02:38:07 2018 (r331154) +++ stable/11/contrib/mdocml/mdoc.7 Mon Mar 19 02:43:20 2018 (r331155) @@ -2575,6 +2575,17 @@ The second and last Technical Corrigendum. .br This standard is also called X/Open Portability Guide version 7. +.Pp +.It \-p1003.1-2013 +.St -p1003.1-2013 +.br +The 2013 edition incorporates Technical Corrigendum 1. +.Pp +.It \-p1003.1-2016 +.St -p1003.1-2016 +.br +The 2016 edition incorporates Technical Corrigendum 1 and +Technical Corrigendum 2. .El .It Other standards .Pp Modified: stable/11/contrib/mdocml/st.in ============================================================================== --- stable/11/contrib/mdocml/st.in Mon Mar 19 02:38:07 2018 (r331154) +++ stable/11/contrib/mdocml/st.in Mon Mar 19 02:43:20 2018 (r331155) @@ -35,6 +35,7 @@ LINE("-p1003.1-2001", "IEEE Std 1003.1-2001 (\\(LqPOSI LINE("-p1003.1-2004", "IEEE Std 1003.1-2004 (\\(LqPOSIX.1\\(Rq)") LINE("-p1003.1-2008", "IEEE Std 1003.1-2008 (\\(LqPOSIX.1\\(Rq)") LINE("-p1003.1-2013", "IEEE Std 1003.1-2008, 2013 Edition (\\(LqPOSIX.1\\(Rq)") +LINE("-p1003.1-2016", "IEEE Std 1003.1-2008, 2016 Edition (\\(LqPOSIX.1\\(Rq)") LINE("-p1003.1", "IEEE Std 1003.1 (\\(LqPOSIX.1\\(Rq)") LINE("-p1003.1b", "IEEE Std 1003.1b (\\(LqPOSIX.1b\\(Rq)") LINE("-p1003.1b-93", "IEEE Std 1003.1b-1993 (\\(LqPOSIX.1b\\(Rq)") From owner-svn-src-stable@freebsd.org Mon Mar 19 02:44:43 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D17AF69755; Mon, 19 Mar 2018 02:44:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 42B2373CF8; Mon, 19 Mar 2018 02:44:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B8F6D6D; Mon, 19 Mar 2018 02:44:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J2ihrf073871; Mon, 19 Mar 2018 02:44:43 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J2ihO4073870; Mon, 19 Mar 2018 02:44:43 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190244.w2J2ihO4073870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 02:44:43 +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: r331156 - stable/11/usr.bin/calendar/calendars/de_DE.ISO8859-1 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/calendar/calendars/de_DE.ISO8859-1 X-SVN-Commit-Revision: 331156 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, 19 Mar 2018 02:44:43 -0000 Author: eadler Date: Mon Mar 19 02:44:42 2018 New Revision: 331156 URL: https://svnweb.freebsd.org/changeset/base/331156 Log: MFC r323135: Spelling. Modified: stable/11/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte ============================================================================== --- stable/11/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Mon Mar 19 02:43:20 2018 (r331155) +++ stable/11/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Mon Mar 19 02:44:42 2018 (r331156) @@ -84,7 +84,7 @@ LANG=de_DE.ISO8859-1 03/15 Einmarsch deutscher Truppen in die Tschechoslowakei, 1939 03/23 Rückgabe des Memelgebietes an Deutschland, 1939 08/23 Abschluß des Hitler-Stalin-Paktes, 1939 -09/03 Kriegserklärung Großbritaniens und Frankreichs an Deutschland, 1939 +09/03 Kriegserklärung Großbritanniens und Frankreichs an Deutschland, 1939 04/09 Deutsche Besetzung Dänemarks, Invasion in Norwegen, 1940 05/10 Deutscher Angriff auf Belgien, die Niederlande, Luxemburg und Frankreich, 1940 From owner-svn-src-stable@freebsd.org Mon Mar 19 02:46:17 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7A42F698EB; Mon, 19 Mar 2018 02:46:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 75AF673E69; Mon, 19 Mar 2018 02:46:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 704FBD6E; Mon, 19 Mar 2018 02:46:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J2kHId073988; Mon, 19 Mar 2018 02:46:17 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J2kHvu073987; Mon, 19 Mar 2018 02:46:17 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190246.w2J2kHvu073987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 02:46: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: r331157 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 331157 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, 19 Mar 2018 02:46:18 -0000 Author: eadler Date: Mon Mar 19 02:46:17 2018 New Revision: 331157 URL: https://svnweb.freebsd.org/changeset/base/331157 Log: MFC r322991: Fix a day-one typo in tty.4 - the sysctls in question are "tty", not "tk" Modified: stable/11/share/man/man4/tty.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/tty.4 ============================================================================== --- stable/11/share/man/man4/tty.4 Mon Mar 19 02:44:42 2018 (r331156) +++ stable/11/share/man/man4/tty.4 Mon Mar 19 02:46:17 2018 (r331157) @@ -360,9 +360,9 @@ is cleared in the terminal. The total number of input and output bytes through all terminal devices are available via the -.Va kern.tk_nin +.Va kern.tty_nin and -.Va kern.tk_nout +.Va kern.tty_nout read-only .Xr sysctl 8 variables. From owner-svn-src-stable@freebsd.org Mon Mar 19 03:04:20 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4B1EF6AE0A; Mon, 19 Mar 2018 03:04:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EF6874F37; Mon, 19 Mar 2018 03:04:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 894D210EC; Mon, 19 Mar 2018 03:04:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J34JZt084740; Mon, 19 Mar 2018 03:04:19 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J34J8Z084739; Mon, 19 Mar 2018 03:04:19 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190304.w2J34J8Z084739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:04:19 +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: r331158 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 331158 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, 19 Mar 2018 03:04:20 -0000 Author: eadler Date: Mon Mar 19 03:04:19 2018 New Revision: 331158 URL: https://svnweb.freebsd.org/changeset/base/331158 Log: MFC r314052: Document what the different flags mean for locking. Modified: stable/11/sys/sys/bufobj.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/bufobj.h ============================================================================== --- stable/11/sys/sys/bufobj.h Mon Mar 19 02:46:17 2018 (r331157) +++ stable/11/sys/sys/bufobj.h Mon Mar 19 03:04:19 2018 (r331158) @@ -90,6 +90,12 @@ struct buf_ops { #define BO_WRITE(bo, bp) ((bo)->bo_ops->bop_write((bp))) #define BO_BDFLUSH(bo, bp) ((bo)->bo_ops->bop_bdflush((bo), (bp))) +/* + * Locking notes: + * 'S' is sync_mtx + * 'v' is the vnode lock which embeds the bufobj. + * '-' Constant and unchanging after initialization. + */ struct bufobj { struct rwlock bo_lock; /* Lock which protects "i" things */ struct buf_ops *bo_ops; /* - Buffer operations */ From owner-svn-src-stable@freebsd.org Mon Mar 19 03:06:28 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 914285A; Mon, 19 Mar 2018 03:06:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 297C5750E3; Mon, 19 Mar 2018 03:06:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E20E10ED; Mon, 19 Mar 2018 03:06:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J36REN084859; Mon, 19 Mar 2018 03:06:27 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J36Rfa084858; Mon, 19 Mar 2018 03:06:27 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190306.w2J36Rfa084858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:06: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: r331159 - stable/11/sys/dev/usb/input X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/usb/input X-SVN-Commit-Revision: 331159 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, 19 Mar 2018 03:06:28 -0000 Author: eadler Date: Mon Mar 19 03:06:27 2018 New Revision: 331159 URL: https://svnweb.freebsd.org/changeset/base/331159 Log: MFC r304725: Bring datasheet URL up to date. Modified: stable/11/sys/dev/usb/input/uep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/input/uep.c ============================================================================== --- stable/11/sys/dev/usb/input/uep.c Mon Mar 19 03:04:19 2018 (r331158) +++ stable/11/sys/dev/usb/input/uep.c Mon Mar 19 03:06:27 2018 (r331159) @@ -29,7 +29,7 @@ */ /* - * http://home.eeti.com.tw/web20/drivers/Software%20Programming%20Guide_v2.0.pdf + * http://www.eeti.com.tw/pdf/Software%20Programming%20Guide_v2.0.pdf */ #include From owner-svn-src-stable@freebsd.org Mon Mar 19 03:13:43 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 431C07B0; Mon, 19 Mar 2018 03:13:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE69D7559B; Mon, 19 Mar 2018 03:13:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5B6E1293; Mon, 19 Mar 2018 03:13:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3DgQ4090038; Mon, 19 Mar 2018 03:13:42 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3Dg1h090037; Mon, 19 Mar 2018 03:13:42 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190313.w2J3Dg1h090037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:13: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: r331160 - stable/11/lib/libedit X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/lib/libedit X-SVN-Commit-Revision: 331160 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, 19 Mar 2018 03:13:43 -0000 Author: eadler Date: Mon Mar 19 03:13:42 2018 New Revision: 331160 URL: https://svnweb.freebsd.org/changeset/base/331160 Log: MFC r317570: editline.3: Add missing argument to H_SET description The H_SET operation of the history() function takes an int argument which is the position of the item to which the cursor should be moved to. Modified: stable/11/lib/libedit/editline.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libedit/editline.3 ============================================================================== --- stable/11/lib/libedit/editline.3 Mon Mar 19 03:06:27 2018 (r331159) +++ stable/11/lib/libedit/editline.3 Mon Mar 19 03:13:42 2018 (r331160) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 24, 2016 +.Dd April 28, 2017 .Dt EDITLINE 3 .Os .Sh NAME @@ -767,7 +767,7 @@ Return the previous element in the history. Return the next element in the history. .It Dv H_CURR Return the current element in the history. -.It Dv H_SET +.It Dv H_SET , Fa "int position" Set the cursor to point to the requested element. .It Dv H_ADD , Fa "const char *str" Append From owner-svn-src-stable@freebsd.org Mon Mar 19 03:15:34 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6334CA9C; Mon, 19 Mar 2018 03:15:34 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 164637574A; Mon, 19 Mar 2018 03:15:34 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10A441297; Mon, 19 Mar 2018 03:15:34 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3FXg8090150; Mon, 19 Mar 2018 03:15:33 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3FXIT090148; Mon, 19 Mar 2018 03:15:33 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190315.w2J3FXIT090148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:15:33 +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: r331161 - stable/11/sys/dev/bnxt X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/bnxt X-SVN-Commit-Revision: 331161 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, 19 Mar 2018 03:15:34 -0000 Author: eadler Date: Mon Mar 19 03:15:33 2018 New Revision: 331161 URL: https://svnweb.freebsd.org/changeset/base/331161 Log: MFC r317798: bnxt: Add support for new Broadcom 100Gb adapter BCM57454 Modified: stable/11/sys/dev/bnxt/bnxt.h stable/11/sys/dev/bnxt/if_bnxt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/bnxt/bnxt.h ============================================================================== --- stable/11/sys/dev/bnxt/bnxt.h Mon Mar 19 03:13:42 2018 (r331160) +++ stable/11/sys/dev/bnxt/bnxt.h Mon Mar 19 03:15:33 2018 (r331161) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #define BCM57417_NPAR1 0x16c0 #define BCM57417_NPAR2 0x16cc #define BCM57417_SFP 0x16e2 +#define BCM57454 0x1614 #define BCM58700 0x16cd #define NETXTREME_C_VF1 0x16cb #define NETXTREME_C_VF2 0x16e1 Modified: stable/11/sys/dev/bnxt/if_bnxt.c ============================================================================== --- stable/11/sys/dev/bnxt/if_bnxt.c Mon Mar 19 03:13:42 2018 (r331160) +++ stable/11/sys/dev/bnxt/if_bnxt.c Mon Mar 19 03:15:33 2018 (r331161) @@ -127,6 +127,8 @@ static pci_vendor_info_t bnxt_vendor_info_array[] = "Broadcom BCM57417 NetXtreme-E Ethernet Partition"), PVID(BROADCOM_VENDOR_ID, BCM57417_SFP, "Broadcom BCM57417 NetXtreme-E 10Gb/25Gb Ethernet"), + PVID(BROADCOM_VENDOR_ID, BCM57454, + "Broadcom BCM57454 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet"), PVID(BROADCOM_VENDOR_ID, BCM58700, "Broadcom BCM58700 Nitro 1Gb/2.5Gb/10Gb Ethernet"), PVID(BROADCOM_VENDOR_ID, NETXTREME_C_VF1, From owner-svn-src-stable@freebsd.org Mon Mar 19 03:19:30 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D04F6F31; Mon, 19 Mar 2018 03:19:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6CBF0759DB; Mon, 19 Mar 2018 03:19:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67A07129A; Mon, 19 Mar 2018 03:19:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3JTXS090321; Mon, 19 Mar 2018 03:19:29 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3JTmm090320; Mon, 19 Mar 2018 03:19:29 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190319.w2J3JTmm090320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:19:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331162 - stable/11/usr.bin/fortune/datfiles X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/fortune/datfiles X-SVN-Commit-Revision: 331162 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, 19 Mar 2018 03:19:30 -0000 Author: eadler Date: Mon Mar 19 03:19:29 2018 New Revision: 331162 URL: https://svnweb.freebsd.org/changeset/base/331162 Log: MFC r325091: Prefer using https over http Modified: stable/11/usr.bin/fortune/datfiles/freebsd-tips Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/fortune/datfiles/freebsd-tips ============================================================================== --- stable/11/usr.bin/fortune/datfiles/freebsd-tips Mon Mar 19 03:15:33 2018 (r331161) +++ stable/11/usr.bin/fortune/datfiles/freebsd-tips Mon Mar 19 03:19:29 2018 (r331162) @@ -68,7 +68,7 @@ If you need a reminder to leave your terminal, type "l % If you need to ask a question on the FreeBSD-questions mailing list then - http://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/\ + https://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/\ freebsd-questions/index.html contains lots of useful advice to help you get the best results. @@ -99,7 +99,7 @@ environment variable in order to make cdcontrol want t If you'd like to keep track of applications in the FreeBSD ports tree, take a look at FreshPorts; - http://www.freshports.org/ + https://www.freshports.org/ % In order to make fetch (the FreeBSD downloading tool) ask for username/password when it encounters a password-protected web page, you can set @@ -445,7 +445,7 @@ You can use "pkg info" to see a list of packages you h % You can use the 'fetch' command to retrieve files over ftp, http or https. - fetch http://www.FreeBSD.org/index.html + fetch https://www.FreeBSD.org/index.html will download the front page of the FreeBSD web site. % From owner-svn-src-stable@freebsd.org Mon Mar 19 03:20:36 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89C2BF42099; Mon, 19 Mar 2018 03:20:36 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 16F9775C5D; Mon, 19 Mar 2018 03:20:36 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11D1312A0; Mon, 19 Mar 2018 03:20:36 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3KZ0f090432; Mon, 19 Mar 2018 03:20:35 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3KZWn090431; Mon, 19 Mar 2018 03:20:35 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190320.w2J3KZWn090431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:20:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331163 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 331163 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, 19 Mar 2018 03:20:36 -0000 Author: eadler Date: Mon Mar 19 03:20:35 2018 New Revision: 331163 URL: https://svnweb.freebsd.org/changeset/base/331163 Log: MFC r303412: Remove myself from kern_timeout.c yeah! Modified: stable/11/MAINTAINERS Directory Properties: stable/11/ (props changed) Modified: stable/11/MAINTAINERS ============================================================================== --- stable/11/MAINTAINERS Mon Mar 19 03:19:29 2018 (r331162) +++ stable/11/MAINTAINERS Mon Mar 19 03:20:35 2018 (r331163) @@ -37,7 +37,6 @@ subsystem login notes ----------------------------- atf freebsd-testing,jmmv,ngie Pre-commit review requested. ath(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org -callout_*(9) rrs Pre-commit review requested -- becareful its tricksy code :o. contrib/compiler-rt dim Pre-commit review preferred. contrib/libc++ dim Pre-commit review preferred. contrib/libcxxrt dim Pre-commit review preferred. From owner-svn-src-stable@freebsd.org Mon Mar 19 03:22:44 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BDC5F424A7; Mon, 19 Mar 2018 03:22:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3997375F5F; Mon, 19 Mar 2018 03:22:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 349341415; Mon, 19 Mar 2018 03:22:44 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3Min5094902; Mon, 19 Mar 2018 03:22:44 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3Migo094901; Mon, 19 Mar 2018 03:22:44 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190322.w2J3Migo094901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:22:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331164 - stable/11/usr.bin/join X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/join X-SVN-Commit-Revision: 331164 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, 19 Mar 2018 03:22:44 -0000 Author: eadler Date: Mon Mar 19 03:22:43 2018 New Revision: 331164 URL: https://svnweb.freebsd.org/changeset/base/331164 Log: MFC r320210: join(1): Fix field ordering for -v output Per POSIX, join(1) (in modes other than -o) is a concatenation of selected character fields. The joined field is first, followed by fields in the order they occurred in the input files. Our join(1) utility previously handled this correctly for lines with a match in the other file. But it failed to order output fields correctly for unmatched lines, printed in -a and -v modes. A simple test case is: $ touch a $ echo "2 1" > b $ join -v2 -2 2 a b 1 2 PR: 217711 Modified: stable/11/usr.bin/join/join.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/join/join.c ============================================================================== --- stable/11/usr.bin/join/join.c Mon Mar 19 03:20:35 2018 (r331163) +++ stable/11/usr.bin/join/join.c Mon Mar 19 03:22:43 2018 (r331164) @@ -469,9 +469,15 @@ outoneline(INPUT *F, LINE *lp) else outfield(lp, 0, 1); } - else + else { + /* + * Output the join field, then the remaining fields. + */ + outfield(lp, F->joinf, 0); for (cnt = 0; cnt < lp->fieldcnt; ++cnt) - outfield(lp, cnt, 0); + if (F->joinf != cnt) + outfield(lp, cnt, 0); + } (void)printf("\n"); if (ferror(stdout)) err(1, "stdout"); From owner-svn-src-stable@freebsd.org Mon Mar 19 03:28:25 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86CDDF42B6F; Mon, 19 Mar 2018 03:28:25 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F2BBF763BC; Mon, 19 Mar 2018 03:28:24 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED86C141E; Mon, 19 Mar 2018 03:28:24 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3SO0U095421; Mon, 19 Mar 2018 03:28:24 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3SOmw095420; Mon, 19 Mar 2018 03:28:24 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190328.w2J3SOmw095420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:28:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331165 - stable/11/share/dict X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/dict X-SVN-Commit-Revision: 331165 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, 19 Mar 2018 03:28:26 -0000 Author: eadler Date: Mon Mar 19 03:28:24 2018 New Revision: 331165 URL: https://svnweb.freebsd.org/changeset/base/331165 Log: MFC r326913: Sync with NetBSD's /usr/share/dict/words, with the exception of quim due to its vulgar nature. Modified: stable/11/share/dict/web2 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/dict/web2 ============================================================================== --- stable/11/share/dict/web2 Mon Mar 19 03:22:43 2018 (r331164) +++ stable/11/share/dict/web2 Mon Mar 19 03:28:24 2018 (r331165) @@ -1545,9 +1545,9 @@ ackman acknow acknowledge acknowledgeable -acknowledgement acknowledged acknowledgedly +acknowledgement acknowledger acknowledgment aclastic @@ -2648,6 +2648,7 @@ admedial admedian admensuration admi +admin adminicle adminicula adminicular @@ -2656,7 +2657,7 @@ adminiculate adminiculation adminiculum administer -administerd +administered administerial administrable administrant @@ -5948,6 +5949,7 @@ alphabetist alphabetization alphabetize alphabetizer +alphanumeric Alphard alphatoluic Alphean @@ -7003,6 +7005,7 @@ amove Amoy Amoyan Amoyese +amp ampalaya ampalea ampangabeite @@ -19646,6 +19649,7 @@ Beaune beaupere beauseant beauship +beaut beauteous beauteously beauteousness @@ -23499,6 +23503,7 @@ blebby blechnoid Blechnum bleck +bled blee bleed bleeder @@ -32163,6 +32168,7 @@ ceilinged ceilingward ceilingwards ceilometer +cel Celadon celadon celadonite @@ -34048,6 +34054,7 @@ checkless checkman checkmate checkoff +checkout checkrack checkrein checkroll @@ -39340,6 +39347,7 @@ collector collectorate collectorship collectress +Colleen colleen collegatary college @@ -42631,6 +42639,7 @@ coony coop cooper cooperage +cooperate Cooperia coopering coopery @@ -57415,6 +57424,7 @@ downlier downligging downlike downline +downlink downlooked downlooker downlying @@ -68583,6 +68593,7 @@ fatuoid fatuous fatuously fatuousness +fatwa fatwood faucal faucalize @@ -70236,6 +70247,7 @@ firestopping firetail firetop firetrap +firewall firewarden firewater fireweed @@ -71816,6 +71828,7 @@ fomenter fomes fomites Fon +fond fondak fondant fondish @@ -74044,6 +74057,7 @@ fuelizer fuerte fuff fuffy +fug fugacious fugaciously fugaciousness @@ -76068,6 +76082,7 @@ geeldikkop geelhout geepound geerah +geese geest geet Geez @@ -85657,6 +85672,7 @@ hickory Hicksite hickwall Hicoria +hid hidable hidage hidalgism @@ -86106,6 +86122,7 @@ hirmos Hirneola hiro Hirofumi +hirofumi hirondelle Hirotoshi Hiroyuki @@ -95495,6 +95512,7 @@ instantaneously instantaneousness instanter instantial +instantiate instantly instantness instar @@ -101941,6 +101959,7 @@ kickout kickseys kickshaw kickup +kid Kidder kidder Kidderminster @@ -106352,6 +106371,7 @@ Libytheinae Licania licareol licca +lice licensable license licensed @@ -106828,6 +106848,7 @@ Limnorchis Limnoria Limnoriidae limnorioid +limo Limodorum limoid limonene @@ -108017,6 +108038,7 @@ logium loglet loglike logman +logo logocracy logodaedaly logogogue @@ -108253,6 +108275,7 @@ looker looking lookout lookum +lookup loom loomer loomery @@ -118182,6 +118205,7 @@ Molinist Molinistic molka Moll +moll molland Mollberg molle @@ -128067,6 +128091,7 @@ nosewards nosewheel nosewise nosey +nosh nosine nosing nosism @@ -130324,6 +130349,7 @@ Oldfieldia Oldhamia oldhamite oldhearted +oldie oldish oldland oldness @@ -147610,6 +147636,7 @@ placeable Placean placebo placeful +placeholder placeless placelessly placemaker @@ -152000,6 +152027,7 @@ pot potability potable potableness +potage potagerie potagery potamic @@ -153673,6 +153701,7 @@ predynamite predynastic preen preener +preexist preeze prefab prefabricate @@ -162965,6 +162994,7 @@ rakishness rakit rakshasa raku +rale Ralf rallentando ralliance @@ -165219,6 +165249,7 @@ redhoop redia redictate redictation +redid redient redifferentiate redifferentiation @@ -165313,6 +165344,7 @@ redolent redolently redominate redondilla +redone redoom redouble redoublement @@ -166542,6 +166574,7 @@ Rellyanite reload reloan relocable +relocatable relocate relocation relocator @@ -173817,6 +173850,7 @@ sashless sasin sasine saskatoon +sass sassaby sassafac sassafrack @@ -184478,6 +184512,7 @@ softner softness softship softtack +software softwood softy sog @@ -185669,6 +185704,7 @@ spaller spalling spalpeen spalt +spam span spancel spandle @@ -186716,6 +186752,8 @@ spill spillage spiller spillet +spillikin +spillover spillproof spillway spilly @@ -201472,6 +201510,7 @@ Themis themis Themistian themsel +themself themselves then thenabouts @@ -204283,6 +204322,7 @@ tolylenediamine Tolypeutes tolypeutine Tom +tom Toma tomahawk tomahawker @@ -205532,6 +205572,7 @@ trade tradecraft tradeful tradeless +trademark trademaster trader tradership @@ -225433,6 +225474,8 @@ uplight uplimb uplimber upline +uplink +upload uplock uplong uplook @@ -232488,6 +232531,7 @@ wimblelike wimbrel wime wimick +wimp wimple wimpleless wimplelike @@ -233075,6 +233119,7 @@ wog wogiet Wogulian woibe +wok wokas woke wokowi @@ -233456,6 +233501,7 @@ workingman workingwoman workless worklessness +workload workloom workman workmanlike From owner-svn-src-stable@freebsd.org Mon Mar 19 03:34:41 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A234CF462BC; Mon, 19 Mar 2018 03:34:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 452257686E; Mon, 19 Mar 2018 03:34:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D7B01599; Mon, 19 Mar 2018 03:34:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3YeqH000387; Mon, 19 Mar 2018 03:34:40 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3Yesa000386; Mon, 19 Mar 2018 03:34:40 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190334.w2J3Yesa000386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:34:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331166 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 331166 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, 19 Mar 2018 03:34:42 -0000 Author: eadler Date: Mon Mar 19 03:34:40 2018 New Revision: 331166 URL: https://svnweb.freebsd.org/changeset/base/331166 Log: MFC r314622: As suggested by several people, note that I prefer to communicate by email. Modified: stable/11/MAINTAINERS Directory Properties: stable/11/ (props changed) Modified: stable/11/MAINTAINERS ============================================================================== --- stable/11/MAINTAINERS Mon Mar 19 03:28:24 2018 (r331165) +++ stable/11/MAINTAINERS Mon Mar 19 03:34:40 2018 (r331166) @@ -49,17 +49,17 @@ dev/usb/wlan adrian Pre-commit review requested, send code, please have patches reviewed by secteam. etc/mail gshapiro Pre-commit review requested. Keep in sync with -STABLE. etc/sendmail gshapiro Pre-commit review requested. Keep in sync with -STABLE. -fetch des Pre-commit review requested. +fetch des Pre-commit review requested, email only. geli pjd Pre-commit review requested (both sys/geom/eli/ and sbin/geom/class/eli/). isci(4) jimharris Pre-commit review requested. iwm(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org iwn(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org kqueue jmg Pre-commit review requested. Documentation Required. libdpv dteske Pre-commit review requested. Keep in sync with dpv(1). -libfetch des Pre-commit review requested. +libfetch des Pre-commit review requested, email only. libfigpar dteske Pre-commit review requested. -libpam des Pre-commit review requested. -linprocfs des Pre-commit review requested. +libpam des Pre-commit review requested, email only. +linprocfs des Pre-commit review requested, email only. lpr gad Pre-commit review requested, particularly for lpd/recvjob.c and lpd/printjob.c. nanobsd imp Pre-commit phabricator review requested. @@ -70,13 +70,13 @@ nvd(4) jimharris Pre-commit review requested. nvme(4) jimharris Pre-commit review requested. nvmecontrol(8) jimharris Pre-commit review requested. opencrypto jmg Pre-commit review requested. Documentation Required. -openssh des Pre-commit review requested. +openssh des Pre-commit review requested, email only. openssl benl,jkim Pre-commit review requested. otus(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org pci bus imp,jhb Pre-commit review requested. pmcstudy(8) rrs Pre-commit review requested. -procfs des Pre-commit review requested. -pseudofs des Pre-commit review requested. +procfs des Pre-commit review requested, email only. +pseudofs des Pre-commit review requested, email only. release/release.sh gjb,re Pre-commit review and regression tests requested. sctp rrs,tuexen Pre-commit review requested (changes need to be backported to github). From owner-svn-src-stable@freebsd.org Mon Mar 19 03:37:00 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B540FF465C8; Mon, 19 Mar 2018 03:37:00 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 66C8B76AEB; Mon, 19 Mar 2018 03:37:00 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6122D159E; Mon, 19 Mar 2018 03:37:00 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3b0AN000634; Mon, 19 Mar 2018 03:37:00 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3b0w4000633; Mon, 19 Mar 2018 03:37:00 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190337.w2J3b0w4000633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331167 - stable/11/lib/msun/src X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/lib/msun/src X-SVN-Commit-Revision: 331167 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, 19 Mar 2018 03:37:01 -0000 Author: eadler Date: Mon Mar 19 03:37:00 2018 New Revision: 331167 URL: https://svnweb.freebsd.org/changeset/base/331167 Log: MFC r326482: lib/msun: remove trailing whitespace from e_pow.c Modified: stable/11/lib/msun/src/e_pow.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/msun/src/e_pow.c ============================================================================== --- stable/11/lib/msun/src/e_pow.c Mon Mar 19 03:34:40 2018 (r331166) +++ stable/11/lib/msun/src/e_pow.c Mon Mar 19 03:37:00 2018 (r331167) @@ -4,7 +4,7 @@ * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. * * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -19,7 +19,7 @@ __FBSDID("$FreeBSD$"); * 1. Compute and return log2(x) in two pieces: * log2(x) = w1 + w2, * where w1 has 53-24 = 29 bit trailing zeros. - * 2. Perform y*log2(x) = n+y' by simulating multi-precision + * 2. Perform y*log2(x) = n+y' by simulating multi-precision * arithmetic, where |y'|<=0.5. * 3. Return x**y = 2**n*exp(y'*log2) * @@ -47,13 +47,13 @@ __FBSDID("$FreeBSD$"); * Accuracy: * pow(x,y) returns x**y nearly rounded. In particular * pow(integer,integer) - * always returns the correct integer provided it is + * always returns the correct integer provided it is * representable. * * Constants : - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -107,14 +107,14 @@ __ieee754_pow(double x, double y) ix = hx&0x7fffffff; iy = hy&0x7fffffff; /* y==zero: x**0 = 1 */ - if((iy|ly)==0) return one; + if((iy|ly)==0) return one; /* x==1: 1**y = 1, even if y is NaN */ if (hx==0x3ff00000 && lx == 0) return one; /* y!=zero: result is NaN if either arg is NaN */ if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || - iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) + iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) return (x+0.0)+(y+0.0); /* determine if y is an odd int when x < 0 @@ -123,7 +123,7 @@ __ieee754_pow(double x, double y) * yisint = 2 ... y is an even int */ yisint = 0; - if(hx<0) { + if(hx<0) { if(iy>=0x43400000) yisint = 2; /* even integer y */ else if(iy>=0x3ff00000) { k = (iy>>20)-0x3ff; /* exponent */ @@ -134,11 +134,11 @@ __ieee754_pow(double x, double y) j = iy>>(20-k); if((j<<(20-k))==iy) yisint = 2-(j&1); } - } - } + } + } /* special value of y */ - if(ly==0) { + if(ly==0) { if (iy==0x7ff00000) { /* y is +-inf */ if(((ix-0x3ff00000)|lx)==0) return one; /* (-1)**+-inf is 1 */ @@ -146,14 +146,14 @@ __ieee754_pow(double x, double y) return (hy>=0)? y: zero; else /* (|x|<1)**-,+inf = inf,0 */ return (hy<0)?-y: zero; - } + } if(iy==0x3ff00000) { /* y is +-1 */ if(hy<0) return one/x; else return x; } if(hy==0x40000000) return x*x; /* y is 2 */ if(hy==0x3fe00000) { /* y is 0.5 */ if(hx>=0) /* x >= +0 */ - return sqrt(x); + return sqrt(x); } } @@ -166,13 +166,13 @@ __ieee754_pow(double x, double y) if(hx<0) { if(((ix-0x3ff00000)|yisint)==0) { z = (z-z)/(z-z); /* (-1)**non-int is NaN */ - } else if(yisint==1) + } else if(yisint==1) z = -z; /* (x<0)**odd = -(|x|**odd) */ } return z; } } - + /* CYGNUS LOCAL + fdlibm-5.3 fix: This used to be n = (hx>>31)+1; but ANSI C says a right shift of a signed negative quantity is @@ -194,7 +194,7 @@ __ieee754_pow(double x, double y) /* over/underflow if x is not close to one */ if(ix<0x3fefffff) return (hy<0)? s*huge*huge:s*tiny*tiny; if(ix>0x3ff00000) return (hy>0)? s*huge*huge:s*tiny*tiny; - /* now |1-x| is tiny <= 2**-20, suffice to compute + /* now |1-x| is tiny <= 2**-20, suffice to compute log(x) by x-x^2/2+x^3/3-x^4/4 */ t = ax-one; /* t has 20 trailing zeros */ w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25)); @@ -287,7 +287,7 @@ __ieee754_pow(double x, double y) n = ((n&0x000fffff)|0x00100000)>>(20-k); if(j<0) n = -n; p_h -= t; - } + } t = p_l+p_h; SET_LOW_WORD(t,0); u = t*lg2_h; From owner-svn-src-stable@freebsd.org Mon Mar 19 03:39:00 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 606BEF467E6; Mon, 19 Mar 2018 03:39:00 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 050A276CCA; Mon, 19 Mar 2018 03:39:00 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F40B615A3; Mon, 19 Mar 2018 03:38:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3cx78000743; Mon, 19 Mar 2018 03:38:59 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3cxak000742; Mon, 19 Mar 2018 03:38:59 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190338.w2J3cxak000742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:38: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: r331168 - stable/11/sys/mips/mips X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/mips/mips X-SVN-Commit-Revision: 331168 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, 19 Mar 2018 03:39:00 -0000 Author: eadler Date: Mon Mar 19 03:38:59 2018 New Revision: 331168 URL: https://svnweb.freebsd.org/changeset/base/331168 Log: MFC r303812: Use a more conventional spelling of "breakpoint". Modified: stable/11/sys/mips/mips/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/mips/mips/trap.c ============================================================================== --- stable/11/sys/mips/mips/trap.c Mon Mar 19 03:37:00 2018 (r331167) +++ stable/11/sys/mips/mips/trap.c Mon Mar 19 03:38:59 2018 (r331168) @@ -854,7 +854,7 @@ dofault: } /* * The restoration of the original instruction and - * the clearing of the berakpoint will be done later + * the clearing of the breakpoint will be done later * by the call to ptrace_clear_single_step() in * issignal() when SIGTRAP is processed. */ From owner-svn-src-stable@freebsd.org Mon Mar 19 03:44:20 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 237A1F46F2E; Mon, 19 Mar 2018 03:44:20 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD4B877231; Mon, 19 Mar 2018 03:44:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8448171D; Mon, 19 Mar 2018 03:44:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3iJiN005692; Mon, 19 Mar 2018 03:44:19 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3iJnu005691; Mon, 19 Mar 2018 03:44:19 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190344.w2J3iJnu005691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:44:19 +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: r331169 - stable/11/share/man/man6 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/man/man6 X-SVN-Commit-Revision: 331169 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, 19 Mar 2018 03:44:20 -0000 Author: eadler Date: Mon Mar 19 03:44:19 2018 New Revision: 331169 URL: https://svnweb.freebsd.org/changeset/base/331169 Log: MFC r326249: Update intro(6) - remove hint that doesn't work, add explicit list of games instead, and mention the "bsdgames" port. Modified: stable/11/share/man/man6/intro.6 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man6/intro.6 ============================================================================== --- stable/11/share/man/man6/intro.6 Mon Mar 19 03:38:59 2018 (r331168) +++ stable/11/share/man/man6/intro.6 Mon Mar 19 03:44:19 2018 (r331169) @@ -27,30 +27,33 @@ .\" .\" $FreeBSD$ .\" -.Dd February 16, 1997 +.Dd November 27, 2017 .Dt INTRO 6 .Os .Sh NAME .Nm intro .Nd "introduction to games" .Sh DESCRIPTION -This section contains information about games. +This section contains information about the traditional BSD games. The games are located in .Pa /usr/bin if installed. -You can get a short overview about all the games with the -command: -.Bd -literal -offset indent -$ apropos '\\(6\\)' -.Ed .Sh FILES .Bl -tag -width /usr/bin -compact .It Pa /usr/bin location of games .El .Sh SEE ALSO -.Xr intro 1 +.Xr intro 1 , +.Xr banner 6 , +.Xr caesar 6 , +.Xr fortune 6 , +.Xr grdc 6 , +.Xr morse 6 , +.Xr number 6 , +.Xr pom 6 , +.Xr random 6 .Sh HISTORY In earlier versions of .Fx , @@ -61,3 +64,5 @@ The .Nm section manual page appeared in .Fx 2.2 . +Most of the games were moved into the bsdgames port in +.Fx 5.0 . From owner-svn-src-stable@freebsd.org Mon Mar 19 03:46:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6B57F4A1E6; Mon, 19 Mar 2018 03:46:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 726D7773D6; Mon, 19 Mar 2018 03:46:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69A951720; Mon, 19 Mar 2018 03:46:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3kDQi005802; Mon, 19 Mar 2018 03:46:13 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3kDdR005800; Mon, 19 Mar 2018 03:46:13 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190346.w2J3kDdR005800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:46: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: r331170 - in stable/11/sys: dev/atkbdc sys X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/sys: dev/atkbdc sys X-SVN-Commit-Revision: 331170 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, 19 Mar 2018 03:46:14 -0000 Author: eadler Date: Mon Mar 19 03:46:12 2018 New Revision: 331170 URL: https://svnweb.freebsd.org/changeset/base/331170 Log: MFC r328636: psm(4): Add support for HP EliteBook 1040 ForcePads. ForcePads do not have any physical buttons, instead they detect click based on finger pressure. Forcepads erroneously report button click if there are 2 or more fingers on the touchpad breaking multifinger gestures. To workaround this start reporting a click only after 4 consecutive single touch packets has been received. Skip these packets in case more contacts appear. PR: 223369 Modified: stable/11/sys/dev/atkbdc/psm.c stable/11/sys/sys/mouse.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Mon Mar 19 03:44:19 2018 (r331169) +++ stable/11/sys/dev/atkbdc/psm.c Mon Mar 19 03:46:12 2018 (r331170) @@ -132,6 +132,13 @@ __FBSDID("$FreeBSD$"); #define PSMCPNP_DRIVER_NAME "psmcpnp" +struct psmcpnp_softc { + enum { + PSMCPNP_GENERIC, + PSMCPNP_FORCEPAD, + } type; /* Based on PnP ID */ +}; + /* input queue */ #define PSM_BUFSIZE 960 #define PSM_SMALLBUFSIZE 240 @@ -416,6 +423,7 @@ struct psm_softc { /* Driver status information */ int squelch; /* level to filter movement at low speed */ int syncerrors; /* # of bytes discarded to synchronize */ int pkterrors; /* # of packets failed during quaranteen. */ + int fpcount; /* forcePad valid packet counter */ struct timeval inputtimeout; struct timeval lastsoftintr; /* time of last soft interrupt */ struct timeval lastinputerr; /* time last sync error happened */ @@ -3183,7 +3191,7 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, static int touchpad_buttons; static int guest_buttons; static finger_t f[PSM_FINGERS]; - int w, id, nfingers, ewcode, extended_buttons; + int w, id, nfingers, ewcode, extended_buttons, clickpad_pressed; extended_buttons = 0; @@ -3445,10 +3453,6 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, extended_buttons |= sc->extended_buttons; } } - /* Handle ClickPad */ - if (sc->synhw.capClickPad && - ((pb->ipacket[0] ^ pb->ipacket[3]) & 0x01)) - touchpad_buttons |= MOUSE_BUTTON1DOWN; if (sc->synhw.capReportsV && nfingers > 1) f[0] = (finger_t) { @@ -3481,6 +3485,36 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, if (f[0].p < sc->syninfo.min_pressure || f[0].x < 2) nfingers = 0; + /* Handle ClickPad */ + if (sc->synhw.capClickPad) { + clickpad_pressed = (pb->ipacket[0] ^ pb->ipacket[3]) & 0x01; + if (sc->synhw.forcePad) { + /* + * Forcepads erroneously report button click if there + * are 2 or more fingers on the touchpad breaking + * multifinger gestures. To workaround this start + * reporting a click only after 4 consecutive single + * touch packets has been received. + * Skip these packets in case more contacts appear. + */ + switch (nfingers) { + case 0: + sc->fpcount = 0; + break; + case 1: + if (clickpad_pressed && sc->fpcount < INT_MAX) + ++sc->fpcount; + /* FALLTHROUGH */ + default: + if (!clickpad_pressed) + sc->fpcount = 0; + if (sc->fpcount >= sc->syninfo.window_min) + touchpad_buttons |= MOUSE_BUTTON1DOWN; + } + } else if (clickpad_pressed) + touchpad_buttons |= MOUSE_BUTTON1DOWN; + } + for (id = 0; id < PSM_FINGERS; id++) if (id >= nfingers) PSM_FINGER_RESET(f[id]); @@ -6004,6 +6038,8 @@ synaptics_set_mode(struct psm_softc *sc, int mode_byte static int enable_synaptics(struct psm_softc *sc, enum probearg arg) { + device_t psmcpnp; + struct psmcpnp_softc *psmcpnp_sc; KBDC kbdc = sc->kbdc; synapticshw_t synhw; int status[3]; @@ -6081,6 +6117,10 @@ enable_synaptics(struct psm_softc *sc, enum probearg a return (FALSE); } + psmcpnp = devclass_get_device(devclass_find(PSMCPNP_DRIVER_NAME), + sc->unit); + psmcpnp_sc = (psmcpnp != NULL) ? device_get_softc(psmcpnp) : NULL; + /* Set the different capabilities when they exist. */ buttons = 0; synhw.capExtended = (status[0] & 0x80) != 0; @@ -6235,6 +6275,20 @@ enable_synaptics(struct psm_softc *sc, enum probearg a synhw.minimumYCoord = 1408; } + /* + * ClickPad properties are not exported through PS/2 + * protocol. Detection is based on controller's PnP ID. + */ + if (synhw.capClickPad && psmcpnp_sc != NULL) { + switch (psmcpnp_sc->type) { + case PSMCPNP_FORCEPAD: + synhw.forcePad = 1; + break; + default: + break; + } + } + if (verbose >= 2) { printf(" Continued capabilities:\n"); printf(" capClickPad: %d\n", @@ -6271,6 +6325,10 @@ enable_synaptics(struct psm_softc *sc, enum probearg a printf(" minimumYCoord: %d\n", synhw.minimumYCoord); } + if (synhw.capClickPad) { + printf(" forcePad: %d\n", + synhw.forcePad); + } } buttons += synhw.capClickPad; } @@ -7096,7 +7154,7 @@ static device_method_t psmcpnp_methods[] = { static driver_t psmcpnp_driver = { PSMCPNP_DRIVER_NAME, psmcpnp_methods, - 1, /* no softc */ + sizeof(struct psmcpnp_softc), }; static struct isa_pnp_id psmcpnp_ids[] = { @@ -7116,6 +7174,13 @@ static struct isa_pnp_id psmcpnp_ids[] = { { 0 } }; +/* _HID list for quirk detection. Any device below has _CID from psmcpnp_ids */ +static struct isa_pnp_id forcepad_ids[] = { + { 0x0d302e4f, "HP PS/2 forcepad port" }, /* SYN300D, EB 1040 */ + { 0x14302e4f, "HP PS/2 forcepad port" }, /* SYN3014, EB 1040 */ + { 0 } +}; + static int create_a_copy(device_t atkbdc, device_t me) { @@ -7142,11 +7207,16 @@ create_a_copy(device_t atkbdc, device_t me) static int psmcpnp_probe(device_t dev) { + struct psmcpnp_softc *sc = device_get_softc(dev); struct resource *res; u_long irq; int rid; - if (ISA_PNP_PROBE(device_get_parent(dev), dev, psmcpnp_ids)) + if (ISA_PNP_PROBE(device_get_parent(dev), dev, forcepad_ids) == 0) + sc->type = PSMCPNP_FORCEPAD; + else if (ISA_PNP_PROBE(device_get_parent(dev), dev, psmcpnp_ids) == 0) + sc->type = PSMCPNP_GENERIC; + else return (ENXIO); /* Modified: stable/11/sys/sys/mouse.h ============================================================================== --- stable/11/sys/sys/mouse.h Mon Mar 19 03:44:19 2018 (r331169) +++ stable/11/sys/sys/mouse.h Mon Mar 19 03:46:12 2018 (r331170) @@ -135,6 +135,7 @@ typedef struct synapticshw { int maximumYCoord; int infoXupmm; int infoYupmm; + int forcePad; } synapticshw_t; /* iftype */ From owner-svn-src-stable@freebsd.org Mon Mar 19 03:47:47 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2025FF4A3C5; Mon, 19 Mar 2018 03:47:47 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C5AB077584; Mon, 19 Mar 2018 03:47:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0AA71724; Mon, 19 Mar 2018 03:47:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3lket005904; Mon, 19 Mar 2018 03:47:46 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3lkOp005903; Mon, 19 Mar 2018 03:47:46 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190347.w2J3lkOp005903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:47:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331171 - stable/11/sys/dev/atkbdc X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/atkbdc X-SVN-Commit-Revision: 331171 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, 19 Mar 2018 03:47:47 -0000 Author: eadler Date: Mon Mar 19 03:47:46 2018 New Revision: 331171 URL: https://svnweb.freebsd.org/changeset/base/331171 Log: MFC r328638: psm(4): Reduce psm watchdog verbosity Modern touchpads do not issue interrupts on inactivity so "lost interrupt" message became annoying spam nowadays. This change quiets the message if debug.psm.loglevel=5 (or less) is set in /boot/loader.conf Approved by: gonzo Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Mon Mar 19 03:46:12 2018 (r331170) +++ stable/11/sys/dev/atkbdc/psm.c Mon Mar 19 03:47:46 2018 (r331171) @@ -2878,7 +2878,7 @@ psmtimeout(void *arg) sc = (struct psm_softc *)arg; s = spltty(); if (sc->watchdog && kbdc_lock(sc->kbdc, TRUE)) { - VLOG(4, (LOG_DEBUG, "psm%d: lost interrupt?\n", sc->unit)); + VLOG(6, (LOG_DEBUG, "psm%d: lost interrupt?\n", sc->unit)); psmintr(sc); kbdc_lock(sc->kbdc, FALSE); } From owner-svn-src-stable@freebsd.org Mon Mar 19 03:49:55 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59421F4A5D7; Mon, 19 Mar 2018 03:49:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0685777711; Mon, 19 Mar 2018 03:49:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 014211726; Mon, 19 Mar 2018 03:49:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3ns6H006011; Mon, 19 Mar 2018 03:49:54 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3nsaa006010; Mon, 19 Mar 2018 03:49:54 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190349.w2J3nsaa006010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:49:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331172 - stable/11/sys/dev/atkbdc X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/atkbdc X-SVN-Commit-Revision: 331172 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, 19 Mar 2018 03:49:55 -0000 Author: eadler Date: Mon Mar 19 03:49:54 2018 New Revision: 331172 URL: https://svnweb.freebsd.org/changeset/base/331172 Log: MFC r328640: psm: Add a kludge to support 0x46 identity middle byte Synaptics touchpads Most synaptics touchpads return 0x47 in middle byte in responce to identify command as stated in p.4.4 of "Synaptics PS/2 TouchPad Interfacing Guide". But some devices e.g. found on HP EliteBook 9470m return 0x46 here. Allow them to be identified as Synaptics as well as 0x47. ExtendedQueries return incorrect data on such a touchpads so we ignore their result and set conservative defaults. PR: 222667 Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Mon Mar 19 03:47:46 2018 (r331171) +++ stable/11/sys/dev/atkbdc/psm.c Mon Mar 19 03:49:54 2018 (r331172) @@ -136,6 +136,7 @@ struct psmcpnp_softc { enum { PSMCPNP_GENERIC, PSMCPNP_FORCEPAD, + PSMCPNP_HPSYN81, } type; /* Based on PnP ID */ }; @@ -174,6 +175,15 @@ typedef struct packetbuf { #define PSM_PACKETQUEUE 128 #endif +/* + * Typical bezel limits. Taken from 'Synaptics + * PS/2 TouchPad Interfacing Guide' p.3.2.3. + */ +#define SYNAPTICS_DEFAULT_MAX_X 5472 +#define SYNAPTICS_DEFAULT_MAX_Y 4448 +#define SYNAPTICS_DEFAULT_MIN_X 1472 +#define SYNAPTICS_DEFAULT_MIN_Y 1408 + typedef struct synapticsinfo { struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; @@ -1096,7 +1106,7 @@ doopen(struct psm_softc *sc, int command_byte) mouse_ext_command(sc->kbdc, 1); get_mouse_status(sc->kbdc, stat, 0, 3); if ((SYNAPTICS_VERSION_GE(sc->synhw, 7, 5) || - stat[1] == 0x47) && + stat[1] == 0x46 || stat[1] == 0x47) && stat[2] == 0x40) { synaptics_set_mode(sc, synaptics_preferred_mode(sc)); VLOG(5, (LOG_DEBUG, "psm%d: Synaptis Absolute Mode " @@ -6043,7 +6053,7 @@ enable_synaptics(struct psm_softc *sc, enum probearg a KBDC kbdc = sc->kbdc; synapticshw_t synhw; int status[3]; - int buttons; + int buttons, middle_byte; VLOG(3, (LOG_DEBUG, "synaptics: BEGIN init\n")); @@ -6060,7 +6070,8 @@ enable_synaptics(struct psm_softc *sc, enum probearg a return (FALSE); if (get_mouse_status(kbdc, status, 0, 3) != 3) return (FALSE); - if (status[1] != 0x47) + middle_byte = status[1]; + if (middle_byte != 0x46 && middle_byte != 0x47) return (FALSE); bzero(&synhw, sizeof(synhw)); @@ -6071,7 +6082,15 @@ enable_synaptics(struct psm_softc *sc, enum probearg a printf("Synaptics Touchpad v%d.%d\n", synhw.infoMajor, synhw.infoMinor); - if (synhw.infoMajor < 4) { + /* + * Most synaptics touchpads return 0x47 in middle byte in responce to + * identify command as stated in p.4.4 of "Synaptics PS/2 TouchPad + * Interfacing Guide" and we only support v4.0 or better. But some + * devices return 0x46 here and have a different numbering scheme. + * In the case of 0x46, we allow versions as low as v2.0 + */ + if ((middle_byte == 0x47 && synhw.infoMajor < 4) || + (middle_byte == 0x46 && synhw.infoMajor < 2)) { printf(" Unsupported (pre-v4) Touchpad detected\n"); return (FALSE); } @@ -6112,7 +6131,7 @@ enable_synaptics(struct psm_softc *sc, enum probearg a return (FALSE); if (get_mouse_status(kbdc, status, 0, 3) != 3) return (FALSE); - if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != 0x47) { + if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != middle_byte) { printf(" Failed to read extended capability bits\n"); return (FALSE); } @@ -6121,10 +6140,29 @@ enable_synaptics(struct psm_softc *sc, enum probearg a sc->unit); psmcpnp_sc = (psmcpnp != NULL) ? device_get_softc(psmcpnp) : NULL; + /* + * Set conservative defaults for 0x46 middle byte touchpads + * as ExtendedQueries return bogus data. + */ + if (middle_byte == 0x46) { + synhw.capExtended = 1; + synhw.capPalmDetect = 1; + synhw.capPassthrough = 1; + synhw.capMultiFinger = 1; + synhw.maximumXCoord = SYNAPTICS_DEFAULT_MAX_X; + synhw.maximumYCoord = SYNAPTICS_DEFAULT_MAX_Y; + synhw.minimumXCoord = SYNAPTICS_DEFAULT_MIN_X; + synhw.minimumYCoord = SYNAPTICS_DEFAULT_MIN_Y; + /* Enable multitouch mode for HW v8.1 devices */ + if (psmcpnp_sc != NULL && + psmcpnp_sc->type == PSMCPNP_HPSYN81) + synhw.capReportsV = 1; + } else + synhw.capExtended = (status[0] & 0x80) != 0; + /* Set the different capabilities when they exist. */ buttons = 0; - synhw.capExtended = (status[0] & 0x80) != 0; - if (synhw.capExtended) { + if (synhw.capExtended && middle_byte == 0x47) { synhw.nExtendedQueries = (status[0] & 0x70) >> 4; synhw.capMiddle = (status[0] & 0x04) != 0; synhw.capPassthrough = (status[2] & 0x80) != 0; @@ -6246,12 +6284,8 @@ enable_synaptics(struct psm_softc *sc, enum probearg a synhw.maximumYCoord = (status[2] << 5) | ((status[1] & 0xf0) >> 3); } else { - /* - * Typical bezel limits. Taken from 'Synaptics - * PS/2 * TouchPad Interfacing Guide' p.3.2.3. - */ - synhw.maximumXCoord = 5472; - synhw.maximumYCoord = 4448; + synhw.maximumXCoord = SYNAPTICS_DEFAULT_MAX_X; + synhw.maximumYCoord = SYNAPTICS_DEFAULT_MAX_Y; } if (synhw.capReportsMin) { @@ -6267,12 +6301,8 @@ enable_synaptics(struct psm_softc *sc, enum probearg a synhw.minimumYCoord = (status[2] << 5) | ((status[1] & 0xf0) >> 3); } else { - /* - * Typical bezel limits. Taken from 'Synaptics - * PS/2 * TouchPad Interfacing Guide' p.3.2.3. - */ - synhw.minimumXCoord = 1472; - synhw.minimumYCoord = 1408; + synhw.minimumXCoord = SYNAPTICS_DEFAULT_MIN_X; + synhw.minimumYCoord = SYNAPTICS_DEFAULT_MIN_Y; } /* @@ -6358,7 +6388,7 @@ enable_synaptics(struct psm_softc *sc, enum probearg a return (FALSE); if (get_mouse_status(kbdc, status, 0, 3) != 3) return (FALSE); - if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != 0x47) { + if (!SYNAPTICS_VERSION_GE(synhw, 7, 5) && status[1] != middle_byte) { printf(" Failed to read mode byte\n"); return (FALSE); } @@ -7181,6 +7211,12 @@ static struct isa_pnp_id forcepad_ids[] = { { 0 } }; +/* List of HW v8.1 synaptics touchpads erroneously detected as HW v2.0 */ +static struct isa_pnp_id hpsyn81_ids[] = { + { 0x9e012e4f, "HP PS/2 trackpad port" }, /* SYN019E, EB 9470 */ + { 0 } +}; + static int create_a_copy(device_t atkbdc, device_t me) { @@ -7214,6 +7250,8 @@ psmcpnp_probe(device_t dev) if (ISA_PNP_PROBE(device_get_parent(dev), dev, forcepad_ids) == 0) sc->type = PSMCPNP_FORCEPAD; + else if(ISA_PNP_PROBE(device_get_parent(dev), dev, hpsyn81_ids) == 0) + sc->type = PSMCPNP_HPSYN81; else if (ISA_PNP_PROBE(device_get_parent(dev), dev, psmcpnp_ids) == 0) sc->type = PSMCPNP_GENERIC; else From owner-svn-src-stable@freebsd.org Mon Mar 19 03:53:47 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F451F4AB2B; Mon, 19 Mar 2018 03:53:47 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E062577C54; Mon, 19 Mar 2018 03:53:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D985D18BE; Mon, 19 Mar 2018 03:53:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3rkBp010902; Mon, 19 Mar 2018 03:53:46 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3rkeF010901; Mon, 19 Mar 2018 03:53:46 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190353.w2J3rkeF010901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331173 - stable/11/sys/dev/acpi_support X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/acpi_support X-SVN-Commit-Revision: 331173 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, 19 Mar 2018 03:53:47 -0000 Author: eadler Date: Mon Mar 19 03:53:46 2018 New Revision: 331173 URL: https://svnweb.freebsd.org/changeset/base/331173 Log: MFC r312887: Hide unneeded message under bootverbose. Modified: stable/11/sys/dev/acpi_support/acpi_panasonic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/acpi_support/acpi_panasonic.c ============================================================================== --- stable/11/sys/dev/acpi_support/acpi_panasonic.c Mon Mar 19 03:49:54 2018 (r331172) +++ stable/11/sys/dev/acpi_support/acpi_panasonic.c Mon Mar 19 03:53:46 2018 (r331173) @@ -493,6 +493,10 @@ acpi_panasonic_notify(ACPI_HANDLE h, UINT32 notify, vo } ACPI_SERIAL_END(panasonic); break; + case 0x81: + if (!bootverbose) + break; + /* FALLTHROUGH */ default: device_printf(sc->dev, "unknown notify: %#x\n", notify); break; From owner-svn-src-stable@freebsd.org Mon Mar 19 03:55:43 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3ECA2F4AE45; Mon, 19 Mar 2018 03:55:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E506677EA5; Mon, 19 Mar 2018 03:55:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFD6618C1; Mon, 19 Mar 2018 03:55:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3tgKf011034; Mon, 19 Mar 2018 03:55:42 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3tgd4011033; Mon, 19 Mar 2018 03:55:42 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190355.w2J3tgd4011033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:55: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: r331174 - stable/11/lib/libc/stdlib X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/lib/libc/stdlib X-SVN-Commit-Revision: 331174 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, 19 Mar 2018 03:55:43 -0000 Author: eadler Date: Mon Mar 19 03:55:42 2018 New Revision: 331174 URL: https://svnweb.freebsd.org/changeset/base/331174 Log: MFC r328785: Use standard 2-clause license where copyright is held by the FreeBSD Foundation Modified: stable/11/lib/libc/stdlib/strtold.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/stdlib/strtold.c ============================================================================== --- stable/11/lib/libc/stdlib/strtold.c Mon Mar 19 03:53:46 2018 (r331173) +++ stable/11/lib/libc/stdlib/strtold.c Mon Mar 19 03:55:42 2018 (r331174) @@ -1,11 +1,12 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2011 The FreeBSD Foundation + * Copyright (C) 2011 The FreeBSD Foundation * All rights reserved. - * Portions of this software were developed by David Chisnall - * under sponsorship from the FreeBSD Foundation. * + * This software was developed by David Chisnall under sponsorship from the + * FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -14,14 +15,11 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) From owner-svn-src-stable@freebsd.org Mon Mar 19 03:57:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7110F4B05F; Mon, 19 Mar 2018 03:57:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74E647802D; Mon, 19 Mar 2018 03:57:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FF8118C4; Mon, 19 Mar 2018 03:57:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J3vE3j011136; Mon, 19 Mar 2018 03:57:14 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J3vEFj011135; Mon, 19 Mar 2018 03:57:14 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190357.w2J3vEFj011135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 03:57: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: r331175 - stable/11/sys/dev/extres/clk X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/extres/clk X-SVN-Commit-Revision: 331175 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, 19 Mar 2018 03:57:15 -0000 Author: eadler Date: Mon Mar 19 03:57:14 2018 New Revision: 331175 URL: https://svnweb.freebsd.org/changeset/base/331175 Log: MFC r328586: Use more verbose panic messages. Modified: stable/11/sys/dev/extres/clk/clk.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/extres/clk/clk.c ============================================================================== --- stable/11/sys/dev/extres/clk/clk.c Mon Mar 19 03:55:42 2018 (r331174) +++ stable/11/sys/dev/extres/clk/clk.c Mon Mar 19 03:57:14 2018 (r331175) @@ -585,10 +585,11 @@ clknode_adjust_parent(struct clknode *clknode, int idx if (clknode->parent_cnt == 0) return; if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt)) - panic("Invalid clock parent index\n"); + panic("%s: Invalid parent index %d for clock %s", + __func__, idx, clknode->name); if (clknode->parents[idx] == NULL) - panic("%s: Attempt to set invalid parent %d for clock %s", + panic("%s: Invalid parent index %d for clock %s", __func__, idx, clknode->name); /* Remove me from old children list. */ @@ -617,8 +618,8 @@ clknode_init_parent_idx(struct clknode *clknode, int i if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt) || (clknode->parent_names[idx] == NULL)) - panic("%s: Invalid clock parent index: %d\n", __func__, idx); - + panic("%s: Invalid parent index %d for clock %s", + __func__, idx, clknode->name); clknode->parent_idx = idx; } From owner-svn-src-stable@freebsd.org Mon Mar 19 04:03:56 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17635F4B8DB; Mon, 19 Mar 2018 04:03:56 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD3C3785B3; Mon, 19 Mar 2018 04:03:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CCEE1A3D; Mon, 19 Mar 2018 04:03:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J43tbo015998; Mon, 19 Mar 2018 04:03:55 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J43tUX015995; Mon, 19 Mar 2018 04:03:55 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190403.w2J43tUX015995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 04:03: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: r331176 - in stable/11/sys/dev/usb: net serial X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/sys/dev/usb: net serial X-SVN-Commit-Revision: 331176 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, 19 Mar 2018 04:03:56 -0000 Author: eadler Date: Mon Mar 19 04:03:55 2018 New Revision: 331176 URL: https://svnweb.freebsd.org/changeset/base/331176 Log: MFC r328162: Improve support for USB based 3G/4G/5G dongles from Huawei. PR: 192345 Modified: stable/11/sys/dev/usb/net/if_cdce.c stable/11/sys/dev/usb/serial/u3g.c stable/11/sys/dev/usb/serial/umodem.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/net/if_cdce.c ============================================================================== --- stable/11/sys/dev/usb/net/if_cdce.c Mon Mar 19 03:57:14 2018 (r331175) +++ stable/11/sys/dev/usb/net/if_cdce.c Mon Mar 19 04:03:55 2018 (r331176) @@ -286,6 +286,9 @@ static const STRUCT_USB_HOST_ID cdce_host_devs[] = { {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x76), USB_DRIVER_INFO(0)}, + {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(0x03), USB_IFACE_PROTOCOL(0x16), + USB_DRIVER_INFO(0)}, }; static const STRUCT_USB_DUAL_ID cdce_dual_devs[] = { Modified: stable/11/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/11/sys/dev/usb/serial/u3g.c Mon Mar 19 03:57:14 2018 (r331175) +++ stable/11/sys/dev/usb/serial/u3g.c Mon Mar 19 04:03:55 2018 (r331176) @@ -307,7 +307,7 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = { U3G_DEV(HUAWEI, E173, 0), U3G_DEV(HUAWEI, E173_INIT, U3GINIT_HUAWEISCSI), U3G_DEV(HUAWEI, E3131, 0), - U3G_DEV(HUAWEI, E3131_INIT, U3GINIT_HUAWEISCSI), + U3G_DEV(HUAWEI, E3131_INIT, U3GINIT_HUAWEISCSI2), U3G_DEV(HUAWEI, E180V, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220BIS, U3GINIT_HUAWEI), @@ -326,6 +326,8 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = { U3G_DEV(HUAWEI, K4505, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, K4505_INIT, U3GINIT_HUAWEISCSI), U3G_DEV(HUAWEI, ETS2055, U3GINIT_HUAWEI), + U3G_DEV(HUAWEI, E3272_INIT, U3GINIT_HUAWEISCSI2), + U3G_DEV(HUAWEI, E3272, 0), U3G_DEV(KYOCERA2, CDMA_MSM_K, 0), U3G_DEV(KYOCERA2, KPC680, 0), U3G_DEV(LONGCHEER, WM66, U3GINIT_HUAWEI), @@ -628,6 +630,45 @@ u3g_huawei_init(struct usb_device *udev) return (0); } +static int +u3g_huawei_is_cdce(uint16_t idVendor, uint8_t bInterfaceSubClass, + uint8_t bInterfaceProtocol) +{ + /* + * This function returns non-zero if the interface being + * probed is of type CDC ethernet, which the U3G driver should + * not attach to. See sys/dev/usb/net/if_cdce.c for matching + * entries. + */ + if (idVendor != USB_VENDOR_HUAWEI) + goto done; + + switch (bInterfaceSubClass) { + case 0x02: + switch (bInterfaceProtocol) { + case 0x16: + case 0x46: + case 0x76: + return (1); + default: + break; + } + break; + case 0x03: + switch (bInterfaceProtocol) { + case 0x16: + return (1); + default: + break; + } + break; + default: + break; + } +done: + return (0); +} + static void u3g_sael_m460_init(struct usb_device *udev) { @@ -841,6 +882,10 @@ u3g_probe(device_t self) if (uaa->info.bInterfaceClass != UICLASS_VENDOR) { return (ENXIO); } + if (u3g_huawei_is_cdce(uaa->info.idVendor, uaa->info.bInterfaceSubClass, + uaa->info.bInterfaceProtocol)) { + return (ENXIO); + } return (usbd_lookup_id_by_uaa(u3g_devs, sizeof(u3g_devs), uaa)); } @@ -883,6 +928,9 @@ u3g_attach(device_t dev) break; id = usbd_get_interface_descriptor(iface); if (id == NULL || id->bInterfaceClass != UICLASS_VENDOR) + continue; + if (u3g_huawei_is_cdce(uaa->info.idVendor, + id->bInterfaceSubClass, id->bInterfaceProtocol)) continue; usbd_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex); iface_valid |= (1< Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B305F4BBDD; Mon, 19 Mar 2018 04:06:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 39EB378790; Mon, 19 Mar 2018 04:06:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A95B1A3F; Mon, 19 Mar 2018 04:06:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J46IsE016142; Mon, 19 Mar 2018 04:06:18 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J46IZP016141; Mon, 19 Mar 2018 04:06:18 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190406.w2J46IZP016141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 04: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: r331177 - stable/11/sys/cam/scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/cam/scsi X-SVN-Commit-Revision: 331177 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, 19 Mar 2018 04:06:19 -0000 Author: eadler Date: Mon Mar 19 04:06:18 2018 New Revision: 331177 URL: https://svnweb.freebsd.org/changeset/base/331177 Log: MFC r328262: This comment is bogus. This is a legit release. Modified: stable/11/sys/cam/scsi/scsi_da.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_da.c Mon Mar 19 04:03:55 2018 (r331176) +++ stable/11/sys/cam/scsi/scsi_da.c Mon Mar 19 04:06:18 2018 (r331177) @@ -2981,7 +2981,7 @@ more: if (cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { cam_iosched_clr_work_flags(softc->cam_iosched, DA_WORK_TUR); - cam_periph_release_locked(periph); /* XXX is this still valid? I think so but unverified */ + cam_periph_release_locked(periph); } if ((bp->bio_flags & BIO_ORDERED) != 0 || From owner-svn-src-stable@freebsd.org Mon Mar 19 04:08:23 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F2F1F4BE22; Mon, 19 Mar 2018 04:08:23 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E5A7D78927; Mon, 19 Mar 2018 04:08:22 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1C0A1A40; Mon, 19 Mar 2018 04:08:22 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J48MvA016257; Mon, 19 Mar 2018 04:08:22 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J48MvX016256; Mon, 19 Mar 2018 04:08:22 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190408.w2J48MvX016256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 04:08: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: r331178 - stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt X-SVN-Commit-Revision: 331178 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, 19 Mar 2018 04:08:23 -0000 Author: eadler Date: Mon Mar 19 04:08:22 2018 New Revision: 331178 URL: https://svnweb.freebsd.org/changeset/base/331178 Log: MFC r313264: Avoid using Sun compiler-specific flags. Modified: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh Mon Mar 19 04:06:18 2018 (r331177) +++ stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh Mon Mar 19 04:08:22 2018 (r331178) @@ -77,7 +77,7 @@ main(int argc, char **argv) } EOF -cc -c -xO2 test.c +cc -c -O2 test.c if [ $? -ne 0 ]; then print -u2 "failed to compile test.c" exit 1 From owner-svn-src-stable@freebsd.org Mon Mar 19 04:16:38 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C94EAF4C88A; Mon, 19 Mar 2018 04:16:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D65478E6A; Mon, 19 Mar 2018 04:16:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73B991BB7; Mon, 19 Mar 2018 04:16:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J4Gcr1021141; Mon, 19 Mar 2018 04:16:38 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J4Gbqt021135; Mon, 19 Mar 2018 04:16:37 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190416.w2J4Gbqt021135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 04:16:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331179 - stable/11/sbin/dhclient X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sbin/dhclient X-SVN-Commit-Revision: 331179 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, 19 Mar 2018 04:16:39 -0000 Author: eadler Date: Mon Mar 19 04:16:37 2018 New Revision: 331179 URL: https://svnweb.freebsd.org/changeset/base/331179 Log: MFC r305306: dhclient: add support for interface-mtu (26) Make dhclient set interface MTU if it was provided. This version implements MTU setting in dhclient itself before it runs dhclient-script. PR: 206721 Modified: stable/11/sbin/dhclient/clparse.c stable/11/sbin/dhclient/dhclient.c stable/11/sbin/dhclient/dhcpd.h stable/11/sbin/dhclient/dispatch.c stable/11/sbin/dhclient/privsep.c stable/11/sbin/dhclient/privsep.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/dhclient/clparse.c ============================================================================== --- stable/11/sbin/dhclient/clparse.c Mon Mar 19 04:08:22 2018 (r331178) +++ stable/11/sbin/dhclient/clparse.c Mon Mar 19 04:16:37 2018 (r331179) @@ -104,6 +104,8 @@ read_client_conf(void) [top_level_config.requested_option_count++] = DHO_HOST_NAME; top_level_config.requested_options [top_level_config.requested_option_count++] = DHO_DOMAIN_SEARCH; + top_level_config.requested_options + [top_level_config.requested_option_count++] = DHO_INTERFACE_MTU; if ((cfile = fopen(path_dhclient_conf, "r")) != NULL) { do { Modified: stable/11/sbin/dhclient/dhclient.c ============================================================================== --- stable/11/sbin/dhclient/dhclient.c Mon Mar 19 04:08:22 2018 (r331178) +++ stable/11/sbin/dhclient/dhclient.c Mon Mar 19 04:16:37 2018 (r331179) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include "privsep.h" #include +#include #include @@ -138,6 +139,9 @@ int fork_privchld(int, int); ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) +/* Minimum MTU is 68 as per RFC791, p. 24 */ +#define MIN_MTU 68 + static time_t scripttime; int @@ -820,8 +824,19 @@ dhcpack(struct packet *packet) void bind_lease(struct interface_info *ip) { + struct option_data *opt; + /* Remember the medium. */ ip->client->new->medium = ip->client->medium; + + opt = &ip->client->new->options[DHO_INTERFACE_MTU]; + if (opt->len == sizeof(u_int16_t)) { + u_int16_t mtu = be16dec(opt->data); + if (mtu < MIN_MTU) + warning("mtu size %u < %d: ignored", (unsigned)mtu, MIN_MTU); + else + interface_set_mtu_unpriv(privfd, mtu); + } /* Write out the new lease. */ write_client_lease(ip, ip->client->new, 0); Modified: stable/11/sbin/dhclient/dhcpd.h ============================================================================== --- stable/11/sbin/dhclient/dhcpd.h Mon Mar 19 04:08:22 2018 (r331178) +++ stable/11/sbin/dhclient/dhcpd.h Mon Mar 19 04:16:37 2018 (r331179) @@ -321,6 +321,8 @@ void cancel_timeout(void (*)(void *), void *); void add_protocol(char *, int, void (*)(struct protocol *), void *); void remove_protocol(struct protocol *); int interface_link_status(char *); +void interface_set_mtu_unpriv(int, u_int16_t); +void interface_set_mtu_priv(char *, u_int16_t); /* hash.c */ struct hash_table *new_hash(void); Modified: stable/11/sbin/dhclient/dispatch.c ============================================================================== --- stable/11/sbin/dhclient/dispatch.c Mon Mar 19 04:08:22 2018 (r331178) +++ stable/11/sbin/dhclient/dispatch.c Mon Mar 19 04:16:37 2018 (r331179) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include "dhcpd.h" +#include "privsep.h" #include @@ -498,4 +499,47 @@ interface_link_status(char *ifname) } } return (1); +} + +void +interface_set_mtu_unpriv(int privfd, u_int16_t mtu) +{ + struct imsg_hdr hdr; + struct buf *buf; + int errs = 0; + + hdr.code = IMSG_SET_INTERFACE_MTU; + hdr.len = sizeof(hdr) + + sizeof(u_int16_t); + + if ((buf = buf_open(hdr.len)) == NULL) + error("buf_open: %m"); + + errs += buf_add(buf, &hdr, sizeof(hdr)); + errs += buf_add(buf, &mtu, sizeof(mtu)); + if (errs) + error("buf_add: %m"); + + if (buf_close(privfd, buf) == -1) + error("buf_close: %m"); +} + +void +interface_set_mtu_priv(char *ifname, u_int16_t mtu) +{ + struct ifreq ifr; + int sock; + + if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + error("Can't create socket"); + + memset(&ifr, 0, sizeof(ifr)); + + strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + ifr.ifr_mtu = mtu; + + if (ioctl(sock, SIOCSIFMTU, &ifr) == -1) + warning("SIOCSIFMTU failed (%d): %s", mtu, + strerror(errno)); + close(sock); } Modified: stable/11/sbin/dhclient/privsep.c ============================================================================== --- stable/11/sbin/dhclient/privsep.c Mon Mar 19 04:08:22 2018 (r331178) +++ stable/11/sbin/dhclient/privsep.c Mon Mar 19 04:16:37 2018 (r331179) @@ -112,6 +112,7 @@ dispatch_imsg(struct interface_info *ifi, int fd) struct client_lease lease; int ret, i; struct buf *buf; + u_int16_t mtu; buf_read(fd, &hdr, sizeof(hdr)); @@ -235,6 +236,13 @@ dispatch_imsg(struct interface_info *ifi, int fd) break; case IMSG_SEND_PACKET: send_packet_priv(ifi, &hdr, fd); + break; + case IMSG_SET_INTERFACE_MTU: + if (hdr.len < sizeof(hdr) + sizeof(u_int16_t)) + error("corrupted message received"); + + buf_read(fd, &mtu, sizeof(u_int16_t)); + interface_set_mtu_priv(ifi->name, mtu); break; default: error("received unknown message, code %d", hdr.code); Modified: stable/11/sbin/dhclient/privsep.h ============================================================================== --- stable/11/sbin/dhclient/privsep.h Mon Mar 19 04:08:22 2018 (r331178) +++ stable/11/sbin/dhclient/privsep.h Mon Mar 19 04:16:37 2018 (r331179) @@ -36,7 +36,8 @@ enum imsg_code { IMSG_SCRIPT_WRITE_PARAMS, IMSG_SCRIPT_GO, IMSG_SCRIPT_GO_RET, - IMSG_SEND_PACKET + IMSG_SEND_PACKET, + IMSG_SET_INTERFACE_MTU, }; struct imsg_hdr { From owner-svn-src-stable@freebsd.org Mon Mar 19 06:37:59 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1543F54B4E; Mon, 19 Mar 2018 06:37:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8016B7D7B1; Mon, 19 Mar 2018 06:37:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AC8B30A9; Mon, 19 Mar 2018 06:37:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6bxsh091123; Mon, 19 Mar 2018 06:37:59 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6bxxW091122; Mon, 19 Mar 2018 06:37:59 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190637.w2J6bxxW091122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:37: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: r331181 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 331181 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, 19 Mar 2018 06:38:00 -0000 Author: eadler Date: Mon Mar 19 06:37:59 2018 New Revision: 331181 URL: https://svnweb.freebsd.org/changeset/base/331181 Log: MFC r328300: copyright.h: Update license text to 'THE AUTHOR' This matches the license text at https://www.freebsd.org/copyright/freebsd-license.html Modified: stable/11/sys/sys/copyright.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/copyright.h ============================================================================== --- stable/11/sys/sys/copyright.h Mon Mar 19 05:49:26 2018 (r331180) +++ stable/11/sys/sys/copyright.h Mon Mar 19 06:37:59 2018 (r331181) @@ -12,10 +12,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) From owner-svn-src-stable@freebsd.org Mon Mar 19 06:40:13 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51E66F54C51; Mon, 19 Mar 2018 06:40:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF7A27D918; Mon, 19 Mar 2018 06:40:12 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E5F9330AD; Mon, 19 Mar 2018 06:40:12 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6eCoG091273; Mon, 19 Mar 2018 06:40:12 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6eCoe091267; Mon, 19 Mar 2018 06:40:12 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190640.w2J6eCoe091267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:40: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: r331182 - in stable/11/sys: arm/allwinner arm/allwinner/a10 dev/iicbus/twsi X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/sys: arm/allwinner arm/allwinner/a10 dev/iicbus/twsi X-SVN-Commit-Revision: 331182 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, 19 Mar 2018 06:40:13 -0000 Author: eadler Date: Mon Mar 19 06:40:11 2018 New Revision: 331182 URL: https://svnweb.freebsd.org/changeset/base/331182 Log: MFC r327184: Change the remaining files using my personnal email address to my freebsd one Modified: stable/11/sys/arm/allwinner/a10/a10_intc.c stable/11/sys/arm/allwinner/allwinner_pinctrl.h stable/11/sys/arm/allwinner/aw_mp.c stable/11/sys/arm/allwinner/aw_mp.h stable/11/sys/arm/allwinner/aw_wdog.c stable/11/sys/dev/iicbus/twsi/a10_twsi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/a10/a10_intc.c ============================================================================== --- stable/11/sys/arm/allwinner/a10/a10_intc.c Mon Mar 19 06:37:59 2018 (r331181) +++ stable/11/sys/arm/allwinner/a10/a10_intc.c Mon Mar 19 06:40:11 2018 (r331182) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2012 Ganbold Tsagaankhuu - * Copyright (c) 2016 Emmanuel Vadot + * Copyright (c) 2016 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/11/sys/arm/allwinner/allwinner_pinctrl.h ============================================================================== --- stable/11/sys/arm/allwinner/allwinner_pinctrl.h Mon Mar 19 06:37:59 2018 (r331181) +++ stable/11/sys/arm/allwinner/allwinner_pinctrl.h Mon Mar 19 06:40:11 2018 (r331182) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Emmanuel Vadot + * Copyright (c) 2016 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/11/sys/arm/allwinner/aw_mp.c ============================================================================== --- stable/11/sys/arm/allwinner/aw_mp.c Mon Mar 19 06:37:59 2018 (r331181) +++ stable/11/sys/arm/allwinner/aw_mp.c Mon Mar 19 06:40:11 2018 (r331182) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Ganbold Tsagaankhuu - * Copyright (c) 2016 Emmanuel Vadot + * Copyright (c) 2016 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/11/sys/arm/allwinner/aw_mp.h ============================================================================== --- stable/11/sys/arm/allwinner/aw_mp.h Mon Mar 19 06:37:59 2018 (r331181) +++ stable/11/sys/arm/allwinner/aw_mp.h Mon Mar 19 06:40:11 2018 (r331182) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Emmanuel Vadot + * Copyright (c) 2016 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/11/sys/arm/allwinner/aw_wdog.c ============================================================================== --- stable/11/sys/arm/allwinner/aw_wdog.c Mon Mar 19 06:37:59 2018 (r331181) +++ stable/11/sys/arm/allwinner/aw_wdog.c Mon Mar 19 06:40:11 2018 (r331182) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2013 Oleksandr Tymoshenko - * Copyright (c) 2016 Emmanuel Vadot + * Copyright (c) 2016 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/11/sys/dev/iicbus/twsi/a10_twsi.c ============================================================================== --- stable/11/sys/dev/iicbus/twsi/a10_twsi.c Mon Mar 19 06:37:59 2018 (r331181) +++ stable/11/sys/dev/iicbus/twsi/a10_twsi.c Mon Mar 19 06:40:11 2018 (r331182) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Emmanuel Vadot + * Copyright (c) 2016 Emmanuel Vadot * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-stable@freebsd.org Mon Mar 19 06:45:41 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0506BF55013; Mon, 19 Mar 2018 06:45:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A236F7DDED; Mon, 19 Mar 2018 06:45:40 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95D0C3220; Mon, 19 Mar 2018 06:45:40 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6jeMN096191; Mon, 19 Mar 2018 06:45:40 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6jegR096190; Mon, 19 Mar 2018 06:45:40 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190645.w2J6jegR096190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:45:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331183 - stable/11/usr.sbin/vidcontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.sbin/vidcontrol X-SVN-Commit-Revision: 331183 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, 19 Mar 2018 06:45:41 -0000 Author: eadler Date: Mon Mar 19 06:45:40 2018 New Revision: 331183 URL: https://svnweb.freebsd.org/changeset/base/331183 Log: MFC r316422: Remove checks that background (bg) colors are not bright and buggy attempts to keep them that way. The bg brightness bit is interpreted as blinking in some modes, but it would barely be useful to disallow setting it when it would give blinking in code which knew when that is. The old code mostly knew this wrong, and added handling errors. It is in fact impossible to know, since future mode switches may change the meaning of the bit many times on the screen and in history. Old versions of vidcontrol disallowed bg color numbers >= 8 in all cases. This is very VGA/syscons-centric. Syscons uses the VGA defaults of blinking fg instead of bright bg in text mode and bright bg in graphics mode. On VGA, this is very easy to toggle at any time, and vt blows away the VGA text mode default at boot time. r146736 changed this to try to allow bg color numbers in graphics mode only. This is even more VGA/syscons-centric, and there are many bugs in this, and many nearby bugs in the parser. These are increased or decreased by differences and bugs in vt and teken. Perhaps the most obvious bug was that almost any vidcontrol command which changes any color or the mode causes an error if the initial fg color is bright. E.g., in syscons text mode, after "vidcontrol lightwhite" to make the fg bright, another "vidcontrol lightwhite" is rejected and buggy fixup code changes the fg to white. This is because the bright fg color creates a bright bg color for the phantom reverse video attribute, so was rejected. (The reverse video attribute is phantom because teken ignores the user's setting of it and simply reverses the fg attributes to create the bg attributes. Sometimes some layer masks off the brightness/blinking bit, but not here.) Perhaps the next most obvious one was that "vidcontrol lightgreen lightblue" was misparsed as 2 settings of the fg instead of 1 setting of the fg and 1 invalid setting of the bg. This is because the parser supports an undocumented syntax with many parsing bugs (an ambiguity gives this one). I recently fix bugs in teken that broke setting of bright fg's and bg's in the normal way. This gave more settings of then, so the old bugs showed up more often. Modified: stable/11/usr.sbin/vidcontrol/vidcontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/vidcontrol/vidcontrol.c ============================================================================== --- stable/11/usr.sbin/vidcontrol/vidcontrol.c Mon Mar 19 06:40:11 2018 (r331182) +++ stable/11/usr.sbin/vidcontrol/vidcontrol.c Mon Mar 19 06:45:40 2018 (r331183) @@ -852,8 +852,7 @@ get_normal_colors(int argc, char **argv, int *_index) normal_fore_color=color; colors_changed = 1; if (*_index < argc - && (color = get_color_number(argv[*_index])) != -1 - && color < 8) { + && (color = get_color_number(argv[*_index])) != -1) { (*_index)++; fprintf(stderr, "\033[=%dG", color); normal_back_color=color; @@ -876,8 +875,7 @@ get_reverse_colors(int argc, char **argv, int *_index) revers_fore_color=color; colors_changed = 1; if (*_index < argc - && (color = get_color_number(argv[*_index])) != -1 - && color < 8) { + && (color = get_color_number(argv[*_index])) != -1) { (*_index)++; fprintf(stderr, "\033[=%dI", color); revers_back_color=color; @@ -1489,18 +1487,8 @@ main(int argc, char **argv) get_normal_colors(argc, argv, &optind); - if (colors_changed || video_mode_changed) { - if (!(new_mode_info.vi_flags & V_INFO_GRAPHICS)) { - if ((normal_back_color < 8) && (revers_back_color < 8)) { - set_colors(); - } else { - revert(); - errx(1, "bg color for text modes must be < 8"); - } - } else { - set_colors(); - } - } + if (colors_changed || video_mode_changed) + set_colors(); if ((optind != argc) || (argc == 1)) usage(); From owner-svn-src-stable@freebsd.org Mon Mar 19 06:49:50 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CD5AF55258; Mon, 19 Mar 2018 06:49:50 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A21927E07F; Mon, 19 Mar 2018 06:49:49 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C4F43223; Mon, 19 Mar 2018 06:49:49 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6nnTF096461; Mon, 19 Mar 2018 06:49:49 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6nnl9096460; Mon, 19 Mar 2018 06:49:49 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190649.w2J6nnl9096460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:49:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331184 - stable/11/sys/powerpc/powerpc X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/powerpc/powerpc X-SVN-Commit-Revision: 331184 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, 19 Mar 2018 06:49:50 -0000 Author: eadler Date: Mon Mar 19 06:49:49 2018 New Revision: 331184 URL: https://svnweb.freebsd.org/changeset/base/331184 Log: MFC r326859: Add identifier for POWER9 CPU to CPU list Without the identifier in the list booting FreeBSD results in printing the following (from a PowerKVM boot): cpu0: Unknown PowerPC CPU revision 0x1201, 2550.00 MHz For now, add the same feature list as POWER8. As new capabilities are added to support POWER9 specific features, they will be added to this. PR: 224344 Modified: stable/11/sys/powerpc/powerpc/cpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/powerpc/cpu.c ============================================================================== --- stable/11/sys/powerpc/powerpc/cpu.c Mon Mar 19 06:45:40 2018 (r331183) +++ stable/11/sys/powerpc/powerpc/cpu.c Mon Mar 19 06:49:49 2018 (r331184) @@ -163,6 +163,12 @@ static const struct cputab models[] = { PPC_FEATURE_HAS_VSX, PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM | PPC_FEATURE2_HAS_VCRYPTO, NULL }, + { "IBM POWER9", IBMPOWER9, REVFMT_MAJMIN, + PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU | + PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 | + PPC_FEATURE_HAS_VSX, + PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM | PPC_FEATURE2_ISEL | + PPC_FEATURE2_HAS_VCRYPTO, NULL }, { "Motorola PowerPC 7400", MPC7400, REVFMT_MAJMIN, PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 7410", MPC7410, REVFMT_MAJMIN, From owner-svn-src-stable@freebsd.org Mon Mar 19 06:54:18 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD68AF555FB; Mon, 19 Mar 2018 06:54:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 806817E5DE; Mon, 19 Mar 2018 06:54:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 77D6033B3; Mon, 19 Mar 2018 06:54:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6sHUA001518; Mon, 19 Mar 2018 06:54:17 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6sGMo001507; Mon, 19 Mar 2018 06:54:16 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190654.w2J6sGMo001507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:54: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: r331185 - in stable/11/lib/libc: gen sys X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/lib/libc: gen sys X-SVN-Commit-Revision: 331185 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, 19 Mar 2018 06:54:18 -0000 Author: eadler Date: Mon Mar 19 06:54:16 2018 New Revision: 331185 URL: https://svnweb.freebsd.org/changeset/base/331185 Log: MFC r326437: Correct history for Unix 2nd Edition through 6th Edition for the system calls. Man pages are missing for v2 and v5, so any entries for those versions were inferred by new implementations of these functions in libc. Modified: stable/11/lib/libc/gen/signal.3 stable/11/lib/libc/sys/dup.2 stable/11/lib/libc/sys/getuid.2 stable/11/lib/libc/sys/kill.2 stable/11/lib/libc/sys/mknod.2 stable/11/lib/libc/sys/pipe.2 stable/11/lib/libc/sys/profil.2 stable/11/lib/libc/sys/ptrace.2 stable/11/lib/libc/sys/setuid.2 stable/11/lib/libc/sys/sync.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/signal.3 ============================================================================== --- stable/11/lib/libc/gen/signal.3 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/gen/signal.3 Mon Mar 19 06:54:16 2018 (r331185) @@ -28,7 +28,7 @@ .\" @(#)signal.3 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd June 7, 2004 +.Dd December 1, 2017 .Dt SIGNAL 3 .Os .Sh NAME @@ -263,6 +263,10 @@ or .Xr tty 4 .Sh HISTORY The +.Fn signal +function appeared in +.At v4 . +The current .Nm facility appeared in .Bx 4.0 . Modified: stable/11/lib/libc/sys/dup.2 ============================================================================== --- stable/11/lib/libc/sys/dup.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/dup.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -28,7 +28,7 @@ .\" @(#)dup.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 1, 2013 +.Dd December 1, 2017 .Dt DUP 2 .Os .Sh NAME @@ -163,7 +163,9 @@ system calls are expected to conform to .Sh HISTORY The .Fn dup -and +function appeared in +.At v3 . +The .Fn dup2 -functions appeared in +function appeared in .At v7 . Modified: stable/11/lib/libc/sys/getuid.2 ============================================================================== --- stable/11/lib/libc/sys/getuid.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/getuid.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -86,4 +86,4 @@ The and .Fn geteuid functions appeared in -.At v7 . +.At v4 . Modified: stable/11/lib/libc/sys/kill.2 ============================================================================== --- stable/11/lib/libc/sys/kill.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/kill.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -28,7 +28,7 @@ .\" @(#)kill.2 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd March 15, 2012 +.Dd December 1, 2017 .Dt KILL 2 .Os .Sh NAME @@ -150,7 +150,11 @@ The system call is expected to conform to .St -p1003.1-90 . .Sh HISTORY -The +A version of the .Fn kill function appeared in -.At v7 . +.At v3 . +The signal number was added to the +.Fn kill +function in +.At v4 . Modified: stable/11/lib/libc/sys/mknod.2 ============================================================================== --- stable/11/lib/libc/sys/mknod.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/mknod.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -175,7 +175,7 @@ system call follows The Open Group Extended API Set 2 The .Fn mknod function appeared in -.At v6 . +.At v4 . The .Fn mknodat system call appeared in Modified: stable/11/lib/libc/sys/pipe.2 ============================================================================== --- stable/11/lib/libc/sys/pipe.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/pipe.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -28,7 +28,7 @@ .\" @(#)pipe.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 20, 2016 +.Dd December 1, 2017 .Dt PIPE 2 .Os .Sh NAME Modified: stable/11/lib/libc/sys/profil.2 ============================================================================== --- stable/11/lib/libc/sys/profil.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/profil.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -31,7 +31,7 @@ .\" @(#)profil.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd December 1, 2017 .Dt PROFIL 2 .Os .Sh NAME @@ -109,7 +109,7 @@ contains an invalid address. The .Fn profil function appeared in -.At v7 . +.At v6 . .Sh BUGS This routine should be named .Fn profile . Modified: stable/11/lib/libc/sys/ptrace.2 ============================================================================== --- stable/11/lib/libc/sys/ptrace.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/ptrace.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -2,7 +2,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd September 14, 2017 +.Dd December 1, 2017 .Dt PTRACE 2 .Os .Sh NAME @@ -1105,4 +1105,4 @@ holds the minimum buffer size required on return. The .Fn ptrace function appeared in -.At v7 . +.At v6 . Modified: stable/11/lib/libc/sys/setuid.2 ============================================================================== --- stable/11/lib/libc/sys/setuid.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/setuid.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -156,7 +156,7 @@ The and .Fn setgid functions appeared in -.At v7 . +.At v4 . .Sh SECURITY CONSIDERATIONS Read and write permissions to files are determined upon a call to .Xr open 2 . Modified: stable/11/lib/libc/sys/sync.2 ============================================================================== --- stable/11/lib/libc/sys/sync.2 Mon Mar 19 06:49:49 2018 (r331184) +++ stable/11/lib/libc/sys/sync.2 Mon Mar 19 06:54:16 2018 (r331185) @@ -28,7 +28,7 @@ .\" @(#)sync.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd December 1, 2017 .Dt SYNC 2 .Os .Sh NAME @@ -69,7 +69,7 @@ attributes. The .Fn sync function appeared in -.At v6 . +.At v3 . .Sh BUGS The .Fn sync From owner-svn-src-stable@freebsd.org Mon Mar 19 06:54:54 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D7CAF55686; Mon, 19 Mar 2018 06:54:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 20D6E7E712; Mon, 19 Mar 2018 06:54:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 019D633B4; Mon, 19 Mar 2018 06:54:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6srIn001588; Mon, 19 Mar 2018 06:54:53 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6srvA001587; Mon, 19 Mar 2018 06:54:53 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190654.w2J6srvA001587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:54: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: r331186 - stable/11/usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/truss X-SVN-Commit-Revision: 331186 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, 19 Mar 2018 06:54:54 -0000 Author: eadler Date: Mon Mar 19 06:54:53 2018 New Revision: 331186 URL: https://svnweb.freebsd.org/changeset/base/331186 Log: MFC r326356: Replace a reference to a license in another file with the license text. The relevant file was recently renamed, so the reference was stale. In addition, explicit licenses are more typical in our sources. Modified: stable/11/usr.bin/truss/syscall.h Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/truss/syscall.h ============================================================================== --- stable/11/usr.bin/truss/syscall.h Mon Mar 19 06:54:16 2018 (r331185) +++ stable/11/usr.bin/truss/syscall.h Mon Mar 19 06:54:53 2018 (r331186) @@ -1,6 +1,39 @@ -/* - * See i386-fbsd.c for copyright and license terms. +/*- + * SPDX-License-Identifier: BSD-4-Clause * + * Copyright 1997 Sean Eric Fagan + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Sean Eric Fagan + * 4. Neither the name of the author may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* * System call arguments come in several flavours: * Hex -- values that should be printed in hex (addresses) * Octal -- Same as above, but octal @@ -33,9 +66,6 @@ * In addition, the pointer types (String, Ptr) may have OUT masked in -- * this means that the data is set on *return* from the system call -- or * IN (meaning that the data is passed *into* the system call). - */ -/* - * $FreeBSD$ */ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHex, Name, Ptr, Stat, Ioctl, From owner-svn-src-stable@freebsd.org Mon Mar 19 06:55:27 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B87DF5570B; Mon, 19 Mar 2018 06:55:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 510697E849; Mon, 19 Mar 2018 06:55:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BDAA33B5; Mon, 19 Mar 2018 06:55:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6tRPY001687; Mon, 19 Mar 2018 06:55:27 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6tQKE001681; Mon, 19 Mar 2018 06:55:26 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190655.w2J6tQKE001681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:55:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331187 - stable/11/lib/libsysdecode X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/lib/libsysdecode X-SVN-Commit-Revision: 331187 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, 19 Mar 2018 06:55:27 -0000 Author: eadler Date: Mon Mar 19 06:55:26 2018 New Revision: 331187 URL: https://svnweb.freebsd.org/changeset/base/331187 Log: MFC r326183: Add stdio.h to the synopsis for sysdecode functions that take a FILE *. Modified: stable/11/lib/libsysdecode/sysdecode_cap_rights.3 stable/11/lib/libsysdecode/sysdecode_fcntl_arg.3 stable/11/lib/libsysdecode/sysdecode_mask.3 stable/11/lib/libsysdecode/sysdecode_quotactl_cmd.3 stable/11/lib/libsysdecode/sysdecode_utrace.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/sysdecode_cap_rights.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_cap_rights.3 Mon Mar 19 06:54:53 2018 (r331186) +++ stable/11/lib/libsysdecode/sysdecode_cap_rights.3 Mon Mar 19 06:55:26 2018 (r331187) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2016 +.Dd November 24, 2017 .Dt sysdecode_cap_rights 3 .Os .Sh NAME @@ -36,6 +36,7 @@ .Sh SYNOPSIS .In sys/types.h .In stdbool.h +.In stdio.h .In sysdecode.h .Ft void .Fn sysdecode_cap_rights "FILE *fp" "cap_rights_t *rightsp" Modified: stable/11/lib/libsysdecode/sysdecode_fcntl_arg.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_fcntl_arg.3 Mon Mar 19 06:54:53 2018 (r331186) +++ stable/11/lib/libsysdecode/sysdecode_fcntl_arg.3 Mon Mar 19 06:55:26 2018 (r331187) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2016 +.Dd November 24, 2017 .Dt sysdecode_fcntl_arg 3 .Os .Sh NAME @@ -37,6 +37,7 @@ .Sh SYNOPSIS .In sys/types.h .In stdbool.h +.In stdio.h .In sysdecode.h .Ft void .Fn sysdecode_fcntl_arg "FILE *fp" "int cmd" "uintptr_t arg" "int base" Modified: stable/11/lib/libsysdecode/sysdecode_mask.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_mask.3 Mon Mar 19 06:54:53 2018 (r331186) +++ stable/11/lib/libsysdecode/sysdecode_mask.3 Mon Mar 19 06:55:26 2018 (r331187) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 3, 2017 +.Dd November 24, 2017 .Dt sysdecode_mask 3 .Os .Sh NAME @@ -63,6 +63,7 @@ .Sh SYNOPSIS .In sys/types.h .In stdbool.h +.In stdio.h .In sysdecode.h .Ft bool .Fn sysdecode_access_mode "FILE *fp" "int mode" "int *rem" Modified: stable/11/lib/libsysdecode/sysdecode_quotactl_cmd.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_quotactl_cmd.3 Mon Mar 19 06:54:53 2018 (r331186) +++ stable/11/lib/libsysdecode/sysdecode_quotactl_cmd.3 Mon Mar 19 06:55:26 2018 (r331187) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2016 +.Dd November 24, 2017 .Dt sysdecode_quotactl_cmd 3 .Os .Sh NAME @@ -36,6 +36,7 @@ .Sh SYNOPSIS .In sys/types.h .In stdbool.h +.In stdio.h .In sysdecode.h .Ft bool .Fn sysdecode_quotactl_cmd "FILE *fp" "int cmd" Modified: stable/11/lib/libsysdecode/sysdecode_utrace.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_utrace.3 Mon Mar 19 06:54:53 2018 (r331186) +++ stable/11/lib/libsysdecode/sysdecode_utrace.3 Mon Mar 19 06:55:26 2018 (r331187) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2016 +.Dd November 24, 2017 .Dt sysdecode_utrace 3 .Os .Sh NAME @@ -36,6 +36,7 @@ .Sh SYNOPSIS .In sys/types.h .In stdbool.h +.In stdio.h .In sysdecode.h .Ft int .Fn sysdecode_utrace "FILE *fp" "void *buf" "size_t len" "int decimal" From owner-svn-src-stable@freebsd.org Mon Mar 19 06:56:31 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73A4CF557EF; Mon, 19 Mar 2018 06:56:31 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0CC6D7E9B4; Mon, 19 Mar 2018 06:56:31 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05F1933B6; Mon, 19 Mar 2018 06:56:31 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6uUXt001771; Mon, 19 Mar 2018 06:56:30 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6uUuo001770; Mon, 19 Mar 2018 06:56:30 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190656.w2J6uUuo001770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:56: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: r331188 - stable/11/sys/dev/flash X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/flash X-SVN-Commit-Revision: 331188 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, 19 Mar 2018 06:56:31 -0000 Author: eadler Date: Mon Mar 19 06:56:30 2018 New Revision: 331188 URL: https://svnweb.freebsd.org/changeset/base/331188 Log: MFC r325113: Add Microchip 1-MBit SPI flash ID Used on the AmigaOne X5000. Modified: stable/11/sys/dev/flash/mx25l.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/flash/mx25l.c ============================================================================== --- stable/11/sys/dev/flash/mx25l.c Mon Mar 19 06:55:26 2018 (r331187) +++ stable/11/sys/dev/flash/mx25l.c Mon Mar 19 06:56:30 2018 (r331188) @@ -124,6 +124,7 @@ struct mx25l_flash_ident flash_devices[] = { { "s25fl064", 0x01, 0x0216, 64 * 1024, 128, FL_NONE }, { "s25fl128", 0x01, 0x2018, 64 * 1024, 256, FL_NONE }, { "s25fl256s", 0x01, 0x0219, 64 * 1024, 512, FL_NONE }, + { "SST25VF010A", 0xbf, 0x2549, 4 * 1024, 32, FL_ERASE_4K | FL_ERASE_32K }, { "SST25VF032B", 0xbf, 0x254a, 64 * 1024, 64, FL_ERASE_4K | FL_ERASE_32K }, /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ From owner-svn-src-stable@freebsd.org Mon Mar 19 06:57:42 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FD1FF558D9; Mon, 19 Mar 2018 06:57:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F63C7EB19; Mon, 19 Mar 2018 06:57:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49F8C33B7; Mon, 19 Mar 2018 06:57:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J6vgaR001851; Mon, 19 Mar 2018 06:57:42 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J6vgPH001850; Mon, 19 Mar 2018 06:57:42 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190657.w2J6vgPH001850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 06:57: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: r331189 - stable/11/sys/powerpc/include X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/powerpc/include X-SVN-Commit-Revision: 331189 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, 19 Mar 2018 06:57:42 -0000 Author: eadler Date: Mon Mar 19 06:57:41 2018 New Revision: 331189 URL: https://svnweb.freebsd.org/changeset/base/331189 Log: MFC r325112: Add P5010/P5010E for completeness Modified: stable/11/sys/powerpc/include/spr.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/include/spr.h ============================================================================== --- stable/11/sys/powerpc/include/spr.h Mon Mar 19 06:56:30 2018 (r331188) +++ stable/11/sys/powerpc/include/spr.h Mon Mar 19 06:57:41 2018 (r331189) @@ -713,6 +713,8 @@ #define SVR_P4040E 0x8208 #define SVR_P4080 0x8201 #define SVR_P4080E 0x8209 +#define SVR_P5010 0x8221 +#define SVR_P5010E 0x8229 #define SVR_P5020 0x8220 #define SVR_P5020E 0x8228 #define SVR_VER(svr) (((svr) >> 16) & 0xffff) From owner-svn-src-stable@freebsd.org Mon Mar 19 07:00:16 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3602DF55A42; Mon, 19 Mar 2018 07:00:16 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D2C407ECA3; Mon, 19 Mar 2018 07:00:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6C2E33BB; Mon, 19 Mar 2018 07:00:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J70FED002035; Mon, 19 Mar 2018 07:00:15 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J70Fkg002034; Mon, 19 Mar 2018 07:00:15 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190700.w2J70Fkg002034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:00: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: r331190 - stable/11/include X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/include X-SVN-Commit-Revision: 331190 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, 19 Mar 2018 07:00:16 -0000 Author: eadler Date: Mon Mar 19 07:00:15 2018 New Revision: 331190 URL: https://svnweb.freebsd.org/changeset/base/331190 Log: MFC r313818: Small inclusion guard comment fix. Modified: stable/11/include/pthread.h Directory Properties: stable/11/ (props changed) Modified: stable/11/include/pthread.h ============================================================================== --- stable/11/include/pthread.h Mon Mar 19 06:57:41 2018 (r331189) +++ stable/11/include/pthread.h Mon Mar 19 07:00:15 2018 (r331190) @@ -349,4 +349,4 @@ void __pthread_cleanup_pop_imp(int); __END_DECLS __NULLABILITY_PRAGMA_POP -#endif /* _PTHREAD_H_ */ +#endif /* !_PTHREAD_H_ */ From owner-svn-src-stable@freebsd.org Mon Mar 19 07:03:03 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11F54F55D93; Mon, 19 Mar 2018 07:03:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4B447F086; Mon, 19 Mar 2018 07:03:02 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 950B33893; Mon, 19 Mar 2018 07:03:02 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7326f006715; Mon, 19 Mar 2018 07:03:02 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J732Jn006714; Mon, 19 Mar 2018 07:03:02 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190703.w2J732Jn006714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:03: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: r331191 - stable/11/sys/dev/fb X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/fb X-SVN-Commit-Revision: 331191 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, 19 Mar 2018 07:03:03 -0000 Author: eadler Date: Mon Mar 19 07:03:02 2018 New Revision: 331191 URL: https://svnweb.freebsd.org/changeset/base/331191 Log: MFC r315986: Fix 3 entries in mode tables related to mono and 90-column text modes. Newer VGAs don't support any mono modes, but bugs in the tables created 2 virtual mono modes (#45 90x43 and #112 80x43) that behaved more strangely than crashing. 90-column modes are tweaked 80-column ones and also fail to work on newer VGAs. #45 did crash (hang) on some hardware. Modified: stable/11/sys/dev/fb/vga.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/fb/vga.c ============================================================================== --- stable/11/sys/dev/fb/vga.c Mon Mar 19 07:00:15 2018 (r331190) +++ stable/11/sys/dev/fb/vga.c Mon Mar 19 07:03:02 2018 (r331191) @@ -347,7 +347,7 @@ static video_info_t bios_vmode[] = { { M_EGAMONO80x25, 0, 80, 25, 8, 14, 2, 1, MDA_BUF_BASE, MDA_BUF_SIZE, MDA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, /* EGA */ - { M_ENH_B80x43, 0, 80, 43, 8, 8, 2, 1, + { M_ENH_B80x43, V_INFO_COLOR, 80, 43, 8, 8, 2, 1, CGA_BUF_BASE, CGA_BUF_SIZE, CGA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, { M_ENH_C80x43, V_INFO_COLOR, 80, 43, 8, 8, 4, 1, CGA_BUF_BASE, CGA_BUF_SIZE, CGA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, @@ -377,7 +377,7 @@ static video_info_t bios_vmode[] = { { M_VGA_C90x30, V_INFO_COLOR, 90, 30, 8, 16, 4, 1, CGA_BUF_BASE, CGA_BUF_SIZE, CGA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, { M_VGA_M90x43, 0, 90, 43, 8, 8, 2, 1, - CGA_BUF_BASE, CGA_BUF_SIZE, CGA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, + MDA_BUF_BASE, MDA_BUF_SIZE, MDA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, { M_VGA_C90x43, V_INFO_COLOR, 90, 43, 8, 8, 4, 1, CGA_BUF_BASE, CGA_BUF_SIZE, CGA_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, { M_VGA_M90x50, 0, 90, 50, 8, 8, 2, 1, @@ -593,7 +593,7 @@ map_mode_num(int mode) { M_VGA_C90x25, M_VGA_C80x25 }, { M_VGA_M90x30, M_VGA_M80x25 }, { M_VGA_C90x30, M_VGA_C80x25 }, - { M_VGA_M90x43, M_ENH_B80x25 }, + { M_VGA_M90x43, M_VGA_M80x25 }, { M_VGA_C90x43, M_ENH_C80x25 }, { M_VGA_M90x50, M_VGA_M80x25 }, { M_VGA_C90x50, M_VGA_C80x25 }, From owner-svn-src-stable@freebsd.org Mon Mar 19 07:07:03 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8EA4F5604E; Mon, 19 Mar 2018 07:07:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 741667F231; Mon, 19 Mar 2018 07:07:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A8713894; Mon, 19 Mar 2018 07:07:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J773Ac006886; Mon, 19 Mar 2018 07:07:03 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J773sg006885; Mon, 19 Mar 2018 07:07:03 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190707.w2J773sg006885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:07:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331192 - stable/11/lib/libc/stdlib X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/lib/libc/stdlib X-SVN-Commit-Revision: 331192 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, 19 Mar 2018 07:07:04 -0000 Author: eadler Date: Mon Mar 19 07:07:03 2018 New Revision: 331192 URL: https://svnweb.freebsd.org/changeset/base/331192 Log: MFC r320992,r320993: Add a complete example to tsearch(3) Modified: stable/11/lib/libc/stdlib/tsearch.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/stdlib/tsearch.3 ============================================================================== --- stable/11/lib/libc/stdlib/tsearch.3 Mon Mar 19 07:03:02 2018 (r331191) +++ stable/11/lib/libc/stdlib/tsearch.3 Mon Mar 19 07:07:03 2018 (r331192) @@ -27,7 +27,7 @@ .\" OpenBSD: tsearch.3,v 1.2 1998/06/21 22:13:49 millert Exp .\" $FreeBSD$ .\" -.Dd October 9, 2016 +.Dd June 4, 2017 .Dt TSEARCH 3 .Os .Sh NAME @@ -130,6 +130,64 @@ is NULL or the datum cannot be found. The .Fn twalk function returns no value. +.Sh EXAMPLES +This example uses +.Fn tsearch +to search for four strings in +.Dv root . +Because the strings are not already present, they are added. +.Fn tsearch +is called twice on the fourth string to demonstrate that a string is not added when it is already present. +.Fn tfind +is used to find the single instance of the fourth string, and +.Fn tdelete +removes it. +Finally, +.Fn twalk +is used to return and display the resulting binary search tree. +.Bd -literal +#include +#include +#include + +int +comp(const void *a, const void *b) +{ + + return strcmp(a, b); +} + +void +printwalk(const posix_tnode * node, VISIT v, int __unused0) +{ + + if (v == postorder || v == leaf) { + printf("node: %s\en", *(char **)node); + } +} + +int +main(void) +{ + posix_tnode *root = NULL; + + char one[] = "blah1"; + char two[] = "blah-2"; + char three[] = "blah-3"; + char four[] = "blah-4"; + + tsearch(one, &root, comp); + tsearch(two, &root, comp); + tsearch(three, &root, comp); + tsearch(four, &root, comp); + tsearch(four, &root, comp); + printf("four: %s\en", *(char **)tfind(four, &root, comp)); + tdelete(four, &root, comp); + + twalk(root, printwalk); + return 0; +} +.Ed .Sh SEE ALSO .Xr bsearch 3 , .Xr hsearch 3 , From owner-svn-src-stable@freebsd.org Mon Mar 19 07:08:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4F4EF56142; Mon, 19 Mar 2018 07:08:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 87FA17F3AE; Mon, 19 Mar 2018 07:08:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8293D3895; Mon, 19 Mar 2018 07:08:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J78E8g006966; Mon, 19 Mar 2018 07:08:14 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J78Emo006965; Mon, 19 Mar 2018 07:08:14 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190708.w2J78Emo006965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:08: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: r331193 - stable/11/usr.bin/cut X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/cut X-SVN-Commit-Revision: 331193 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, 19 Mar 2018 07:08:15 -0000 Author: eadler Date: Mon Mar 19 07:08:14 2018 New Revision: 331193 URL: https://svnweb.freebsd.org/changeset/base/331193 Log: MFC r322013: Document -w flag is an extension to POSIX. PR: 201937 Modified: stable/11/usr.bin/cut/cut.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/cut/cut.1 ============================================================================== --- stable/11/usr.bin/cut/cut.1 Mon Mar 19 07:07:03 2018 (r331192) +++ stable/11/usr.bin/cut/cut.1 Mon Mar 19 07:08:14 2018 (r331193) @@ -31,7 +31,7 @@ .\" @(#)cut.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd August 8, 2012 +.Dd August 3, 2017 .Dt CUT 1 .Os .Sh NAME @@ -154,6 +154,10 @@ The .Nm utility conforms to .St -p1003.2-92 . +.Pp +The +.Fl w +flag is an extension to the specification. .Sh HISTORY A .Nm From owner-svn-src-stable@freebsd.org Mon Mar 19 07:28:55 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10678F576F8; Mon, 19 Mar 2018 07:28:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B80A9802F2; Mon, 19 Mar 2018 07:28:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2F353C5E; Mon, 19 Mar 2018 07:28:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7Ss9e017192; Mon, 19 Mar 2018 07:28:54 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J7SsOF017190; Mon, 19 Mar 2018 07:28:54 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190728.w2J7SsOF017190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:28:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331194 - stable/11/sbin/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sbin/ipfw X-SVN-Commit-Revision: 331194 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, 19 Mar 2018 07:28:55 -0000 Author: eadler Date: Mon Mar 19 07:28:54 2018 New Revision: 331194 URL: https://svnweb.freebsd.org/changeset/base/331194 Log: MFC r320268,r320276: ipfw: dummynet: Add 'G' and 'g' suffix for bandwidth configuration/display Modified: stable/11/sbin/ipfw/dummynet.c stable/11/sbin/ipfw/ipfw.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/dummynet.c ============================================================================== --- stable/11/sbin/ipfw/dummynet.c Mon Mar 19 07:08:14 2018 (r331193) +++ stable/11/sbin/ipfw/dummynet.c Mon Mar 19 07:28:54 2018 (r331194) @@ -626,6 +626,8 @@ list_pipes(struct dn_id *oid, struct dn_id *end) /* data rate */ if (b == 0) sprintf(bwbuf, "unlimited "); + else if (b >= 1000000000) + sprintf(bwbuf, "%7.3f Gbit/s", b/1000000000); else if (b >= 1000000) sprintf(bwbuf, "%7.3f Mbit/s", b/1000000); else if (b >= 1000) @@ -818,6 +820,9 @@ read_bandwidth(char *arg, int *bandwidth, char *if_nam } else if (*end == 'M' || *end == 'm') { end++; bw *= 1000000; + } else if (*end == 'G' || *end == 'g') { + end++; + bw *= 1000000000; } if ((*end == 'B' && _substrcmp2(end, "Bi", "Bit/s") != 0) || Modified: stable/11/sbin/ipfw/ipfw.8 ============================================================================== --- stable/11/sbin/ipfw/ipfw.8 Mon Mar 19 07:08:14 2018 (r331193) +++ stable/11/sbin/ipfw/ipfw.8 Mon Mar 19 07:28:54 2018 (r331194) @@ -2499,7 +2499,7 @@ The following parameters can be configured for a pipe: .It Cm bw Ar bandwidth | device Bandwidth, measured in .Sm off -.Op Cm K | M +.Op Cm K | M | G .Brq Cm bit/s | Byte/s . .Sm on .Pp From owner-svn-src-stable@freebsd.org Mon Mar 19 07:33:13 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82400F57C1E; Mon, 19 Mar 2018 07:33:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 353E88074E; Mon, 19 Mar 2018 07:33:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 303E53DDD; Mon, 19 Mar 2018 07:33:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7XDtw021755; Mon, 19 Mar 2018 07:33:13 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J7XCDe021753; Mon, 19 Mar 2018 07:33:12 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190733.w2J7XCDe021753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:33: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: r331195 - in stable/11/sys/dev: ahci usb/controller X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/sys/dev: ahci usb/controller X-SVN-Commit-Revision: 331195 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, 19 Mar 2018 07:33:13 -0000 Author: eadler Date: Mon Mar 19 07:33:12 2018 New Revision: 331195 URL: https://svnweb.freebsd.org/changeset/base/331195 Log: MFC r320178: Add some device IDs for Intel Denverton SoCs. Modified: stable/11/sys/dev/ahci/ahci_pci.c stable/11/sys/dev/usb/controller/xhci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci_pci.c Mon Mar 19 07:28:54 2018 (r331194) +++ stable/11/sys/dev/ahci/ahci_pci.c Mon Mar 19 07:33:12 2018 (r331195) @@ -123,6 +123,26 @@ static const struct { {0x3b298086, 0x00, "Intel Ibex Peak-M", 0}, {0x3b2c8086, 0x00, "Intel Ibex Peak-M (RAID)", 0}, {0x3b2f8086, 0x00, "Intel Ibex Peak-M", 0}, + {0x19b08086, 0x00, "Intel Denverton", 0}, + {0x19b18086, 0x00, "Intel Denverton", 0}, + {0x19b28086, 0x00, "Intel Denverton", 0}, + {0x19b38086, 0x00, "Intel Denverton", 0}, + {0x19b48086, 0x00, "Intel Denverton", 0}, + {0x19b58086, 0x00, "Intel Denverton", 0}, + {0x19b68086, 0x00, "Intel Denverton", 0}, + {0x19b78086, 0x00, "Intel Denverton", 0}, + {0x19be8086, 0x00, "Intel Denverton", 0}, + {0x19bf8086, 0x00, "Intel Denverton", 0}, + {0x19c08086, 0x00, "Intel Denverton", 0}, + {0x19c18086, 0x00, "Intel Denverton", 0}, + {0x19c28086, 0x00, "Intel Denverton", 0}, + {0x19c38086, 0x00, "Intel Denverton", 0}, + {0x19c48086, 0x00, "Intel Denverton", 0}, + {0x19c58086, 0x00, "Intel Denverton", 0}, + {0x19c68086, 0x00, "Intel Denverton", 0}, + {0x19c78086, 0x00, "Intel Denverton", 0}, + {0x19ce8086, 0x00, "Intel Denverton", 0}, + {0x19cf8086, 0x00, "Intel Denverton", 0}, {0x1c028086, 0x00, "Intel Cougar Point", 0}, {0x1c038086, 0x00, "Intel Cougar Point", 0}, {0x1c048086, 0x00, "Intel Cougar Point (RAID)", 0}, Modified: stable/11/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- stable/11/sys/dev/usb/controller/xhci_pci.c Mon Mar 19 07:28:54 2018 (r331194) +++ stable/11/sys/dev/usb/controller/xhci_pci.c Mon Mar 19 07:33:12 2018 (r331195) @@ -119,6 +119,8 @@ xhci_pci_match(device_t self) case 0x0f358086: return ("Intel BayTrail USB 3.0 controller"); + case 0x19d08086: + return ("Intel Denverton USB 3.0 controller"); case 0x9c318086: case 0x1e318086: return ("Intel Panther Point USB 3.0 controller"); From owner-svn-src-stable@freebsd.org Mon Mar 19 07:34:25 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EA2FF57D6D; Mon, 19 Mar 2018 07:34:25 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A838808B7; Mon, 19 Mar 2018 07:34:25 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 159B73DDE; Mon, 19 Mar 2018 07:34:25 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7YOvg021837; Mon, 19 Mar 2018 07:34:24 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J7YOUP021836; Mon, 19 Mar 2018 07:34:24 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190734.w2J7YOUP021836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:34:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331196 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 331196 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, 19 Mar 2018 07:34:25 -0000 Author: eadler Date: Mon Mar 19 07:34:24 2018 New Revision: 331196 URL: https://svnweb.freebsd.org/changeset/base/331196 Log: MFC r322674: Add Thunderbolt Apple interfaces to the bge(4) supported list. Document message reported by kernel upon removal in DIAGNOSTIC section. Document shortcomings in BUGS section. Modified: stable/11/share/man/man4/bge.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/bge.4 ============================================================================== --- stable/11/share/man/man4/bge.4 Mon Mar 19 07:33:12 2018 (r331195) +++ stable/11/share/man/man4/bge.4 Mon Mar 19 07:34:24 2018 (r331196) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 19, 2012 +.Dd August 18, 2017 .Dt BGE 4 .Os .Sh NAME @@ -159,6 +159,10 @@ following: .It 3Com 3c996-T (10/100/1000baseTX) .It +Apple Thunderbolt Display (10/100/1000baseTX) +.It +Apple Thunderbolt to Gigabit Ethernet Adapter (10/100/1000baseTX) +.It Dell PowerEdge 1750 integrated BCM5704C NIC (10/100/1000baseTX) .It Dell PowerEdge 2550 integrated BCM5700 NIC (10/100/1000baseTX) @@ -236,6 +240,9 @@ during initialization. The driver failed to initialize PCI shared memory mapping. This might happen if the card is not in a bus-master slot. +.It "bge%d: firmware handshake timed out, found 0xffffffff" +The device was physically disconnected from the system, or there is a problem with +the device causing it to stop responding to the host it is attached to. .It "bge%d: no memory for jumbo buffers!" The driver failed to allocate memory for jumbo frames during initialization. @@ -262,3 +269,12 @@ The .Nm driver was written by .An Bill Paul Aq Mt wpaul@windriver.com . +.Sh BUGS +Hotplug is not currently supported in +.Fx , +hence, Thunderbolt interfaces need to be connected prior to system power up on +Apple systems in order for the interface to be detected. +Also, due to the lack of hotplug support, Thunderbolt-based interfaces must not be removed +while the system is up as the kernel is currently unable to cope with a +.Nm +interface disappearing. From owner-svn-src-stable@freebsd.org Mon Mar 19 07:35:35 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCB99F57EE1; Mon, 19 Mar 2018 07:35:35 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C94480AFC; Mon, 19 Mar 2018 07:35:35 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 771EB3DE0; Mon, 19 Mar 2018 07:35:35 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7ZZkE022030; Mon, 19 Mar 2018 07:35:35 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J7ZZG9022028; Mon, 19 Mar 2018 07:35:35 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190735.w2J7ZZG9022028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:35:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331197 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 331197 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, 19 Mar 2018 07:35:36 -0000 Author: eadler Date: Mon Mar 19 07:35:35 2018 New Revision: 331197 URL: https://svnweb.freebsd.org/changeset/base/331197 Log: MFC r324806: Use the .Fx macro consistently. Sponsored by: Spectra Logic Corp Modified: stable/11/share/man/man4/mpr.4 stable/11/share/man/man4/usfs.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/mpr.4 ============================================================================== --- stable/11/share/man/man4/mpr.4 Mon Mar 19 07:34:24 2018 (r331196) +++ stable/11/share/man/man4/mpr.4 Mon Mar 19 07:35:35 2018 (r331197) @@ -380,7 +380,8 @@ These bits have the described effects: .Sh HISTORY The .Nm -driver first appeared in FreeBSD 9.3. +driver first appeared in +.Fx 9.3 . .Sh AUTHORS The .Nm Modified: stable/11/share/man/man4/usfs.4 ============================================================================== --- stable/11/share/man/man4/usfs.4 Mon Mar 19 07:34:24 2018 (r331196) +++ stable/11/share/man/man4/usfs.4 Mon Mar 19 07:35:35 2018 (r331197) @@ -65,4 +65,5 @@ Upon attach the driver creates a RAM disk which can be .Sh HISTORY The .Nm -driver appeared in FreeBSD 8. +driver appeared in +.Fx 8.0 . From owner-svn-src-stable@freebsd.org Mon Mar 19 07:37:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74DF3F580C6; Mon, 19 Mar 2018 07:37:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 269F280D43; Mon, 19 Mar 2018 07:37:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2156F3DE5; Mon, 19 Mar 2018 07:37:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7bDkE022271; Mon, 19 Mar 2018 07:37:13 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J7bDtH022268; Mon, 19 Mar 2018 07:37:13 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190737.w2J7bDtH022268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:37: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: r331198 - in stable/11/sys/dev/usb: . misc X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in stable/11/sys/dev/usb: . misc X-SVN-Commit-Revision: 331198 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, 19 Mar 2018 07:37:14 -0000 Author: eadler Date: Mon Mar 19 07:37:13 2018 New Revision: 331198 URL: https://svnweb.freebsd.org/changeset/base/331198 Log: MFC r324858: Add Prolific PL27A1 USB 3.0 Host-Host device to udbp(4). Tested with a Plugable cable in VirtualBox against Linux 4.11. Modified: stable/11/sys/dev/usb/misc/udbp.c stable/11/sys/dev/usb/usbdevs Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/misc/udbp.c ============================================================================== --- stable/11/sys/dev/usb/misc/udbp.c Mon Mar 19 07:35:35 2018 (r331197) +++ stable/11/sys/dev/usb/misc/udbp.c Mon Mar 19 07:37:13 2018 (r331198) @@ -265,6 +265,7 @@ static const STRUCT_USB_HOST_ID udbp_devs[] = { {USB_VPI(USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_GADGETZERO, 0)}, {USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2301, 0)}, {USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2302, 0)}, + {USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL27A1, 0)}, {USB_VPI(USB_VENDOR_ANCHOR, USB_PRODUCT_ANCHOR_EZLINK, 0)}, {USB_VPI(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL620USB, 0)}, }; Modified: stable/11/sys/dev/usb/usbdevs ============================================================================== --- stable/11/sys/dev/usb/usbdevs Mon Mar 19 07:35:35 2018 (r331197) +++ stable/11/sys/dev/usb/usbdevs Mon Mar 19 07:37:13 2018 (r331198) @@ -3633,6 +3633,7 @@ product PROLIFIC PL2305 0x2305 Parallel printer product PROLIFIC ATAPI4 0x2307 ATAPI-4 Controller product PROLIFIC PL2501 0x2501 PL2501 Host-Host interface product PROLIFIC PL2506 0x2506 PL2506 USB to IDE Bridge +product PROLIFIC PL27A1 0x27A1 PL27A1 USB 3.0 Host-Host interface product PROLIFIC HCR331 0x331a HCR331 Hybrid Card Reader product PROLIFIC PHAROS 0xaaa0 Prolific Pharos product PROLIFIC RSAQ3 0xaaa2 PL2303 Serial Adapter (IODATA USB-RSAQ3) From owner-svn-src-stable@freebsd.org Mon Mar 19 07:37:37 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75EDCF58145; Mon, 19 Mar 2018 07:37:37 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 28E3880E54; Mon, 19 Mar 2018 07:37:37 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23C653DE6; Mon, 19 Mar 2018 07:37:37 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2J7bb8c022331; Mon, 19 Mar 2018 07:37:37 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J7bbX0022330; Mon, 19 Mar 2018 07:37:37 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803190737.w2J7bbX0022330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 19 Mar 2018 07:37:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331199 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 331199 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, 19 Mar 2018 07:37:37 -0000 Author: eadler Date: Mon Mar 19 07:37:36 2018 New Revision: 331199 URL: https://svnweb.freebsd.org/changeset/base/331199 Log: MFC r324860: Modernise this man page somewhat. 1. Add a reference to a good 3rd party list of compatible cables, but provide suggestions for 'known good' vendors. 2. Change IP-based USB host-host example to a modern Ethernet one which works 'out of box' with current Linux systems. 3. Explain that USB 3.0 is host-host, even though point-to-point soft Ethernet can be achieved. Modified: stable/11/share/man/man4/udbp.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/udbp.4 ============================================================================== --- stable/11/share/man/man4/udbp.4 Mon Mar 19 07:37:13 2018 (r331198) +++ stable/11/share/man/man4/udbp.4 Mon Mar 19 07:37:36 2018 (r331199) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 22, 2006 +.Dd October 20, 2017 .Dt UDBP 4 .Os .Sh NAME @@ -48,9 +48,14 @@ udbp_load="YES" The .Nm driver provides support for host-to-host cables -that contain at least two bulk pipes (one for each direction), -for example -the EzLink cable and the NetChip 1080 chip. +that contain at least two bulk pipes (one for each direction). +This typically includes cables branded for use with +.Sy Windows USB Easy Transfer , +and many cables based on the Prolific PL2xx1 series of USB bridge chips. +A useful (but non-comprehensive) list of compatible USB host cables +is listed in the +.Sx SEE ALSO +section below. .Pp .\" XXX The description of how to add netgraph to the kernel .\" is out of place here. It should be limited to the @@ -86,30 +91,64 @@ module and then the .Nm driver. .Pp -.Dl ngctl mkpeer udbp0: iface data inet -.Dl ifconfig ng0 10.0.0.1 10.0.0.2 +.Dl ngctl mkpeer udbp0: eiface data ether +.Dl ifconfig ngeth0 ether aa:dd:xx:xx:xx +.Dl ifconfig ngeth0 inet 169.254.x.x/16 .Pp -Create a new network interface node -and connect its inet hook to the data hook of the +Create a new Ethernet network interface node +and connect its ether hook to the data hook of the .Nm -node. -.Xr ifconfig 8 -configures the resulting network interface ng0 with a local -IP address of 10.0.0.1 and a remote IP address of 10.0.0.2. -On the remote host, the two -IP addresses should of course be reversed. +driver. +.Pp +This enables FreeBSD to communicate with a Linux peer (e.g. using the +.Sy plusb +driver). +The Linux node should be configured to prefer link-local IPv4 addresses +(e.g. using Network Manager in Debian and Red Hat derived distributions). +.Pp +Whilst both FreeBSD and Linux are able to interoperate by +loosely following CDC EEM 1.0 in their behaviour, neither implementation +has been expressly designed to follow its specification. .Sh SEE ALSO .Xr netgraph 4 , -.Xr ng_iface 4 , +.Xr ng_eiface 4 , .Xr ohci 4 , .Xr uhci 4 , .Xr usb 4 , .Xr ngctl 8 +.\" +.Rs +.%B Universal Serial Bus: Communications Class Subclass Specification for Ethernet Emulation Model Devices +.%N Revision 1.0 +.%D February 2, 2005 +.%I USB Implementers Forum, Inc. +.%U http://www.usb.org/developers/docs/devclass_docs/CDC_EEM10.pdf +.Re +.\" +.Rs +.%B Total Commander: Supported cables for USB cable connection +.%I Ghisler Software GmbH. +.%U https://www.ghisler.com/cables/index.htm +.Re +.Sh CAVEATS +The point-to-point nature and additional latency of USB host-host links +makes them unsuitable as a "drop-in" replacement for an Ethernet LAN; +for a USB 3.0 SuperSpeed cable, latency is comparable to 100BaseTX Ethernet +(but often worse), with throughput comparable to 2.5GBASE-T. +.Pp +However, their energy efficiency makes them attractive for embedded +applications. A Plugable PL27A1 cable claims 24mA of USB3 bus power, +as compared to 150mA for a typical USB 3.0 to Gigabit Ethernet interface. .Sh HISTORY The .Nm driver first appeared in .Fx 5.0 . +.Sh BUGS +The +.Nm +driver does not support the special packets described in section 5.1 +of the CDC EEM specification. .Sh AUTHORS .An -nosplit The @@ -121,4 +160,6 @@ and .An Nick Hibma Aq Mt n_hibma@FreeBSD.org . .Pp This manual page was written by -.An Nick Hibma Aq Mt n_hibma@FreeBSD.org . +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org +and updated by +.An Bruce Simpson Aq Mt bms@FreeBSD.org . From owner-svn-src-stable@freebsd.org Mon Mar 19 09:52:17 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0613F60D35; Mon, 19 Mar 2018 09:52:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7368F86AEA; Mon, 19 Mar 2018 09:52:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E55A5243; Mon, 19 Mar 2018 09:52:17 +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 w2J9qHHd092638; Mon, 19 Mar 2018 09:52:17 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J9qH2B092636; Mon, 19 Mar 2018 09:52:17 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201803190952.w2J9qH2B092636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 19 Mar 2018 09:52: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: r331201 - in stable/11: sbin/ipfw sys/netpfil/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/11: sbin/ipfw sys/netpfil/ipfw X-SVN-Commit-Revision: 331201 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, 19 Mar 2018 09:52:17 -0000 Author: ae Date: Mon Mar 19 09:52:16 2018 New Revision: 331201 URL: https://svnweb.freebsd.org/changeset/base/331201 Log: MFC r330792: Do not try to reassemble IPv6 fragments in "reass" rule. ip_reass() expects IPv4 packet and will just corrupt any IPv6 packets that it gets. Until proper IPv6 fragments handling function will be implemented, pass IPv6 packets to next rule. PR: 170604 Modified: stable/11/sbin/ipfw/ipfw.8 stable/11/sys/netpfil/ipfw/ip_fw2.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/ipfw.8 ============================================================================== --- stable/11/sbin/ipfw/ipfw.8 Mon Mar 19 08:28:25 2018 (r331200) +++ stable/11/sbin/ipfw/ipfw.8 Mon Mar 19 09:52:16 2018 (r331201) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 3, 2017 +.Dd March 12, 2018 .Dt IPFW 8 .Os .Sh NAME @@ -1135,7 +1135,7 @@ Regardless of matched a packet or not by the .Cm tcp-setmss rule, the search continues with the next rule. .It Cm reass -Queue and reassemble IP fragments. +Queue and reassemble IPv4 fragments. If the packet is not fragmented, counters are updated and processing continues with the next rule. If the packet is the last logical fragment, the packet is reassembled and, if Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw2.c Mon Mar 19 08:28:25 2018 (r331200) +++ stable/11/sys/netpfil/ipfw/ip_fw2.c Mon Mar 19 09:52:16 2018 (r331201) @@ -2779,8 +2779,10 @@ do { \ case O_REASS: { int ip_off; - IPFW_INC_RULE_COUNTER(f, pktlen); l = 0; /* in any case exit inner loop */ + if (is_ipv6) /* IPv6 is not supported yet */ + break; + IPFW_INC_RULE_COUNTER(f, pktlen); ip_off = ntohs(ip->ip_off); /* if not fragmented, go to next rule */ From owner-svn-src-stable@freebsd.org Mon Mar 19 09:54:17 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4457F61096; Mon, 19 Mar 2018 09:54:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 558C986D0B; Mon, 19 Mar 2018 09:54:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50566535A; Mon, 19 Mar 2018 09:54:17 +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 w2J9sHEb092768; Mon, 19 Mar 2018 09:54:17 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2J9sHOJ092766; Mon, 19 Mar 2018 09:54:17 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201803190954.w2J9sHOJ092766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 19 Mar 2018 09:54:17 +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: r331202 - in stable/10: sbin/ipfw sys/netpfil/ipfw X-SVN-Group: stable-10 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/10: sbin/ipfw sys/netpfil/ipfw X-SVN-Commit-Revision: 331202 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, 19 Mar 2018 09:54:17 -0000 Author: ae Date: Mon Mar 19 09:54:16 2018 New Revision: 331202 URL: https://svnweb.freebsd.org/changeset/base/331202 Log: MFC r330792: Do not try to reassemble IPv6 fragments in "reass" rule. ip_reass() expects IPv4 packet and will just corrupt any IPv6 packets that it gets. Until proper IPv6 fragments handling function will be implemented, pass IPv6 packets to next rule. PR: 170604 Modified: stable/10/sbin/ipfw/ipfw.8 stable/10/sys/netpfil/ipfw/ip_fw2.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/ipfw/ipfw.8 ============================================================================== --- stable/10/sbin/ipfw/ipfw.8 Mon Mar 19 09:52:16 2018 (r331201) +++ stable/10/sbin/ipfw/ipfw.8 Mon Mar 19 09:54:16 2018 (r331202) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 26, 2016 +.Dd March 12, 2018 .Dt IPFW 8 .Os .Sh NAME @@ -1016,7 +1016,7 @@ keyword with setdscp. If the tablearg value is not within the 0..64 range, lower 6 bits of supplied value are used. .It Cm reass -Queue and reassemble IP fragments. +Queue and reassemble IPv4 fragments. If the packet is not fragmented, counters are updated and processing continues with the next rule. If the packet is the last logical fragment, the packet is reassembled and, if Modified: stable/10/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/10/sys/netpfil/ipfw/ip_fw2.c Mon Mar 19 09:52:16 2018 (r331201) +++ stable/10/sys/netpfil/ipfw/ip_fw2.c Mon Mar 19 09:54:16 2018 (r331202) @@ -2461,8 +2461,10 @@ do { \ case O_REASS: { int ip_off; - IPFW_INC_RULE_COUNTER(f, pktlen); l = 0; /* in any case exit inner loop */ + if (is_ipv6) /* IPv6 is not supported yet */ + break; + IPFW_INC_RULE_COUNTER(f, pktlen); ip_off = ntohs(ip->ip_off); /* if not fragmented, go to next rule */ From owner-svn-src-stable@freebsd.org Mon Mar 19 14:28:22 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F280F50B5B; Mon, 19 Mar 2018 14:28:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED53371BAA; Mon, 19 Mar 2018 14:28:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E83387C15; Mon, 19 Mar 2018 14:28:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JESLrJ027524; Mon, 19 Mar 2018 14:28:21 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JESKXm027512; Mon, 19 Mar 2018 14:28:20 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201803191428.w2JESKXm027512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 19 Mar 2018 14:28: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: r331205 - in stable/11: lib/libc/sparc64/sys libexec/rtld-elf libexec/rtld-elf/aarch64 libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/mips libexec/rt... X-SVN-Group: stable-11 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/11: lib/libc/sparc64/sys libexec/rtld-elf libexec/rtld-elf/aarch64 libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/mips libexec/rtld-elf/powerpc libexec/rt... X-SVN-Commit-Revision: 331205 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, 19 Mar 2018 14:28:22 -0000 Author: marius Date: Mon Mar 19 14:28:20 2018 New Revision: 331205 URL: https://svnweb.freebsd.org/changeset/base/331205 Log: MFC: r328834 o Let rtld(1) set up psABI user trap handlers prior to executing the objects' init functions instead of doing the setup via a constructor in libc as the init functions may already depend on these handlers to be in place. This gets us rid of: - the undefined order in which libc constructors as __guard_setup() and jemalloc_constructor() are executed WRT __sparc_utrap_setup(), - the requirement to link libc last so __sparc_utrap_setup() gets called prior to constructors in other libraries (see r122883). For static binaries, crt1.o still sets up the user trap handlers. o Move misplaced prototypes for MD functions in to the MD prototype section of rtld.h. o Sprinkle nitems(). Modified: stable/11/lib/libc/sparc64/sys/__sparc_utrap_setup.c stable/11/libexec/rtld-elf/aarch64/reloc.c stable/11/libexec/rtld-elf/amd64/reloc.c stable/11/libexec/rtld-elf/arm/reloc.c stable/11/libexec/rtld-elf/i386/reloc.c stable/11/libexec/rtld-elf/mips/reloc.c stable/11/libexec/rtld-elf/powerpc/reloc.c stable/11/libexec/rtld-elf/powerpc64/reloc.c stable/11/libexec/rtld-elf/riscv/reloc.c stable/11/libexec/rtld-elf/rtld.c stable/11/libexec/rtld-elf/rtld.h stable/11/libexec/rtld-elf/sparc64/reloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sparc64/sys/__sparc_utrap_setup.c ============================================================================== --- stable/11/lib/libc/sparc64/sys/__sparc_utrap_setup.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/lib/libc/sparc64/sys/__sparc_utrap_setup.c Mon Mar 19 14:28:20 2018 (r331205) @@ -29,13 +29,11 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include #include -#include - #include "__sparc_utrap_private.h" static const struct sparc_utrap_args ua[] = { @@ -47,10 +45,10 @@ static const struct sparc_utrap_args ua[] = { }; static const struct sparc_utrap_install_args uia[] = { - { sizeof (ua) / sizeof (*ua), ua } + { nitems(ua), ua } }; -void __sparc_utrap_setup(void) __attribute__((constructor)); +void __sparc_utrap_setup(void); void __sparc_utrap_setup(void) Modified: stable/11/libexec/rtld-elf/aarch64/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/aarch64/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/aarch64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -306,6 +306,13 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } /* Modified: stable/11/libexec/rtld-elf/amd64/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/amd64/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/amd64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -485,6 +485,12 @@ ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] } void +pre_init(void) +{ + +} + +void allocate_initial_tls(Obj_Entry *objs) { /* Modified: stable/11/libexec/rtld-elf/arm/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/arm/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/arm/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -481,6 +481,13 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/11/libexec/rtld-elf/i386/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/i386/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/i386/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -471,6 +471,12 @@ ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] } void +pre_init(void) +{ + +} + +void allocate_initial_tls(Obj_Entry *objs) { void* tls; Modified: stable/11/libexec/rtld-elf/mips/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/mips/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/mips/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -628,6 +628,13 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/11/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/powerpc/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/powerpc/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -626,6 +626,13 @@ init_pltgot(Obj_Entry *obj) void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/11/libexec/rtld-elf/powerpc64/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/powerpc64/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/powerpc64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -531,6 +531,13 @@ init_pltgot(Obj_Entry *obj) void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/11/libexec/rtld-elf/riscv/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/riscv/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/riscv/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -368,6 +368,13 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/11/libexec/rtld-elf/rtld.c ============================================================================== --- stable/11/libexec/rtld-elf/rtld.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/rtld.c Mon Mar 19 14:28:20 2018 (r331205) @@ -753,6 +753,12 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr obj_main->fini_array = (Elf_Addr)NULL; } + /* + * Execute MD initializers required before we call the objects' + * init functions. + */ + pre_init(); + wlock_acquire(rtld_bind_lock, &lockstate); if (obj_main->crt_no_init) preinit_main(); Modified: stable/11/libexec/rtld-elf/rtld.h ============================================================================== --- stable/11/libexec/rtld-elf/rtld.h Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/rtld.h Mon Mar 19 14:28:20 2018 (r331205) @@ -371,8 +371,6 @@ void dump_Elf_Rela(Obj_Entry *, const Elf_Rela *, u_lo unsigned long elf_hash(const char *); const Elf_Sym *find_symdef(unsigned long, const Obj_Entry *, const Obj_Entry **, int, SymCache *, struct Struct_RtldLockState *); -void ifunc_init(Elf_Auxinfo[__min_size(AT_COUNT)]); -void init_pltgot(Obj_Entry *); void lockdflt_init(void); void digest_notes(Obj_Entry *, Elf_Addr, Elf_Addr); Obj_Entry *globallist_curr(const Obj_Entry *obj); @@ -402,6 +400,9 @@ int reloc_plt(Obj_Entry *); int reloc_jmpslots(Obj_Entry *, int flags, struct Struct_RtldLockState *); int reloc_iresolve(Obj_Entry *, struct Struct_RtldLockState *); int reloc_gnu_ifunc(Obj_Entry *, int flags, struct Struct_RtldLockState *); +void ifunc_init(Elf_Auxinfo[__min_size(AT_COUNT)]); +void pre_init(void); +void init_pltgot(Obj_Entry *); void allocate_initial_tls(Obj_Entry *); #endif /* } */ Modified: stable/11/libexec/rtld-elf/sparc64/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/sparc64/reloc.c Mon Mar 19 13:51:33 2018 (r331204) +++ stable/11/libexec/rtld-elf/sparc64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) @@ -365,8 +365,7 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rela *re * Note: R_SPARC_TLS_TPOFF64 must be the numerically largest * relocation type. */ - if (type >= sizeof(reloc_target_bitmask) / - sizeof(*reloc_target_bitmask)) { + if (type >= nitems(reloc_target_bitmask)) { _rtld_error("%s: Unsupported relocation type %d in non-PLT " "object\n", obj->path, type); return (-1); @@ -791,8 +790,18 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + } +extern void __sparc_utrap_setup(void); + +void +pre_init(void) +{ + + __sparc_utrap_setup(); +} + /* * Install rtld function call into this PLT slot. */ @@ -821,6 +830,7 @@ init_pltgot(Obj_Entry *obj) static void install_plt(Elf_Word *pltgot, Elf_Addr proc) { + pltgot[0] = SAVE; flush(pltgot, 0); pltgot[1] = SETHI_l0 | HIVAL(proc, 42); From owner-svn-src-stable@freebsd.org Mon Mar 19 14:29:00 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55FC1F50C0B; Mon, 19 Mar 2018 14:29:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 060D571CE0; Mon, 19 Mar 2018 14:29:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00F927C16; Mon, 19 Mar 2018 14:29:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JESxO1027619; Mon, 19 Mar 2018 14:28:59 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JESwYm027606; Mon, 19 Mar 2018 14:28:58 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201803191428.w2JESwYm027606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 19 Mar 2018 14:28: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: r331206 - in stable/10: lib/libc/sparc64/sys libexec/rtld-elf libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/ia64 libexec/rtld-elf/mips libexec/rtld-... X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/10: lib/libc/sparc64/sys libexec/rtld-elf libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/ia64 libexec/rtld-elf/mips libexec/rtld-elf/powerpc libexec/rtld-... X-SVN-Commit-Revision: 331206 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, 19 Mar 2018 14:29:00 -0000 Author: marius Date: Mon Mar 19 14:28:58 2018 New Revision: 331206 URL: https://svnweb.freebsd.org/changeset/base/331206 Log: MFC: r328834 o Let rtld(1) set up psABI user trap handlers prior to executing the objects' init functions instead of doing the setup via a constructor in libc as the init functions may already depend on these handlers to be in place. This gets us rid of: - the undefined order in which libc constructors as __guard_setup() and jemalloc_constructor() are executed WRT __sparc_utrap_setup(), - the requirement to link libc last so __sparc_utrap_setup() gets called prior to constructors in other libraries (see r122883). For static binaries, crt1.o still sets up the user trap handlers. o Move misplaced prototypes for MD functions in to the MD prototype section of rtld.h. o Sprinkle nitems(). Modified: stable/10/lib/libc/sparc64/sys/__sparc_utrap_setup.c stable/10/libexec/rtld-elf/amd64/reloc.c stable/10/libexec/rtld-elf/arm/reloc.c stable/10/libexec/rtld-elf/i386/reloc.c stable/10/libexec/rtld-elf/ia64/reloc.c stable/10/libexec/rtld-elf/mips/reloc.c stable/10/libexec/rtld-elf/powerpc/reloc.c stable/10/libexec/rtld-elf/powerpc64/reloc.c stable/10/libexec/rtld-elf/rtld.c stable/10/libexec/rtld-elf/rtld.h stable/10/libexec/rtld-elf/sparc64/reloc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sparc64/sys/__sparc_utrap_setup.c ============================================================================== --- stable/10/lib/libc/sparc64/sys/__sparc_utrap_setup.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/lib/libc/sparc64/sys/__sparc_utrap_setup.c Mon Mar 19 14:28:58 2018 (r331206) @@ -27,13 +27,11 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include #include -#include - #include "__sparc_utrap_private.h" static const struct sparc_utrap_args ua[] = { @@ -45,10 +43,10 @@ static const struct sparc_utrap_args ua[] = { }; static const struct sparc_utrap_install_args uia[] = { - { sizeof (ua) / sizeof (*ua), ua } + { nitems(ua), ua } }; -void __sparc_utrap_setup(void) __attribute__((constructor)); +void __sparc_utrap_setup(void); void __sparc_utrap_setup(void) Modified: stable/10/libexec/rtld-elf/amd64/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/amd64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/amd64/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -471,6 +471,12 @@ ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] } void +pre_init(void) +{ + +} + +void allocate_initial_tls(Obj_Entry *objs) { /* Modified: stable/10/libexec/rtld-elf/arm/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/arm/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/arm/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -437,6 +437,13 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/10/libexec/rtld-elf/i386/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/i386/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/i386/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -457,6 +457,12 @@ ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] } void +pre_init(void) +{ + +} + +void allocate_initial_tls(Obj_Entry *objs) { void* tls; Modified: stable/10/libexec/rtld-elf/ia64/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/ia64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/ia64/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -606,6 +606,13 @@ call_init_pointer(const Obj_Entry *obj, Elf_Addr targe void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } /* Initialize the special PLT entries. */ Modified: stable/10/libexec/rtld-elf/mips/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/mips/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/mips/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -620,6 +620,13 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/10/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/powerpc/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/powerpc/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -622,6 +622,13 @@ init_pltgot(Obj_Entry *obj) void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/10/libexec/rtld-elf/powerpc64/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/powerpc64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/powerpc64/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -490,6 +490,13 @@ init_pltgot(Obj_Entry *obj) void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + +} + +void +pre_init(void) +{ + } void Modified: stable/10/libexec/rtld-elf/rtld.c ============================================================================== --- stable/10/libexec/rtld-elf/rtld.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/rtld.c Mon Mar 19 14:28:58 2018 (r331206) @@ -659,6 +659,12 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr obj_main->fini_array = (Elf_Addr)NULL; } + /* + * Execute MD initializers required before we call the objects' + * init functions. + */ + pre_init(); + wlock_acquire(rtld_bind_lock, &lockstate); if (obj_main->crt_no_init) preinit_main(); Modified: stable/10/libexec/rtld-elf/rtld.h ============================================================================== --- stable/10/libexec/rtld-elf/rtld.h Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/rtld.h Mon Mar 19 14:28:58 2018 (r331206) @@ -380,8 +380,6 @@ void dump_Elf_Rela(Obj_Entry *, const Elf_Rela *, u_lo unsigned long elf_hash(const char *); const Elf_Sym *find_symdef(unsigned long, const Obj_Entry *, const Obj_Entry **, int, SymCache *, struct Struct_RtldLockState *); -void ifunc_init(Elf_Auxinfo *); -void init_pltgot(Obj_Entry *); void lockdflt_init(void); void digest_notes(Obj_Entry *, Elf_Addr, Elf_Addr); Obj_Entry *globallist_curr(const Obj_Entry *obj); @@ -411,6 +409,9 @@ int reloc_plt(Obj_Entry *); int reloc_jmpslots(Obj_Entry *, int flags, struct Struct_RtldLockState *); int reloc_iresolve(Obj_Entry *, struct Struct_RtldLockState *); int reloc_gnu_ifunc(Obj_Entry *, int flags, struct Struct_RtldLockState *); +void ifunc_init(Elf_Auxinfo *); +void pre_init(void); +void init_pltgot(Obj_Entry *); void allocate_initial_tls(Obj_Entry *); #endif /* } */ Modified: stable/10/libexec/rtld-elf/sparc64/reloc.c ============================================================================== --- stable/10/libexec/rtld-elf/sparc64/reloc.c Mon Mar 19 14:28:20 2018 (r331205) +++ stable/10/libexec/rtld-elf/sparc64/reloc.c Mon Mar 19 14:28:58 2018 (r331206) @@ -365,8 +365,7 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rela *re * Note: R_SPARC_TLS_TPOFF64 must be the numerically largest * relocation type. */ - if (type >= sizeof(reloc_target_bitmask) / - sizeof(*reloc_target_bitmask)) { + if (type >= nitems(reloc_target_bitmask)) { _rtld_error("%s: Unsupported relocation type %d in non-PLT " "object\n", obj->path, type); return (-1); @@ -789,8 +788,18 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const void ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) { + } +extern void __sparc_utrap_setup(void); + +void +pre_init(void) +{ + + __sparc_utrap_setup(); +} + /* * Install rtld function call into this PLT slot. */ @@ -819,6 +828,7 @@ init_pltgot(Obj_Entry *obj) static void install_plt(Elf_Word *pltgot, Elf_Addr proc) { + pltgot[0] = SAVE; flush(pltgot, 0); pltgot[1] = SETHI_l0 | HIVAL(proc, 42); From owner-svn-src-stable@freebsd.org Mon Mar 19 17:37:52 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71A5EF5E660; Mon, 19 Mar 2018 17:37:52 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E0627B61F; Mon, 19 Mar 2018 17:37:52 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14C5111975; Mon, 19 Mar 2018 17:37:52 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JHbpIZ023625; Mon, 19 Mar 2018 17:37:51 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JHbpwZ023624; Mon, 19 Mar 2018 17:37:51 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201803191737.w2JHbpwZ023624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Mon, 19 Mar 2018 17:37: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: r331216 - stable/11/etc/rc.d X-SVN-Group: stable-11 X-SVN-Commit-Author: dab X-SVN-Commit-Paths: stable/11/etc/rc.d X-SVN-Commit-Revision: 331216 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, 19 Mar 2018 17:37:52 -0000 Author: dab Date: Mon Mar 19 17:37:51 2018 New Revision: 331216 URL: https://svnweb.freebsd.org/changeset/base/331216 Log: MFC r331015: Modify rc.d/fsck to handle new status from fsck/fsck_ffs r328013 introduced a new error code from fsck_ffs that indicates that it could not completely fix the file system; this happens when it prints the message PLEASE RERUN FSCK. However, this status can happen when fsck is run in "preen" mode and the rc.d/fsck script does not handle that error code. Modify rc.d/fsck so that if "fsck -p" ("preen") returns the new status code (16) it will run "fsck -y", as it currently does for a status code of 8 (the "standard error exit"). Reported by: markj Sponsored by: Dell EMC Modified: stable/11/etc/rc.d/fsck Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.d/fsck ============================================================================== --- stable/11/etc/rc.d/fsck Mon Mar 19 17:14:56 2018 (r331215) +++ stable/11/etc/rc.d/fsck Mon Mar 19 17:37:51 2018 (r331216) @@ -57,7 +57,7 @@ fsck_start() echo "Reboot failed; help!" stop_boot ;; - 8) + 8|16) if checkyesno fsck_y_enable; then echo "File system preen failed, trying fsck -y ${fsck_y_flags}" fsck -y ${fsck_y_flags} From owner-svn-src-stable@freebsd.org Mon Mar 19 17:38:36 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AB63F5E739; Mon, 19 Mar 2018 17:38:36 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E75677B78B; Mon, 19 Mar 2018 17:38:35 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E203011976; Mon, 19 Mar 2018 17:38:35 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JHcZN8023700; Mon, 19 Mar 2018 17:38:35 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JHcZMp023699; Mon, 19 Mar 2018 17:38:35 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201803191738.w2JHcZMp023699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Mon, 19 Mar 2018 17:38:35 +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: r331217 - stable/10/etc/rc.d X-SVN-Group: stable-10 X-SVN-Commit-Author: dab X-SVN-Commit-Paths: stable/10/etc/rc.d X-SVN-Commit-Revision: 331217 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, 19 Mar 2018 17:38:36 -0000 Author: dab Date: Mon Mar 19 17:38:35 2018 New Revision: 331217 URL: https://svnweb.freebsd.org/changeset/base/331217 Log: MFC r331015: Modify rc.d/fsck to handle new status from fsck/fsck_ffs r328013 introduced a new error code from fsck_ffs that indicates that it could not completely fix the file system; this happens when it prints the message PLEASE RERUN FSCK. However, this status can happen when fsck is run in "preen" mode and the rc.d/fsck script does not handle that error code. Modify rc.d/fsck so that if "fsck -p" ("preen") returns the new status code (16) it will run "fsck -y", as it currently does for a status code of 8 (the "standard error exit"). Reported by: markj Sponsored by: Dell EMC Modified: stable/10/etc/rc.d/fsck Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/fsck ============================================================================== --- stable/10/etc/rc.d/fsck Mon Mar 19 17:37:51 2018 (r331216) +++ stable/10/etc/rc.d/fsck Mon Mar 19 17:38:35 2018 (r331217) @@ -42,7 +42,7 @@ fsck_start() echo "Reboot failed; help!" stop_boot ;; - 8) + 8|16) if checkyesno fsck_y_enable; then echo "File system preen failed, trying fsck -y ${fsck_y_flags}" fsck -y ${fsck_y_flags} From owner-svn-src-stable@freebsd.org Mon Mar 19 18:36:47 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD85FF62826; Mon, 19 Mar 2018 18:36:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D7C67E3AC; Mon, 19 Mar 2018 18:36:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6386C1230A; Mon, 19 Mar 2018 18:36:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2JIakgl053874; Mon, 19 Mar 2018 18:36:46 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2JIah8o053850; Mon, 19 Mar 2018 18:36:43 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201803191836.w2JIah8o053850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 19 Mar 2018 18:36:43 +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: r331219 - in stable/11: contrib/llvm/include/llvm contrib/llvm/include/llvm/CodeGen contrib/llvm/include/llvm/Target contrib/llvm/lib/CodeGen contrib/llvm/lib/Target/X86 contrib/llvm/to... X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable/11: contrib/llvm/include/llvm contrib/llvm/include/llvm/CodeGen contrib/llvm/include/llvm/Target contrib/llvm/lib/CodeGen contrib/llvm/lib/Target/X86 contrib/llvm/tools/clang/include/clang/D... X-SVN-Commit-Revision: 331219 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, 19 Mar 2018 18:36:47 -0000 Author: dim Date: Mon Mar 19 18:36:43 2018 New Revision: 331219 URL: https://svnweb.freebsd.org/changeset/base/331219 Log: Merge retpoline support from the upstream llvm, clang and lld 5.0 branches. Upstream merge revisions: r324007: merging r323155 for llvm r324009: merging r323915 for llvm r324012: merging r323155 for clang r324025: merging r323155 for lld, with modifications to handle int3 fill r324026: merging r323288 for lld r325088: merging r324449 for llvm r325089: merging r324645 for llvm r325090: merging r325049 for llvm r325091: merging r325085 for llvm Original commit messages: r323155 (by Chandler Carruth): Introduce the "retpoline" x86 mitigation technique for variant #2 of the speculative execution vulnerabilities disclosed today, specifically identified by CVE-2017-5715, "Branch Target Injection", and is one of the two halves to Spectre. Summary: First, we need to explain the core of the vulnerability. Note that this is a very incomplete description, please see the Project Zero blog post for details: https://googleprojectzero.blogspot.com/2018/01/reading-privileged-memory-with-side.html The basis for branch target injection is to direct speculative execution of the processor to some "gadget" of executable code by poisoning the prediction of indirect branches with the address of that gadget. The gadget in turn contains an operation that provides a side channel for reading data. Most commonly, this will look like a load of secret data followed by a branch on the loaded value and then a load of some predictable cache line. The attacker then uses timing of the processors cache to determine which direction the branch took *in the speculative execution*, and in turn what one bit of the loaded value was. Due to the nature of these timing side channels and the branch predictor on Intel processors, this allows an attacker to leak data only accessible to a privileged domain (like the kernel) back into an unprivileged domain. The goal is simple: avoid generating code which contains an indirect branch that could have its prediction poisoned by an attacker. In many cases, the compiler can simply use directed conditional branches and a small search tree. LLVM already has support for lowering switches in this way and the first step of this patch is to disable jump-table lowering of switches and introduce a pass to rewrite explicit indirectbr sequences into a switch over integers. However, there is no fully general alternative to indirect calls. We introduce a new construct we call a "retpoline" to implement indirect calls in a non-speculatable way. It can be thought of loosely as a trampoline for indirect calls which uses the RET instruction on x86. Further, we arrange for a specific call->ret sequence which ensures the processor predicts the return to go to a controlled, known location. The retpoline then "smashes" the return address pushed onto the stack by the call with the desired target of the original indirect call. The result is a predicted return to the next instruction after a call (which can be used to trap speculative execution within an infinite loop) and an actual indirect branch to an arbitrary address. On 64-bit x86 ABIs, this is especially easily done in the compiler by using a guaranteed scratch register to pass the target into this device. For 32-bit ABIs there isn't a guaranteed scratch register and so several different retpoline variants are introduced to use a scratch register if one is available in the calling convention and to otherwise use direct stack push/pop sequences to pass the target address. This "retpoline" mitigation is fully described in the following blog post: https://support.google.com/faqs/answer/7625886 We also support a target feature that disables emission of the retpoline thunk by the compiler to allow for custom thunks if users want them. These are particularly useful in environments like kernels that routinely do hot-patching on boot and want to hot-patch their thunk to different code sequences. They can write this custom thunk and use `-mretpoline-external-thunk` *in addition* to `-mretpoline`. In this case, on x86-64 thu thunk names must be: ``` __llvm_external_retpoline_r11 ``` or on 32-bit: ``` __llvm_external_retpoline_eax __llvm_external_retpoline_ecx __llvm_external_retpoline_edx __llvm_external_retpoline_push ``` And the target of the retpoline is passed in the named register, or in the case of the `push` suffix on the top of the stack via a `pushl` instruction. There is one other important source of indirect branches in x86 ELF binaries: the PLT. These patches also include support for LLD to generate PLT entries that perform a retpoline-style indirection. The only other indirect branches remaining that we are aware of are from precompiled runtimes (such as crt0.o and similar). The ones we have found are not really attackable, and so we have not focused on them here, but eventually these runtimes should also be replicated for retpoline-ed configurations for completeness. For kernels or other freestanding or fully static executables, the compiler switch `-mretpoline` is sufficient to fully mitigate this particular attack. For dynamic executables, you must compile *all* libraries with `-mretpoline` and additionally link the dynamic executable and all shared libraries with LLD and pass `-z retpolineplt` (or use similar functionality from some other linker). We strongly recommend also using `-z now` as non-lazy binding allows the retpoline-mitigated PLT to be substantially smaller. When manually apply similar transformations to `-mretpoline` to the Linux kernel we observed very small performance hits to applications running typical workloads, and relatively minor hits (approximately 2%) even for extremely syscall-heavy applications. This is largely due to the small number of indirect branches that occur in performance sensitive paths of the kernel. When using these patches on statically linked applications, especially C++ applications, you should expect to see a much more dramatic performance hit. For microbenchmarks that are switch, indirect-, or virtual-call heavy we have seen overheads ranging from 10% to 50%. However, real-world workloads exhibit substantially lower performance impact. Notably, techniques such as PGO and ThinLTO dramatically reduce the impact of hot indirect calls (by speculatively promoting them to direct calls) and allow optimized search trees to be used to lower switches. If you need to deploy these techniques in C++ applications, we *strongly* recommend that you ensure all hot call targets are statically linked (avoiding PLT indirection) and use both PGO and ThinLTO. Well tuned servers using all of these techniques saw 5% - 10% overhead from the use of retpoline. We will add detailed documentation covering these components in subsequent patches, but wanted to make the core functionality available as soon as possible. Happy for more code review, but we'd really like to get these patches landed and backported ASAP for obvious reasons. We're planning to backport this to both 6.0 and 5.0 release streams and get a 5.0 release with just this cherry picked ASAP for distros and vendors. This patch is the work of a number of people over the past month: Eric, Reid, Rui, and myself. I'm mailing it out as a single commit due to the time sensitive nature of landing this and the need to backport it. Huge thanks to everyone who helped out here, and everyone at Intel who helped out in discussions about how to craft this. Also, credit goes to Paul Turner (at Google, but not an LLVM contributor) for much of the underlying retpoline design. Reviewers: echristo, rnk, ruiu, craig.topper, DavidKreitzer Subscribers: sanjoy, emaste, mcrosier, mgorny, mehdi_amini, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D41723 r323915 (by Chandler Carruth): [x86] Make the retpoline thunk insertion a machine function pass. Summary: This removes the need for a machine module pass using some deeply questionable hacks. This should address PR36123 which is a case where in full LTO the memory usage of a machine module pass actually ended up being significant. We should revert this on trunk as soon as we understand and fix the memory usage issue, but we should include this in any backports of retpolines themselves. Reviewers: echristo, MatzeB Subscribers: sanjoy, mcrosier, mehdi_amini, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D42726 r323288 (by Rui Ueyama): Fix retpoline PLT header size for i386. Differential Revision: https://reviews.llvm.org/D42397 r324449 (by Chandler Carruth): [x86/retpoline] Make the external thunk names exactly match the names that happened to end up in GCC. This is really unfortunate, as the names don't have much rhyme or reason to them. Originally in the discussions it seemed fine to rely on aliases to map different names to whatever external thunk code developers wished to use but there are practical problems with that in the kernel it turns out. And since we're discovering this practical problems late and since GCC has already shipped a release with one set of names, we are forced, yet again, to blindly match what is there. Somewhat rushing this patch out for the Linux kernel folks to test and so we can get it patched into our releases. Differential Revision: https://reviews.llvm.org/D42998 r324645 (by David Woodhouse): [X86] Support 'V' register operand modifier This allows the register name to be printed without the leading '%'. This can be used for emitting calls to the retpoline thunks from inline asm. r325049 (by Reid Kleckner): [X86] Use EDI for retpoline when no scratch regs are left Summary: Instead of solving the hard problem of how to pass the callee to the indirect jump thunk without a register, just use a CSR. At a call boundary, there's nothing stopping us from using a CSR to hold the callee as long as we save and restore it in the prologue. Also, add tests for this mregparm=3 case. I wrote execution tests for __llvm_retpoline_push, but they never got committed as lit tests, either because I never rewrote them or because they got lost in merge conflicts. Reviewers: chandlerc, dwmw2 Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D43214 r325085 (by Reid Kleckner): [X86] Remove dead code from retpoline thunk generation Differential Revision: https://reviews.freebsd.org/D14720 Added: stable/11/contrib/llvm/lib/CodeGen/IndirectBrExpandPass.cpp stable/11/contrib/llvm/lib/Target/X86/X86RetpolineThunks.cpp Modified: stable/11/contrib/llvm/include/llvm/CodeGen/Passes.h stable/11/contrib/llvm/include/llvm/CodeGen/TargetPassConfig.h stable/11/contrib/llvm/include/llvm/InitializePasses.h stable/11/contrib/llvm/include/llvm/Target/TargetLowering.h stable/11/contrib/llvm/include/llvm/Target/TargetSubtargetInfo.h stable/11/contrib/llvm/lib/CodeGen/CodeGen.cpp stable/11/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp stable/11/contrib/llvm/lib/CodeGen/TargetSubtargetInfo.cpp stable/11/contrib/llvm/lib/Target/X86/X86.h stable/11/contrib/llvm/lib/Target/X86/X86.td stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.h stable/11/contrib/llvm/lib/Target/X86/X86FastISel.cpp stable/11/contrib/llvm/lib/Target/X86/X86FrameLowering.cpp stable/11/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.h stable/11/contrib/llvm/lib/Target/X86/X86InstrCompiler.td stable/11/contrib/llvm/lib/Target/X86/X86InstrControl.td stable/11/contrib/llvm/lib/Target/X86/X86InstrInfo.td stable/11/contrib/llvm/lib/Target/X86/X86MCInstLower.cpp stable/11/contrib/llvm/lib/Target/X86/X86Subtarget.cpp stable/11/contrib/llvm/lib/Target/X86/X86Subtarget.h stable/11/contrib/llvm/lib/Target/X86/X86TargetMachine.cpp stable/11/contrib/llvm/tools/clang/include/clang/Driver/Options.td stable/11/contrib/llvm/tools/clang/lib/Basic/Targets.cpp stable/11/contrib/llvm/tools/lld/ELF/Arch/X86.cpp stable/11/contrib/llvm/tools/lld/ELF/Arch/X86_64.cpp stable/11/contrib/llvm/tools/lld/ELF/Config.h stable/11/contrib/llvm/tools/lld/ELF/Driver.cpp stable/11/contrib/llvm/tools/opt/opt.cpp stable/11/lib/clang/freebsd_cc_version.h stable/11/lib/clang/libllvm/Makefile stable/11/sys/sys/param.h Modified: stable/11/contrib/llvm/include/llvm/CodeGen/Passes.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/CodeGen/Passes.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/include/llvm/CodeGen/Passes.h Mon Mar 19 18:36:43 2018 (r331219) @@ -420,6 +420,9 @@ namespace llvm { /// shuffles. FunctionPass *createExpandReductionsPass(); + // This pass expands indirectbr instructions. + FunctionPass *createIndirectBrExpandPass(); + } // End llvm namespace #endif Modified: stable/11/contrib/llvm/include/llvm/CodeGen/TargetPassConfig.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/CodeGen/TargetPassConfig.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/include/llvm/CodeGen/TargetPassConfig.h Mon Mar 19 18:36:43 2018 (r331219) @@ -406,6 +406,13 @@ class TargetPassConfig : public ImmutablePass { (prote /// immediately before machine code is emitted. virtual void addPreEmitPass() { } + /// Targets may add passes immediately before machine code is emitted in this + /// callback. This is called even later than `addPreEmitPass`. + // FIXME: Rename `addPreEmitPass` to something more sensible given its actual + // position and remove the `2` suffix here as this callback is what + // `addPreEmitPass` *should* be but in reality isn't. + virtual void addPreEmitPass2() {} + /// Utilities for targets to add passes to the pass manager. /// Modified: stable/11/contrib/llvm/include/llvm/InitializePasses.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/InitializePasses.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/include/llvm/InitializePasses.h Mon Mar 19 18:36:43 2018 (r331219) @@ -157,6 +157,7 @@ void initializeIVUsersWrapperPassPass(PassRegistry&); void initializeIfConverterPass(PassRegistry&); void initializeImplicitNullChecksPass(PassRegistry&); void initializeIndVarSimplifyLegacyPassPass(PassRegistry&); +void initializeIndirectBrExpandPassPass(PassRegistry&); void initializeInductiveRangeCheckEliminationPass(PassRegistry&); void initializeInferAddressSpacesPass(PassRegistry&); void initializeInferFunctionAttrsLegacyPassPass(PassRegistry&); Modified: stable/11/contrib/llvm/include/llvm/Target/TargetLowering.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/Target/TargetLowering.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/include/llvm/Target/TargetLowering.h Mon Mar 19 18:36:43 2018 (r331219) @@ -799,7 +799,7 @@ class TargetLoweringBase { (public) } /// Return true if lowering to a jump table is allowed. - bool areJTsAllowed(const Function *Fn) const { + virtual bool areJTsAllowed(const Function *Fn) const { if (Fn->getFnAttribute("no-jump-tables").getValueAsString() == "true") return false; Modified: stable/11/contrib/llvm/include/llvm/Target/TargetSubtargetInfo.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/Target/TargetSubtargetInfo.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/include/llvm/Target/TargetSubtargetInfo.h Mon Mar 19 18:36:43 2018 (r331219) @@ -172,6 +172,9 @@ class TargetSubtargetInfo : public MCSubtargetInfo { ( /// \brief True if the subtarget should run the atomic expansion pass. virtual bool enableAtomicExpand() const; + /// True if the subtarget should run the indirectbr expansion pass. + virtual bool enableIndirectBrExpand() const; + /// \brief Override generic scheduling policy within a region. /// /// This is a convenient way for targets that don't provide any custom Modified: stable/11/contrib/llvm/lib/CodeGen/CodeGen.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/CodeGen.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/CodeGen/CodeGen.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -39,6 +39,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) { initializeGCModuleInfoPass(Registry); initializeIfConverterPass(Registry); initializeImplicitNullChecksPass(Registry); + initializeIndirectBrExpandPassPass(Registry); initializeInterleavedAccessPass(Registry); initializeLiveDebugValuesPass(Registry); initializeLiveDebugVariablesPass(Registry); Added: stable/11/contrib/llvm/lib/CodeGen/IndirectBrExpandPass.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/llvm/lib/CodeGen/IndirectBrExpandPass.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -0,0 +1,221 @@ +//===- IndirectBrExpandPass.cpp - Expand indirectbr to switch -------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// \file +/// +/// Implements an expansion pass to turn `indirectbr` instructions in the IR +/// into `switch` instructions. This works by enumerating the basic blocks in +/// a dense range of integers, replacing each `blockaddr` constant with the +/// corresponding integer constant, and then building a switch that maps from +/// the integers to the actual blocks. All of the indirectbr instructions in the +/// function are redirected to this common switch. +/// +/// While this is generically useful if a target is unable to codegen +/// `indirectbr` natively, it is primarily useful when there is some desire to +/// get the builtin non-jump-table lowering of a switch even when the input +/// source contained an explicit indirect branch construct. +/// +/// Note that it doesn't make any sense to enable this pass unless a target also +/// disables jump-table lowering of switches. Doing that is likely to pessimize +/// the code. +/// +//===----------------------------------------------------------------------===// + +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/Sequence.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/CodeGen/TargetPassConfig.h" +#include "llvm/Target/TargetSubtargetInfo.h" +#include "llvm/IR/BasicBlock.h" +#include "llvm/IR/Function.h" +#include "llvm/IR/IRBuilder.h" +#include "llvm/IR/InstIterator.h" +#include "llvm/IR/Instruction.h" +#include "llvm/IR/Instructions.h" +#include "llvm/Pass.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/Target/TargetMachine.h" + +using namespace llvm; + +#define DEBUG_TYPE "indirectbr-expand" + +namespace { + +class IndirectBrExpandPass : public FunctionPass { + const TargetLowering *TLI = nullptr; + +public: + static char ID; // Pass identification, replacement for typeid + + IndirectBrExpandPass() : FunctionPass(ID) { + initializeIndirectBrExpandPassPass(*PassRegistry::getPassRegistry()); + } + + bool runOnFunction(Function &F) override; +}; + +} // end anonymous namespace + +char IndirectBrExpandPass::ID = 0; + +INITIALIZE_PASS(IndirectBrExpandPass, DEBUG_TYPE, + "Expand indirectbr instructions", false, false) + +FunctionPass *llvm::createIndirectBrExpandPass() { + return new IndirectBrExpandPass(); +} + +bool IndirectBrExpandPass::runOnFunction(Function &F) { + auto &DL = F.getParent()->getDataLayout(); + auto *TPC = getAnalysisIfAvailable(); + if (!TPC) + return false; + + auto &TM = TPC->getTM(); + auto &STI = *TM.getSubtargetImpl(F); + if (!STI.enableIndirectBrExpand()) + return false; + TLI = STI.getTargetLowering(); + + SmallVector IndirectBrs; + + // Set of all potential successors for indirectbr instructions. + SmallPtrSet IndirectBrSuccs; + + // Build a list of indirectbrs that we want to rewrite. + for (BasicBlock &BB : F) + if (auto *IBr = dyn_cast(BB.getTerminator())) { + // Handle the degenerate case of no successors by replacing the indirectbr + // with unreachable as there is no successor available. + if (IBr->getNumSuccessors() == 0) { + (void)new UnreachableInst(F.getContext(), IBr); + IBr->eraseFromParent(); + continue; + } + + IndirectBrs.push_back(IBr); + for (BasicBlock *SuccBB : IBr->successors()) + IndirectBrSuccs.insert(SuccBB); + } + + if (IndirectBrs.empty()) + return false; + + // If we need to replace any indirectbrs we need to establish integer + // constants that will correspond to each of the basic blocks in the function + // whose address escapes. We do that here and rewrite all the blockaddress + // constants to just be those integer constants cast to a pointer type. + SmallVector BBs; + + for (BasicBlock &BB : F) { + // Skip blocks that aren't successors to an indirectbr we're going to + // rewrite. + if (!IndirectBrSuccs.count(&BB)) + continue; + + auto IsBlockAddressUse = [&](const Use &U) { + return isa(U.getUser()); + }; + auto BlockAddressUseIt = llvm::find_if(BB.uses(), IsBlockAddressUse); + if (BlockAddressUseIt == BB.use_end()) + continue; + + assert(std::find_if(std::next(BlockAddressUseIt), BB.use_end(), + IsBlockAddressUse) == BB.use_end() && + "There should only ever be a single blockaddress use because it is " + "a constant and should be uniqued."); + + auto *BA = cast(BlockAddressUseIt->getUser()); + + // Skip if the constant was formed but ended up not being used (due to DCE + // or whatever). + if (!BA->isConstantUsed()) + continue; + + // Compute the index we want to use for this basic block. We can't use zero + // because null can be compared with block addresses. + int BBIndex = BBs.size() + 1; + BBs.push_back(&BB); + + auto *ITy = cast(DL.getIntPtrType(BA->getType())); + ConstantInt *BBIndexC = ConstantInt::get(ITy, BBIndex); + + // Now rewrite the blockaddress to an integer constant based on the index. + // FIXME: We could potentially preserve the uses as arguments to inline asm. + // This would allow some uses such as diagnostic information in crashes to + // have higher quality even when this transform is enabled, but would break + // users that round-trip blockaddresses through inline assembly and then + // back into an indirectbr. + BA->replaceAllUsesWith(ConstantExpr::getIntToPtr(BBIndexC, BA->getType())); + } + + if (BBs.empty()) { + // There are no blocks whose address is taken, so any indirectbr instruction + // cannot get a valid input and we can replace all of them with unreachable. + for (auto *IBr : IndirectBrs) { + (void)new UnreachableInst(F.getContext(), IBr); + IBr->eraseFromParent(); + } + return true; + } + + BasicBlock *SwitchBB; + Value *SwitchValue; + + // Compute a common integer type across all the indirectbr instructions. + IntegerType *CommonITy = nullptr; + for (auto *IBr : IndirectBrs) { + auto *ITy = + cast(DL.getIntPtrType(IBr->getAddress()->getType())); + if (!CommonITy || ITy->getBitWidth() > CommonITy->getBitWidth()) + CommonITy = ITy; + } + + auto GetSwitchValue = [DL, CommonITy](IndirectBrInst *IBr) { + return CastInst::CreatePointerCast( + IBr->getAddress(), CommonITy, + Twine(IBr->getAddress()->getName()) + ".switch_cast", IBr); + }; + + if (IndirectBrs.size() == 1) { + // If we only have one indirectbr, we can just directly replace it within + // its block. + SwitchBB = IndirectBrs[0]->getParent(); + SwitchValue = GetSwitchValue(IndirectBrs[0]); + IndirectBrs[0]->eraseFromParent(); + } else { + // Otherwise we need to create a new block to hold the switch across BBs, + // jump to that block instead of each indirectbr, and phi together the + // values for the switch. + SwitchBB = BasicBlock::Create(F.getContext(), "switch_bb", &F); + auto *SwitchPN = PHINode::Create(CommonITy, IndirectBrs.size(), + "switch_value_phi", SwitchBB); + SwitchValue = SwitchPN; + + // Now replace the indirectbr instructions with direct branches to the + // switch block and fill out the PHI operands. + for (auto *IBr : IndirectBrs) { + SwitchPN->addIncoming(GetSwitchValue(IBr), IBr->getParent()); + BranchInst::Create(SwitchBB, IBr); + IBr->eraseFromParent(); + } + } + + // Now build the switch in the block. The block will have no terminator + // already. + auto *SI = SwitchInst::Create(SwitchValue, BBs[0], BBs.size(), SwitchBB); + + // Add a case for each block. + for (int i : llvm::seq(1, BBs.size())) + SI->addCase(ConstantInt::get(CommonITy, i + 1), BBs[i]); + + return true; +} Modified: stable/11/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/CodeGen/TargetPassConfig.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -790,6 +790,9 @@ void TargetPassConfig::addMachinePasses() { if (EnableMachineOutliner) PM->add(createMachineOutlinerPass()); + // Add passes that directly emit MI after all other MI passes. + addPreEmitPass2(); + AddingMachinePasses = false; } Modified: stable/11/contrib/llvm/lib/CodeGen/TargetSubtargetInfo.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/TargetSubtargetInfo.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/CodeGen/TargetSubtargetInfo.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -37,6 +37,10 @@ bool TargetSubtargetInfo::enableAtomicExpand() const { return true; } +bool TargetSubtargetInfo::enableIndirectBrExpand() const { + return false; +} + bool TargetSubtargetInfo::enableMachineScheduler() const { return false; } Modified: stable/11/contrib/llvm/lib/Target/X86/X86.h ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86.h Mon Mar 19 18:36:43 2018 (r331219) @@ -22,6 +22,7 @@ namespace llvm { class FunctionPass; class ImmutablePass; class InstructionSelector; +class ModulePass; class PassRegistry; class X86RegisterBankInfo; class X86Subtarget; @@ -97,6 +98,9 @@ void initializeFixupBWInstPassPass(PassRegistry &); /// This pass replaces EVEX ecnoded of AVX-512 instructiosn by VEX /// encoding when possible in order to reduce code size. FunctionPass *createX86EvexToVexInsts(); + +/// This pass creates the thunks for the retpoline feature. +FunctionPass *createX86RetpolineThunksPass(); InstructionSelector *createX86InstructionSelector(const X86TargetMachine &TM, X86Subtarget &, Modified: stable/11/contrib/llvm/lib/Target/X86/X86.td ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86.td Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86.td Mon Mar 19 18:36:43 2018 (r331219) @@ -290,6 +290,27 @@ def FeatureERMSB "ermsb", "HasERMSB", "true", "REP MOVS/STOS are fast">; +// Enable mitigation of some aspects of speculative execution related +// vulnerabilities by removing speculatable indirect branches. This disables +// jump-table formation, rewrites explicit `indirectbr` instructions into +// `switch` instructions, and uses a special construct called a "retpoline" to +// prevent speculation of the remaining indirect branches (indirect calls and +// tail calls). +def FeatureRetpoline + : SubtargetFeature<"retpoline", "UseRetpoline", "true", + "Remove speculation of indirect branches from the " + "generated code, either by avoiding them entirely or " + "lowering them with a speculation blocking construct.">; + +// Rely on external thunks for the emitted retpoline calls. This allows users +// to provide their own custom thunk definitions in highly specialized +// environments such as a kernel that does boot-time hot patching. +def FeatureRetpolineExternalThunk + : SubtargetFeature< + "retpoline-external-thunk", "UseRetpolineExternalThunk", "true", + "Enable retpoline, but with an externally provided thunk.", + [FeatureRetpoline]>; + //===----------------------------------------------------------------------===// // X86 processors supported. //===----------------------------------------------------------------------===// Modified: stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -344,6 +344,8 @@ static void printIntelMemReference(X86AsmPrinter &P, c static bool printAsmMRegister(X86AsmPrinter &P, const MachineOperand &MO, char Mode, raw_ostream &O) { unsigned Reg = MO.getReg(); + bool EmitPercent = true; + switch (Mode) { default: return true; // Unknown mode. case 'b': // Print QImode register @@ -358,6 +360,9 @@ static bool printAsmMRegister(X86AsmPrinter &P, const case 'k': // Print SImode register Reg = getX86SubSuperRegister(Reg, 32); break; + case 'V': + EmitPercent = false; + LLVM_FALLTHROUGH; case 'q': // Print 64-bit register names if 64-bit integer registers are available. // Otherwise, print 32-bit register names. @@ -365,7 +370,10 @@ static bool printAsmMRegister(X86AsmPrinter &P, const break; } - O << '%' << X86ATTInstPrinter::getRegisterName(Reg); + if (EmitPercent) + O << '%'; + + O << X86ATTInstPrinter::getRegisterName(Reg); return false; } @@ -438,6 +446,7 @@ bool X86AsmPrinter::PrintAsmOperand(const MachineInstr case 'w': // Print HImode register case 'k': // Print SImode register case 'q': // Print DImode register + case 'V': // Print native register without '%' if (MO.isReg()) return printAsmMRegister(*this, MO, ExtraCode[0], O); printOperand(*this, MI, OpNo, O); Modified: stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.h ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86AsmPrinter.h Mon Mar 19 18:36:43 2018 (r331219) @@ -30,6 +30,7 @@ class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public A StackMaps SM; FaultMaps FM; std::unique_ptr CodeEmitter; + bool NeedsRetpoline = false; // This utility class tracks the length of a stackmap instruction's 'shadow'. // It is used by the X86AsmPrinter to ensure that the stackmap shadow Modified: stable/11/contrib/llvm/lib/Target/X86/X86FastISel.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86FastISel.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86FastISel.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -3161,6 +3161,10 @@ bool X86FastISel::fastLowerCall(CallLoweringInfo &CLI) (CalledFn && CalledFn->hasFnAttribute("no_caller_saved_registers"))) return false; + // Functions using retpoline should use SDISel for calls. + if (Subtarget->useRetpoline()) + return false; + // Handle only C, fastcc, and webkit_js calling conventions for now. switch (CC) { default: return false; Modified: stable/11/contrib/llvm/lib/Target/X86/X86FrameLowering.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86FrameLowering.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86FrameLowering.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -742,6 +742,11 @@ void X86FrameLowering::emitStackProbeCall(MachineFunct bool InProlog) const { bool IsLargeCodeModel = MF.getTarget().getCodeModel() == CodeModel::Large; + // FIXME: Add retpoline support and remove this. + if (Is64Bit && IsLargeCodeModel && STI.useRetpoline()) + report_fatal_error("Emitting stack probe calls on 64-bit with the large " + "code model and retpoline not yet implemented."); + unsigned CallOp; if (Is64Bit) CallOp = IsLargeCodeModel ? X86::CALL64r : X86::CALL64pcrel32; @@ -2337,6 +2342,10 @@ void X86FrameLowering::adjustForSegmentedStacks( // This solution is not perfect, as it assumes that the .rodata section // is laid out within 2^31 bytes of each function body, but this seems // to be sufficient for JIT. + // FIXME: Add retpoline support and remove the error here.. + if (STI.useRetpoline()) + report_fatal_error("Emitting morestack calls on 64-bit with the large " + "code model and retpoline not yet implemented."); BuildMI(allocMBB, DL, TII.get(X86::CALL64m)) .addReg(X86::RIP) .addImm(0) Modified: stable/11/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -550,11 +550,11 @@ void X86DAGToDAGISel::PreprocessISelDAG() { SDNode *N = &*I++; // Preincrement iterator to avoid invalidation issues. if (OptLevel != CodeGenOpt::None && - // Only does this when target favors doesn't favor register indirect - // call. + // Only do this when the target can fold the load into the call or + // jmp. + !Subtarget->useRetpoline() && ((N->getOpcode() == X86ISD::CALL && !Subtarget->callRegIndirect()) || (N->getOpcode() == X86ISD::TC_RETURN && - // Only does this if load can be folded into TC_RETURN. (Subtarget->is64Bit() || !getTargetMachine().isPositionIndependent())))) { /// Also try moving call address load from outside callseq_start to just Modified: stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -24994,6 +24994,15 @@ X86TargetLowering::isVectorClearMaskLegal(const SmallV return isShuffleMaskLegal(Mask, VT); } +bool X86TargetLowering::areJTsAllowed(const Function *Fn) const { + // If the subtarget is using retpolines, we need to not generate jump tables. + if (Subtarget.useRetpoline()) + return false; + + // Otherwise, fallback on the generic logic. + return TargetLowering::areJTsAllowed(Fn); +} + //===----------------------------------------------------------------------===// // X86 Scheduler Hooks //===----------------------------------------------------------------------===// @@ -26225,7 +26234,131 @@ X86TargetLowering::EmitLoweredTLSCall(MachineInstr &MI return BB; } +static unsigned getOpcodeForRetpoline(unsigned RPOpc) { + switch (RPOpc) { + case X86::RETPOLINE_CALL32: + return X86::CALLpcrel32; + case X86::RETPOLINE_CALL64: + return X86::CALL64pcrel32; + case X86::RETPOLINE_TCRETURN32: + return X86::TCRETURNdi; + case X86::RETPOLINE_TCRETURN64: + return X86::TCRETURNdi64; + } + llvm_unreachable("not retpoline opcode"); +} + +static const char *getRetpolineSymbol(const X86Subtarget &Subtarget, + unsigned Reg) { + if (Subtarget.useRetpolineExternalThunk()) { + // When using an external thunk for retpolines, we pick names that match the + // names GCC happens to use as well. This helps simplify the implementation + // of the thunks for kernels where they have no easy ability to create + // aliases and are doing non-trivial configuration of the thunk's body. For + // example, the Linux kernel will do boot-time hot patching of the thunk + // bodies and cannot easily export aliases of these to loaded modules. + // + // Note that at any point in the future, we may need to change the semantics + // of how we implement retpolines and at that time will likely change the + // name of the called thunk. Essentially, there is no hard guarantee that + // LLVM will generate calls to specific thunks, we merely make a best-effort + // attempt to help out kernels and other systems where duplicating the + // thunks is costly. + switch (Reg) { + case X86::EAX: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__x86_indirect_thunk_eax"; + case X86::ECX: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__x86_indirect_thunk_ecx"; + case X86::EDX: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__x86_indirect_thunk_edx"; + case X86::EDI: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__x86_indirect_thunk_edi"; + case X86::R11: + assert(Subtarget.is64Bit() && "Should not be using a 64-bit thunk!"); + return "__x86_indirect_thunk_r11"; + } + llvm_unreachable("unexpected reg for retpoline"); + } + + // When targeting an internal COMDAT thunk use an LLVM-specific name. + switch (Reg) { + case X86::EAX: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__llvm_retpoline_eax"; + case X86::ECX: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__llvm_retpoline_ecx"; + case X86::EDX: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__llvm_retpoline_edx"; + case X86::EDI: + assert(!Subtarget.is64Bit() && "Should not be using a 32-bit thunk!"); + return "__llvm_retpoline_edi"; + case X86::R11: + assert(Subtarget.is64Bit() && "Should not be using a 64-bit thunk!"); + return "__llvm_retpoline_r11"; + } + llvm_unreachable("unexpected reg for retpoline"); +} + MachineBasicBlock * +X86TargetLowering::EmitLoweredRetpoline(MachineInstr &MI, + MachineBasicBlock *BB) const { + // Copy the virtual register into the R11 physical register and + // call the retpoline thunk. + DebugLoc DL = MI.getDebugLoc(); + const X86InstrInfo *TII = Subtarget.getInstrInfo(); + unsigned CalleeVReg = MI.getOperand(0).getReg(); + unsigned Opc = getOpcodeForRetpoline(MI.getOpcode()); + + // Find an available scratch register to hold the callee. On 64-bit, we can + // just use R11, but we scan for uses anyway to ensure we don't generate + // incorrect code. On 32-bit, we use one of EAX, ECX, or EDX that isn't + // already a register use operand to the call to hold the callee. If none + // are available, use EDI instead. EDI is chosen because EBX is the PIC base + // register and ESI is the base pointer to realigned stack frames with VLAs. + SmallVector AvailableRegs; + if (Subtarget.is64Bit()) + AvailableRegs.push_back(X86::R11); + else + AvailableRegs.append({X86::EAX, X86::ECX, X86::EDX, X86::EDI}); + + // Zero out any registers that are already used. + for (const auto &MO : MI.operands()) { + if (MO.isReg() && MO.isUse()) + for (unsigned &Reg : AvailableRegs) + if (Reg == MO.getReg()) + Reg = 0; + } + + // Choose the first remaining non-zero available register. + unsigned AvailableReg = 0; + for (unsigned MaybeReg : AvailableRegs) { + if (MaybeReg) { + AvailableReg = MaybeReg; + break; + } + } + if (!AvailableReg) + report_fatal_error("calling convention incompatible with retpoline, no " + "available registers"); + + const char *Symbol = getRetpolineSymbol(Subtarget, AvailableReg); + + BuildMI(*BB, MI, DL, TII->get(TargetOpcode::COPY), AvailableReg) + .addReg(CalleeVReg); + MI.getOperand(0).ChangeToES(Symbol); + MI.setDesc(TII->get(Opc)); + MachineInstrBuilder(*BB->getParent(), &MI) + .addReg(AvailableReg, RegState::Implicit | RegState::Kill); + return BB; +} + +MachineBasicBlock * X86TargetLowering::emitEHSjLjSetJmp(MachineInstr &MI, MachineBasicBlock *MBB) const { DebugLoc DL = MI.getDebugLoc(); @@ -26689,6 +26822,11 @@ X86TargetLowering::EmitInstrWithCustomInserter(Machine case X86::TLS_base_addr32: case X86::TLS_base_addr64: return EmitLoweredTLSAddr(MI, BB); + case X86::RETPOLINE_CALL32: + case X86::RETPOLINE_CALL64: + case X86::RETPOLINE_TCRETURN32: + case X86::RETPOLINE_TCRETURN64: + return EmitLoweredRetpoline(MI, BB); case X86::CATCHRET: return EmitLoweredCatchRet(MI, BB); case X86::CATCHPAD: Modified: stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.h ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.h Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.h Mon Mar 19 18:36:43 2018 (r331219) @@ -986,6 +986,9 @@ namespace llvm { bool isVectorClearMaskLegal(const SmallVectorImpl &Mask, EVT VT) const override; + /// Returns true if lowering to a jump table is allowed. + bool areJTsAllowed(const Function *Fn) const override; + /// If true, then instruction selection should /// seek to shrink the FP constant of the specified type to a smaller type /// in order to save space and / or reduce runtime. @@ -1288,6 +1291,9 @@ namespace llvm { MachineBasicBlock *EmitLoweredTLSCall(MachineInstr &MI, MachineBasicBlock *BB) const; + + MachineBasicBlock *EmitLoweredRetpoline(MachineInstr &MI, + MachineBasicBlock *BB) const; MachineBasicBlock *emitEHSjLjSetJmp(MachineInstr &MI, MachineBasicBlock *MBB) const; Modified: stable/11/contrib/llvm/lib/Target/X86/X86InstrCompiler.td ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Mon Mar 19 18:36:43 2018 (r331219) @@ -1106,14 +1106,14 @@ def X86tcret_6regs : PatFrag<(ops node:$ptr, node:$off def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), (TCRETURNri ptr_rc_tailcall:$dst, imm:$off)>, - Requires<[Not64BitMode]>; + Requires<[Not64BitMode, NotUseRetpoline]>; // FIXME: This is disabled for 32-bit PIC mode because the global base // register which is part of the address mode may be assigned a // callee-saved register. def : Pat<(X86tcret (load addr:$dst), imm:$off), (TCRETURNmi addr:$dst, imm:$off)>, - Requires<[Not64BitMode, IsNotPIC]>; + Requires<[Not64BitMode, IsNotPIC, NotUseRetpoline]>; def : Pat<(X86tcret (i32 tglobaladdr:$dst), imm:$off), (TCRETURNdi tglobaladdr:$dst, imm:$off)>, @@ -1125,13 +1125,21 @@ def : Pat<(X86tcret (i32 texternalsym:$dst), imm:$off) def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), (TCRETURNri64 ptr_rc_tailcall:$dst, imm:$off)>, - Requires<[In64BitMode]>; + Requires<[In64BitMode, NotUseRetpoline]>; // Don't fold loads into X86tcret requiring more than 6 regs. // There wouldn't be enough scratch registers for base+index. def : Pat<(X86tcret_6regs (load addr:$dst), imm:$off), (TCRETURNmi64 addr:$dst, imm:$off)>, - Requires<[In64BitMode]>; + Requires<[In64BitMode, NotUseRetpoline]>; + +def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), + (RETPOLINE_TCRETURN64 ptr_rc_tailcall:$dst, imm:$off)>, + Requires<[In64BitMode, UseRetpoline]>; + +def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), + (RETPOLINE_TCRETURN32 ptr_rc_tailcall:$dst, imm:$off)>, + Requires<[Not64BitMode, UseRetpoline]>; def : Pat<(X86tcret (i64 tglobaladdr:$dst), imm:$off), (TCRETURNdi64 tglobaladdr:$dst, imm:$off)>, Modified: stable/11/contrib/llvm/lib/Target/X86/X86InstrControl.td ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86InstrControl.td Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86InstrControl.td Mon Mar 19 18:36:43 2018 (r331219) @@ -211,11 +211,12 @@ let isCall = 1 in Sched<[WriteJumpLd]>; def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst), "call{l}\t{*}$dst", [(X86call GR32:$dst)], IIC_CALL_RI>, - OpSize32, Requires<[Not64BitMode]>, Sched<[WriteJump]>; + OpSize32, Requires<[Not64BitMode,NotUseRetpoline]>, + Sched<[WriteJump]>; def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst), "call{l}\t{*}$dst", [(X86call (loadi32 addr:$dst))], IIC_CALL_MEM>, OpSize32, - Requires<[Not64BitMode,FavorMemIndirectCall]>, + Requires<[Not64BitMode,FavorMemIndirectCall,NotUseRetpoline]>, Sched<[WriteJumpLd]>; let Predicates = [Not64BitMode] in { @@ -298,11 +299,12 @@ let isCall = 1, Uses = [RSP], SchedRW = [WriteJump] in def CALL64r : I<0xFF, MRM2r, (outs), (ins GR64:$dst), "call{q}\t{*}$dst", [(X86call GR64:$dst)], IIC_CALL_RI>, - Requires<[In64BitMode]>; + Requires<[In64BitMode,NotUseRetpoline]>; def CALL64m : I<0xFF, MRM2m, (outs), (ins i64mem:$dst), "call{q}\t{*}$dst", [(X86call (loadi64 addr:$dst))], IIC_CALL_MEM>, - Requires<[In64BitMode,FavorMemIndirectCall]>; + Requires<[In64BitMode,FavorMemIndirectCall, + NotUseRetpoline]>; def FARCALL64 : RI<0xFF, MRM3m, (outs), (ins opaque80mem:$dst), "lcall{q}\t{*}$dst", [], IIC_CALL_FAR_MEM>; @@ -338,6 +340,27 @@ let isCall = 1, isTerminator = 1, isReturn = 1, isBarr let mayLoad = 1 in def TAILJMPm64_REX : I<0xFF, MRM4m, (outs), (ins i64mem_TC:$dst), "rex64 jmp{q}\t{*}$dst", [], IIC_JMP_MEM>; + } +} + +let isPseudo = 1, isCall = 1, isCodeGenOnly = 1, + Uses = [RSP], + usesCustomInserter = 1, + SchedRW = [WriteJump] in { + def RETPOLINE_CALL32 : + PseudoI<(outs), (ins GR32:$dst), [(X86call GR32:$dst)]>, + Requires<[Not64BitMode,UseRetpoline]>; + + def RETPOLINE_CALL64 : + PseudoI<(outs), (ins GR64:$dst), [(X86call GR64:$dst)]>, + Requires<[In64BitMode,UseRetpoline]>; + + // Retpoline variant of indirect tail calls. + let isTerminator = 1, isReturn = 1, isBarrier = 1 in { + def RETPOLINE_TCRETURN64 : + PseudoI<(outs), (ins GR64:$dst, i32imm:$offset), []>; + def RETPOLINE_TCRETURN32 : + PseudoI<(outs), (ins GR32:$dst, i32imm:$offset), []>; } } Modified: stable/11/contrib/llvm/lib/Target/X86/X86InstrInfo.td ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86InstrInfo.td Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86InstrInfo.td Mon Mar 19 18:36:43 2018 (r331219) @@ -917,6 +917,8 @@ def HasFastLZCNT : Predicate<"Subtarget->hasFastLZCNT( def HasFastSHLDRotate : Predicate<"Subtarget->hasFastSHLDRotate()">; def HasERMSB : Predicate<"Subtarget->hasERMSB()">; def HasMFence : Predicate<"Subtarget->hasMFence()">; +def UseRetpoline : Predicate<"Subtarget->useRetpoline()">; +def NotUseRetpoline : Predicate<"!Subtarget->useRetpoline()">; //===----------------------------------------------------------------------===// // X86 Instruction Format Definitions. Modified: stable/11/contrib/llvm/lib/Target/X86/X86MCInstLower.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/X86/X86MCInstLower.cpp Mon Mar 19 18:34:08 2018 (r331218) +++ stable/11/contrib/llvm/lib/Target/X86/X86MCInstLower.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -874,6 +874,10 @@ void X86AsmPrinter::LowerSTATEPOINT(const MachineInstr // address is to far away. (TODO: support non-relative addressing) break; case MachineOperand::MO_Register: + // FIXME: Add retpoline support and remove this. + if (Subtarget->useRetpoline()) + report_fatal_error("Lowering register statepoints with retpoline not " + "yet implemented."); CallTargetMCOp = MCOperand::createReg(CallTarget.getReg()); CallOpcode = X86::CALL64r; break; @@ -1028,6 +1032,10 @@ void X86AsmPrinter::LowerPATCHPOINT(const MachineInstr EmitAndCountInstruction( MCInstBuilder(X86::MOV64ri).addReg(ScratchReg).addOperand(CalleeMCOp)); + // FIXME: Add retpoline support and remove this. + if (Subtarget->useRetpoline()) + report_fatal_error( + "Lowering patchpoint with retpoline not yet implemented."); EmitAndCountInstruction(MCInstBuilder(X86::CALL64r).addReg(ScratchReg)); } Added: stable/11/contrib/llvm/lib/Target/X86/X86RetpolineThunks.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/llvm/lib/Target/X86/X86RetpolineThunks.cpp Mon Mar 19 18:36:43 2018 (r331219) @@ -0,0 +1,265 @@ +//======- X86RetpolineThunks.cpp - Construct retpoline thunks for x86 --=====// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// \file +/// +/// Pass that injects an MI thunk implementing a "retpoline". This is +/// a RET-implemented trampoline that is used to lower indirect calls in a way +/// that prevents speculation on some x86 processors and can be used to mitigate +/// security vulnerabilities due to targeted speculative execution and side +/// channels such as CVE-2017-5715. +/// +/// TODO(chandlerc): All of this code could use better comments and +/// documentation. +/// +//===----------------------------------------------------------------------===// + +#include "X86.h" +#include "X86InstrBuilder.h" +#include "X86Subtarget.h" +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/CodeGen/Passes.h" +#include "llvm/CodeGen/TargetPassConfig.h" +#include "llvm/IR/IRBuilder.h" +#include "llvm/IR/Instructions.h" +#include "llvm/IR/Module.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h" + +using namespace llvm; + +#define DEBUG_TYPE "x86-retpoline-thunks" + +static const char ThunkNamePrefix[] = "__llvm_retpoline_"; +static const char R11ThunkName[] = "__llvm_retpoline_r11"; +static const char EAXThunkName[] = "__llvm_retpoline_eax"; +static const char ECXThunkName[] = "__llvm_retpoline_ecx"; +static const char EDXThunkName[] = "__llvm_retpoline_edx"; +static const char EDIThunkName[] = "__llvm_retpoline_edi"; + +namespace { +class X86RetpolineThunks : public MachineFunctionPass { +public: + static char ID; + + X86RetpolineThunks() : MachineFunctionPass(ID) {} + + StringRef getPassName() const override { return "X86 Retpoline Thunks"; } + + bool doInitialization(Module &M) override; + bool runOnMachineFunction(MachineFunction &F) override; + + void getAnalysisUsage(AnalysisUsage &AU) const override { + MachineFunctionPass::getAnalysisUsage(AU); + AU.addRequired(); + AU.addPreserved(); + } + +private: + MachineModuleInfo *MMI; + const TargetMachine *TM; + bool Is64Bit; + const X86Subtarget *STI; + const X86InstrInfo *TII; + + bool InsertedThunks; + + void createThunkFunction(Module &M, StringRef Name); + void insertRegReturnAddrClobber(MachineBasicBlock &MBB, unsigned Reg); + void populateThunk(MachineFunction &MF, Optional Reg = None); +}; + +} // end anonymous namespace + +FunctionPass *llvm::createX86RetpolineThunksPass() { + return new X86RetpolineThunks(); +} + +char X86RetpolineThunks::ID = 0; + +bool X86RetpolineThunks::doInitialization(Module &M) { + InsertedThunks = false; + return false; +} + +bool X86RetpolineThunks::runOnMachineFunction(MachineFunction &MF) { + DEBUG(dbgs() << getPassName() << '\n'); + + TM = &MF.getTarget();; + STI = &MF.getSubtarget(); + TII = STI->getInstrInfo(); + Is64Bit = TM->getTargetTriple().getArch() == Triple::x86_64; + + MMI = &getAnalysis(); + Module &M = const_cast(*MMI->getModule()); + + // If this function is not a thunk, check to see if we need to insert + // a thunk. + if (!MF.getName().startswith(ThunkNamePrefix)) { + // If we've already inserted a thunk, nothing else to do. + if (InsertedThunks) + return false; + + // Only add a thunk if one of the functions has the retpoline feature + // enabled in its subtarget, and doesn't enable external thunks. + // FIXME: Conditionalize on indirect calls so we don't emit a thunk when + // nothing will end up calling it. + // FIXME: It's a little silly to look at every function just to enumerate + // the subtargets, but eventually we'll want to look at them for indirect + // calls, so maybe this is OK. + if (!STI->useRetpoline() || STI->useRetpolineExternalThunk()) + return false; + + // Otherwise, we need to insert the thunk. + // WARNING: This is not really a well behaving thing to do in a function + // pass. We extract the module and insert a new function (and machine + // function) directly into the module. + if (Is64Bit) + createThunkFunction(M, R11ThunkName); + else + for (StringRef Name : + {EAXThunkName, ECXThunkName, EDXThunkName, EDIThunkName}) + createThunkFunction(M, Name); + InsertedThunks = true; + return true; + } + + // If this *is* a thunk function, we need to populate it with the correct MI. + if (Is64Bit) { + assert(MF.getName() == "__llvm_retpoline_r11" && + "Should only have an r11 thunk on 64-bit targets"); + + // __llvm_retpoline_r11: + // callq .Lr11_call_target + // .Lr11_capture_spec: + // pause + // lfence + // jmp .Lr11_capture_spec + // .align 16 + // .Lr11_call_target: + // movq %r11, (%rsp) + // retq + populateThunk(MF, X86::R11); + } else { + // For 32-bit targets we need to emit a collection of thunks for various + // possible scratch registers as well as a fallback that uses EDI, which is + // normally callee saved. + // __llvm_retpoline_eax: + // calll .Leax_call_target + // .Leax_capture_spec: + // pause + // jmp .Leax_capture_spec + // .align 16 + // .Leax_call_target: + // movl %eax, (%esp) # Clobber return addr + // retl + // + // __llvm_retpoline_ecx: + // ... # Same setup + // movl %ecx, (%esp) + // retl + // + // __llvm_retpoline_edx: + // ... # Same setup + // movl %edx, (%esp) + // retl + // + // __llvm_retpoline_edi: + // ... # Same setup + // movl %edi, (%esp) + // retl + if (MF.getName() == EAXThunkName) + populateThunk(MF, X86::EAX); + else if (MF.getName() == ECXThunkName) + populateThunk(MF, X86::ECX); + else if (MF.getName() == EDXThunkName) + populateThunk(MF, X86::EDX); + else if (MF.getName() == EDIThunkName) + populateThunk(MF, X86::EDI); + else + llvm_unreachable("Invalid thunk name on x86-32!"); + } + + return true; +} + +void X86RetpolineThunks::createThunkFunction(Module &M, StringRef Name) { + assert(Name.startswith(ThunkNamePrefix) && + "Created a thunk with an unexpected prefix!"); + + LLVMContext &Ctx = M.getContext(); + auto Type = FunctionType::get(Type::getVoidTy(Ctx), false); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Mar 20 02:54:32 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC15DF672F8; Tue, 20 Mar 2018 02:54:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7CF7E77B30; Tue, 20 Mar 2018 02:54:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74F351727B; Tue, 20 Mar 2018 02:54:32 +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 w2K2sWa2007445; Tue, 20 Mar 2018 02:54:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2K2sWAH007443; Tue, 20 Mar 2018 02:54:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803200254.w2K2sWAH007443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Mar 2018 02:54:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331235 - stable/11/contrib/xz/src/liblzma/check X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/contrib/xz/src/liblzma/check X-SVN-Commit-Revision: 331235 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, 20 Mar 2018 02:54:33 -0000 Author: emaste Date: Tue Mar 20 02:54:32 2018 New Revision: 331235 URL: https://svnweb.freebsd.org/changeset/base/331235 Log: MFC r319510: xz: set noexec stack flag on FreeBSD Modified: stable/11/contrib/xz/src/liblzma/check/crc32_x86.S stable/11/contrib/xz/src/liblzma/check/crc64_x86.S Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/xz/src/liblzma/check/crc32_x86.S ============================================================================== --- stable/11/contrib/xz/src/liblzma/check/crc32_x86.S Tue Mar 20 02:50:11 2018 (r331234) +++ stable/11/contrib/xz/src/liblzma/check/crc32_x86.S Tue Mar 20 02:54:32 2018 (r331235) @@ -299,6 +299,6 @@ LZMA_CRC32: * use __linux__ here, but I don't know a way to detect when * we are using GNU assembler. */ -#if defined(__ELF__) && defined(__linux__) +#if defined(__ELF__) && (defined(__FreeBSD__) || defined(__linux__)) .section .note.GNU-stack,"",@progbits #endif Modified: stable/11/contrib/xz/src/liblzma/check/crc64_x86.S ============================================================================== --- stable/11/contrib/xz/src/liblzma/check/crc64_x86.S Tue Mar 20 02:50:11 2018 (r331234) +++ stable/11/contrib/xz/src/liblzma/check/crc64_x86.S Tue Mar 20 02:54:32 2018 (r331235) @@ -282,6 +282,6 @@ LZMA_CRC64: * use __linux__ here, but I don't know a way to detect when * we are using GNU assembler. */ -#if defined(__ELF__) && defined(__linux__) +#if defined(__ELF__) && (defined(__FreeBSD__) || defined(__linux__)) .section .note.GNU-stack,"",@progbits #endif From owner-svn-src-stable@freebsd.org Tue Mar 20 15:57:54 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7204F58329; Tue, 20 Mar 2018 15:57:53 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 692D879660; Tue, 20 Mar 2018 15:57:53 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F5201ED9C; Tue, 20 Mar 2018 15:57:53 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KFvr70098977; Tue, 20 Mar 2018 15:57:53 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KFvqkC098969; Tue, 20 Mar 2018 15:57:52 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201803201557.w2KFvqkC098969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Tue, 20 Mar 2018 15:57:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331246 - in stable/11: contrib/bmake contrib/bmake/mk contrib/bmake/unit-tests usr.bin/bmake X-SVN-Group: stable-11 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in stable/11: contrib/bmake contrib/bmake/mk contrib/bmake/unit-tests usr.bin/bmake X-SVN-Commit-Revision: 331246 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, 20 Mar 2018 15:57:54 -0000 Author: sjg Date: Tue Mar 20 15:57:52 2018 New Revision: 331246 URL: https://svnweb.freebsd.org/changeset/base/331246 Log: MFC bmake-20180222 PR: 226678 Submitted by: sjg Added: stable/11/contrib/bmake/VERSION - copied, changed from r325340, head/contrib/bmake/VERSION stable/11/contrib/bmake/mk/ldorder.mk - copied unchanged from r330260, head/contrib/bmake/mk/ldorder.mk Modified: stable/11/contrib/bmake/ChangeLog stable/11/contrib/bmake/FILES stable/11/contrib/bmake/Makefile stable/11/contrib/bmake/Makefile.config.in stable/11/contrib/bmake/aclocal.m4 stable/11/contrib/bmake/bmake.cat1 stable/11/contrib/bmake/bsd.after-import.mk stable/11/contrib/bmake/configure stable/11/contrib/bmake/configure.in stable/11/contrib/bmake/job.c stable/11/contrib/bmake/machine.sh stable/11/contrib/bmake/main.c stable/11/contrib/bmake/make-bootstrap.sh.in stable/11/contrib/bmake/make.h stable/11/contrib/bmake/meta.c stable/11/contrib/bmake/mk/ChangeLog stable/11/contrib/bmake/mk/FILES stable/11/contrib/bmake/mk/auto.obj.mk stable/11/contrib/bmake/mk/autoconf.mk stable/11/contrib/bmake/mk/dirdeps.mk stable/11/contrib/bmake/mk/dpadd.mk stable/11/contrib/bmake/mk/final.mk stable/11/contrib/bmake/mk/gendirdeps.mk stable/11/contrib/bmake/mk/install-mk stable/11/contrib/bmake/mk/lib.mk stable/11/contrib/bmake/mk/meta.autodep.mk stable/11/contrib/bmake/mk/meta.stage.mk stable/11/contrib/bmake/mk/own.mk stable/11/contrib/bmake/mk/prog.mk stable/11/contrib/bmake/mk/sys.clean-env.mk stable/11/contrib/bmake/mk/sys.mk stable/11/contrib/bmake/mk/sys.vars.mk stable/11/contrib/bmake/mk/whats.mk stable/11/contrib/bmake/os.sh stable/11/contrib/bmake/parse.c stable/11/contrib/bmake/stresep.c stable/11/contrib/bmake/unit-tests/dotwait.exp stable/11/contrib/bmake/unit-tests/dotwait.mk stable/11/contrib/bmake/unit-tests/varcmd.exp stable/11/contrib/bmake/unit-tests/varcmd.mk stable/11/contrib/bmake/var.c stable/11/usr.bin/bmake/Makefile stable/11/usr.bin/bmake/Makefile.config stable/11/usr.bin/bmake/Makefile.inc stable/11/usr.bin/bmake/config.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/bmake/ChangeLog ============================================================================== --- stable/11/contrib/bmake/ChangeLog Tue Mar 20 15:51:05 2018 (r331245) +++ stable/11/contrib/bmake/ChangeLog Tue Mar 20 15:57:52 2018 (r331246) @@ -1,3 +1,77 @@ +2018-02-22 Simon J. Gerraty + + * VERSION: 20180222 + Merge with NetBSD make, pick up + o parse.c: avoid calling sysconf for every call to loadfile + +2018-02-18 Simon J. Gerraty + + * VERSION: 20180218 + Merge with NetBSD make, pick up + o var.c: Var_Set handle NULL value anytime. + +2018-02-12 Simon J. Gerraty + + * VERSION: 20180212 + Merge with NetBSD make, pick up + o parse.c: do not treat .info as warning with -W + +2017-12-07 Simon J. Gerraty + + * VERSION: 20171207 + Merge with NetBSD make, pick up + o var.c: Var_Append use Var_Set if var not previously set + so that VAR_CMD is handled correctly. + Add a suitable unit-test. + +2017-11-26 Simon J. Gerraty + + * VERSION (_MAKE_VERSION): 20171126 + + * aclocal.m4: use AC_LINK_IFELSE for AC_C___ATTRIBUTE__ + since AC_TRY_COMPILE puts input inside main() + which upsets modern compilers. + +2017-11-18 Simon J. Gerraty + + * VERSION: 20171118 + Merge with NetBSD make, pick up + o var.c: do not append to variable set on command line + add unit-test to catch this. + +2017-10-28 Simon J. Gerraty + + * VERSION: 20171028 + Merge with NetBSD make, pick up + o main.c: ignore empty MAKEOBJDIR + + * Makefile.config.in: + make @prefix@ @machine*@ and @default_sys_path@ defaults. + +2017-10-05 Simon J. Gerraty + + * VERSION: 20171005 + + * unit-tests/dotwait.mk: redirect stderr through pipe for more + consistent result on some platforms. + +2017-08-13 Simon J. Gerraty + + * machine.sh: entry for AIX + +2017-08-12 Simon J. Gerraty + + * VERSION (_MAKE_VERSION): Move the setting of _MAKE_VERSION + to a file that can be included by configure as well as make. + This allows configure to set set _MAKE_VERSION in make-bootstrap.sh + +2017-08-10 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170810 + Merge with NetBSD make, pick up + o meta.c: if target is in subdir we only need subdir name in + meta_name. + 2017-07-20 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20170720 Modified: stable/11/contrib/bmake/FILES ============================================================================== --- stable/11/contrib/bmake/FILES Tue Mar 20 15:51:05 2018 (r331245) +++ stable/11/contrib/bmake/FILES Tue Mar 20 15:57:52 2018 (r331246) @@ -5,6 +5,7 @@ Makefile.config.in PSD.doc/Makefile PSD.doc/tutorial.ms README +VERSION aclocal.m4 arch.c bmake.1 Modified: stable/11/contrib/bmake/Makefile ============================================================================== --- stable/11/contrib/bmake/Makefile Tue Mar 20 15:51:05 2018 (r331245) +++ stable/11/contrib/bmake/Makefile Tue Mar 20 15:57:52 2018 (r331246) @@ -1,8 +1,5 @@ -# $Id: Makefile,v 1.95 2017/07/20 19:36:13 sjg Exp $ +# $Id: Makefile,v 1.99 2017/08/13 20:12:53 sjg Exp $ -# Base version on src date -_MAKE_VERSION= 20170720 - PROG= bmake SRCS= \ @@ -58,6 +55,8 @@ SRCS+= \ lstReplace.c \ lstSucc.c +.-include "VERSION" + # this file gets generated by configure .-include "Makefile.config" @@ -192,11 +191,13 @@ MANDIR= ${MANDIR.bmake:U${SHAREDIR}/man} ${OBJS}: config.h .endif +# start-delete2 for bsd.after-import.mk + # make sure that MAKE_VERSION gets updated. -main.o: ${SRCS} ${MAKEFILE} +main.o: ${SRCS} ${.CURDIR}/VERSION -# start-delete2 for bsd.after-import.mk .if ${MK_AUTOCONF_MK} == "yes" +CONFIGURE_DEPS += ${.CURDIR}/VERSION .include .endif SHARE_MK?=${SHAREDIR}/mk Modified: stable/11/contrib/bmake/Makefile.config.in ============================================================================== --- stable/11/contrib/bmake/Makefile.config.in Tue Mar 20 15:51:05 2018 (r331245) +++ stable/11/contrib/bmake/Makefile.config.in Tue Mar 20 15:57:52 2018 (r331246) @@ -1,11 +1,13 @@ # things set by configure -prefix= @prefix@ +_MAKE_VERSION=@_MAKE_VERSION@ + +prefix?= @prefix@ srcdir= @srcdir@ CC?= @CC@ -MACHINE= @machine@ -MACHINE_ARCH= @machine_arch@ -DEFAULT_SYS_PATH= @default_sys_path@ +MACHINE?= @machine@ +MACHINE_ARCH?= @machine_arch@ +DEFAULT_SYS_PATH?= @default_sys_path@ CPPFLAGS+= @CPPFLAGS@ CFLAGS+= ${CPPFLAGS} @DEFS@ @@ -13,8 +15,7 @@ LDFLAGS= @LDFLAGS@ LIBOBJS= @LIBOBJS@ LDADD= @LIBS@ USE_META= @use_meta@ -FILEMON_H= @filemon_h@ +FILEMON_H?= @filemon_h@ BMAKE_PATH_MAX?= @bmake_path_max@ # used if MAXPATHLEN not defined CPPFLAGS+= -DBMAKE_PATH_MAX=${BMAKE_PATH_MAX} - Copied and modified: stable/11/contrib/bmake/VERSION (from r325340, head/contrib/bmake/VERSION) ============================================================================== --- head/contrib/bmake/VERSION Thu Nov 2 20:08:00 2017 (r325340, copy source) +++ stable/11/contrib/bmake/VERSION Tue Mar 20 15:57:52 2018 (r331246) @@ -1,2 +1,2 @@ # keep this compatible with sh and make -_MAKE_VERSION=20171028 +_MAKE_VERSION=20180222 Modified: stable/11/contrib/bmake/aclocal.m4 ============================================================================== --- stable/11/contrib/bmake/aclocal.m4 Tue Mar 20 15:51:05 2018 (r331245) +++ stable/11/contrib/bmake/aclocal.m4 Tue Mar 20 15:57:52 2018 (r331246) @@ -1,5 +1,5 @@ dnl RCSid: -dnl $Id: aclocal.m4,v 1.5 2003/03/06 21:21:30 sjg Exp $ +dnl $Id: aclocal.m4,v 1.6 2017/11/26 22:39:20 sjg Exp $ dnl dnl @@ -55,16 +55,21 @@ dnl AC_DEFUN(AC_C___ATTRIBUTE__, [ AC_MSG_CHECKING(for __attribute__) AC_CACHE_VAL(ac_cv___attribute__, [ -AC_TRY_COMPILE([ +AC_LINK_IFELSE([ #include -], -[ + static void foo(void) __attribute__ ((noreturn)); static void foo(void) { exit(1); +} + +int +main(int argc, char **argv) +{ + foo(); } ], ac_cv___attribute__=yes, Modified: stable/11/contrib/bmake/bmake.cat1 ============================================================================== --- stable/11/contrib/bmake/bmake.cat1 Tue Mar 20 15:51:05 2018 (r331245) +++ stable/11/contrib/bmake/bmake.cat1 Tue Mar 20 15:57:52 2018 (r331246) @@ -1,73 +1,73 @@ -BMAKE(1) NetBSD General Commands Manual BMAKE(1) +BMAKE(1) FreeBSD General Commands Manual BMAKE(1) -NNAAMMEE - bbmmaakkee -- maintain program dependencies +NAME + bmake -- maintain program dependencies -SSYYNNOOPPSSIISS - bbmmaakkee [--BBeeiikkNNnnqqrrssttWWwwXX] [--CC _d_i_r_e_c_t_o_r_y] [--DD _v_a_r_i_a_b_l_e] [--dd _f_l_a_g_s] - [--ff _m_a_k_e_f_i_l_e] [--II _d_i_r_e_c_t_o_r_y] [--JJ _p_r_i_v_a_t_e] [--jj _m_a_x___j_o_b_s] - [--mm _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--VV _v_a_r_i_a_b_l_e] [--vv _v_a_r_i_a_b_l_e] - [_v_a_r_i_a_b_l_e_=_v_a_l_u_e] [_t_a_r_g_e_t _._._.] +SYNOPSIS + bmake [-BeikNnqrstWwX] [-C directory] [-D variable] [-d flags] + [-f makefile] [-I directory] [-J private] [-j max_jobs] + [-m directory] [-T file] [-V variable] [-v variable] + [variable=value] [target ...] -DDEESSCCRRIIPPTTIIOONN - bbmmaakkee is a program designed to simplify the maintenance of other pro- +DESCRIPTION + bmake is a program designed to simplify the maintenance of other pro- grams. Its input is a list of specifications as to the files upon which - programs and other files depend. If no --ff _m_a_k_e_f_i_l_e makefile option is - given, bbmmaakkee will try to open `_m_a_k_e_f_i_l_e' then `_M_a_k_e_f_i_l_e' in order to find - the specifications. If the file `_._d_e_p_e_n_d' exists, it is read (see + programs and other files depend. If no -f makefile makefile option is + given, bmake will try to open `makefile' then `Makefile' in order to find + the specifications. If the file `.depend' exists, it is read (see mkdep(1)). This manual page is intended as a reference document only. For a more - thorough description of bbmmaakkee and makefiles, please refer to _P_M_a_k_e _- _A - _T_u_t_o_r_i_a_l. + thorough description of bmake and makefiles, please refer to PMake - A + Tutorial. - bbmmaakkee will prepend the contents of the _M_A_K_E_F_L_A_G_S environment variable to + bmake will prepend the contents of the MAKEFLAGS environment variable to the command line arguments before parsing them. The options are as follows: - --BB Try to be backwards compatible by executing a single shell per + -B Try to be backwards compatible by executing a single shell per command and by executing the commands to make the sources of a dependency line in sequence. - --CC _d_i_r_e_c_t_o_r_y - Change to _d_i_r_e_c_t_o_r_y before reading the makefiles or doing any- - thing else. If multiple --CC options are specified, each is inter- - preted relative to the previous one: --CC _/ --CC _e_t_c is equivalent to - --CC _/_e_t_c. + -C directory + Change to directory before reading the makefiles or doing any- + thing else. If multiple -C options are specified, each is inter- + preted relative to the previous one: -C / -C etc is equivalent to + -C /etc. - --DD _v_a_r_i_a_b_l_e - Define _v_a_r_i_a_b_l_e to be 1, in the global context. + -D variable + Define variable to be 1, in the global context. - --dd _[_-_]_f_l_a_g_s - Turn on debugging, and specify which portions of bbmmaakkee are to + -d [-]flags + Turn on debugging, and specify which portions of bmake are to print debugging information. Unless the flags are preceded by - `-' they are added to the _M_A_K_E_F_L_A_G_S environment variable and will + `-' they are added to the MAKEFLAGS environment variable and will be processed by any child make processes. By default, debugging information is printed to standard error, but this can be changed - using the _F debugging flag. The debugging output is always + using the F debugging flag. The debugging output is always unbuffered; in addition, if debugging is enabled but debugging output is not directed to standard output, then the standard out- - put is line buffered. _F_l_a_g_s is one or more of the following: + put is line buffered. Flags is one or more of the following: - _A Print all possible debugging information; equivalent to + A Print all possible debugging information; equivalent to specifying all of the debugging flags. - _a Print debugging information about archive searching and + a Print debugging information about archive searching and caching. - _C Print debugging information about current working direc- + C Print debugging information about current working direc- tory. - _c Print debugging information about conditional evaluation. + c Print debugging information about conditional evaluation. - _d Print debugging information about directory searching and + d Print debugging information about directory searching and caching. - _e Print debugging information about failed commands and + e Print debugging information about failed commands and targets. - _F[++]_f_i_l_e_n_a_m_e + F[+]filename Specify where debugging output is written. This must be the last flag, because it consumes the remainder of the argument. If the character immediately after the `F' @@ -80,80 +80,80 @@ DDEESSCCRRIIPPTTIIOONN named file. If the file name ends `.%d' then the `%d' is replaced by the pid. - _f Print debugging information about loop evaluation. + f Print debugging information about loop evaluation. - _g_1 Print the input graph before making anything. + g1 Print the input graph before making anything. - _g_2 Print the input graph after making everything, or before + g2 Print the input graph after making everything, or before exiting on error. - _g_3 Print the input graph before exiting on error. + g3 Print the input graph before exiting on error. - _j Print debugging information about running multiple + j Print debugging information about running multiple shells. - _l Print commands in Makefiles regardless of whether or not + l Print commands in Makefiles regardless of whether or not they are prefixed by `@' or other "quiet" flags. Also known as "loud" behavior. - _M Print debugging information about "meta" mode decisions + M Print debugging information about "meta" mode decisions about targets. - _m Print debugging information about making targets, includ- + m Print debugging information about making targets, includ- ing modification dates. - _n Don't delete the temporary command scripts created when + n Don't delete the temporary command scripts created when running commands. These temporary scripts are created in the directory referred to by the TMPDIR environment vari- - able, or in _/_t_m_p if TMPDIR is unset or set to the empty + able, or in /tmp if TMPDIR is unset or set to the empty string. The temporary scripts are created by mkstemp(3), - and have names of the form _m_a_k_e_X_X_X_X_X_X. _N_O_T_E: This can - create many files in TMPDIR or _/_t_m_p, so use with care. + and have names of the form makeXXXXXX. NOTE: This can + create many files in TMPDIR or /tmp, so use with care. - _p Print debugging information about makefile parsing. + p Print debugging information about makefile parsing. - _s Print debugging information about suffix-transformation + s Print debugging information about suffix-transformation rules. - _t Print debugging information about target list mainte- + t Print debugging information about target list mainte- nance. - _V Force the --VV option to print raw values of variables, + V Force the -V option to print raw values of variables, overriding the default behavior set via - _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S. + .MAKE.EXPAND_VARIABLES. - _v Print debugging information about variable assignment. + v Print debugging information about variable assignment. - _x Run shell commands with --xx so the actual commands are + x Run shell commands with -x so the actual commands are printed as they are executed. - --ee Specify that environment variables override macro assignments + -e Specify that environment variables override macro assignments within makefiles. - --ff _m_a_k_e_f_i_l_e - Specify a makefile to read instead of the default `_m_a_k_e_f_i_l_e'. If - _m_a_k_e_f_i_l_e is `--', standard input is read. Multiple makefiles may + -f makefile + Specify a makefile to read instead of the default `makefile'. If + makefile is `-', standard input is read. Multiple makefiles may be specified, and are read in the order specified. - --II _d_i_r_e_c_t_o_r_y + -I directory Specify a directory in which to search for makefiles and included makefiles. The system makefile directory (or directories, see - the --mm option) is automatically included as part of this list. + the -m option) is automatically included as part of this list. - --ii Ignore non-zero exit of shell commands in the makefile. Equiva- - lent to specifying `--' before each command line in the makefile. + -i Ignore non-zero exit of shell commands in the makefile. Equiva- + lent to specifying `-' before each command line in the makefile. - --JJ _p_r_i_v_a_t_e - This option should _n_o_t be specified by the user. + -J private + This option should not be specified by the user. - When the _j option is in use in a recursive build, this option is + When the j option is in use in a recursive build, this option is passed by a make to child makes to allow all the make processes in the build to cooperate to avoid overloading the system. - --jj _m_a_x___j_o_b_s - Specify the maximum number of jobs that bbmmaakkee may have running at - any one time. The value is saved in _._M_A_K_E_._J_O_B_S. Turns compati- - bility mode off, unless the _B flag is also specified. When com- + -j max_jobs + Specify the maximum number of jobs that bmake may have running at + any one time. The value is saved in .MAKE.JOBS. Turns compati- + bility mode off, unless the B flag is also specified. When com- patibility mode is off, all commands associated with a target are executed in a single shell invocation as opposed to the tradi- tional one shell invocation per line. This can break traditional @@ -162,90 +162,90 @@ DDEESSCCRRIIPPTTIIOONN It is more efficient to correct the scripts rather than turn backwards compatibility on. - --kk Continue processing after errors are encountered, but only on + -k Continue processing after errors are encountered, but only on those targets that do not depend on the target whose creation caused the error. - --mm _d_i_r_e_c_t_o_r_y + -m directory Specify a directory in which to search for sys.mk and makefiles - included via the <_f_i_l_e>-style include statement. The --mm option + included via the <file>-style include statement. The -m option can be used multiple times to form a search path. This path will override the default system include path: /usr/share/mk. Fur- thermore the system include path will be appended to the search - path used for "_f_i_l_e"-style include statements (see the --II + path used for "file"-style include statements (see the -I option). - If a file or directory name in the --mm argument (or the + If a file or directory name in the -m argument (or the MAKESYSPATH environment variable) starts with the string ".../" - then bbmmaakkee will search for the specified file or directory named + then bmake will search for the specified file or directory named in the remaining part of the argument string. The search starts with the current directory of the Makefile and then works upward towards the root of the file system. If the search is success- ful, then the resulting directory replaces the ".../" specifica- - tion in the --mm argument. If used, this feature allows bbmmaakkee to + tion in the -m argument. If used, this feature allows bmake to easily search in the current source tree for customized sys.mk files (e.g., by using ".../mk/sys.mk" as an argument). - --nn Display the commands that would have been executed, but do not + -n Display the commands that would have been executed, but do not actually execute them unless the target depends on the .MAKE spe- cial source (see below). - --NN Display the commands which would have been executed, but do not + -N Display the commands which would have been executed, but do not actually execute any of them; useful for debugging top-level makefiles without descending into subdirectories. - --qq Do not execute any commands, but exit 0 if the specified targets + -q Do not execute any commands, but exit 0 if the specified targets are up-to-date and 1, otherwise. - --rr Do not use the built-in rules specified in the system makefile. + -r Do not use the built-in rules specified in the system makefile. - --ss Do not echo any commands as they are executed. Equivalent to - specifying `@@' before each command line in the makefile. + -s Do not echo any commands as they are executed. Equivalent to + specifying `@' before each command line in the makefile. - --TT _t_r_a_c_e_f_i_l_e - When used with the --jj flag, append a trace record to _t_r_a_c_e_f_i_l_e + -T tracefile + When used with the -j flag, append a trace record to tracefile for each job started and completed. - --tt Rather than re-building a target as specified in the makefile, + -t Rather than re-building a target as specified in the makefile, create it or update its modification time to make it appear up- to-date. - --VV _v_a_r_i_a_b_l_e - Print the value of _v_a_r_i_a_b_l_e. Do not build any targets. Multiple + -V variable + Print the value of variable. Do not build any targets. Multiple instances of this option may be specified; the variables will be printed one per line, with a blank line for each null or unde- fined variable. The value printed is extracted from the global context after all makefiles have been read. By default, the raw variable contents (which may include additional unexpanded vari- - able references) are shown. If _v_a_r_i_a_b_l_e contains a `$' then the + able references) are shown. If variable contains a `$' then the value will be recursively expanded to its complete resultant text before printing. The expanded value will also be printed if - _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S is set to true and the --ddVV option has not + .MAKE.EXPAND_VARIABLES is set to true and the -dV option has not been used to override it. Note that loop-local and target-local variables, as well as values taken temporarily by global vari- ables during makefile processing, are not accessible via this - option. The --ddvv debug mode can be used to see these at the cost + option. The -dv debug mode can be used to see these at the cost of generating substantial extraneous output. - --vv _v_a_r_i_a_b_l_e - Like --VV but the variable is always expanded to its complete + -v variable + Like -V but the variable is always expanded to its complete value. - --WW Treat any warnings during makefile parsing as errors. + -W Treat any warnings during makefile parsing as errors. - --ww Print entering and leaving directory messages, pre and post pro- + -w Print entering and leaving directory messages, pre and post pro- cessing. - --XX Don't export variables passed on the command line to the environ- + -X Don't export variables passed on the command line to the environ- ment individually. Variables passed on the command line are - still exported via the _M_A_K_E_F_L_A_G_S environment variable. This + still exported via the MAKEFLAGS environment variable. This option may be useful on systems which have a small limit on the size of command arguments. - _v_a_r_i_a_b_l_e_=_v_a_l_u_e - Set the value of the variable _v_a_r_i_a_b_l_e to _v_a_l_u_e. Normally, all + variable=value + Set the value of the variable variable to value. Normally, all values passed on the command line are also exported to sub-makes - in the environment. The --XX flag disables this behavior. Vari- + in the environment. The -X flag disables this behavior. Vari- able assignments should follow options for POSIX compatibility but no ordering is enforced. @@ -257,28 +257,28 @@ DDEESSCCRRIIPPTTIIOONN them with a backslash (`\'). The trailing newline character and initial whitespace on the following line are compressed into a single space. -FFIILLEE DDEEPPEENNDDEENNCCYY SSPPEECCIIFFIICCAATTIIOONNSS +FILE DEPENDENCY SPECIFICATIONS Dependency lines consist of one or more targets, an operator, and zero or more sources. This creates a relationship where the targets ``depend'' on the sources and are usually created from them. The exact relationship between the target and the source is determined by the operator that sep- arates them. The three operators are as follows: - :: A target is considered out-of-date if its modification time is less + : A target is considered out-of-date if its modification time is less than those of any of its sources. Sources for a target accumulate over dependency lines when this operator is used. The target is - removed if bbmmaakkee is interrupted. + removed if bmake is interrupted. - !! Targets are always re-created, but not until all sources have been + ! Targets are always re-created, but not until all sources have been examined and re-created as necessary. Sources for a target accumu- late over dependency lines when this operator is used. The target - is removed if bbmmaakkee is interrupted. + is removed if bmake is interrupted. - :::: If no sources are specified, the target is always re-created. Oth- + :: If no sources are specified, the target is always re-created. Oth- erwise, a target is considered out-of-date if any of its sources has been modified more recently than the target. Sources for a target do not accumulate over dependency lines when this operator - is used. The target will not be removed if bbmmaakkee is interrupted. + is used. The target will not be removed if bmake is interrupted. Targets and sources may contain the shell wildcard values `?', `*', `[]', and `{}'. The values `?', `*', and `[]' may only be used as part of the @@ -287,37 +287,37 @@ FFIILLEE DDEEPPEENNDDEENNCCYY SSPPEEC existing files. Expansion is in directory order, not alphabetically as done in the shell. -SSHHEELLLL CCOOMMMMAANNDDSS +SHELL COMMANDS Each target may have associated with it one or more lines of shell com- mands, normally used to create the target. Each of the lines in this - script _m_u_s_t be preceded by a tab. (For historical reasons, spaces are + script must be preceded by a tab. (For historical reasons, spaces are not accepted.) While targets can appear in many dependency lines if desired, by default only one of these rules may be followed by a creation - script. If the `::::' operator is used, however, all rules may include + script. If the `::' operator is used, however, all rules may include scripts and the scripts are executed in the order found. Each line is treated as a separate shell command, unless the end of line is escaped with a backslash (`\') in which case that line and the next are combined. If the first characters of the command are any combination - of `@@', `++', or `--', the command is treated specially. A `@@' causes the - command not to be echoed before it is executed. A `++' causes the command - to be executed even when --nn is given. This is similar to the effect of + of `@', `+', or `-', the command is treated specially. A `@' causes the + command not to be echoed before it is executed. A `+' causes the command + to be executed even when -n is given. This is similar to the effect of the .MAKE special source, except that the effect can be limited to a sin- - gle line of a script. A `--' in compatibility mode causes any non-zero + gle line of a script. A `-' in compatibility mode causes any non-zero exit status of the command line to be ignored. - When bbmmaakkee is run in jobs mode with --jj _m_a_x___j_o_b_s, the entire script for + When bmake is run in jobs mode with -j max_jobs, the entire script for the target is fed to a single instance of the shell. In compatibility (non-jobs) mode, each command is run in a separate process. If the com- mand contains any shell meta characters (`#=|^(){};&<>*?[]:$`\\n') it - will be passed to the shell; otherwise bbmmaakkee will attempt direct execu- - tion. If a line starts with `--' and the shell has ErrCtl enabled then + will be passed to the shell; otherwise bmake will attempt direct execu- + tion. If a line starts with `-' and the shell has ErrCtl enabled then failure of the command line will be ignored as in compatibility mode. - Otherwise `--' affects the entire job; the script will stop at the first + Otherwise `-' affects the entire job; the script will stop at the first command line that fails, but the target will not be deemed to have failed. - Makefiles should be written so that the mode of bbmmaakkee operation does not + Makefiles should be written so that the mode of bmake operation does not change their behavior. For example, any command which needs to use ``cd'' or ``chdir'' without potentially changing the directory for subse- quent commands should be put in parentheses so it executes in a subshell. @@ -334,35 +334,35 @@ SSHHEELLLL CCOOMMMMAANNDDSS (cd ${.CURDIR} && ${MAKE} $@); \ echo Back in `pwd` - Since bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' before executing any targets, each + Since bmake will chdir(2) to `.OBJDIR' before executing any targets, each child process starts with that as its current working directory. -VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS +VARIABLE ASSIGNMENTS Variables in make are much like variables in the shell, and, by tradi- tion, consist of all upper-case letters. - VVaarriiaabbllee aassssiiggnnmmeenntt mmooddiiffiieerrss + Variable assignment modifiers The five operators that can be used to assign values to variables are as follows: - == Assign the value to the variable. Any previous value is overrid- + = Assign the value to the variable. Any previous value is overrid- den. - ++== Append the value to the current value of the variable. + += Append the value to the current value of the variable. - ??== Assign the value to the variable if it is not already defined. + ?= Assign the value to the variable if it is not already defined. - ::== Assign with expansion, i.e. expand the value before assigning it + := Assign with expansion, i.e. expand the value before assigning it to the variable. Normally, expansion is not done until the vari- - able is referenced. _N_O_T_E: References to undefined variables are - _n_o_t expanded. This can cause problems when variable modifiers + able is referenced. NOTE: References to undefined variables are + not expanded. This can cause problems when variable modifiers are used. - !!== Expand the value and pass it to the shell for execution and + != Expand the value and pass it to the shell for execution and assign the result to the variable. Any newlines in the result are replaced with spaces. - Any white-space before the assigned _v_a_l_u_e is removed; if the value is + Any white-space before the assigned value is removed; if the value is being appended, a single space is inserted between the previous contents of the variable and the appended value. @@ -412,12 +412,12 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNT ${b} contains ``${j} ${j} ${j}'' which expands to ``3 3 3'' since after the loop completes ${j} contains ``3''. - VVaarriiaabbllee ccllaasssseess + Variable classes The four different classes of variables (in order of increasing prece- dence) are: Environment variables - Variables defined as part of bbmmaakkee's environment. + Variables defined as part of bmake's environment. Global variables Variables defined in the makefile or in included makefiles. @@ -432,91 +432,91 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNT target to target. It is not currently possible to define new local vari- ables. The seven local variables are as follows: - _._A_L_L_S_R_C The list of all sources for this target; also known as - `_>'. + .ALLSRC The list of all sources for this target; also known as + `>'. - _._A_R_C_H_I_V_E The name of the archive file; also known as `_!'. + .ARCHIVE The name of the archive file; also known as `!'. - _._I_M_P_S_R_C In suffix-transformation rules, the name/path of the + .IMPSRC In suffix-transformation rules, the name/path of the source from which the target is to be transformed (the - ``implied'' source); also known as `_<'. It is not + ``implied'' source); also known as `<'. It is not defined in explicit rules. - _._M_E_M_B_E_R The name of the archive member; also known as `_%'. + .MEMBER The name of the archive member; also known as `%'. - _._O_O_D_A_T_E The list of sources for this target that were deemed out- - of-date; also known as `_?'. + .OODATE The list of sources for this target that were deemed out- + of-date; also known as `?'. - _._P_R_E_F_I_X The file prefix of the target, containing only the file + .PREFIX The file prefix of the target, containing only the file portion, no suffix or preceding directory components; - also known as `_*'. The suffix must be one of the known - suffixes declared with ..SSUUFFFFIIXXEESS or it will not be recog- + also known as `*'. The suffix must be one of the known + suffixes declared with .SUFFIXES or it will not be recog- nized. - _._T_A_R_G_E_T The name of the target; also known as `_@'. For compati- - bility with other makes this is an alias for ..AARRCCHHIIVVEE in + .TARGET The name of the target; also known as `@'. For compati- + bility with other makes this is an alias for .ARCHIVE in archive member rules. - The shorter forms (`_>', `_!', `_<', `_%', `_?', `_*', and `_@') are permitted + The shorter forms (`>', `!', `<', `%', `?', `*', and `@') are permitted for backward compatibility with historical makefiles and legacy POSIX make and are not recommended. Variants of these variables with the punctuation followed immediately by - `D' or `F', e.g. `_$_(_@_D_)', are legacy forms equivalent to using the `:H' + `D' or `F', e.g. `$(@D)', are legacy forms equivalent to using the `:H' and `:T' modifiers. These forms are accepted for compatibility with AT&T System V UNIX makefiles and POSIX but are not recommended. Four of the local variables may be used in sources on dependency lines because they expand to the proper value for each target on the line. - These variables are `_._T_A_R_G_E_T', `_._P_R_E_F_I_X', `_._A_R_C_H_I_V_E', and `_._M_E_M_B_E_R'. + These variables are `.TARGET', `.PREFIX', `.ARCHIVE', and `.MEMBER'. - AAddddiittiioonnaall bbuuiilltt--iinn vvaarriiaabblleess - In addition, bbmmaakkee sets or knows about the following variables: + Additional built-in variables + In addition, bmake sets or knows about the following variables: - _$ A single dollar sign `$', i.e. `$$' expands to a single + $ A single dollar sign `$', i.e. `$$' expands to a single dollar sign. - _._A_L_L_T_A_R_G_E_T_S The list of all targets encountered in the Makefile. If + .ALLTARGETS The list of all targets encountered in the Makefile. If evaluated during Makefile parsing, lists only those tar- gets encountered thus far. - _._C_U_R_D_I_R A path to the directory where bbmmaakkee was executed. Refer + .CURDIR A path to the directory where bmake was executed. Refer to the description of `PWD' for more details. - _._I_N_C_L_U_D_E_D_F_R_O_M_D_I_R + .INCLUDEDFROMDIR The directory of the file this Makefile was included from. - _._I_N_C_L_U_D_E_D_F_R_O_M_F_I_L_E + .INCLUDEDFROMFILE The filename of the file this Makefile was included from. - MAKE The name that bbmmaakkee was executed with (_a_r_g_v_[_0_]). For - compatibility bbmmaakkee also sets _._M_A_K_E with the same value. + MAKE The name that bmake was executed with (argv[0]). For + compatibility bmake also sets .MAKE with the same value. The preferred variable to use is the environment variable MAKE because it is more compatible with other versions of - bbmmaakkee and cannot be confused with the special target with + bmake and cannot be confused with the special target with the same name. - _._M_A_K_E_._D_E_P_E_N_D_F_I_L_E - Names the makefile (default `_._d_e_p_e_n_d') from which gener- + .MAKE.DEPENDFILE + Names the makefile (default `.depend') from which gener- ated dependencies are read. - _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S - A boolean that controls the default behavior of the --VV - option. If true, variable values printed with --VV are + .MAKE.EXPAND_VARIABLES + A boolean that controls the default behavior of the -V + option. If true, variable values printed with -V are fully expanded; if false, the raw variable contents (which may include additional unexpanded variable refer- ences) are shown. - _._M_A_K_E_._E_X_P_O_R_T_E_D The list of variables exported by bbmmaakkee. + .MAKE.EXPORTED The list of variables exported by bmake. - _._M_A_K_E_._J_O_B_S The argument to the --jj option. + .MAKE.JOBS The argument to the -j option. - _._M_A_K_E_._J_O_B_._P_R_E_F_I_X - If bbmmaakkee is run with _j then output for each target is + .MAKE.JOB.PREFIX + If bmake is run with j then output for each target is prefixed with a token `--- target ---' the first part of - which can be controlled via _._M_A_K_E_._J_O_B_._P_R_E_F_I_X. If - _._M_A_K_E_._J_O_B_._P_R_E_F_I_X is empty, no token is printed. + which can be controlled via .MAKE.JOB.PREFIX. If + .MAKE.JOB.PREFIX is empty, no token is printed. For example: .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}] would produce tokens like `---make[1234] target ---' mak- @@ -524,156 +524,156 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNT achieved. MAKEFLAGS The environment variable `MAKEFLAGS' may contain anything - that may be specified on bbmmaakkee's command line. Anything - specified on bbmmaakkee's command line is appended to the + that may be specified on bmake's command line. Anything + specified on bmake's command line is appended to the `MAKEFLAGS' variable which is then entered into the envi- - ronment for all programs which bbmmaakkee executes. + ronment for all programs which bmake executes. - _._M_A_K_E_._L_E_V_E_L The recursion depth of bbmmaakkee. The initial instance of - bbmmaakkee will be 0, and an incremented value is put into the + .MAKE.LEVEL The recursion depth of bmake. The initial instance of + bmake will be 0, and an incremented value is put into the environment to be seen by the next generation. This allows tests like: .if ${.MAKE.LEVEL} == 0 to protect things which should only be evaluated in the initial - instance of bbmmaakkee. + instance of bmake. - _._M_A_K_E_._M_A_K_E_F_I_L_E___P_R_E_F_E_R_E_N_C_E - The ordered list of makefile names (default `_m_a_k_e_f_i_l_e', - `_M_a_k_e_f_i_l_e') that bbmmaakkee will look for. + .MAKE.MAKEFILE_PREFERENCE + The ordered list of makefile names (default `makefile', + `Makefile') that bmake will look for. - _._M_A_K_E_._M_A_K_E_F_I_L_E_S - The list of makefiles read by bbmmaakkee, which is useful for + .MAKE.MAKEFILES + The list of makefiles read by bmake, which is useful for tracking dependencies. Each makefile is recorded only once, regardless of the number of times read. - _._M_A_K_E_._M_O_D_E Processed after reading all makefiles. Can affect the - mode that bbmmaakkee runs in. It can contain a number of key- + .MAKE.MODE Processed after reading all makefiles. Can affect the + mode that bmake runs in. It can contain a number of key- words: - _c_o_m_p_a_t Like --BB, puts bbmmaakkee into "compat" + compat Like -B, puts bmake into "compat" mode. - _m_e_t_a Puts bbmmaakkee into "meta" mode, where + meta Puts bmake into "meta" mode, where meta files are created for each tar- get to capture the command run, the output generated and if filemon(4) is available, the system calls which - are of interest to bbmmaakkee. The cap- + are of interest to bmake. The cap- tured output can be very useful when diagnosing errors. - _c_u_r_d_i_r_O_k_= _b_f Normally bbmmaakkee will not create .meta - files in `_._C_U_R_D_I_R'. This can be - overridden by setting _b_f to a value + curdirOk= bf Normally bmake will not create .meta + files in `.CURDIR'. This can be + overridden by setting bf to a value which represents True. - _m_i_s_s_i_n_g_-_m_e_t_a_= _b_f If _b_f is True, then a missing .meta + missing-meta= bf If bf is True, then a missing .meta file makes the target out-of-date. - _m_i_s_s_i_n_g_-_f_i_l_e_m_o_n_= _b_f If _b_f is True, then missing filemon + missing-filemon= bf If bf is True, then missing filemon data makes the target out-of-date. - _n_o_f_i_l_e_m_o_n Do not use filemon(4). + nofilemon Do not use filemon(4). - _e_n_v For debugging, it can be useful to + env For debugging, it can be useful to include the environment in the .meta file. - _v_e_r_b_o_s_e If in "meta" mode, print a clue + verbose If in "meta" mode, print a clue about the target being built. This is useful if the build is otherwise running silently. The message printed the value of: - _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X. + .MAKE.META.PREFIX. - _i_g_n_o_r_e_-_c_m_d Some makefiles have commands which + ignore-cmd Some makefiles have commands which are simply not stable. This keyword causes them to be ignored for deter- mining whether a target is out of date in "meta" mode. See also - ..NNOOMMEETTAA__CCMMPP. + .NOMETA_CMP. - _s_i_l_e_n_t_= _b_f If _b_f is True, when a .meta file is - created, mark the target ..SSIILLEENNTT. + silent= bf If bf is True, when a .meta file is + created, mark the target .SILENT. - _._M_A_K_E_._M_E_T_A_._B_A_I_L_I_W_I_C_K + .MAKE.META.BAILIWICK In "meta" mode, provides a list of prefixes which match - the directories controlled by bbmmaakkee. If a file that was - generated outside of _._O_B_J_D_I_R but within said bailiwick is + the directories controlled by bmake. If a file that was + generated outside of .OBJDIR but within said bailiwick is missing, the current target is considered out-of-date. - _._M_A_K_E_._M_E_T_A_._C_R_E_A_T_E_D + .MAKE.META.CREATED In "meta" mode, this variable contains a list of all the meta files updated. If not empty, it can be used to - trigger processing of _._M_A_K_E_._M_E_T_A_._F_I_L_E_S. + trigger processing of .MAKE.META.FILES. - _._M_A_K_E_._M_E_T_A_._F_I_L_E_S + .MAKE.META.FILES In "meta" mode, this variable contains a list of all the meta files used (updated or not). This list can be used to process the meta files to extract dependency informa- tion. - _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___P_A_T_H_S + .MAKE.META.IGNORE_PATHS Provides a list of path prefixes that should be ignored; because the contents are expected to change over time. - The default list includes: `_/_d_e_v _/_e_t_c _/_p_r_o_c _/_t_m_p _/_v_a_r_/_r_u_n - _/_v_a_r_/_t_m_p' + The default list includes: `/dev /etc /proc /tmp /var/run + /var/tmp' - _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___P_A_T_T_E_R_N_S + .MAKE.META.IGNORE_PATTERNS Provides a list of patterns to match against pathnames. Ignore any that match. - _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___F_I_L_T_E_R + .MAKE.META.IGNORE_FILTER Provides a list of variable modifiers to apply to each pathname. Ignore if the expansion is an empty string. - _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X + .MAKE.META.PREFIX Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: Building ${.TARGET:H:tA}/${.TARGET:T} - _._M_A_K_E_O_V_E_R_R_I_D_E_S This variable is used to record the names of variables + .MAKEOVERRIDES This variable is used to record the names of variables assigned to on the command line, so that they may be exported as part of `MAKEFLAGS'. This behavior can be - disabled by assigning an empty value to `_._M_A_K_E_O_V_E_R_R_I_D_E_S' + disabled by assigning an empty value to `.MAKEOVERRIDES' within a makefile. Extra variables can be exported from - a makefile by appending their names to `_._M_A_K_E_O_V_E_R_R_I_D_E_S'. - `MAKEFLAGS' is re-exported whenever `_._M_A_K_E_O_V_E_R_R_I_D_E_S' is + a makefile by appending their names to `.MAKEOVERRIDES'. + `MAKEFLAGS' is re-exported whenever `.MAKEOVERRIDES' is modified. - _._M_A_K_E_._P_A_T_H___F_I_L_E_M_O_N - If bbmmaakkee was built with filemon(4) support, this is set + .MAKE.PATH_FILEMON + If bmake was built with filemon(4) support, this is set to the path of the device node. This allows makefiles to test for this support. - _._M_A_K_E_._P_I_D The process-id of bbmmaakkee. + .MAKE.PID The process-id of bmake. - _._M_A_K_E_._P_P_I_D The parent process-id of bbmmaakkee. + .MAKE.PPID The parent process-id of bmake. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Mar 20 17:27:01 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5263CF5F03C; Tue, 20 Mar 2018 17:27:01 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EE30B7DCC2; Tue, 20 Mar 2018 17:27:00 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E40FC1FBD4; Tue, 20 Mar 2018 17:27:00 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KHR0Nf045504; Tue, 20 Mar 2018 17:27:00 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KHR0rQ045501; Tue, 20 Mar 2018 17:27:00 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201803201727.w2KHR0rQ045501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 20 Mar 2018 17:27:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331249 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 331249 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, 20 Mar 2018 17:27:01 -0000 Author: sbruno Date: Tue Mar 20 17:27:00 2018 New Revision: 331249 URL: https://svnweb.freebsd.org/changeset/base/331249 Log: MFC r330675 Update tcp_lro with tested bugfixes from Netflix and LLNW: rrs - Lets make the LRO code look for true dup-acks and window update acks fly on through and combine. rrs - Make the LRO engine a bit more aware of ack-only seq space. Lets not have it incorrectly wipe out newer acks for older acks when we have out-of-order acks (common in wifi environments). jeggleston - LRO eating window updates Based on all of the above I think we are RFC compliant doing it this way: https://tools.ietf.org/html/rfc1122 section 4.2.2.16 "Note that TCP has a heuristic to select the latest window update despite possible datagram reordering; as a result, it may ignore a window update with a smaller window than previously offered if neither the sequence number nor the acknowledgment number is increased." Submitted by: Kevin Bowling Sponsored by: NetFlix and Limelight Networks Modified: stable/11/sys/netinet/tcp_lro.c stable/11/sys/netinet/tcp_seq.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_lro.c ============================================================================== --- stable/11/sys/netinet/tcp_lro.c Tue Mar 20 17:05:23 2018 (r331248) +++ stable/11/sys/netinet/tcp_lro.c Tue Mar 20 17:27:00 2018 (r331249) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -734,7 +735,9 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32 /* Try to append the new segment. */ if (__predict_false(seq != le->next_seq || - (tcp_data_len == 0 && le->ack_seq == th->th_ack))) { + (tcp_data_len == 0 && + le->ack_seq == th->th_ack && + le->window == th->th_win))) { /* Out of order packet or duplicate ACK. */ tcp_lro_active_remove(le); tcp_lro_flush(lc, le); @@ -751,12 +754,20 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32 le->tsval = tsval; le->tsecr = *(ts_ptr + 2); } - - le->next_seq += tcp_data_len; - le->ack_seq = th->th_ack; - le->window = th->th_win; - le->append_cnt++; - + if (tcp_data_len || SEQ_GT(ntohl(th->th_ack), ntohl(le->ack_seq))) { + le->next_seq += tcp_data_len; + le->ack_seq = th->th_ack; + le->window = th->th_win; + le->append_cnt++; + } else if (th->th_ack == le->ack_seq) { + le->window = WIN_MAX(le->window, th->th_win); + le->append_cnt++; + } else { + /* no data and old ack */ + le->append_cnt++; + m_freem(m); + return (0); + } #ifdef TCP_LRO_UPDATE_CSUM le->ulp_csum += tcp_lro_rx_csum_fixup(le, l3hdr, th, tcp_data_len, ~csum); Modified: stable/11/sys/netinet/tcp_seq.h ============================================================================== --- stable/11/sys/netinet/tcp_seq.h Tue Mar 20 17:05:23 2018 (r331248) +++ stable/11/sys/netinet/tcp_seq.h Tue Mar 20 17:27:00 2018 (r331249) @@ -47,6 +47,14 @@ #define SEQ_MIN(a, b) ((SEQ_LT(a, b)) ? (a) : (b)) #define SEQ_MAX(a, b) ((SEQ_GT(a, b)) ? (a) : (b)) +#define WIN_LT(a,b) ((short)(ntohs(a)-ntohs(b)) < 0) +#define WIN_LEQ(a,b) ((short)(ntohs(a)-ntohs(b)) <= 0) +#define WIN_GT(a,b) ((short)(ntohs(a)-ntohs(b)) > 0) +#define WIN_GEQ(a,b) ((short)(ntohs(a)-ntohs(b)) >= 0) + +#define WIN_MIN(a, b) ((WIN_LT(a, b)) ? (a) : (b)) +#define WIN_MAX(a, b) ((WIN_GT(a, b)) ? (a) : (b)) + /* for modulo comparisons of timestamps */ #define TSTMP_LT(a,b) ((int)((a)-(b)) < 0) #define TSTMP_GT(a,b) ((int)((a)-(b)) > 0) From owner-svn-src-stable@freebsd.org Tue Mar 20 17:39:51 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70B39F5FF2E; Tue, 20 Mar 2018 17:39:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B4E87E516; Tue, 20 Mar 2018 17:39:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14DB21FDA4; Tue, 20 Mar 2018 17:39:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KHdo8p050735; Tue, 20 Mar 2018 17:39:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KHdoYC050734; Tue, 20 Mar 2018 17:39:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803201739.w2KHdoYC050734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Mar 2018 17:39:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331250 - stable/11/stand/ficl X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/ficl X-SVN-Commit-Revision: 331250 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, 20 Mar 2018 17:39:51 -0000 Author: kevans Date: Tue Mar 20 17:39:50 2018 New Revision: 331250 URL: https://svnweb.freebsd.org/changeset/base/331250 Log: MFC r330612: stand/ficl: Fix testmain testmain is a userland application intended to be built with standard headers and whatnot, which we broke. Fix it by having the testmain build clobber cflags, reducing it to just the set of defines/includes it needs to build. Modified: stable/11/stand/ficl/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/ficl/Makefile ============================================================================== --- stable/11/stand/ficl/Makefile Tue Mar 20 17:27:00 2018 (r331249) +++ stable/11/stand/ficl/Makefile Tue Mar 20 17:39:50 2018 (r331250) @@ -14,7 +14,8 @@ CLEANFILES+= softcore.c testmain testmain.o .include .ifmake testmain -CFLAGS+= -DTESTMAIN -D_TESTMAIN +CFLAGS= -DTESTMAIN -D_TESTMAIN +CFLAGS+= -I${FICLSRC} -I${FICLSRC}/${FICL_CPUARCH} -I${LDRSRC} SRCS+= testmain.c PROG= testmain .include From owner-svn-src-stable@freebsd.org Tue Mar 20 17:41:55 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 508DEF601CD; Tue, 20 Mar 2018 17:41:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E5B447E880; Tue, 20 Mar 2018 17:41:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C68141FEF3; Tue, 20 Mar 2018 17:41:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KHfssd053182; Tue, 20 Mar 2018 17:41:54 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KHfs2N053180; Tue, 20 Mar 2018 17:41:54 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803201741.w2KHfs2N053180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Mar 2018 17:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331251 - stable/11/stand/libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/libsa X-SVN-Commit-Revision: 331251 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, 20 Mar 2018 17:41:55 -0000 Author: kevans Date: Tue Mar 20 17:41:54 2018 New Revision: 331251 URL: https://svnweb.freebsd.org/changeset/base/331251 Log: MFC r330023, r330028: Add MAXWAIT for configuring pxeboot timeout r330023: libsa: Add MAXWAIT to net for establishing max total timeout Current timeout behavior is to progress in timeout values from MINTMO to MAXTMO in MINTMO steps before finally timing out. This results in a fairly long time before operations finally timeout, which may not be ideal for some use-cases. Add MAXWAIT that may be configured along with MINTMO/MAXTMO. If we attempt to start our send/recv cycle over again but MAXWAIT > 0 and MAXWAIT seconds have already passed, then go ahead and timeout. This is intended for those that just want to say "timeout after 180 seconds" rather than calculate and tweak MINTMO/MAXTMO to get their desired timeout. The default is 0, or "progress from MINTMO to MAXTMO with no exception." This has been modified since review to allow for it to be defined via CFLAGS and doing appropriate error checking. Future work may add some Makefile foo to respect LOADER_NET_MAXWAIT if it's specified in the environment and pass it in as MAXWAIT accordingly. r330028: libsa: Partially revert r330023 The removal of tmo >= MAXTMO check should not have been done; this is specifically what handles timeout if MAXWAIT == 0. Modified: stable/11/stand/libsa/net.c stable/11/stand/libsa/net.h Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/net.c ============================================================================== --- stable/11/stand/libsa/net.c Tue Mar 20 17:39:50 2018 (r331250) +++ stable/11/stand/libsa/net.c Tue Mar 20 17:41:54 2018 (r331251) @@ -77,6 +77,7 @@ sendrecv(struct iodesc *d, { ssize_t cc; time_t t, tmo, tlast; + time_t tref; long tleft; #ifdef NET_DEBUG @@ -87,8 +88,13 @@ sendrecv(struct iodesc *d, tmo = MINTMO; tlast = 0; tleft = 0; + tref = getsecs(); t = getsecs(); for (;;) { + if (MAXWAIT > 0 && (getsecs() - tref) >= MAXWAIT) { + errno = ETIMEDOUT; + return -1; + } if (tleft <= 0) { if (tmo >= MAXTMO) { errno = ETIMEDOUT; Modified: stable/11/stand/libsa/net.h ============================================================================== --- stable/11/stand/libsa/net.h Tue Mar 20 17:39:50 2018 (r331250) +++ stable/11/stand/libsa/net.h Tue Mar 20 17:41:54 2018 (r331251) @@ -61,6 +61,20 @@ enum net_proto { #define MAXTMO 120 /* seconds */ #define MINTMO 2 /* seconds */ +/* + * Maximum wait time for sending and receiving before we give up and timeout. + * If set to 0, operations will eventually timeout completely, but send/recv + * timeouts must progress exponentially from MINTMO to MAXTMO before final + * timeout is hit. + */ +#ifndef MAXWAIT +#define MAXWAIT 0 /* seconds */ +#endif + +#if MAXWAIT < 0 +#error MAXWAIT must not be a negative number +#endif + #define FNAME_SIZE 128 #define IFNAME_SIZE 16 #define RECV_SIZE 1536 /* XXX delete this */ From owner-svn-src-stable@freebsd.org Tue Mar 20 21:02:43 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8D43F46CC4; Tue, 20 Mar 2018 21:02:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6960287A13; Tue, 20 Mar 2018 21:02:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AB5321E1D; Tue, 20 Mar 2018 21:02:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KL2h3V056086; Tue, 20 Mar 2018 21:02:43 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KL2hcq056085; Tue, 20 Mar 2018 21:02:43 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803202102.w2KL2hcq056085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 20 Mar 2018 21:02:43 +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: r331262 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 331262 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, 20 Mar 2018 21:02:43 -0000 Author: ian Date: Tue Mar 20 21:02:42 2018 New Revision: 331262 URL: https://svnweb.freebsd.org/changeset/base/331262 Log: MFC r330745: Make root mount timeout logic work for filesystems other than ufs. The vfs.mountroot.timeout tunable and .timeout directive in a mount.conf(5) file allow specifying a wait timeout for the device(s) hosting the root filesystem to become usable. The current mechanism for waiting for devices and detecting their availability can't be used for zfs-hosted filesystems. See the comment #20 in the PR for some expanded detail on these points. This change adds retry logic to the actual root filesystem mount. That is, insted of relying on device availability using device name lookups, it uses the kernel_mount() call itself to detect whether the filesystem can be mounted, and loops until it succeeds or the configured timeout is exceeded. These changes are based on the patch attached to the PR, but it's rewritten enough that all mistakes belong to me. PR: 208882 Modified: stable/11/sys/kern/vfs_mountroot.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_mountroot.c ============================================================================== --- stable/11/sys/kern/vfs_mountroot.c Tue Mar 20 21:00:45 2018 (r331261) +++ stable/11/sys/kern/vfs_mountroot.c Tue Mar 20 21:02:42 2018 (r331262) @@ -712,7 +712,7 @@ parse_mount(char **conf) char *errmsg; struct mntarg *ma; char *dev, *fs, *opts, *tok; - int error; + int delay, error, timeout; error = parse_token(conf, &tok); if (error) @@ -753,15 +753,31 @@ parse_mount(char **conf) if (error != 0) goto out; - ma = NULL; - ma = mount_arg(ma, "fstype", fs, -1); - ma = mount_arg(ma, "fspath", "/", -1); - ma = mount_arg(ma, "from", dev, -1); - ma = mount_arg(ma, "errmsg", errmsg, ERRMSGL); - ma = mount_arg(ma, "ro", NULL, 0); - ma = parse_mountroot_options(ma, opts); - error = kernel_mount(ma, MNT_ROOTFS); + delay = hz / 10; + timeout = root_mount_timeout * hz; + for (;;) { + ma = NULL; + ma = mount_arg(ma, "fstype", fs, -1); + ma = mount_arg(ma, "fspath", "/", -1); + ma = mount_arg(ma, "from", dev, -1); + ma = mount_arg(ma, "errmsg", errmsg, ERRMSGL); + ma = mount_arg(ma, "ro", NULL, 0); + ma = parse_mountroot_options(ma, opts); + + error = kernel_mount(ma, MNT_ROOTFS); + if (error == 0 || timeout <= 0) + break; + + if (root_mount_timeout * hz == timeout || + (bootverbose && timeout % hz == 0)) { + printf("Mounting from %s:%s failed with error %d; " + "retrying for %d more second%s\n", fs, dev, error, + timeout / hz, (timeout / hz > 1) ? "s" : ""); + } + pause("rmretry", delay); + timeout -= delay; + } out: if (error) { printf("Mounting from %s:%s failed with error %d", From owner-svn-src-stable@freebsd.org Tue Mar 20 22:57:15 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F200DF53325; Tue, 20 Mar 2018 22:57:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D4136E734; Tue, 20 Mar 2018 22:57:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 97B4722ED4; Tue, 20 Mar 2018 22:57:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2KMvEWo014834; Tue, 20 Mar 2018 22:57:14 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2KMvEG7014833; Tue, 20 Mar 2018 22:57:14 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803202257.w2KMvEG7014833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 20 Mar 2018 22:57: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: r331276 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 331276 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, 20 Mar 2018 22:57:15 -0000 Author: ian Date: Tue Mar 20 22:57:14 2018 New Revision: 331276 URL: https://svnweb.freebsd.org/changeset/base/331276 Log: MFC r330745: Make root mount timeout logic work for filesystems other than ufs. The vfs.mountroot.timeout tunable and .timeout directive in a mount.conf(5) file allow specifying a wait timeout for the device(s) hosting the root filesystem to become usable. The current mechanism for waiting for devices and detecting their availability can't be used for zfs-hosted filesystems. See the comment #20 in the PR for some expanded detail on these points. This change adds retry logic to the actual root filesystem mount. That is, insted of relying on device availability using device name lookups, it uses the kernel_mount() call itself to detect whether the filesystem can be mounted, and loops until it succeeds or the configured timeout is exceeded. These changes are based on the patch attached to the PR, but it's rewritten enough that all mistakes belong to me. PR: 208882 Modified: stable/10/sys/kern/vfs_mountroot.c Modified: stable/10/sys/kern/vfs_mountroot.c ============================================================================== --- stable/10/sys/kern/vfs_mountroot.c Tue Mar 20 22:57:06 2018 (r331275) +++ stable/10/sys/kern/vfs_mountroot.c Tue Mar 20 22:57:14 2018 (r331276) @@ -741,15 +741,31 @@ parse_mount(char **conf) } } - ma = NULL; - ma = mount_arg(ma, "fstype", fs, -1); - ma = mount_arg(ma, "fspath", "/", -1); - ma = mount_arg(ma, "from", dev, -1); - ma = mount_arg(ma, "errmsg", errmsg, ERRMSGL); - ma = mount_arg(ma, "ro", NULL, 0); - ma = parse_mountroot_options(ma, opts); - error = kernel_mount(ma, MNT_ROOTFS); + delay = hz / 10; + timeout = root_mount_timeout * hz; + for (;;) { + ma = NULL; + ma = mount_arg(ma, "fstype", fs, -1); + ma = mount_arg(ma, "fspath", "/", -1); + ma = mount_arg(ma, "from", dev, -1); + ma = mount_arg(ma, "errmsg", errmsg, ERRMSGL); + ma = mount_arg(ma, "ro", NULL, 0); + ma = parse_mountroot_options(ma, opts); + + error = kernel_mount(ma, MNT_ROOTFS); + if (error == 0 || timeout <= 0) + break; + + if (root_mount_timeout * hz == timeout || + (bootverbose && timeout % hz == 0)) { + printf("Mounting from %s:%s failed with error %d; " + "retrying for %d more second%s\n", fs, dev, error, + timeout / hz, (timeout / hz > 1) ? "s" : ""); + } + pause("rmretry", delay); + timeout -= delay; + } out: if (error) { printf("Mounting from %s:%s failed with error %d", From owner-svn-src-stable@freebsd.org Wed Mar 21 09:55:20 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81808F58C27; Wed, 21 Mar 2018 09:55:20 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 33878867D6; Wed, 21 Mar 2018 09:55:20 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E956292E2; Wed, 21 Mar 2018 09:55:20 +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 w2L9tKMl046566; Wed, 21 Mar 2018 09:55:20 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L9tKel046565; Wed, 21 Mar 2018 09:55:20 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803210955.w2L9tKel046565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 21 Mar 2018 09:55: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: r331286 - 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: 331286 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, 21 Mar 2018 09:55:20 -0000 Author: kp Date: Wed Mar 21 09:55:19 2018 New Revision: 331286 URL: https://svnweb.freebsd.org/changeset/base/331286 Log: MFC r330108: pf: Apply $pf_flags when verifying the pf.conf file When checking the validity of the pf.conf file also include the user supplied pf_flags. These flags might overrule macros or specify anchors, which we will apply when actually applying the pf.conf file, so we must also take them into account when verifying the validity. Submitted by: Andreas Longwitz Modified: stable/11/etc/rc.d/pf Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.d/pf ============================================================================== --- stable/11/etc/rc.d/pf Wed Mar 21 09:07:01 2018 (r331285) +++ stable/11/etc/rc.d/pf Wed Mar 21 09:55:19 2018 (r331286) @@ -47,13 +47,13 @@ pf_stop() pf_check() { echo "Checking pf rules." - $pf_program -n -f "$pf_rules" + $pf_program -n -f "$pf_rules" $pf_flags } pf_reload() { echo "Reloading pf rules." - $pf_program -n -f "$pf_rules" || return 1 + $pf_program -n -f "$pf_rules" $pf_flags || return 1 # Flush everything but existing state entries that way when # rules are read in, it doesn't break established connections. $pf_program -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp > /dev/null 2>&1 From owner-svn-src-stable@freebsd.org Wed Mar 21 09:55:50 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D473F58CD5; Wed, 21 Mar 2018 09:55:50 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 21C76868F6; Wed, 21 Mar 2018 09:55:50 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A73A292E3; Wed, 21 Mar 2018 09:55:50 +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 w2L9tnZf046631; Wed, 21 Mar 2018 09:55:49 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L9tnLO046630; Wed, 21 Mar 2018 09:55:49 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803210955.w2L9tnLO046630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 21 Mar 2018 09:55: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: r331287 - stable/10/etc/rc.d X-SVN-Group: stable-10 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/10/etc/rc.d X-SVN-Commit-Revision: 331287 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, 21 Mar 2018 09:55:50 -0000 Author: kp Date: Wed Mar 21 09:55:49 2018 New Revision: 331287 URL: https://svnweb.freebsd.org/changeset/base/331287 Log: MFC r330108: pf: Apply $pf_flags when verifying the pf.conf file When checking the validity of the pf.conf file also include the user supplied pf_flags. These flags might overrule macros or specify anchors, which we will apply when actually applying the pf.conf file, so we must also take them into account when verifying the validity. Submitted by: Andreas Longwitz Modified: stable/10/etc/rc.d/pf Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/pf ============================================================================== --- stable/10/etc/rc.d/pf Wed Mar 21 09:55:19 2018 (r331286) +++ stable/10/etc/rc.d/pf Wed Mar 21 09:55:49 2018 (r331287) @@ -46,13 +46,13 @@ pf_stop() pf_check() { echo "Checking pf rules." - $pf_program -n -f "$pf_rules" + $pf_program -n -f "$pf_rules" $pf_flags } pf_reload() { echo "Reloading pf rules." - $pf_program -n -f "$pf_rules" || return 1 + $pf_program -n -f "$pf_rules" $pf_flags || return 1 # Flush everything but existing state entries that way when # rules are read in, it doesn't break established connections. $pf_program -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp > /dev/null 2>&1 From owner-svn-src-stable@freebsd.org Wed Mar 21 09:57:06 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 978BBF58DE7; Wed, 21 Mar 2018 09:57:06 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C09786A64; Wed, 21 Mar 2018 09:57:06 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46F65292E4; Wed, 21 Mar 2018 09:57:06 +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 w2L9v6EU046734; Wed, 21 Mar 2018 09:57:06 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L9v6jA046733; Wed, 21 Mar 2018 09:57:06 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803210957.w2L9v6jA046733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 21 Mar 2018 09:57:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331288 - 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: 331288 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, 21 Mar 2018 09:57:06 -0000 Author: kp Date: Wed Mar 21 09:57:05 2018 New Revision: 331288 URL: https://svnweb.freebsd.org/changeset/base/331288 Log: MFC 330105: pf: Do not flush on reload pfctl only takes the last '-F' argument into account, so this never did what was intended. Moreover, there is no reason to flush rules before reloading, because pf keeps track of the rule which created a given state. That means that existing connections will keep being processed according to the rule which originally created them. Simply reloading the (new) rules suffices. The new rules will apply to new connections. PR: 127814 Submitted by: Andreas Longwitz Modified: stable/11/etc/rc.d/pf Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.d/pf ============================================================================== --- stable/11/etc/rc.d/pf Wed Mar 21 09:55:49 2018 (r331287) +++ stable/11/etc/rc.d/pf Wed Mar 21 09:57:05 2018 (r331288) @@ -54,9 +54,6 @@ pf_reload() { echo "Reloading pf rules." $pf_program -n -f "$pf_rules" $pf_flags || return 1 - # Flush everything but existing state entries that way when - # rules are read in, it doesn't break established connections. - $pf_program -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp > /dev/null 2>&1 $pf_program -f "$pf_rules" $pf_flags } From owner-svn-src-stable@freebsd.org Wed Mar 21 09:57:30 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83D3BF58E76; Wed, 21 Mar 2018 09:57:30 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 34C1D86B86; Wed, 21 Mar 2018 09:57:30 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FCA4292E6; Wed, 21 Mar 2018 09:57:30 +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 w2L9vUMc046808; Wed, 21 Mar 2018 09:57:30 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L9vUin046807; Wed, 21 Mar 2018 09:57:30 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201803210957.w2L9vUin046807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 21 Mar 2018 09:57:30 +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: r331289 - stable/10/etc/rc.d X-SVN-Group: stable-10 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/10/etc/rc.d X-SVN-Commit-Revision: 331289 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, 21 Mar 2018 09:57:30 -0000 Author: kp Date: Wed Mar 21 09:57:29 2018 New Revision: 331289 URL: https://svnweb.freebsd.org/changeset/base/331289 Log: MFC 330105: pf: Do not flush on reload pfctl only takes the last '-F' argument into account, so this never did what was intended. Moreover, there is no reason to flush rules before reloading, because pf keeps track of the rule which created a given state. That means that existing connections will keep being processed according to the rule which originally created them. Simply reloading the (new) rules suffices. The new rules will apply to new connections. PR: 127814 Submitted by: Andreas Longwitz Modified: stable/10/etc/rc.d/pf Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/pf ============================================================================== --- stable/10/etc/rc.d/pf Wed Mar 21 09:57:05 2018 (r331288) +++ stable/10/etc/rc.d/pf Wed Mar 21 09:57:29 2018 (r331289) @@ -53,9 +53,6 @@ pf_reload() { echo "Reloading pf rules." $pf_program -n -f "$pf_rules" $pf_flags || return 1 - # Flush everything but existing state entries that way when - # rules are read in, it doesn't break established connections. - $pf_program -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp > /dev/null 2>&1 $pf_program -f "$pf_rules" $pf_flags } From owner-svn-src-stable@freebsd.org Wed Mar 21 15:05:09 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 975FAF4B237; Wed, 21 Mar 2018 15:05:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CBE2740B3; Wed, 21 Mar 2018 15:05:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4318B2C39C; Wed, 21 Mar 2018 15:05:09 +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 w2LF59n5002251; Wed, 21 Mar 2018 15:05:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LF59ba002250; Wed, 21 Mar 2018 15:05:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803211505.w2LF59ba002250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Mar 2018 15:05: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: r331300 - stable/11/sys/ddb X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/ddb X-SVN-Commit-Revision: 331300 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, 21 Mar 2018 15:05:09 -0000 Author: avg Date: Wed Mar 21 15:05:08 2018 New Revision: 331300 URL: https://svnweb.freebsd.org/changeset/base/331300 Log: MFC r330374: db_script_exec: use a saved script name when reporting commands executed Modified: stable/11/sys/ddb/db_script.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ddb/db_script.c ============================================================================== --- stable/11/sys/ddb/db_script.c Wed Mar 21 14:47:17 2018 (r331299) +++ stable/11/sys/ddb/db_script.c Wed Mar 21 15:05:08 2018 (r331300) @@ -294,7 +294,7 @@ db_script_exec(const char *scriptname, int warnifnotfo buffer = drd->drd_buffer; strcpy(buffer, dsp->ds_script); while ((command = strsep(&buffer, ";")) != NULL) { - db_printf("db:%d:%s> %s\n", db_recursion, scriptname, + db_printf("db:%d:%s> %s\n", db_recursion, dsp->ds_scriptname, command); db_command_trim(&command); prev_jb = kdb_jmpbuf(jb); From owner-svn-src-stable@freebsd.org Wed Mar 21 15:05:46 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 432E8F4B3CC; Wed, 21 Mar 2018 15:05:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED36974202; Wed, 21 Mar 2018 15:05:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E79AC2C39D; Wed, 21 Mar 2018 15:05:45 +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 w2LF5jrx002339; Wed, 21 Mar 2018 15:05:45 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LF5jx4002338; Wed, 21 Mar 2018 15:05:45 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803211505.w2LF5jx4002338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Mar 2018 15:05:45 +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: r331301 - stable/10/sys/ddb X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/10/sys/ddb X-SVN-Commit-Revision: 331301 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, 21 Mar 2018 15:05:46 -0000 Author: avg Date: Wed Mar 21 15:05:45 2018 New Revision: 331301 URL: https://svnweb.freebsd.org/changeset/base/331301 Log: MFC r330374: db_script_exec: use a saved script name when reporting commands executed Modified: stable/10/sys/ddb/db_script.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ddb/db_script.c ============================================================================== --- stable/10/sys/ddb/db_script.c Wed Mar 21 15:05:08 2018 (r331300) +++ stable/10/sys/ddb/db_script.c Wed Mar 21 15:05:45 2018 (r331301) @@ -294,7 +294,7 @@ db_script_exec(const char *scriptname, int warnifnotfo buffer = drd->drd_buffer; strcpy(buffer, dsp->ds_script); while ((command = strsep(&buffer, ";")) != NULL) { - db_printf("db:%d:%s> %s\n", db_recursion, scriptname, + db_printf("db:%d:%s> %s\n", db_recursion, dsp->ds_scriptname, command); db_command_trim(&command); prev_jb = kdb_jmpbuf(jb); From owner-svn-src-stable@freebsd.org Wed Mar 21 15:07:27 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3950CF4B6A1; Wed, 21 Mar 2018 15:07:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DAE58743D0; Wed, 21 Mar 2018 15:07: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5C8B2C3A0; Wed, 21 Mar 2018 15:07: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 w2LF7Qfv002459; Wed, 21 Mar 2018 15:07:26 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LF7QeO002458; Wed, 21 Mar 2018 15:07:26 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803211507.w2LF7QeO002458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Mar 2018 15:07:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331302 - 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: 331302 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, 21 Mar 2018 15:07:27 -0000 Author: avg Date: Wed Mar 21 15:07:26 2018 New Revision: 331302 URL: https://svnweb.freebsd.org/changeset/base/331302 Log: MFC r330592: MFV r330591: 8984 fix for 6764 breaks ACL inheritance PR: 216886 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed Mar 21 15:05:45 2018 (r331301) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed Mar 21 15:07:26 2018 (r331302) @@ -1476,7 +1476,7 @@ zfs_ace_can_use(vtype_t vtype, uint16_t acep_flags) */ static zfs_acl_t * zfs_acl_inherit(zfsvfs_t *zfsvfs, vtype_t vtype, zfs_acl_t *paclp, - uint64_t mode) + uint64_t mode, boolean_t *need_chmod) { void *pacep = NULL; void *acep; @@ -1490,7 +1490,10 @@ zfs_acl_inherit(zfsvfs_t *zfsvfs, vtype_t vtype, zfs_a size_t data1sz, data2sz; uint_t aclinherit; boolean_t isdir = (vtype == VDIR); + boolean_t isreg = (vtype == VREG); + *need_chmod = B_TRUE; + aclp = zfs_acl_alloc(paclp->z_version); aclinherit = zfsvfs->z_acl_inherit; if (aclinherit == ZFS_ACL_DISCARD || vtype == VLNK) @@ -1513,6 +1516,17 @@ zfs_acl_inherit(zfsvfs_t *zfsvfs, vtype_t vtype, zfs_a continue; /* + * If owner@, group@, or everyone@ inheritable + * then zfs_acl_chmod() isn't needed. + */ + if ((aclinherit == ZFS_ACL_PASSTHROUGH || + aclinherit == ZFS_ACL_PASSTHROUGH_X) && + ((iflags & (ACE_OWNER|ACE_EVERYONE)) || + ((iflags & OWNING_GROUP) == OWNING_GROUP)) && + (isreg || (isdir && (iflags & ACE_DIRECTORY_INHERIT_ACE)))) + *need_chmod = B_FALSE; + + /* * Strip inherited execute permission from file if * not in mode */ @@ -1599,6 +1613,7 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *va zfsvfs_t *zfsvfs = dzp->z_zfsvfs; zfs_acl_t *paclp; gid_t gid; + boolean_t need_chmod = B_TRUE; boolean_t trim = B_FALSE; boolean_t inherited = B_FALSE; @@ -1694,7 +1709,7 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *va !(dzp->z_pflags & ZFS_XATTR)) { VERIFY(0 == zfs_acl_node_read(dzp, &paclp, B_FALSE)); acl_ids->z_aclp = zfs_acl_inherit(zfsvfs, - vap->va_type, paclp, acl_ids->z_mode); + vap->va_type, paclp, acl_ids->z_mode, &need_chmod); inherited = B_TRUE; } else { acl_ids->z_aclp = @@ -1703,15 +1718,18 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *va } mutex_exit(&dzp->z_acl_lock); - if (vap->va_type == VDIR) - acl_ids->z_aclp->z_hints |= ZFS_ACL_AUTO_INHERIT; + if (need_chmod) { + if (vap->va_type == VDIR) + acl_ids->z_aclp->z_hints |= + ZFS_ACL_AUTO_INHERIT; - if (zfsvfs->z_acl_mode == ZFS_ACL_GROUPMASK && - zfsvfs->z_acl_inherit != ZFS_ACL_PASSTHROUGH && - zfsvfs->z_acl_inherit != ZFS_ACL_PASSTHROUGH_X) - trim = B_TRUE; - zfs_acl_chmod(vap->va_type, acl_ids->z_mode, B_FALSE, trim, - acl_ids->z_aclp); + if (zfsvfs->z_acl_mode == ZFS_ACL_GROUPMASK && + zfsvfs->z_acl_inherit != ZFS_ACL_PASSTHROUGH && + zfsvfs->z_acl_inherit != ZFS_ACL_PASSTHROUGH_X) + trim = B_TRUE; + zfs_acl_chmod(vap->va_type, acl_ids->z_mode, B_FALSE, + trim, acl_ids->z_aclp); + } } if (inherited || vsecp) { From owner-svn-src-stable@freebsd.org Wed Mar 21 15:09:42 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FA58F4B90E; Wed, 21 Mar 2018 15:09:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E19574598; Wed, 21 Mar 2018 15:09:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44B212C3A2; Wed, 21 Mar 2018 15:09:42 +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 w2LF9g4T002628; Wed, 21 Mar 2018 15:09:42 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LF9g6a002627; Wed, 21 Mar 2018 15:09:42 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803211509.w2LF9g6a002627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Mar 2018 15:09: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: r331303 - stable/11/sys/x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/x86/x86 X-SVN-Commit-Revision: 331303 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, 21 Mar 2018 15:09:42 -0000 Author: avg Date: Wed Mar 21 15:09:41 2018 New Revision: 331303 URL: https://svnweb.freebsd.org/changeset/base/331303 Log: MFC r330793: fix r297857, do not modify CPU extension bits under virtual machines PR: 213155 Modified: stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Wed Mar 21 15:07:26 2018 (r331302) +++ stable/11/sys/x86/x86/identcpu.c Wed Mar 21 15:09:41 2018 (r331303) @@ -1394,7 +1394,8 @@ fix_cpuid(void) * See BIOS and Kernel Developer’s Guide (BKDG) for AMD Family 15h * Models 60h-6Fh Processors, Publication # 50742. */ - if (cpu_vendor_id == CPU_VENDOR_AMD && CPUID_TO_FAMILY(cpu_id) == 0x15) { + if (vm_guest == VM_GUEST_NO && cpu_vendor_id == CPU_VENDOR_AMD && + CPUID_TO_FAMILY(cpu_id) == 0x15) { msr = rdmsr(MSR_EXTFEATURES); if ((msr & ((uint64_t)1 << 54)) == 0) { msr |= (uint64_t)1 << 54; From owner-svn-src-stable@freebsd.org Wed Mar 21 15:13:48 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65B0EF4C0FB; Wed, 21 Mar 2018 15:13:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1930874D68; Wed, 21 Mar 2018 15:13:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13F062C541; Wed, 21 Mar 2018 15:13:48 +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 w2LFDlfa007495; Wed, 21 Mar 2018 15:13:47 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LFDlPs007494; Wed, 21 Mar 2018 15:13:47 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201803211513.w2LFDlPs007494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 21 Mar 2018 15:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331305 - stable/10/sys/x86/x86 X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/10/sys/x86/x86 X-SVN-Commit-Revision: 331305 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, 21 Mar 2018 15:13:48 -0000 Author: avg Date: Wed Mar 21 15:13:47 2018 New Revision: 331305 URL: https://svnweb.freebsd.org/changeset/base/331305 Log: MFC r330793: fix r297857, do not modify CPU extension bits under virtual machines PR: 213155 Modified: stable/10/sys/x86/x86/identcpu.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/x86/identcpu.c ============================================================================== --- stable/10/sys/x86/x86/identcpu.c Wed Mar 21 15:09:47 2018 (r331304) +++ stable/10/sys/x86/x86/identcpu.c Wed Mar 21 15:13:47 2018 (r331305) @@ -1335,7 +1335,8 @@ fix_cpuid(void) * See BIOS and Kernel Developer’s Guide (BKDG) for AMD Family 15h * Models 60h-6Fh Processors, Publication # 50742. */ - if (cpu_vendor_id == CPU_VENDOR_AMD && CPUID_TO_FAMILY(cpu_id) == 0x15) { + if (vm_guest == VM_GUEST_NO && cpu_vendor_id == CPU_VENDOR_AMD && + CPUID_TO_FAMILY(cpu_id) == 0x15) { msr = rdmsr(MSR_EXTFEATURES); if ((msr & ((uint64_t)1 << 54)) == 0) { msr |= (uint64_t)1 << 54; From owner-svn-src-stable@freebsd.org Wed Mar 21 15:42:30 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 469B0F4EAB2; Wed, 21 Mar 2018 15:42:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E83EE76CCB; Wed, 21 Mar 2018 15:42:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E33062C9F3; Wed, 21 Mar 2018 15:42:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LFgT4h022715; Wed, 21 Mar 2018 15:42:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LFgTZM022714; Wed, 21 Mar 2018 15:42:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803211542.w2LFgTZM022714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 15:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331307 - stable/11/stand/uboot/common X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/uboot/common X-SVN-Commit-Revision: 331307 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, 21 Mar 2018 15:42:30 -0000 Author: kevans Date: Wed Mar 21 15:42:29 2018 New Revision: 331307 URL: https://svnweb.freebsd.org/changeset/base/331307 Log: MFC r330891: ubldr: Bump heap size from 512K to 1M lualoader in itself only uses another ~200K, but there seems to be no reason not to bump it a little higher to give us some more wiggle room. With this, I can boot using a menu-enabled lualoader, no problem and reasonably fast. Some heap usage datapoints from the review: forthloader, no menus, kernel loaded: heap base at 0x1203d5b0, top at 0x1208e000, used 330320 lualoader, no menus, kernel loaded: heap base at 0x42050028, top at 0x420ab000, used 372696 lualoader, menus, kernel loaded: heap base at 0x42050028, top at 0x420d5000, used 544728 Since then, the no menu case for lualoader should have decreased slightly as I've made some changes to make sure that it no longer loads any of th emenu bits with beastie disabled. While here, split heap size out into a HEAP_SIZE macro. Modified: stable/11/stand/uboot/common/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/uboot/common/main.c ============================================================================== --- stable/11/stand/uboot/common/main.c Wed Mar 21 15:17:54 2018 (r331306) +++ stable/11/stand/uboot/common/main.c Wed Mar 21 15:42:29 2018 (r331307) @@ -41,6 +41,10 @@ __FBSDID("$FreeBSD$"); #define nitems(x) (sizeof((x)) / sizeof((x)[0])) #endif +#ifndef HEAP_SIZE +#define HEAP_SIZE (1 * 1024 * 1024) +#endif + struct uboot_devdesc currdev; struct arch_switch archsw; /* MI/MD interface boundary */ int devs_no; @@ -421,7 +425,7 @@ main(int argc, char **argv) * of our bss and the bottom of the u-boot stack to avoid overlap. */ uboot_heap_start = round_page((uintptr_t)end); - uboot_heap_end = uboot_heap_start + 512 * 1024; + uboot_heap_end = uboot_heap_start + HEAP_SIZE; setheap((void *)uboot_heap_start, (void *)uboot_heap_end); /* From owner-svn-src-stable@freebsd.org Wed Mar 21 15:43:58 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE9FFF4EC7F; Wed, 21 Mar 2018 15:43:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7DD1B76F99; Wed, 21 Mar 2018 15:43:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 78CE62C9F8; Wed, 21 Mar 2018 15:43:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LFhv50022814; Wed, 21 Mar 2018 15:43:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LFhvUL022812; Wed, 21 Mar 2018 15:43:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201803211543.w2LFhvUL022812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 21 Mar 2018 15:43:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331308 - in stable/11: . release/packages X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: . release/packages X-SVN-Commit-Revision: 331308 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, 21 Mar 2018 15:43:58 -0000 Author: kevans Date: Wed Mar 21 15:43:57 2018 New Revision: 331308 URL: https://svnweb.freebsd.org/changeset/base/331308 Log: MFC r330929: pkgbase: Fix post-install script for kernel packages kernel.ucl uses a hardcoded boot/kernel for kldxref, which is the incorrect directory when we're installing extra kernels that aren't the "default" kernel (placed at boot/kernel). Fix this by instead using a new %KERNELDIR% that we now replace in Makefile.inc1 with "kernel" for the default kernel and "kernel.${_kernel}" for these extra kernels so that, e.g. /boot/kernel.SHIVA, will get properly kldxref'd upon update and avoid outdated linker.hints. Modified: stable/11/Makefile.inc1 stable/11/release/packages/kernel.ucl Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Wed Mar 21 15:42:29 2018 (r331307) +++ stable/11/Makefile.inc1 Wed Mar 21 15:43:57 2018 (r331308) @@ -1495,6 +1495,7 @@ _debug=-debug pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \ sed -e "s/%VERSION%/${PKG_VERSION}/" \ -e "s/%PKGNAME%/kernel-${INSTALLKERNEL:tl}${flavor}/" \ + -e "s/%KERNELDIR%/kernel/" \ -e "s/%COMMENT%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ -e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ @@ -1527,6 +1528,7 @@ _debug=-debug pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \ sed -e "s/%VERSION%/${PKG_VERSION}/" \ -e "s/%PKGNAME%/kernel-${_kernel:tl}${flavor}/" \ + -e "s/%KERNELDIR%/kernel.${_kernel}/" \ -e "s/%COMMENT%/FreeBSD ${_kernel} kernel ${flavor}/" \ -e "s/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ Modified: stable/11/release/packages/kernel.ucl ============================================================================== --- stable/11/release/packages/kernel.ucl Wed Mar 21 15:42:29 2018 (r331307) +++ stable/11/release/packages/kernel.ucl Wed Mar 21 15:43:57 2018 (r331308) @@ -17,6 +17,6 @@ desc = < Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FCFEF60003; Wed, 21 Mar 2018 19:33:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1ACCC83502; Wed, 21 Mar 2018 19:33:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 143792EE65; Wed, 21 Mar 2018 19:33:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LJX0vJ042565; Wed, 21 Mar 2018 19:33:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LJX05p042562; Wed, 21 Mar 2018 19:33:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803211933.w2LJX05p042562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Mar 2018 19:33:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331319 - in stable/11: lib/libpmc sys/dev/hwpmc X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11: lib/libpmc sys/dev/hwpmc X-SVN-Commit-Revision: 331319 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, 21 Mar 2018 19:33:01 -0000 Author: kib Date: Wed Mar 21 19:33:00 2018 New Revision: 331319 URL: https://svnweb.freebsd.org/changeset/base/331319 Log: MFC r328087 (by fabient): Fix pmcstat exit from kernel introduced by r325275. PR: 223689 Modified: stable/11/lib/libpmc/pmclog.c stable/11/sys/dev/hwpmc/hwpmc_logging.c stable/11/sys/dev/hwpmc/hwpmc_mod.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libpmc/pmclog.c ============================================================================== --- stable/11/lib/libpmc/pmclog.c Wed Mar 21 18:57:31 2018 (r331318) +++ stable/11/lib/libpmc/pmclog.c Wed Mar 21 19:33:00 2018 (r331319) @@ -335,6 +335,8 @@ pmclog_get_event(void *cookie, char **data, ssize_t *l ev->pl_u.pl_cc.pl_pc[npc] = (uintfptr_t) 0; break; case PMCLOG_TYPE_CLOSELOG: + ev->pl_state = PMCLOG_EOF; + return (-1); case PMCLOG_TYPE_DROPNOTIFY: /* nothing to do */ break; Modified: stable/11/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- stable/11/sys/dev/hwpmc/hwpmc_logging.c Wed Mar 21 18:57:31 2018 (r331318) +++ stable/11/sys/dev/hwpmc/hwpmc_logging.c Wed Mar 21 19:33:00 2018 (r331319) @@ -803,6 +803,8 @@ pmclog_close(struct pmc_owner *po) PMCDBG1(LOG,CLO,1, "po=%p", po); + pmclog_process_closelog(po); + mtx_lock(&pmc_kthread_mtx); /* Modified: stable/11/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/11/sys/dev/hwpmc/hwpmc_mod.c Wed Mar 21 18:57:31 2018 (r331318) +++ stable/11/sys/dev/hwpmc/hwpmc_mod.c Wed Mar 21 19:33:00 2018 (r331319) @@ -2928,7 +2928,6 @@ pmc_syscall_handler(struct thread *td, void *syscall_a po : NULL); } else if (po->po_flags & PMC_PO_OWNS_LOGFILE) { pmclog_proc_ignite(pmclog_proc_handle, NULL); - pmclog_process_closelog(po); error = pmclog_close(po); if (error == 0) { LIST_FOREACH(pm, &po->po_pmcs, pm_next) From owner-svn-src-stable@freebsd.org Wed Mar 21 20:13:25 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 006C8F63227; Wed, 21 Mar 2018 20:13:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A75288571E; Wed, 21 Mar 2018 20:13:24 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A22642F48A; Wed, 21 Mar 2018 20:13:24 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LKDOCx064106; Wed, 21 Mar 2018 20:13:24 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LKDOVU064104; Wed, 21 Mar 2018 20:13:24 GMT (envelope-from np@FreeBSD.org) Message-Id: <201803212013.w2LKDOVU064104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 21 Mar 2018 20:13: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: r331320 - stable/10/sys/dev/cxgb X-SVN-Group: stable-10 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/10/sys/dev/cxgb X-SVN-Commit-Revision: 331320 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, 21 Mar 2018 20:13:25 -0000 Author: np Date: Wed Mar 21 20:13:24 2018 New Revision: 331320 URL: https://svnweb.freebsd.org/changeset/base/331320 Log: MFC r328315: cxgb(4): Validate offset/len in the GET_EEPROM ioctl. Sponsored by: Chelsio Communications. Modified: stable/10/sys/dev/cxgb/cxgb_main.c Modified: stable/10/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/10/sys/dev/cxgb/cxgb_main.c Wed Mar 21 19:33:00 2018 (r331319) +++ stable/10/sys/dev/cxgb/cxgb_main.c Wed Mar 21 20:13:24 2018 (r331320) @@ -2914,8 +2914,14 @@ cxgb_extension_ioctl(struct cdev *dev, unsigned long c case CHELSIO_GET_EEPROM: { int i; struct ch_eeprom *e = (struct ch_eeprom *)data; - uint8_t *buf = malloc(EEPROMSIZE, M_DEVBUF, M_NOWAIT); + uint8_t *buf; + if (e->offset & 3 || e->offset >= EEPROMSIZE || + e->len > EEPROMSIZE || e->offset + e->len > EEPROMSIZE) { + return (EINVAL); + } + + buf = malloc(EEPROMSIZE, M_DEVBUF, M_NOWAIT); if (buf == NULL) { return (ENOMEM); } From owner-svn-src-stable@freebsd.org Wed Mar 21 21:10:51 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A50BBF67695; Wed, 21 Mar 2018 21:10:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC743683B1; Wed, 21 Mar 2018 21:10:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D745D2FC6F; Wed, 21 Mar 2018 21:10:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2LLAnfa089642; Wed, 21 Mar 2018 21:10:49 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LLAn2A089641; Wed, 21 Mar 2018 21:10:49 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803212110.w2LLAn2A089641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 21 Mar 2018 21:10:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331323 - stable/11/gnu/usr.bin/gdb/kgdb X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/gnu/usr.bin/gdb/kgdb X-SVN-Commit-Revision: 331323 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, 21 Mar 2018 21:10:51 -0000 Author: jhb Date: Wed Mar 21 21:10:49 2018 New Revision: 331323 URL: https://svnweb.freebsd.org/changeset/base/331323 Log: MFC 328158,330708: Update kgdb for PTI. 328158: Recognize mchk_calltrap as a trapframe generator. Should have been included in r328157. 330708: Use the trapframe unwinder for "fast_syscall_common". Modified: stable/11/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Directory Properties: stable/11/ (props changed) Modified: stable/11/gnu/usr.bin/gdb/kgdb/trgt_amd64.c ============================================================================== --- stable/11/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Wed Mar 21 20:59:30 2018 (r331322) +++ stable/11/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Wed Mar 21 21:10:49 2018 (r331323) @@ -189,6 +189,8 @@ kgdb_trgt_trapframe_sniffer(struct frame_info *next_fr if (pname == NULL) return (NULL); if (strcmp(pname, "calltrap") == 0 || + strcmp(pname, "fast_syscall_common") == 0 || + strcmp(pname, "mchk_calltrap") == 0 || strcmp(pname, "nmi_calltrap") == 0 || (pname[0] == 'X' && pname[1] != '_')) return (&kgdb_trgt_trapframe_unwind); From owner-svn-src-stable@freebsd.org Wed Mar 21 23:45:49 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4F15F4EF60; Wed, 21 Mar 2018 23:45:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 94C736F580; Wed, 21 Mar 2018 23:45:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B7C514F1; Wed, 21 Mar 2018 23:45:48 +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 w2LNjmSc070956; Wed, 21 Mar 2018 23:45:48 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2LNjmTf070955; Wed, 21 Mar 2018 23:45:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803212345.w2LNjmTf070955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Mar 2018 23:45:48 +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: r331330 - stable/11/sys/compat/svr4 X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/compat/svr4 X-SVN-Commit-Revision: 331330 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, 21 Mar 2018 23:45:49 -0000 Author: emaste Date: Wed Mar 21 23:45:48 2018 New Revision: 331330 URL: https://svnweb.freebsd.org/changeset/base/331330 Log: Fix kernel memory disclosure in svr4_sys_getdents64 svr4_sys_getdents64() copies a dirent structure to userland. When calculating the record length for any given dirent entry alignment is performed. However, the aligned bytes are not cleared, this will trigger an info leak. Direct commit to stable/11; this code does not exist in HEAD. This change to be merged from stable/11 to stable/10. Reported by: Ilja Van Sprundel MFC after: 3 days Security: Kernel memory disclosure (797) Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/compat/svr4/svr4_misc.c Modified: stable/11/sys/compat/svr4/svr4_misc.c ============================================================================== --- stable/11/sys/compat/svr4/svr4_misc.c Wed Mar 21 23:26:42 2018 (r331329) +++ stable/11/sys/compat/svr4/svr4_misc.c Wed Mar 21 23:45:48 2018 (r331330) @@ -259,6 +259,7 @@ svr4_sys_getdents64(td, uap) u_long *cookies = NULL, *cookiep; int ncookies; + memset(&svr4_dirent, 0, sizeof(svr4_dirent)); DPRINTF(("svr4_sys_getdents64(%d, *, %d)\n", uap->fd, uap->nbytes)); error = getvnode(td, uap->fd, cap_rights_init(&rights, CAP_READ), &fp); From owner-svn-src-stable@freebsd.org Thu Mar 22 00:45:48 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7380F53B73; Thu, 22 Mar 2018 00:45:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 755B57220B; Thu, 22 Mar 2018 00:45:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 703091E42; Thu, 22 Mar 2018 00:45:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M0jmn3000977; Thu, 22 Mar 2018 00:45:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M0jmqo000976; Thu, 22 Mar 2018 00:45:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803220045.w2M0jmqo000976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 00:45:48 +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: r331335 - stable/11/sys/dev/isp X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/isp X-SVN-Commit-Revision: 331335 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, 22 Mar 2018 00:45:49 -0000 Author: mav Date: Thu Mar 22 00:45:48 2018 New Revision: 331335 URL: https://svnweb.freebsd.org/changeset/base/331335 Log: MFC r330963: Increase ABOUT FIRMWARE command timeout to 5s. It seems default timeout of 100ms is not enough for my 2694L card, while it was perfectly fine for others, even for full-height 2694. Modified: stable/11/sys/dev/isp/isp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp.c ============================================================================== --- stable/11/sys/dev/isp/isp.c Wed Mar 21 23:52:37 2018 (r331334) +++ stable/11/sys/dev/isp/isp.c Thu Mar 22 00:45:48 2018 (r331335) @@ -874,6 +874,7 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults) } } } else if (IS_26XX(isp)) { + isp_prt(isp, ISP_LOGDEBUG1, "loading firmware from flash"); MBSINIT(&mbs, MBOX_LOAD_FLASH_FIRMWARE, MBLOGALL, 5000000); mbs.ibitm = 0x01; mbs.obitm = 0x07; @@ -911,9 +912,12 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults) * we still need to (re)start it. */ MBSINIT(&mbs, MBOX_EXEC_FIRMWARE, MBLOGALL, 5000000); - if (IS_24XX(isp)) { + if (IS_26XX(isp)) { mbs.param[1] = code_org >> 16; mbs.param[2] = code_org; + } else if (IS_24XX(isp)) { + mbs.param[1] = code_org >> 16; + mbs.param[2] = code_org; if (isp->isp_loaded_fw) { mbs.param[3] = 0; } else { @@ -952,7 +956,7 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults) * Ask the chip for the current firmware version. * This should prove that the new firmware is working. */ - MBSINIT(&mbs, MBOX_ABOUT_FIRMWARE, MBLOGALL, 0); + MBSINIT(&mbs, MBOX_ABOUT_FIRMWARE, MBLOGALL, 5000000); isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { return; @@ -6737,7 +6741,7 @@ static const char *scsi_mbcmd_names[] = { static const uint32_t mbpfc[] = { ISP_FC_OPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */ ISP_FC_OPMAP(0x1f, 0x01), /* 0x01: MBOX_LOAD_RAM */ - ISP_FC_OPMAP_HALF(0x07, 0xff, 0x00, 0x03), /* 0x02: MBOX_EXEC_FIRMWARE */ + ISP_FC_OPMAP_HALF(0x07, 0xff, 0x00, 0x1f), /* 0x02: MBOX_EXEC_FIRMWARE */ ISP_FC_OPMAP(0xdf, 0x01), /* 0x03: MBOX_DUMP_RAM */ ISP_FC_OPMAP(0x07, 0x07), /* 0x04: MBOX_WRITE_RAM_WORD */ ISP_FC_OPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */ From owner-svn-src-stable@freebsd.org Thu Mar 22 00:52:53 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6D30F54527; Thu, 22 Mar 2018 00:52:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C14E7286D; Thu, 22 Mar 2018 00:52:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D9E11FB9; Thu, 22 Mar 2018 00:52:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2M0qr9H006024; Thu, 22 Mar 2018 00:52:53 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M0qrMX006023; Thu, 22 Mar 2018 00:52:53 GMT (envelope-from np@FreeBSD.org) Message-Id: <201803220052.w2M0qrMX006023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 22 Mar 2018 00:52:53 +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: r331336 - stable/10 X-SVN-Group: stable-10 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/10 X-SVN-Commit-Revision: 331336 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, 22 Mar 2018 00:52:53 -0000 Author: np Date: Thu Mar 22 00:52:53 2018 New Revision: 331336 URL: https://svnweb.freebsd.org/changeset/base/331336 Log: Add mergeinfo. This should have been part of r331320. Modified: Directory Properties: stable/10/ (props changed) From owner-svn-src-stable@freebsd.org Thu Mar 22 00:54:13 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBC05F54652; Thu, 22 Mar 2018 00:54:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8181F729C5; Thu, 22 Mar 2018 00:54:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C26D1FBA; Thu, 22 Mar 2018 00:54:13 +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 w2M0sD0C006125; Thu, 22 Mar 2018 00:54:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M0sD3P006124; Thu, 22 Mar 2018 00:54:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803220054.w2M0sD3P006124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Mar 2018 00:54: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: r331337 - stable/11/sys/dev/bktr X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/dev/bktr X-SVN-Commit-Revision: 331337 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, 22 Mar 2018 00:54:14 -0000 Author: emaste Date: Thu Mar 22 00:54:13 2018 New Revision: 331337 URL: https://svnweb.freebsd.org/changeset/base/331337 Log: MFC r330668: bktr: correct Japan IF frequency PR: 36451 Submitted by: Hijiri Umemoto Modified: stable/11/sys/dev/bktr/bktr_tuner.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/bktr/bktr_tuner.c ============================================================================== --- stable/11/sys/dev/bktr/bktr_tuner.c Thu Mar 22 00:52:53 2018 (r331336) +++ stable/11/sys/dev/bktr/bktr_tuner.c Thu Mar 22 00:54:13 2018 (r331337) @@ -566,12 +566,10 @@ static int weurope[] = { * 8: 193.25MHz - 12: 217.25MHz (VHF) * 13: 471.25MHz - 62: 765.25MHz (UHF) * - * IF freq: 45.75 mHz - * OR * IF freq: 58.75 mHz */ #define OFFSET 6.00 -#define IF_FREQ 45.75 +#define IF_FREQ 58.75 static int jpnbcst[] = { 62, (int)(IF_FREQ * FREQFACTOR), 0, 13, (int)(471.25 * FREQFACTOR), (int)(OFFSET * FREQFACTOR), @@ -593,10 +591,10 @@ static int jpnbcst[] = { * 22: 165.25MHz * 23: 223.25MHz - 63: 463.25MHz * - * IF freq: 45.75 mHz + * IF freq: 58.75 mHz */ #define OFFSET 6.00 -#define IF_FREQ 45.75 +#define IF_FREQ 58.75 static int jpncable[] = { 63, (int)(IF_FREQ * FREQFACTOR), 0, 23, (int)(223.25 * FREQFACTOR), (int)(OFFSET * FREQFACTOR), From owner-svn-src-stable@freebsd.org Thu Mar 22 00:55:36 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9DC1F54812; Thu, 22 Mar 2018 00:55:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7EC2D72B54; Thu, 22 Mar 2018 00:55:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7989C1FBD; Thu, 22 Mar 2018 00:55:36 +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 w2M0ta3A006272; Thu, 22 Mar 2018 00:55:36 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2M0taCo006271; Thu, 22 Mar 2018 00:55:36 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803220055.w2M0taCo006271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Mar 2018 00:55: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: r331338 - stable/10/sys/dev/bktr X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/dev/bktr X-SVN-Commit-Revision: 331338 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, 22 Mar 2018 00:55:37 -0000 Author: emaste Date: Thu Mar 22 00:55:36 2018 New Revision: 331338 URL: https://svnweb.freebsd.org/changeset/base/331338 Log: MFC r330668: bktr: correct Japan IF frequency PR: 36451 Submitted by: Hijiri Umemoto Modified: stable/10/sys/dev/bktr/bktr_tuner.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/bktr/bktr_tuner.c ============================================================================== --- stable/10/sys/dev/bktr/bktr_tuner.c Thu Mar 22 00:54:13 2018 (r331337) +++ stable/10/sys/dev/bktr/bktr_tuner.c Thu Mar 22 00:55:36 2018 (r331338) @@ -564,12 +564,10 @@ static int weurope[] = { * 8: 193.25MHz - 12: 217.25MHz (VHF) * 13: 471.25MHz - 62: 765.25MHz (UHF) * - * IF freq: 45.75 mHz - * OR * IF freq: 58.75 mHz */ #define OFFSET 6.00 -#define IF_FREQ 45.75 +#define IF_FREQ 58.75 static int jpnbcst[] = { 62, (int)(IF_FREQ * FREQFACTOR), 0, 13, (int)(471.25 * FREQFACTOR), (int)(OFFSET * FREQFACTOR), @@ -591,10 +589,10 @@ static int jpnbcst[] = { * 22: 165.25MHz * 23: 223.25MHz - 63: 463.25MHz * - * IF freq: 45.75 mHz + * IF freq: 58.75 mHz */ #define OFFSET 6.00 -#define IF_FREQ 45.75 +#define IF_FREQ 58.75 static int jpncable[] = { 63, (int)(IF_FREQ * FREQFACTOR), 0, 23, (int)(223.25 * FREQFACTOR), (int)(OFFSET * FREQFACTOR), From owner-svn-src-stable@freebsd.org Thu Mar 22 10:57:52 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 617EAF5A356; Thu, 22 Mar 2018 10:57:52 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 12C916DAC4; Thu, 22 Mar 2018 10:57:52 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DB9D107F1; Thu, 22 Mar 2018 10:57:52 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MAvpCR007679; Thu, 22 Mar 2018 10:57:51 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MAvpKt007678; Thu, 22 Mar 2018 10:57:51 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201803221057.w2MAvpKt007678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Thu, 22 Mar 2018 10:57: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: r331349 - stable/11/sbin/ifconfig X-SVN-Group: stable-11 X-SVN-Commit-Author: garga X-SVN-Commit-Paths: stable/11/sbin/ifconfig X-SVN-Commit-Revision: 331349 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, 22 Mar 2018 10:57:52 -0000 Author: garga (ports committer) Date: Thu Mar 22 10:57:51 2018 New Revision: 331349 URL: https://svnweb.freebsd.org/changeset/base/331349 Log: MFC r322281: Add missing parenthesis on error message Approved by: loos Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sbin/ifconfig/ifconfig.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ifconfig/ifconfig.c ============================================================================== --- stable/11/sbin/ifconfig/ifconfig.c Thu Mar 22 09:43:15 2018 (r331348) +++ stable/11/sbin/ifconfig/ifconfig.c Thu Mar 22 10:57:51 2018 (r331349) @@ -762,7 +762,7 @@ top: if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0 && (uafp != NULL || errno != EAFNOSUPPORT || (s = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0)) - err(1, "socket(family %u,SOCK_DGRAM", ifr.ifr_addr.sa_family); + err(1, "socket(family %u,SOCK_DGRAM)", ifr.ifr_addr.sa_family); while (argc > 0) { p = cmd_lookup(*argv, iscreate); From owner-svn-src-stable@freebsd.org Thu Mar 22 11:48:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B46D5F5DF8D; Thu, 22 Mar 2018 11:48:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 630176FA2D; Thu, 22 Mar 2018 11:48:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E0A810FAE; Thu, 22 Mar 2018 11:48: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 w2MBmEv9032135; Thu, 22 Mar 2018 11:48:14 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MBmESf032134; Thu, 22 Mar 2018 11:48:14 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803221148.w2MBmESf032134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Mar 2018 11:48: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: r331350 - stable/11/contrib/dma X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/contrib/dma X-SVN-Commit-Revision: 331350 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, 22 Mar 2018 11:48:14 -0000 Author: emaste Date: Thu Mar 22 11:48:14 2018 New Revision: 331350 URL: https://svnweb.freebsd.org/changeset/base/331350 Log: MFC r325047: dma: fix use-after-free Sponsored by: The FreeBSD Foundation Modified: stable/11/contrib/dma/dma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/dma/dma.c ============================================================================== --- stable/11/contrib/dma/dma.c Thu Mar 22 10:57:51 2018 (r331349) +++ stable/11/contrib/dma/dma.c Thu Mar 22 11:48:14 2018 (r331350) @@ -331,8 +331,8 @@ retry: switch (error) { case 0: - delqueue(it); syslog(LOG_INFO, "<%s> delivery successful", it->addr); + delqueue(it); exit(EX_OK); case 1: From owner-svn-src-stable@freebsd.org Thu Mar 22 17:46:39 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14792F5AE74; Thu, 22 Mar 2018 17:46:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BDBCC81998; Thu, 22 Mar 2018 17:46:38 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4595147A5; Thu, 22 Mar 2018 17:46:38 +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 w2MHkcqv012610; Thu, 22 Mar 2018 17:46:38 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MHkcaf012609; Thu, 22 Mar 2018 17:46:38 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201803221746.w2MHkcaf012609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 22 Mar 2018 17:46:38 +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: r331363 - 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: 331363 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, 22 Mar 2018 17:46:39 -0000 Author: gjb Date: Thu Mar 22 17:46:38 2018 New Revision: 331363 URL: https://svnweb.freebsd.org/changeset/base/331363 Log: MFC r322794: Use py-google-compute-engine instead for releasing Google Compute Engine (GCE) images with an updated version of Google's tools. PR: 221714 Sponsored by: The FreeBSD Foundation Modified: stable/10/release/tools/gce.conf Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/release/tools/gce.conf Directory Properties: stable/11/ (props changed) Modified: stable/10/release/tools/gce.conf ============================================================================== --- stable/10/release/tools/gce.conf Thu Mar 22 15:34:37 2018 (r331362) +++ stable/10/release/tools/gce.conf Thu Mar 22 17:46:38 2018 (r331363) @@ -5,12 +5,15 @@ # Set to a list of packages to install. export VM_EXTRA_PACKAGES="firstboot-freebsd-update firstboot-pkgs \ - google-cloud-sdk google-daemon panicmail sudo firstboot-growfs \ - google-startup-scripts" + google-cloud-sdk panicmail sudo firstboot-growfs \ + sysutils/py-google-compute-engine" # Set to a list of third-party software to enable in rc.conf(5). export VM_RC_LIST="google_accounts_manager ntpd sshd firstboot_growfs \ - firstboot_pkgs firstboot_freebsd_update google_startup" + firstboot_pkgs firstboot_freebsd_update google_startup \ + google_accounts_daemon google_clock_skew_daemon + google_instance_setup google_ip_forwarding_daemon + google_network_setup" vm_extra_install_base() { echo 'search google.internal' > ${DESTDIR}/etc/resolv.conf From owner-svn-src-stable@freebsd.org Thu Mar 22 17:46:39 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B7ADF5AE7C; Thu, 22 Mar 2018 17:46:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0BADA81999; Thu, 22 Mar 2018 17:46:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 068D5147A6; Thu, 22 Mar 2018 17:46:39 +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 w2MHkc34012616; Thu, 22 Mar 2018 17:46:38 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MHkcBT012615; Thu, 22 Mar 2018 17:46:38 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201803221746.w2MHkcBT012615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 22 Mar 2018 17:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331363 - 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: 331363 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, 22 Mar 2018 17:46:39 -0000 Author: gjb Date: Thu Mar 22 17:46:38 2018 New Revision: 331363 URL: https://svnweb.freebsd.org/changeset/base/331363 Log: MFC r322794: Use py-google-compute-engine instead for releasing Google Compute Engine (GCE) images with an updated version of Google's tools. PR: 221714 Sponsored by: The FreeBSD Foundation Modified: stable/11/release/tools/gce.conf Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/release/tools/gce.conf Directory Properties: stable/10/ (props changed) Modified: stable/11/release/tools/gce.conf ============================================================================== --- stable/11/release/tools/gce.conf Thu Mar 22 15:34:37 2018 (r331362) +++ stable/11/release/tools/gce.conf Thu Mar 22 17:46:38 2018 (r331363) @@ -5,12 +5,15 @@ # Set to a list of packages to install. export VM_EXTRA_PACKAGES="firstboot-freebsd-update firstboot-pkgs \ - google-cloud-sdk google-daemon panicmail sudo firstboot-growfs \ - google-startup-scripts" + google-cloud-sdk panicmail sudo firstboot-growfs \ + sysutils/py-google-compute-engine" # Set to a list of third-party software to enable in rc.conf(5). export VM_RC_LIST="google_accounts_manager ntpd sshd firstboot_growfs \ - firstboot_pkgs firstboot_freebsd_update google_startup" + firstboot_pkgs firstboot_freebsd_update google_startup \ + google_accounts_daemon google_clock_skew_daemon + google_instance_setup google_ip_forwarding_daemon + google_network_setup" vm_extra_install_base() { echo 'search google.internal' > ${DESTDIR}/etc/resolv.conf From owner-svn-src-stable@freebsd.org Thu Mar 22 23:38:04 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11084F53902; Thu, 22 Mar 2018 23:38:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA27F71D1C; Thu, 22 Mar 2018 23:38:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B50F217FE6; Thu, 22 Mar 2018 23:38:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNc373089802; Thu, 22 Mar 2018 23:38:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNc3Do089801; Thu, 22 Mar 2018 23:38:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222338.w2MNc3Do089801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331381 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331381 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, 22 Mar 2018 23:38:04 -0000 Author: mav Date: Thu Mar 22 23:38:03 2018 New Revision: 331381 URL: https://svnweb.freebsd.org/changeset/base/331381 Log: MFC r329505: MFV r323911: 8502 illumos#7955 broke delegated datasets when libshare is not present illumos/illumos-gate@1c18e8fbd8db41a9fb39bd3ef7a18ee71ece20da https://github.com/illumos/illumos-gate/commit/1c18e8fbd8db41a9fb39bd3ef7a18ee71ece20da https://www.illumos.org/issues/8502 The code in lib/libzfs/common/libzfs_mount.c already basically handles the case when libshare is not installed. We just need to not fail in zfs_init_libshare_impl. I tested this in lx and things work as expected. I also tested there trying to set sharenfs and sharesmb on the delegated dataset. Neither is allowed from within a zone. The spew of msgs from a native zone is not ZFS specific. I see the same spew simply running the share command. Reviewed by: Robert Mustacchi Reviewed by: Yuri Pankov Approved by: Richard Lowe Author: Jerry Jelinek Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:34:48 2018 (r331380) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:38:03 2018 (r331381) @@ -24,6 +24,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov + * Copyright 2017 Joyent, Inc. * Copyright 2017 RackTop Systems. */ @@ -610,8 +611,14 @@ zfs_init_libshare(libzfs_handle_t *zhandle, int servic int ret = SA_OK; #ifdef illumos + /* + * libshare is either not installed or we're in a branded zone. The + * rest of the wrapper functions around the libshare calls already + * handle NULL function pointers, but we don't want the callers of + * zfs_init_libshare() to fail prematurely if libshare is not available. + */ if (_sa_init == NULL) - ret = SA_CONFIG_ERR; + return (SA_OK); if (ret == SA_OK && zhandle->libzfs_shareflags & ZFSSHARE_MISS) { /* From owner-svn-src-stable@freebsd.org Thu Mar 22 23:39:50 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C2D4F53B25; Thu, 22 Mar 2018 23:39:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 493ED71EC7; Thu, 22 Mar 2018 23:39:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E13017FE7; Thu, 22 Mar 2018 23:39:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNdoIM089919; Thu, 22 Mar 2018 23:39:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNdn94089914; Thu, 22 Mar 2018 23:39:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222339.w2MNdn94089914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:39:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331382 - in stable/11/cddl/contrib/opensolaris: cmd/zdb cmd/ztest lib/libzpool/common/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/cddl/contrib/opensolaris: cmd/zdb cmd/ztest lib/libzpool/common/sys X-SVN-Commit-Revision: 331382 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, 22 Mar 2018 23:39:51 -0000 Author: mav Date: Thu Mar 22 23:39:49 2018 New Revision: 331382 URL: https://svnweb.freebsd.org/changeset/base/331382 Log: MFC r329508: MFV r324198: 8081 Compiler warnings in zdb illumos/illumos-gate@3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://github.com/illumos/illumos-gate/commit/3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://www.illumos.org/issues/8081 zdb(8) is full of minor problems that generate compiler warnings. On FreeBSD, which uses -WError, the only way to build it is to disable all compiler warnings. This makes it much harder to detect newly introduced bugs. We should cleanup all the warnings. Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Approved by: Richard Lowe Author: Alan Somers Added: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.h - copied unchanged from r329508, head/cddl/contrib/opensolaris/cmd/zdb/zdb.h Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Mar 22 23:38:03 2018 (r331381) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Mar 22 23:39:49 2018 (r331382) @@ -67,6 +67,8 @@ #undef verify #include +#include "zdb.h" + #define ZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \ zio_compress_table[(idx)].ci_name : "UNKNOWN") #define ZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \ @@ -90,14 +92,13 @@ uint64_t zfs_arc_max, zfs_arc_meta_limit; int zfs_vdev_async_read_max_active; #endif -const char cmdname[] = "zdb"; +static const char cmdname[] = "zdb"; uint8_t dump_opt[256]; typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size); -extern void dump_intent_log(zilog_t *); static uint64_t *zopt_object = NULL; -static int zopt_objects = 0; +static unsigned zopt_objects = 0; static libzfs_handle_t *g_zfs; static uint64_t max_inflight = 1000; @@ -285,8 +286,8 @@ zdb_nicenum(uint64_t num, char *buf, size_t buflen) nicenum(num, buf, sizeof (buf)); } -const char histo_stars[] = "****************************************"; -const int histo_width = sizeof (histo_stars) - 1; +static const char histo_stars[] = "****************************************"; +static const uint64_t histo_width = sizeof (histo_stars) - 1; static void dump_histogram(const uint64_t *histo, int size, int offset) @@ -392,7 +393,7 @@ dump_unknown(objset_t *os, uint64_t object, void *data } /*ARGSUSED*/ -void +static void dump_uint8(objset_t *os, uint64_t object, void *data, size_t size) { } @@ -410,7 +411,7 @@ dump_zap(objset_t *os, uint64_t object, void *data, si zap_cursor_t zc; zap_attribute_t attr; void *prop; - int i; + unsigned i; dump_zap_stats(os, object); (void) printf("\n"); @@ -573,7 +574,7 @@ dump_sa_layouts(objset_t *os, uint64_t object, void *d zap_cursor_t zc; zap_attribute_t attr; uint16_t *layout_attrs; - int i; + unsigned i; dump_zap_stats(os, object); (void) printf("\n"); @@ -642,7 +643,7 @@ dump_zpldir(objset_t *os, uint64_t object, void *data, zap_cursor_fini(&zc); } -int +static int get_dtl_refcount(vdev_t *vd) { int refcount = 0; @@ -656,18 +657,18 @@ get_dtl_refcount(vdev_t *vd) return (0); } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) refcount += get_dtl_refcount(vd->vdev_child[c]); return (refcount); } -int +static int get_metaslab_refcount(vdev_t *vd) { int refcount = 0; if (vd->vdev_top == vd && !vd->vdev_removing) { - for (int m = 0; m < vd->vdev_ms_count; m++) { + for (unsigned m = 0; m < vd->vdev_ms_count; m++) { space_map_t *sm = vd->vdev_ms[m]->ms_sm; if (sm != NULL && @@ -675,7 +676,7 @@ get_metaslab_refcount(vdev_t *vd) refcount++; } } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) refcount += get_metaslab_refcount(vd->vdev_child[c]); return (refcount); @@ -707,7 +708,7 @@ static void dump_spacemap(objset_t *os, space_map_t *sm) { uint64_t alloc, offset, entry; - char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", + const char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" }; if (sm == NULL) @@ -844,7 +845,7 @@ dump_metaslab_groups(spa_t *spa) metaslab_class_histogram_verify(mc); - for (int c = 0; c < rvd->vdev_children; c++) { + for (unsigned c = 0; c < rvd->vdev_children; c++) { vdev_t *tvd = rvd->vdev_child[c]; metaslab_group_t *mg = tvd->vdev_mg; @@ -923,7 +924,7 @@ dump_dde(const ddt_t *ddt, const ddt_entry_t *dde, uin { const ddt_phys_t *ddp = dde->dde_phys; const ddt_key_t *ddk = &dde->dde_key; - char *types[4] = { "ditto", "single", "double", "triple" }; + const char *types[4] = { "ditto", "single", "double", "triple" }; char blkbuf[BP_SPRINTF_LEN]; blkptr_t blk; @@ -1016,9 +1017,12 @@ dump_ddt(ddt_t *ddt, enum ddt_type type, enum ddt_clas static void dump_all_ddts(spa_t *spa) { - ddt_histogram_t ddh_total = { 0 }; - ddt_stat_t dds_total = { 0 }; + ddt_histogram_t ddh_total; + ddt_stat_t dds_total; + bzero(&ddh_total, sizeof (ddh_total)); + bzero(&dds_total, sizeof (dds_total)); + for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) { ddt_t *ddt = spa->spa_ddt[c]; for (enum ddt_type type = 0; type < DDT_TYPES; type++) { @@ -1064,7 +1068,8 @@ dump_dtl(vdev_t *vd, int indent) { spa_t *spa = vd->vdev_spa; boolean_t required; - char *name[DTL_TYPES] = { "missing", "partial", "scrub", "outage" }; + const char *name[DTL_TYPES] = { "missing", "partial", "scrub", + "outage" }; char prefix[256]; spa_vdev_state_enter(spa, SCL_NONE); @@ -1092,7 +1097,7 @@ dump_dtl(vdev_t *vd, int indent) dump_spacemap(spa->spa_meta_objset, vd->vdev_dtl_sm); } - for (int c = 0; c < vd->vdev_children; c++) + for (unsigned c = 0; c < vd->vdev_children; c++) dump_dtl(vd->vdev_child[c], indent + 4); } @@ -1150,7 +1155,7 @@ dump_history(spa_t *spa) free(buf); (void) printf("\nHistory:\n"); - for (int i = 0; i < num; i++) { + for (unsigned i = 0; i < num; i++) { uint64_t time, txg, ievent; char *cmd, *intstr; boolean_t printed = B_FALSE; @@ -1172,8 +1177,8 @@ dump_history(spa_t *spa) (void) snprintf(internalstr, sizeof (internalstr), - "[internal %s txg:%lld] %s", - zfs_history_event_names[ievent], txg, + "[internal %s txg:%ju] %s", + zfs_history_event_names[ievent], (uintmax_t)txg, intstr); cmd = internalstr; } @@ -1490,7 +1495,7 @@ dump_bptree_cb(void *arg, const blkptr_t *bp, dmu_tx_t } static void -dump_bptree(objset_t *os, uint64_t obj, char *name) +dump_bptree(objset_t *os, uint64_t obj, const char *name) { char bytes[32]; bptree_phys_t *bt; @@ -1530,7 +1535,7 @@ dump_bpobj_cb(void *arg, const blkptr_t *bp, dmu_tx_t } static void -dump_full_bpobj(bpobj_t *bpo, char *name, int indent) +dump_full_bpobj(bpobj_t *bpo, const char *name, int indent) { char bytes[32]; char comp[32]; @@ -2034,7 +2039,7 @@ dump_object(objset_t *os, uint64_t object, int verbosi dmu_buf_rele(db, FTAG); } -static char *objset_types[DMU_OST_NUMTYPES] = { +static const char *objset_types[DMU_OST_NUMTYPES] = { "NONE", "META", "ZPL", "ZVOL", "OTHER", "ANY" }; static void @@ -2046,10 +2051,11 @@ dump_dir(objset_t *os) char numbuf[32]; char blkbuf[BP_SPRINTF_LEN + 20]; char osname[ZFS_MAX_DATASET_NAME_LEN]; - char *type = "UNKNOWN"; + const char *type = "UNKNOWN"; int verbosity = dump_opt['d']; int print_header = 1; - int i, error; + unsigned i; + int error; /* make sure nicenum has enough space */ CTASSERT(sizeof (numbuf) >= NN_NUMBUF_SZ); @@ -2139,7 +2145,7 @@ dump_uberblock(uberblock_t *ub, const char *header, co { time_t timestamp = ub->ub_timestamp; - (void) printf(header ? header : ""); + (void) printf("%s", header ? header : ""); (void) printf("\tmagic = %016llx\n", (u_longlong_t)ub->ub_magic); (void) printf("\tversion = %llu\n", (u_longlong_t)ub->ub_version); (void) printf("\ttxg = %llu\n", (u_longlong_t)ub->ub_txg); @@ -2151,7 +2157,7 @@ dump_uberblock(uberblock_t *ub, const char *header, co snprintf_blkptr(blkbuf, sizeof (blkbuf), &ub->ub_rootbp); (void) printf("\trootbp = %s\n", blkbuf); } - (void) printf(footer ? footer : ""); + (void) printf("%s", footer ? footer : ""); } static void @@ -2494,7 +2500,7 @@ typedef struct zdb_blkstats { #define ZDB_OT_OTHER (DMU_OT_NUMTYPES + 2) #define ZDB_OT_TOTAL (DMU_OT_NUMTYPES + 3) -static char *zdb_ot_extname[] = { +static const char *zdb_ot_extname[] = { "deferred free", "dedup ditto", "other", @@ -2511,7 +2517,7 @@ typedef struct zdb_cb { uint64_t zcb_embedded_histogram[NUM_BP_EMBEDDED_TYPES] [BPE_PAYLOAD_SIZE]; uint64_t zcb_start; - uint64_t zcb_lastprint; + hrtime_t zcb_lastprint; uint64_t zcb_totalasize; uint64_t zcb_errors[256]; int zcb_readfails; @@ -2546,7 +2552,7 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const b * SPA_OLD_MAXBLOCKSIZE; larger blocks go into the last, * "other", bucket. */ - int idx = BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT; + unsigned idx = BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT; idx = MIN(idx, SPA_OLD_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1); zb->zb_psize_histogram[idx]++; @@ -2753,10 +2759,11 @@ static metaslab_ops_t zdb_metaslab_ops = { static void zdb_ddt_leak_init(spa_t *spa, zdb_cb_t *zcb) { - ddt_bookmark_t ddb = { 0 }; + ddt_bookmark_t ddb; ddt_entry_t dde; int error; + bzero(&ddb, sizeof (ddb)); while ((error = ddt_walk(spa, &ddb, &dde)) == 0) { blkptr_t blk; ddt_phys_t *ddp = dde.dde_phys; @@ -2864,10 +2871,10 @@ zdb_leak_fini(spa_t *spa) { if (!dump_opt['L']) { vdev_t *rvd = spa->spa_root_vdev; - for (int c = 0; c < rvd->vdev_children; c++) { + for (unsigned c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; metaslab_group_t *mg = vd->vdev_mg; - for (int m = 0; m < vd->vdev_ms_count; m++) { + for (unsigned m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; ASSERT3P(mg, ==, msp->ms_group); mutex_enter(&msp->ms_lock); @@ -2913,12 +2920,13 @@ count_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t static int dump_block_stats(spa_t *spa) { - zdb_cb_t zcb = { 0 }; + zdb_cb_t zcb; zdb_blkstats_t *zb, *tzb; uint64_t norm_alloc, norm_space, total_alloc, total_found; int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA | TRAVERSE_HARD; boolean_t leaks = B_FALSE; + bzero(&zcb, sizeof (zcb)); (void) printf("\nTraversing all blocks %s%s%s%s%s...\n\n", (dump_opt['c'] || !dump_opt['L']) ? "to verify " : "", (dump_opt['c'] == 1) ? "metadata " : "", @@ -3069,7 +3077,7 @@ dump_block_stats(spa_t *spa) for (t = 0; t <= ZDB_OT_TOTAL; t++) { char csize[32], lsize[32], psize[32], asize[32]; char avg[32], gang[32]; - char *typename; + const char *typename; /* make sure nicenum has enough space */ CTASSERT(sizeof (csize) >= NN_NUMBUF_SZ); @@ -3220,9 +3228,11 @@ dump_simulated_ddt(spa_t *spa) avl_tree_t t; void *cookie = NULL; zdb_ddt_entry_t *zdde; - ddt_histogram_t ddh_total = { 0 }; - ddt_stat_t dds_total = { 0 }; + ddt_histogram_t ddh_total; + ddt_stat_t dds_total; + bzero(&ddh_total, sizeof (ddh_total)); + bzero(&dds_total, sizeof (dds_total)); avl_create(&t, ddt_entry_compare, sizeof (zdb_ddt_entry_t), offsetof(zdb_ddt_entry_t, zdde_node)); @@ -3369,7 +3379,7 @@ dump_zpool(spa_t *spa) #define ZDB_FLAG_RAW 0x0040 #define ZDB_FLAG_PRINT_BLKPTR 0x0080 -int flagbits[256]; +static int flagbits[256]; static void zdb_print_blkptr(blkptr_t *bp, int flags) @@ -3410,10 +3420,11 @@ static void zdb_dump_block(char *label, void *buf, uint64_t size, int flags) { uint64_t *d = (uint64_t *)buf; - int nwords = size / sizeof (uint64_t); + unsigned nwords = size / sizeof (uint64_t); int do_bswap = !!(flags & ZDB_FLAG_BSWAP); - int i, j; - char *hdr, *c; + unsigned i, j; + const char *hdr; + char *c; if (do_bswap) @@ -3446,19 +3457,19 @@ zdb_dump_block(char *label, void *buf, uint64_t size, * RAID-Zs, you can specify either RAID-Z vdev with 0.0 or 0.1 . */ static vdev_t * -zdb_vdev_lookup(vdev_t *vdev, char *path) +zdb_vdev_lookup(vdev_t *vdev, const char *path) { char *s, *p, *q; - int i; + unsigned i; if (vdev == NULL) return (NULL); /* First, assume the x.x.x.x format */ - i = (int)strtoul(path, &s, 10); + i = strtoul(path, &s, 10); if (s == path || (s && *s != '.' && *s != '\0')) goto name; - if (i < 0 || i >= vdev->vdev_children) + if (i >= vdev->vdev_children) return (NULL); vdev = vdev->vdev_child[i]; @@ -3533,7 +3544,8 @@ zdb_read_block(char *thing, spa_t *spa) vdev_t *vd; abd_t *pabd; void *lbuf, *buf; - char *s, *p, *dup, *vdev, *flagstr; + const char *s, *vdev; + char *p, *dup, *flagstr; int i, error; dup = strdup(thing); @@ -3544,7 +3556,10 @@ zdb_read_block(char *thing, spa_t *spa) s = strtok(NULL, ":"); size = strtoull(s ? s : "", NULL, 16); s = strtok(NULL, ":"); - flagstr = s ? s : ""; + if (s) + flagstr = strdup(s); + else + flagstr = strdup(""); s = NULL; if (size == 0) @@ -3586,6 +3601,7 @@ zdb_read_block(char *thing, spa_t *spa) i += p - &flagstr[i + 1]; /* skip over the number */ } } + free(flagstr); vd = zdb_vdev_lookup(spa->spa_root_vdev, vdev); if (vd == NULL) { @@ -3722,11 +3738,12 @@ out: static void zdb_embedded_block(char *thing) { - blkptr_t bp = { 0 }; + blkptr_t bp; unsigned long long *words = (void *)&bp; char *buf; int err; + bzero(&bp, sizeof (bp)); err = sscanf(thing, "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx:" "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx", words + 0, words + 1, words + 2, words + 3, @@ -3779,8 +3796,9 @@ find_zpool(char **target, nvlist_t **configp, int dirc char *sepp = NULL; char sep = '\0'; int count = 0; - importargs_t args = { 0 }; + importargs_t args; + bzero(&args, sizeof (args)); args.paths = dirc; args.path = dirv; args.can_be_active = B_TRUE; @@ -3840,7 +3858,7 @@ find_zpool(char **target, nvlist_t **configp, int dirc int main(int argc, char **argv) { - int i, c; + int c; struct rlimit rl = { 1024, 1024 }; spa_t *spa = NULL; objset_t *os = NULL; @@ -4121,7 +4139,7 @@ main(int argc, char **argv) if (argc > 0) { zopt_objects = argc; zopt_object = calloc(zopt_objects, sizeof (uint64_t)); - for (i = 0; i < zopt_objects; i++) { + for (unsigned i = 0; i < zopt_objects; i++) { errno = 0; zopt_object[i] = strtoull(argv[i], NULL, 0); if (zopt_object[i] == 0 && errno != 0) @@ -4146,7 +4164,7 @@ main(int argc, char **argv) flagbits['p'] = ZDB_FLAG_PHYS; flagbits['r'] = ZDB_FLAG_RAW; - for (i = 0; i < argc; i++) + for (int i = 0; i < argc; i++) zdb_read_block(argv[i], spa); } Copied: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.h (from r329508, head/cddl/contrib/opensolaris/cmd/zdb/zdb.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.h Thu Mar 22 23:39:49 2018 (r331382, copy of r329508, head/cddl/contrib/opensolaris/cmd/zdb/zdb.h) @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2017 Spectra Logic Corp Inc. All rights reserved. + * Use is subject to license terms. + */ + + +#ifndef _ZDB_H +#define _ZDB_H + +void dump_intent_log(zilog_t *); +extern uint8_t dump_opt[256]; + +#endif /* _ZDB_H */ Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Thu Mar 22 23:38:03 2018 (r331381) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Thu Mar 22 23:39:49 2018 (r331382) @@ -43,9 +43,11 @@ #include #include +#include "zdb.h" + extern uint8_t dump_opt[256]; -static char prefix[4] = "\t\t\t"; +static char tab_prefix[4] = "\t\t\t"; static void print_log_bp(const blkptr_t *bp, const char *prefix) @@ -58,8 +60,9 @@ print_log_bp(const blkptr_t *bp, const char *prefix) /* ARGSUSED */ static void -zil_prt_rec_create(zilog_t *zilog, int txtype, lr_create_t *lr) +zil_prt_rec_create(zilog_t *zilog, int txtype, void *arg) { + lr_create_t *lr = arg; time_t crtime = lr->lr_crtime[0]; char *name, *link; lr_attr_t *lrattr; @@ -74,47 +77,53 @@ zil_prt_rec_create(zilog_t *zilog, int txtype, lr_crea if (txtype == TX_SYMLINK) { link = name + strlen(name) + 1; - (void) printf("%s%s -> %s\n", prefix, name, link); + (void) printf("%s%s -> %s\n", tab_prefix, name, link); } else if (txtype != TX_MKXATTR) { - (void) printf("%s%s\n", prefix, name); + (void) printf("%s%s\n", tab_prefix, name); } - (void) printf("%s%s", prefix, ctime(&crtime)); - (void) printf("%sdoid %llu, foid %llu, mode %llo\n", prefix, + (void) printf("%s%s", tab_prefix, ctime(&crtime)); + (void) printf("%sdoid %llu, foid %llu, mode %llo\n", tab_prefix, (u_longlong_t)lr->lr_doid, (u_longlong_t)lr->lr_foid, (longlong_t)lr->lr_mode); - (void) printf("%suid %llu, gid %llu, gen %llu, rdev 0x%llx\n", prefix, + (void) printf("%suid %llu, gid %llu, gen %llu, rdev 0x%llx\n", + tab_prefix, (u_longlong_t)lr->lr_uid, (u_longlong_t)lr->lr_gid, (u_longlong_t)lr->lr_gen, (u_longlong_t)lr->lr_rdev); } /* ARGSUSED */ static void -zil_prt_rec_remove(zilog_t *zilog, int txtype, lr_remove_t *lr) +zil_prt_rec_remove(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sdoid %llu, name %s\n", prefix, + lr_remove_t *lr = arg; + + (void) printf("%sdoid %llu, name %s\n", tab_prefix, (u_longlong_t)lr->lr_doid, (char *)(lr + 1)); } /* ARGSUSED */ static void -zil_prt_rec_link(zilog_t *zilog, int txtype, lr_link_t *lr) +zil_prt_rec_link(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sdoid %llu, link_obj %llu, name %s\n", prefix, + lr_link_t *lr = arg; + + (void) printf("%sdoid %llu, link_obj %llu, name %s\n", tab_prefix, (u_longlong_t)lr->lr_doid, (u_longlong_t)lr->lr_link_obj, (char *)(lr + 1)); } /* ARGSUSED */ static void -zil_prt_rec_rename(zilog_t *zilog, int txtype, lr_rename_t *lr) +zil_prt_rec_rename(zilog_t *zilog, int txtype, void *arg) { + lr_rename_t *lr = arg; char *snm = (char *)(lr + 1); char *tnm = snm + strlen(snm) + 1; - (void) printf("%ssdoid %llu, tdoid %llu\n", prefix, + (void) printf("%ssdoid %llu, tdoid %llu\n", tab_prefix, (u_longlong_t)lr->lr_sdoid, (u_longlong_t)lr->lr_tdoid); - (void) printf("%ssrc %s tgt %s\n", prefix, snm, tnm); + (void) printf("%ssrc %s tgt %s\n", tab_prefix, snm, tnm); } /* ARGSUSED */ @@ -122,7 +131,7 @@ static int zil_prt_rec_write_cb(void *data, size_t len, void *unused) { char *cdata = data; - for (int i = 0; i < len; i++) { + for (size_t i = 0; i < len; i++) { if (isprint(*cdata)) (void) printf("%c ", *cdata); else @@ -134,15 +143,16 @@ zil_prt_rec_write_cb(void *data, size_t len, void *unu /* ARGSUSED */ static void -zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write_t *lr) +zil_prt_rec_write(zilog_t *zilog, int txtype, void *arg) { + lr_write_t *lr = arg; abd_t *data; blkptr_t *bp = &lr->lr_blkptr; zbookmark_phys_t zb; int verbose = MAX(dump_opt['d'], dump_opt['i']); int error; - (void) printf("%sfoid %llu, offset %llx, length %llx\n", prefix, + (void) printf("%sfoid %llu, offset %llx, length %llx\n", tab_prefix, (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_offset, (u_longlong_t)lr->lr_length); @@ -150,20 +160,21 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write return; if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) { - (void) printf("%shas blkptr, %s\n", prefix, + (void) printf("%shas blkptr, %s\n", tab_prefix, !BP_IS_HOLE(bp) && bp->blk_birth >= spa_first_txg(zilog->zl_spa) ? "will claim" : "won't claim"); - print_log_bp(bp, prefix); + print_log_bp(bp, tab_prefix); if (BP_IS_HOLE(bp)) { (void) printf("\t\t\tLSIZE 0x%llx\n", (u_longlong_t)BP_GET_LSIZE(bp)); - (void) printf("%s\n", prefix); + (void) printf("%s\n", tab_prefix); return; } if (bp->blk_birth < zilog->zl_header->zh_claim_txg) { - (void) printf("%s\n", prefix); + (void) printf("%s\n", + tab_prefix); return; } @@ -183,7 +194,7 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write abd_copy_from_buf(data, lr + 1, lr->lr_length); } - (void) printf("%s", prefix); + (void) printf("%s", tab_prefix); (void) abd_iterate_func(data, 0, MIN(lr->lr_length, (verbose < 6 ? 20 : SPA_MAXBLOCKSIZE)), zil_prt_rec_write_cb, NULL); @@ -195,52 +206,55 @@ out: /* ARGSUSED */ static void -zil_prt_rec_truncate(zilog_t *zilog, int txtype, lr_truncate_t *lr) +zil_prt_rec_truncate(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sfoid %llu, offset 0x%llx, length 0x%llx\n", prefix, + lr_truncate_t *lr = arg; + + (void) printf("%sfoid %llu, offset 0x%llx, length 0x%llx\n", tab_prefix, (u_longlong_t)lr->lr_foid, (longlong_t)lr->lr_offset, (u_longlong_t)lr->lr_length); } /* ARGSUSED */ static void -zil_prt_rec_setattr(zilog_t *zilog, int txtype, lr_setattr_t *lr) +zil_prt_rec_setattr(zilog_t *zilog, int txtype, void *arg) { + lr_setattr_t *lr = arg; time_t atime = (time_t)lr->lr_atime[0]; time_t mtime = (time_t)lr->lr_mtime[0]; - (void) printf("%sfoid %llu, mask 0x%llx\n", prefix, + (void) printf("%sfoid %llu, mask 0x%llx\n", tab_prefix, (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_mask); if (lr->lr_mask & AT_MODE) { - (void) printf("%sAT_MODE %llo\n", prefix, + (void) printf("%sAT_MODE %llo\n", tab_prefix, (longlong_t)lr->lr_mode); } if (lr->lr_mask & AT_UID) { - (void) printf("%sAT_UID %llu\n", prefix, + (void) printf("%sAT_UID %llu\n", tab_prefix, (u_longlong_t)lr->lr_uid); } if (lr->lr_mask & AT_GID) { - (void) printf("%sAT_GID %llu\n", prefix, + (void) printf("%sAT_GID %llu\n", tab_prefix, (u_longlong_t)lr->lr_gid); } if (lr->lr_mask & AT_SIZE) { - (void) printf("%sAT_SIZE %llu\n", prefix, + (void) printf("%sAT_SIZE %llu\n", tab_prefix, (u_longlong_t)lr->lr_size); } if (lr->lr_mask & AT_ATIME) { - (void) printf("%sAT_ATIME %llu.%09llu %s", prefix, + (void) printf("%sAT_ATIME %llu.%09llu %s", tab_prefix, (u_longlong_t)lr->lr_atime[0], (u_longlong_t)lr->lr_atime[1], ctime(&atime)); } if (lr->lr_mask & AT_MTIME) { - (void) printf("%sAT_MTIME %llu.%09llu %s", prefix, + (void) printf("%sAT_MTIME %llu.%09llu %s", tab_prefix, (u_longlong_t)lr->lr_mtime[0], (u_longlong_t)lr->lr_mtime[1], ctime(&mtime)); @@ -249,41 +263,43 @@ zil_prt_rec_setattr(zilog_t *zilog, int txtype, lr_set /* ARGSUSED */ static void -zil_prt_rec_acl(zilog_t *zilog, int txtype, lr_acl_t *lr) +zil_prt_rec_acl(zilog_t *zilog, int txtype, void *arg) { - (void) printf("%sfoid %llu, aclcnt %llu\n", prefix, + lr_acl_t *lr = arg; + + (void) printf("%sfoid %llu, aclcnt %llu\n", tab_prefix, (u_longlong_t)lr->lr_foid, (u_longlong_t)lr->lr_aclcnt); } -typedef void (*zil_prt_rec_func_t)(); +typedef void (*zil_prt_rec_func_t)(zilog_t *, int, void *); typedef struct zil_rec_info { zil_prt_rec_func_t zri_print; - char *zri_name; + const char *zri_name; uint64_t zri_count; } zil_rec_info_t; static zil_rec_info_t zil_rec_info[TX_MAX_TYPE] = { - { NULL, "Total " }, - { zil_prt_rec_create, "TX_CREATE " }, - { zil_prt_rec_create, "TX_MKDIR " }, - { zil_prt_rec_create, "TX_MKXATTR " }, - { zil_prt_rec_create, "TX_SYMLINK " }, - { zil_prt_rec_remove, "TX_REMOVE " }, - { zil_prt_rec_remove, "TX_RMDIR " }, - { zil_prt_rec_link, "TX_LINK " }, - { zil_prt_rec_rename, "TX_RENAME " }, - { zil_prt_rec_write, "TX_WRITE " }, - { zil_prt_rec_truncate, "TX_TRUNCATE " }, - { zil_prt_rec_setattr, "TX_SETATTR " }, - { zil_prt_rec_acl, "TX_ACL_V0 " }, - { zil_prt_rec_acl, "TX_ACL_ACL " }, - { zil_prt_rec_create, "TX_CREATE_ACL " }, - { zil_prt_rec_create, "TX_CREATE_ATTR " }, - { zil_prt_rec_create, "TX_CREATE_ACL_ATTR " }, - { zil_prt_rec_create, "TX_MKDIR_ACL " }, - { zil_prt_rec_create, "TX_MKDIR_ATTR " }, - { zil_prt_rec_create, "TX_MKDIR_ACL_ATTR " }, - { zil_prt_rec_write, "TX_WRITE2 " }, + {.zri_print = NULL, .zri_name = "Total "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKXATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_SYMLINK "}, + {.zri_print = zil_prt_rec_remove, .zri_name = "TX_REMOVE "}, + {.zri_print = zil_prt_rec_remove, .zri_name = "TX_RMDIR "}, + {.zri_print = zil_prt_rec_link, .zri_name = "TX_LINK "}, + {.zri_print = zil_prt_rec_rename, .zri_name = "TX_RENAME "}, + {.zri_print = zil_prt_rec_write, .zri_name = "TX_WRITE "}, + {.zri_print = zil_prt_rec_truncate, .zri_name = "TX_TRUNCATE "}, + {.zri_print = zil_prt_rec_setattr, .zri_name = "TX_SETATTR "}, + {.zri_print = zil_prt_rec_acl, .zri_name = "TX_ACL_V0 "}, + {.zri_print = zil_prt_rec_acl, .zri_name = "TX_ACL_ACL "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE_ACL "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE_ATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_CREATE_ACL_ATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR_ACL "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR_ATTR "}, + {.zri_print = zil_prt_rec_create, .zri_name = "TX_MKDIR_ACL_ATTR "}, + {.zri_print = zil_prt_rec_write, .zri_name = "TX_WRITE2 "}, }; /* ARGSUSED */ @@ -321,7 +337,7 @@ print_log_block(zilog_t *zilog, blkptr_t *bp, void *ar { char blkbuf[BP_SPRINTF_LEN + 10]; int verbose = MAX(dump_opt['d'], dump_opt['i']); - char *claim; + const char *claim; if (verbose <= 3) return (0); @@ -350,7 +366,7 @@ print_log_block(zilog_t *zilog, blkptr_t *bp, void *ar static void print_log_stats(int verbose) { - int i, w, p10; + unsigned i, w, p10; if (verbose > 3) (void) printf("\n"); Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Mar 22 23:38:03 2018 (r331381) +++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Mar 22 23:39:49 2018 (r331382) @@ -1425,8 +1425,10 @@ ztest_log_setattr(ztest_ds_t *zd, dmu_tx_t *tx, lr_set * ZIL replay ops */ static int -ztest_replay_create(ztest_ds_t *zd, lr_create_t *lr, boolean_t byteswap) +ztest_replay_create(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_create_t *lr = arg2; char *name = (void *)(lr + 1); /* name follows lr */ objset_t *os = zd->zd_os; ztest_block_tag_t *bbt; @@ -1509,8 +1511,10 @@ ztest_replay_create(ztest_ds_t *zd, lr_create_t *lr, b } static int -ztest_replay_remove(ztest_ds_t *zd, lr_remove_t *lr, boolean_t byteswap) +ztest_replay_remove(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_remove_t *lr = arg2; char *name = (void *)(lr + 1); /* name follows lr */ objset_t *os = zd->zd_os; dmu_object_info_t doi; @@ -1560,8 +1564,10 @@ ztest_replay_remove(ztest_ds_t *zd, lr_remove_t *lr, b } static int -ztest_replay_write(ztest_ds_t *zd, lr_write_t *lr, boolean_t byteswap) +ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_write_t *lr = arg2; objset_t *os = zd->zd_os; void *data = lr + 1; /* data follows lr */ uint64_t offset, length; @@ -1685,8 +1691,10 @@ ztest_replay_write(ztest_ds_t *zd, lr_write_t *lr, boo } static int -ztest_replay_truncate(ztest_ds_t *zd, lr_truncate_t *lr, boolean_t byteswap) +ztest_replay_truncate(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_truncate_t *lr = arg2; objset_t *os = zd->zd_os; dmu_tx_t *tx; uint64_t txg; @@ -1724,8 +1732,10 @@ ztest_replay_truncate(ztest_ds_t *zd, lr_truncate_t *l } static int -ztest_replay_setattr(ztest_ds_t *zd, lr_setattr_t *lr, boolean_t byteswap) +ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap) { + ztest_ds_t *zd = arg1; + lr_setattr_t *lr = arg2; objset_t *os = zd->zd_os; dmu_tx_t *tx; dmu_buf_t *db; Modified: stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Mar 22 23:38:03 2018 (r331381) +++ stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Mar 22 23:39:49 2018 (r331382) @@ -237,7 +237,7 @@ extern struct proc p0; #define PS_NONE -1 -extern kthread_t *zk_thread_create(void (*func)(), void *arg); +extern kthread_t *zk_thread_create(void (*func)(void*), void *arg); #define issig(why) (FALSE) #define ISSIG(thr, why) (FALSE) From owner-svn-src-stable@freebsd.org Thu Mar 22 23:41:27 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94CFAF53DD0; Thu, 22 Mar 2018 23:41:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45D2C72271; Thu, 22 Mar 2018 23:41:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26EDF1811E; Thu, 22 Mar 2018 23:41:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNfRlu090757; Thu, 22 Mar 2018 23:41:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNfRkF090756; Thu, 22 Mar 2018 23:41:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222341.w2MNfRkF090756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:41: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: r331383 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 331383 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, 22 Mar 2018 23:41:27 -0000 Author: mav Date: Thu Mar 22 23:41:26 2018 New Revision: 331383 URL: https://svnweb.freebsd.org/changeset/base/331383 Log: MFC r329623: MFV r302649: 7016 arc_available_memory is not 32-bit safe illumos/illumos-gate@0dd053d7d890618ea1fc697b07de364e69eb4190 https://github.com/illumos/illumos-gate/commit/0dd053d7d890618ea1fc697b07de364e69eb4190 https://www.illumos.org/issues/7016 upstream DLPX-39446 arc_available_memory is not 32-bit safe https://github.com/delphix/delphix-os/commit/ 6b353ea3b8a1610be22e71e657d051743c64190b related to this upstream: DLPX-38547 delphix engine hang https://github.com/delphix/delphix-os/commit/ 3183a567b3e8c62a74a65885ca60c86f3d693783 DLPX-38547 delphix engine hang (fix static global) https://github.com/delphix/delphix-os/commit/ 22ac551d8ef085ad66cc8f65e51ac372b12993b9 DLPX-38882 system hung waiting on free segment https://github.com/delphix/delphix-os/commit/ cdd6beef7548cd3b12f0fc0328eeb3af540079c2 Reviewed by: Igor Kozhukhov Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: George Wilson Approved by: Gordon Ross Author: Prakash Surya Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Mar 22 23:39:49 2018 (r331382) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Mar 22 23:41:26 2018 (r331383) @@ -350,6 +350,11 @@ extern boolean_t zfs_prefetch_disable; static boolean_t arc_warm; /* + * log2 fraction of the zio arena to keep free. + */ +int arc_zio_arena_free_shift = 2; + +/* * These tunables are for performance analysis. */ uint64_t zfs_arc_max; @@ -4326,15 +4331,16 @@ arc_available_memory(void) /* * If zio data pages are being allocated out of a separate heap segment, * then enforce that the size of available vmem for this arena remains - * above about 1/16th free. + * above about 1/4th (1/(2^arc_zio_arena_free_shift)) free. * - * Note: The 1/16th arena free requirement was put in place - * to aggressively evict memory from the arc in order to avoid - * memory fragmentation issues. + * Note that reducing the arc_zio_arena_free_shift keeps more virtual + * memory (in the zio_arena) free, which can avoid memory + * fragmentation issues. */ if (zio_arena != NULL) { n = (int64_t)vmem_size(zio_arena, VMEM_FREE) - - (vmem_size(zio_arena, VMEM_ALLOC) >> 4); + (vmem_size(zio_arena, VMEM_ALLOC) >> + arc_zio_arena_free_shift); if (n < lowest) { lowest = n; r = FMR_ZIO_ARENA; From owner-svn-src-stable@freebsd.org Thu Mar 22 23:43:06 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C93CF5415B; Thu, 22 Mar 2018 23:43:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2AB05725F9; Thu, 22 Mar 2018 23:43:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2598118177; Thu, 22 Mar 2018 23:43:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNh60L094698; Thu, 22 Mar 2018 23:43:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNh5vx094693; Thu, 22 Mar 2018 23:43:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222343.w2MNh5vx094693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:43: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: r331384 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 331384 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, 22 Mar 2018 23:43:06 -0000 Author: mav Date: Thu Mar 22 23:43:05 2018 New Revision: 331384 URL: https://svnweb.freebsd.org/changeset/base/331384 Log: MFC r329625: MFV r307315: 7301 zpool export -f should be able to interrupt file freeing Reviewed by: Matthew Ahrens Reviewed by: Sanjay Nadkarni Reviewed by: Saso Kiselkov Reviewed by: John Kennedy Author: Alek Pinchuk Closes #175 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Mar 22 23:41:26 2018 (r331383) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Mar 22 23:43:05 2018 (r331384) @@ -24,7 +24,7 @@ */ /* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Copyright (c) 2013, Joyent, Inc. All rights reserved. */ -/* Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. */ +/* Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ #include #include @@ -723,6 +723,22 @@ get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t return (0); } +/* + * If this objset is of type OST_ZFS return true if vfs's unmounted flag is set, + * otherwise return false. + * Used below in dmu_free_long_range_impl() to enable abort when unmounting + */ +/*ARGSUSED*/ +static boolean_t +dmu_objset_zfs_unmounting(objset_t *os) +{ +#ifdef _KERNEL + if (dmu_objset_type(os) == DMU_OST_ZFS) + return (zfs_get_vfs_flag_unmounted(os)); +#endif + return (B_FALSE); +} + static int dmu_free_long_range_impl(objset_t *os, dnode_t *dn, uint64_t offset, uint64_t length) @@ -748,6 +764,9 @@ dmu_free_long_range_impl(objset_t *os, dnode_t *dn, ui uint64_t chunk_end, chunk_begin, chunk_len; uint64_t long_free_dirty_all_txgs = 0; dmu_tx_t *tx; + + if (dmu_objset_zfs_unmounting(dn->dn_objset)) + return (SET_ERROR(EINTR)); chunk_end = chunk_begin = offset + length; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Thu Mar 22 23:41:26 2018 (r331383) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Thu Mar 22 23:43:05 2018 (r331384) @@ -22,6 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ #ifndef _SYS_FS_ZFS_ZNODE_H @@ -321,6 +322,7 @@ extern int zfs_create_op_tables(); extern dev_t zfs_cmpldev(uint64_t); extern int zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value); extern int zfs_get_stats(objset_t *os, nvlist_t *nv); +extern boolean_t zfs_get_vfs_flag_unmounted(objset_t *os); extern void zfs_znode_dmu_fini(znode_t *); extern void zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Mar 22 23:41:26 2018 (r331383) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Mar 22 23:43:05 2018 (r331384) @@ -428,8 +428,8 @@ zfs_rmnode(znode_t *zp) error = dmu_free_long_range(os, zp->z_id, 0, DMU_OBJECT_END); if (error) { /* - * Not enough space. Leave the file in the unlinked - * set. + * Not enough space or we were interrupted by unmount. + * Leave the file in the unlinked set. */ zfs_znode_dmu_fini(zp); zfs_znode_free(zp); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Mar 22 23:41:26 2018 (r331383) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Mar 22 23:43:05 2018 (r331384) @@ -24,6 +24,7 @@ * All rights reserved. * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -1846,7 +1847,7 @@ zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp) /* * Teardown the zfsvfs::z_os. * - * Note, if 'unmounting' if FALSE, we return with the 'z_teardown_lock' + * Note, if 'unmounting' is FALSE, we return with the 'z_teardown_lock' * and 'z_teardown_inactive_lock' held. */ static int @@ -1914,8 +1915,8 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting */ if (unmounting) { zfsvfs->z_unmounted = B_TRUE; - rrm_exit(&zfsvfs->z_teardown_lock, FTAG); rw_exit(&zfsvfs->z_teardown_inactive_lock); + rrm_exit(&zfsvfs->z_teardown_lock, FTAG); } /* @@ -2505,6 +2506,29 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_ error = 0; } return (error); +} + +/* + * Return true if the coresponding vfs's unmounted flag is set. + * Otherwise return false. + * If this function returns true we know VFS unmount has been initiated. + */ +boolean_t +zfs_get_vfs_flag_unmounted(objset_t *os) +{ + zfsvfs_t *zfvp; + boolean_t unmounted = B_FALSE; + + ASSERT(dmu_objset_type(os) == DMU_OST_ZFS); + + mutex_enter(&os->os_user_ptr_lock); + zfvp = dmu_objset_get_user(os); + if (zfvp != NULL && zfvp->z_vfs != NULL && + (zfvp->z_vfs->mnt_kern_flag & MNTK_UNMOUNT)) + unmounted = B_TRUE; + mutex_exit(&os->os_user_ptr_lock); + + return (unmounted); } #ifdef _KERNEL From owner-svn-src-stable@freebsd.org Thu Mar 22 23:43:50 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11EB4F5427F; Thu, 22 Mar 2018 23:43:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9741F72733; Thu, 22 Mar 2018 23:43:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 920A018178; Thu, 22 Mar 2018 23:43:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNhnq5094778; Thu, 22 Mar 2018 23:43:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNhnYL094775; Thu, 22 Mar 2018 23:43:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222343.w2MNhnYL094775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:43:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331385 - in stable/11/sys/cddl/contrib/opensolaris: common/nvpair uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris: common/nvpair uts/common/fs/zfs X-SVN-Commit-Revision: 331385 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, 22 Mar 2018 23:43:50 -0000 Author: mav Date: Thu Mar 22 23:43:48 2018 New Revision: 331385 URL: https://svnweb.freebsd.org/changeset/base/331385 Log: MFC r329628: MFC r316910: 7812 Remove gender specific language illumos/illumos-gate@48bbca816818409505a6e214d0911fda44e622e3 https://github.com/illumos/illumos-gate/commit/48bbca816818409505a6e214d0911fda44e622e3 https://www.illumos.org/issues/7812 This change removes all gendered language that did not refer specifically to an individual person or pet. The convention taken was to use variations on "they" when referring to users and/or human beings, while using "it" when referring to code, functions, and/or libraries. Additionally, we took the liberty to fix up any whitespace issues that were found in any files that were already being modified. Reviewed by: Matt Ahrens Reviewed by: Prakash Surya Reviewed by: Steve Gonczi Reviewed by: Chris Williamson Reviewed by: George Wilson Reviewed by: Igor Kozhukhov Reviewed by: Dan McDonald Reviewed by: Robert Mustacchi Approved by: Richard Lowe Author: Daniel Hoffman Modified: stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Thu Mar 22 23:43:05 2018 (r331384) +++ stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Thu Mar 22 23:43:48 2018 (r331385) @@ -2379,7 +2379,7 @@ nvlist_xpack(nvlist_t *nvl, char **bufp, size_t *bufle * 1. The nvlist has fixed allocator properties. * All other nvlist routines (like nvlist_add_*, ...) use * these properties. - * 2. When using nvlist_pack() the user can specify his own + * 2. When using nvlist_pack() the user can specify their own * allocator properties (e.g. by using KM_NOSLEEP). * * We use the user specified properties (2). A clearer solution Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Mar 22 23:43:05 2018 (r331384) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Mar 22 23:43:48 2018 (r331385) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013, 2015 by Delphix. All rights reserved. + * Copyright (c) 2013, 2016 by Delphix. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Mar 22 23:43:05 2018 (r331384) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Mar 22 23:43:48 2018 (r331385) @@ -1812,7 +1812,7 @@ zio_reexecute(zio_t *pio) /* * Now that all children have been reexecuted, execute the parent. * We don't reexecute "The Godfather" I/O here as it's the - * responsibility of the caller to wait on him. + * responsibility of the caller to wait on it. */ if (!(pio->io_flags & ZIO_FLAG_GODFATHER)) { pio->io_queued_timestamp = gethrtime(); From owner-svn-src-stable@freebsd.org Thu Mar 22 23:45:01 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4D19F54412; Thu, 22 Mar 2018 23:45:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 51D82728A4; Thu, 22 Mar 2018 23:45:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CE0118179; Thu, 22 Mar 2018 23:45:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNj111094911; Thu, 22 Mar 2018 23:45:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNj1i6094910; Thu, 22 Mar 2018 23:45:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222345.w2MNj1i6094910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:45: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: r331386 - stable/11/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/zdb X-SVN-Commit-Revision: 331386 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, 22 Mar 2018 23:45:01 -0000 Author: mav Date: Thu Mar 22 23:45:01 2018 New Revision: 331386 URL: https://svnweb.freebsd.org/changeset/base/331386 Log: MFC r329657 (by asomers): Fix memory leaks in zdb introduced by r329508 Reported by: Coverity CID: 1386185 Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Mar 22 23:43:48 2018 (r331385) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Mar 22 23:45:01 2018 (r331386) @@ -3570,6 +3570,7 @@ zdb_read_block(char *thing, spa_t *spa) s = "offset must be a multiple of sector size"; if (s) { (void) printf("Invalid block specifier: %s - %s\n", thing, s); + free(flagstr); free(dup); return; } @@ -3595,6 +3596,7 @@ zdb_read_block(char *thing, spa_t *spa) blkptr_offset = strtoull(p, &p, 16); if (*p != ':' && *p != '\0') { (void) printf("***Invalid flag arg: '%s'\n", s); + free(flagstr); free(dup); return; } From owner-svn-src-stable@freebsd.org Thu Mar 22 23:45:47 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BD7BF54563; Thu, 22 Mar 2018 23:45:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4218172A0D; Thu, 22 Mar 2018 23:45:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CD921817A; Thu, 22 Mar 2018 23:45:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNjlEX094988; Thu, 22 Mar 2018 23:45:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNjlAt094987; Thu, 22 Mar 2018 23:45:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222345.w2MNjlAt094987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:45: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: r331387 - stable/11/cddl/contrib/opensolaris/cmd/ztest X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/ztest X-SVN-Commit-Revision: 331387 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, 22 Mar 2018 23:45:47 -0000 Author: mav Date: Thu Mar 22 23:45:46 2018 New Revision: 331387 URL: https://svnweb.freebsd.org/changeset/base/331387 Log: MFC r329658: MFV r316872: 7502 ztest should run zdb with -G (debug mode) illumos/illumos-gate@c3c65d17f7b6689bbd6568a1a1fcc0c4a3bac127 https://github.com/illumos/illumos-gate/commit/c3c65d17f7b6689bbd6568a1a1fcc0c4a3bac127 https://www.illumos.org/issues/7502 Right now ztest executes zdb without -G, so when it has errors, the messages are often not very helpful: Executing zdb -bccsv -d -U /rpool/tmp/zpool.cache ztest zdb: can't open 'ztest': Operation not supported ztest: '/usr/sbin/amd64/zdb -bccsv -d -U /rpool/tmp/zpool.cache ztest' exit code 1 With -G, we'd have: /usr/sbin/amd64/zdb -bccsv -d -U /rpool/tmp/zpool.cache -G ztest zdb: can't open 'ztest': Operation not supported ZFS_DBGMSG(zdb): spa_open_common: opening ztest spa_load(ztest): LOADING spa_load(ztest): FAILED: unable to parse config [error=48] spa_load(ztest): UNLOADING Which indicates where the error came from Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Approved by: Gordon Ross Author: Pavel Zakharov Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Mar 22 23:45:01 2018 (r331386) +++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Mar 22 23:45:46 2018 (r331387) @@ -5277,7 +5277,7 @@ ztest_run_zdb(char *pool) isa = strdup(isa); /* LINTED */ (void) sprintf(bin, - "/usr/sbin%.*s/zdb -bcc%s%s -d -U %s %s", + "/usr/sbin%.*s/zdb -bcc%s%s -G -d -U %s %s", isalen, isa, ztest_opts.zo_verbose >= 3 ? "s" : "", From owner-svn-src-stable@freebsd.org Thu Mar 22 23:47:05 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB236F54794; Thu, 22 Mar 2018 23:47:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C7C172C9E; Thu, 22 Mar 2018 23:47:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9766618193; Thu, 22 Mar 2018 23:47:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNl4AN095229; Thu, 22 Mar 2018 23:47:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNl44k095228; Thu, 22 Mar 2018 23:47:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222347.w2MNl44k095228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:47: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: r331388 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331388 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, 22 Mar 2018 23:47:05 -0000 Author: mav Date: Thu Mar 22 23:47:04 2018 New Revision: 331388 URL: https://svnweb.freebsd.org/changeset/base/331388 Log: MFC r329659: MFV r316873: 7233 dir_is_empty should open directory with CLOEXEC illumos/illumos-gate@d420209d9c807f782c1d31f5683be74798142198 https://github.com/illumos/illumos-gate/commit/d420209d9c807f782c1d31f5683be74798142198 https://www.illumos.org/issues/7233 This fixes a race where one thread is executing zfs_mount() while another thread forks and execs. If the fork occurs while the directory is open, the child process will inherit (but not necessarily close immediately) the open fd for the directory, preventing the mount. Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Approved by: Richard Lowe Author: Alex Reece Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:45:46 2018 (r331387) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:47:04 2018 (r331388) @@ -22,7 +22,7 @@ /* * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014 by Delphix. All rights reserved. + * Copyright (c) 2014, 2015 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov * Copyright 2017 Joyent, Inc. * Copyright 2017 RackTop Systems. @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include @@ -187,9 +188,16 @@ dir_is_empty(const char *dirname) { DIR *dirp; struct dirent64 *dp; + int dirfd; - if ((dirp = opendir(dirname)) == NULL) + if ((dirfd = openat(AT_FDCWD, dirname, + O_RDONLY | O_NDELAY | O_LARGEFILE | O_CLOEXEC, 0)) < 0) { return (B_TRUE); + } + + if ((dirp = fdopendir(dirfd)) == NULL) { + return (B_TRUE); + } while ((dp = readdir64(dirp)) != NULL) { From owner-svn-src-stable@freebsd.org Thu Mar 22 23:48:08 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B4F0F54914; Thu, 22 Mar 2018 23:48:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E46A372E27; Thu, 22 Mar 2018 23:48:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C72B718194; Thu, 22 Mar 2018 23:48:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNm7WG095317; Thu, 22 Mar 2018 23:48:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNm7C0095316; Thu, 22 Mar 2018 23:48:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222348.w2MNm7C0095316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331389 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331389 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, 22 Mar 2018 23:48:08 -0000 Author: mav Date: Thu Mar 22 23:48:07 2018 New Revision: 331389 URL: https://svnweb.freebsd.org/changeset/base/331389 Log: MFC r329661: MFV r316875: 7336 vfork and O_CLOEXEC causes zfs_mount EBUSY illumos/illumos-gate@873c4903a52d089cd8234b79d24f5a3fc3bccc82 https://github.com/illumos/illumos-gate/commit/873c4903a52d089cd8234b79d24f5a3fc3bccc82 https://www.illumos.org/issues/7336 We can run into a problem where we call into zfs_mount, which in turn calls is_dir_empty, which opens the directory to try and make sure it's empty. The issue with the current approach is that it holds the directory open while it traverses it with readdir, which, due to subtle interaction with the Java JVM, vfork, and exec can cause a tricky race condition resulting in zfs_mount failures. The approach to resolving the issue in this patch is to drop the usage of readdir altogether, and instead rely on the fact that ZFS stores the number of entries contained in a directory using the st_size field of the stat structure. Thus, if the directory in question is a ZFS directory, we can check to see if it's empty by calling stat() and inspecting the st_size field of structure returned. =============================================================================== The root cause appears to be an interesting race between vfork, exec, and zfs_mount's usage of O_CLOEXEC when calling openat. Here's what is going on: 1. We call zfs_mount, and this in turn calls openat to check if the directory is empty, which results in opening the directory we're trying to mount onto, and increment v_count. 2. As we're in the middle of reading the directory, vfork is called by the JVM and proceeds to exec the jspawnhelper utility. As a result of the vfork, we take an additional hold on the directory, which increments v_count a second time. The semantics of vfork mean the parent process will wait for the child process to exit or exec before the parent can continue; at this point the parent is in the middle of zfs_mount, reading the directory to determine if it's empty or not. 3. The child process exec-ing jspawnhelper gets to the relvm call within exec_args (which is called by exec_common). relvm is the function that releases the parent process, allowing the parent to proceed. The problem is, at this point of calling relvm, the child hasn't yet called close_exec which is responsible for closing the file descriptors inherited from the parent process Reviewed by: Matt Ahrens Reviewed by: Paul Dagnelie Reviewed by: Robert Mustacchi Approved by: Dan McDonald Author: Prakash Surya Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:47:04 2018 (r331388) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:48:07 2018 (r331389) @@ -78,6 +78,7 @@ #include #include #include +#include #include @@ -178,14 +179,33 @@ is_shared(libzfs_handle_t *hdl, const char *mountpoint } #ifdef illumos -/* - * Returns true if the specified directory is empty. If we can't open the - * directory at all, return true so that the mount can fail with a more - * informative error message. - */ static boolean_t -dir_is_empty(const char *dirname) +dir_is_empty_stat(const char *dirname) { + struct stat st; + + /* + * We only want to return false if the given path is a non empty + * directory, all other errors are handled elsewhere. + */ + if (stat(dirname, &st) < 0 || !S_ISDIR(st.st_mode)) { + return (B_TRUE); + } + + /* + * An empty directory will still have two entries in it, one + * entry for each of "." and "..". + */ + if (st.st_size > 2) { + return (B_FALSE); + } + + return (B_TRUE); +} + +static boolean_t +dir_is_empty_readdir(const char *dirname) +{ DIR *dirp; struct dirent64 *dp; int dirfd; @@ -211,6 +231,42 @@ dir_is_empty(const char *dirname) (void) closedir(dirp); return (B_TRUE); +} + +/* + * Returns true if the specified directory is empty. If we can't open the + * directory at all, return true so that the mount can fail with a more + * informative error message. + */ +static boolean_t +dir_is_empty(const char *dirname) +{ + struct statvfs64 st; + + /* + * If the statvfs call fails or the filesystem is not a ZFS + * filesystem, fall back to the slow path which uses readdir. + */ + if ((statvfs64(dirname, &st) != 0) || + (strcmp(st.f_basetype, "zfs") != 0)) { + return (dir_is_empty_readdir(dirname)); + } + + /* + * At this point, we know the provided path is on a ZFS + * filesystem, so we can use stat instead of readdir to + * determine if the directory is empty or not. We try to avoid + * using readdir because that requires opening "dirname"; this + * open file descriptor can potentially end up in a child + * process if there's a concurrent fork, thus preventing the + * zfs_mount() from otherwise succeeding (the open file + * descriptor inherited by the child process will cause the + * parent's mount to fail with EBUSY). The performance + * implications of replacing the open, read, and close with a + * single stat is nice; but is not the main motivation for the + * added complexity. + */ + return (dir_is_empty_stat(dirname)); } #endif From owner-svn-src-stable@freebsd.org Thu Mar 22 23:49:55 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6FD7F54B0C; Thu, 22 Mar 2018 23:49:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5901172FB6; Thu, 22 Mar 2018 23:49:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36DFB18195; Thu, 22 Mar 2018 23:49:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNnt1t095438; Thu, 22 Mar 2018 23:49:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNnsqH095436; Thu, 22 Mar 2018 23:49:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222349.w2MNnsqH095436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:49:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331390 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331390 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, 22 Mar 2018 23:49:55 -0000 Author: mav Date: Thu Mar 22 23:49:54 2018 New Revision: 331390 URL: https://svnweb.freebsd.org/changeset/base/331390 Log: MFC r329663: MFV r316876: 7542 zfs_unmount failed with EZFS_UNSHARENFSFAILED illumos/illumos-gate@09c9e6dc9b69d10b771bb87e01040ec320a0bfd3 https://github.com/illumos/illumos-gate/commit/09c9e6dc9b69d10b771bb87e01040ec320a0bfd3 https://www.illumos.org/issues/7542 libshare keeps a cached copy of the sharetab listing in memory, which can become out of date if shares are destroyed or created while leaving a libzfs handle open. This results in a spurious unmounting failure when an NFS share exists but isn't in the stale libshare cache. Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Reviewed by: Matt Amdur Approved by: Robert Mustacchi Author: Chris Williamson Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Thu Mar 22 23:48:07 2018 (r331389) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Thu Mar 22 23:49:54 2018 (r331390) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 Martin Matuska . All rights reserved. */ @@ -72,7 +72,6 @@ struct libzfs_handle { int libzfs_printerr; int libzfs_storeerr; /* stuff error messages into buffer */ void *libzfs_sharehdl; /* libshare handle */ - uint_t libzfs_shareflags; boolean_t libzfs_mnttab_enable; avl_tree_t libzfs_mnttab_cache; int libzfs_pool_iter; @@ -81,8 +80,6 @@ struct libzfs_handle { char libzfs_chassis_id[256]; boolean_t libzfs_prop_debug; }; - -#define ZFSSHARE_MISS 0x01 /* Didn't find entry in cache */ struct zfs_handle { libzfs_handle_t *zfs_hdl; Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:48:07 2018 (r331389) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:49:54 2018 (r331390) @@ -22,7 +22,7 @@ /* * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014, 2015 by Delphix. All rights reserved. + * Copyright (c) 2014, 2016 by Delphix. All rights reserved. * Copyright 2016 Igor Kozhukhov * Copyright 2017 Joyent, Inc. * Copyright 2017 RackTop Systems. @@ -672,8 +672,6 @@ _zfs_init_libshare(void) int zfs_init_libshare(libzfs_handle_t *zhandle, int service) { - int ret = SA_OK; - #ifdef illumos /* * libshare is either not installed or we're in a branded zone. The @@ -684,31 +682,28 @@ zfs_init_libshare(libzfs_handle_t *zhandle, int servic if (_sa_init == NULL) return (SA_OK); - if (ret == SA_OK && zhandle->libzfs_shareflags & ZFSSHARE_MISS) { - /* - * We had a cache miss. Most likely it is a new ZFS - * dataset that was just created. We want to make sure - * so check timestamps to see if a different process - * has updated any of the configuration. If there was - * some non-ZFS change, we need to re-initialize the - * internal cache. - */ - zhandle->libzfs_shareflags &= ~ZFSSHARE_MISS; - if (_sa_needs_refresh != NULL && - _sa_needs_refresh(zhandle->libzfs_sharehdl)) { - zfs_uninit_libshare(zhandle); - zhandle->libzfs_sharehdl = _sa_init(service); - } + /* + * Attempt to refresh libshare. This is necessary if there was a cache + * miss for a new ZFS dataset that was just created, or if state of the + * sharetab file has changed since libshare was last initialized. We + * want to make sure so check timestamps to see if a different process + * has updated any of the configuration. If there was some non-ZFS + * change, we need to re-initialize the internal cache. + */ + if (_sa_needs_refresh != NULL && + _sa_needs_refresh(zhandle->libzfs_sharehdl)) { + zfs_uninit_libshare(zhandle); + zhandle->libzfs_sharehdl = _sa_init(service); } - if (ret == SA_OK && zhandle && zhandle->libzfs_sharehdl == NULL) + if (zhandle && zhandle->libzfs_sharehdl == NULL) zhandle->libzfs_sharehdl = _sa_init(service); - if (ret == SA_OK && zhandle->libzfs_sharehdl == NULL) - ret = SA_NO_MEMORY; + if (zhandle->libzfs_sharehdl == NULL) + return (SA_NO_MEMORY); #endif - return (ret); + return (SA_OK); } /* @@ -864,7 +859,6 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t * zfs_get_name(zhp)); return (-1); } - hdl->libzfs_shareflags |= ZFSSHARE_MISS; share = zfs_sa_find_share(hdl->libzfs_sharehdl, mountpoint); } From owner-svn-src-stable@freebsd.org Thu Mar 22 23:50:44 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 688FEF54D80; Thu, 22 Mar 2018 23:50:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13892731CE; Thu, 22 Mar 2018 23:50:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03F92181A7; Thu, 22 Mar 2018 23:50:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNohmZ096552; Thu, 22 Mar 2018 23:50:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNoh3r096551; Thu, 22 Mar 2018 23:50:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222350.w2MNoh3r096551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:50:43 +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: r331391 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331391 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, 22 Mar 2018 23:50:44 -0000 Author: mav Date: Thu Mar 22 23:50:43 2018 New Revision: 331391 URL: https://svnweb.freebsd.org/changeset/base/331391 Log: MFC r329664: MFV r316893: 7604 if volblocksize property is the default, it displays as "-" rather than 8K illumos/illumos-gate@4d86c0eab246bdfddc2dd52410ba808433bd6266 https://github.com/illumos/illumos-gate/commit/4d86c0eab246bdfddc2dd52410ba808433bd6266 https://www.illumos.org/issues/7604 If a zvol has the default setting for the "volblocksize" property, it is 8KB. However, it is displayed as "-" (not present), rather than "8K". The problem was introduced by: commit 25228e830e86924a41243343b1de9daf2d7dd43a Author: Matthew Ahrens <mahrens@delphix.com> Date: Thu Nov 17 14:37:24 2016 -0800 7571 non-present readonly numeric ZFS props do not have default value which changed changed get_numeric_property() to indicate that readonly default properties are not present. However, zfs_prop_readonly() returns TRUE for both readonly and set-once properties (e.g. volblocksize). Amusingly, that commit essentially reverted: 6900484 default volblocksize is no longer being reported correctly from November 2009. However, that change was not correct either; the correct solution is to only do this check for "truly readonly" (i.e. not setonce) properties. $ zfs list -t volume -o name,volblocksize NAME VOLBLOCK domain0/group-100/appdata_container-101/appdata_windows_timeflow-102/ archive - domain0/group-100/appdata_container-101/appdata_windows_timeflow-102/ datafile - domain0/group-100/appdata_container-101/appdata_windows_timeflow-102/ external - rpool/dump 128K rpool/swap 4K rpool/swap1 =============================================================================== Reviewed by: Pavel Zakharov Reviewed by: Paul Dagnelie Reviewed by: John Kennedy Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Matthew Ahrens Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Mar 22 23:49:54 2018 (r331390) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Mar 22 23:50:43 2018 (r331391) @@ -2161,9 +2161,12 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t pro /* * If we tried to use a default value for a * readonly property, it means that it was not - * present. + * present. Note this only applies to "truly" + * readonly properties, not set-once properties + * like volblocksize. */ if (zfs_prop_readonly(prop) && + !zfs_prop_setonce(prop) && *source != NULL && (*source)[0] == '\0') { *source = NULL; return (-1); From owner-svn-src-stable@freebsd.org Thu Mar 22 23:51:40 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40F12F54E90; Thu, 22 Mar 2018 23:51:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E0DD8733D6; Thu, 22 Mar 2018 23:51:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBE2D182F4; Thu, 22 Mar 2018 23:51:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNpdVH000518; Thu, 22 Mar 2018 23:51:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNpd7P000517; Thu, 22 Mar 2018 23:51:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222351.w2MNpd7P000517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:51: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: r331392 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331392 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, 22 Mar 2018 23:51:40 -0000 Author: mav Date: Thu Mar 22 23:51:39 2018 New Revision: 331392 URL: https://svnweb.freebsd.org/changeset/base/331392 Log: MFC r329665: MFV r316901: 7730 libzfs`add_config() leaks config nvl when reading spare/l2cache devices illumos/illumos-gate@105686550ee9cbf5d033166a8a2a5a763667d436 https://github.com/illumos/illumos-gate/commit/105686550ee9cbf5d033166a8a2a5a763667d436 https://www.illumos.org/issues/7730 antares:root:~# mdb /usr/sbin/zpool > ::sysbp _exit > ::run import pool: data id: 2093977168778024605 state: ONLINE action: The pool can be imported using its name or numeric identifier. config: data ONLINE c6t0d0 ONLINE c6t1d0 ONLINE cache c6t2d0 mdb: stop on entry to _exit mdb: target stopped at: 0xfee556ba: nop mdb: You've got symbols! Loading modules: [ ld.so.1 libumem.so.1 libc.so.1 libtopo.so.1 libavl.so.1 libnvpair.so.1 ] > ::findleaks -d BYTES LEAKED VMEM_SEG CALLER 4096 10 fda7b000 MMAP 8192 1 fea8d000 MMAP 8192 1 fe76d000 MMAP 8192 1 fe66e000 MMAP 4096 1 fe570000 MMAP 8192 1 fe470000 MMAP 4096 1 fe372000 MMAP 4096 1 fe273000 MMAP Reviewed by: Matthew Ahrens Reviewed by: Serapheim Dimitropoulos Approved by: Robert Mustacchi Author: Yuri Pankov Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Mar 22 23:50:43 2018 (r331391) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Mar 22 23:51:39 2018 (r331392) @@ -240,9 +240,12 @@ add_config(libzfs_handle_t *hdl, pool_list_t *pl, cons free(ne); return (-1); } + ne->ne_guid = vdev_guid; ne->ne_next = pl->names; pl->names = ne; + + nvlist_free(config); return (0); } From owner-svn-src-stable@freebsd.org Thu Mar 22 23:52:38 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DF15F5501B; Thu, 22 Mar 2018 23:52:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3E817373E; Thu, 22 Mar 2018 23:52:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AED1318364; Thu, 22 Mar 2018 23:52:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNqbIX000610; Thu, 22 Mar 2018 23:52:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNqboK000607; Thu, 22 Mar 2018 23:52:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222352.w2MNqboK000607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:52:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331393 - in stable/11/cddl/contrib/opensolaris/lib: libzfs/common libzfs_core/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/cddl/contrib/opensolaris/lib: libzfs/common libzfs_core/common X-SVN-Commit-Revision: 331393 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, 22 Mar 2018 23:52:38 -0000 Author: mav Date: Thu Mar 22 23:52:37 2018 New Revision: 331393 URL: https://svnweb.freebsd.org/changeset/base/331393 Log: MFC r329667: MFV r316902: 7745 print error if lzc_* is called before libzfs_core_init illumos/illumos-gate@7c13517fff71be473e47531ef4330160c042bedc https://github.com/illumos/illumos-gate/commit/7c13517fff71be473e47531ef4330160c042bedc https://www.illumos.org/issues/7745 The problem is that consumers of `libZFS_Core` that forget to call `libzfs_core_init()` before calling any other function of the library are having a hard time realizing their mistake. The library's internal file descriptor is declared as global static, which is ok, but it is not initialized explicitly; therefore, it defaults to 0, which is a valid file descriptor. If `libzfs_core_init()`, which explicitly initializes the correct fd, is skipped, the ioctl functions return errors that do not have anything to do with `libZFS_Core`, where the problem is actually located. Even though assertions for that existed within `libZFS_Core` for debug builds, they were never enabled because the `-DDEBUG` flag was missing from the compiler flags. This patch applies the following changes: 1. It adds `-DDEBUG` for debug builds of `libZFS_Core` and `libzfs`, to enable their assertions on debug builds. 2. It corrects an assertion within `libzfs`, where a function had been spelled incorrectly (`zpool_prop_unsupported()`) and nobody knew because the `-DDEBUG` flag was missing, and the preprocessor was taking that part of the code away. 3. The library's internal fd is initialized to `-1` and `VERIFY` assertions have been placed to check that the fd is not equal to `-1` before issuing any ioctl. It is important here to note, that the `VERIFY` assertions exist in both debug and non-debug builds. 4. In `libzfs_core_fini` we make sure to never increment the refcount of our fd below 0, and also reset the fd to `-1` when no one refers to it. The reason for this, is for the rare case that the consumer closes all references but then calls one of the library's functions without using `libzfs_core_init()` first, and in the mean time, a previous call to `open()` decided to reuse our previous fd. This scenario would have passed our assertion in Reviewed by: Pavel Zakharov Reviewed by: Matthew Ahrens Approved by: Dan McDonald Author: Serapheim Dimitropoulos Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Thu Mar 22 23:51:39 2018 (r331392) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Thu Mar 22 23:52:37 2018 (r331393) @@ -273,6 +273,15 @@ cksummer(void *arg) ofp = fdopen(dda->inputfd, "r"); while (ssread(drr, sizeof (*drr), ofp) != 0) { + /* + * kernel filled in checksum, we are going to write same + * record, but need to regenerate checksum. + */ + if (drr->drr_type != DRR_BEGIN) { + bzero(&drr->drr_u.drr_checksum.drr_checksum, + sizeof (drr->drr_u.drr_checksum.drr_checksum)); + } + switch (drr->drr_type) { case DRR_BEGIN: { Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Thu Mar 22 23:51:39 2018 (r331392) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Thu Mar 22 23:52:37 2018 (r331393) @@ -94,7 +94,7 @@ extern int zfs_ioctl_version; #endif -static int g_fd; +static int g_fd = -1; static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER; static int g_refcount; @@ -120,9 +120,14 @@ libzfs_core_fini(void) { (void) pthread_mutex_lock(&g_lock); ASSERT3S(g_refcount, >, 0); - g_refcount--; - if (g_refcount == 0) + + if (g_refcount > 0) + g_refcount--; + + if (g_refcount == 0 && g_fd != -1) { (void) close(g_fd); + g_fd = -1; + } (void) pthread_mutex_unlock(&g_lock); } @@ -139,6 +144,7 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, size_t size; ASSERT3S(g_refcount, >, 0); + VERIFY3S(g_fd, !=, -1); (void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name)); @@ -411,6 +417,9 @@ lzc_exists(const char *dataset) */ zfs_cmd_t zc = { 0 }; + ASSERT3S(g_refcount, >, 0); + VERIFY3S(g_fd, !=, -1); + (void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name)); return (ioctl(g_fd, ZFS_IOC_OBJSET_STATS, &zc) == 0); } @@ -656,6 +665,7 @@ recv_impl(const char *snapname, nvlist_t *props, const int error; ASSERT3S(g_refcount, >, 0); + VERIFY3S(g_fd, !=, -1); /* zc_name is name of containing filesystem */ (void) strlcpy(zc.zc_name, snapname, sizeof (zc.zc_name)); From owner-svn-src-stable@freebsd.org Thu Mar 22 23:53:19 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32B18F55121; Thu, 22 Mar 2018 23:53:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD626738AA; Thu, 22 Mar 2018 23:53:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D847418366; Thu, 22 Mar 2018 23:53:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNrIIg000692; Thu, 22 Mar 2018 23:53:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNrIQC000691; Thu, 22 Mar 2018 23:53:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222353.w2MNrIQC000691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:53: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: r331394 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331394 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, 22 Mar 2018 23:53:19 -0000 Author: mav Date: Thu Mar 22 23:53:18 2018 New Revision: 331394 URL: https://svnweb.freebsd.org/changeset/base/331394 Log: MFC r329668: MFV r316918: 7990 libzfs: snapspec_cb() does not need to call zfs_strdup() illumos/illumos-gate@d8584ba6fb7a5e46da1725845b99ae5fab5a4baf https://github.com/illumos/illumos-gate/commit/d8584ba6fb7a5e46da1725845b99ae5fab5a4baf https://www.illumos.org/issues/7990 The snapspec_cb() callback function in libzfs does not need to call zfs_strdup(). Reviewed by: Yuri Pankov Reviewed by: Toomas Soome Approved by: Matthew Ahrens Author: Marcel Telka Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Thu Mar 22 23:52:37 2018 (r331393) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Thu Mar 22 23:53:18 2018 (r331394) @@ -317,26 +317,23 @@ static int snapspec_cb(zfs_handle_t *zhp, void *arg) { snapspec_arg_t *ssa = arg; - char *shortsnapname; + const char *shortsnapname; int err = 0; if (ssa->ssa_seenlast) return (0); - shortsnapname = zfs_strdup(zhp->zfs_hdl, - strchr(zfs_get_name(zhp), '@') + 1); + shortsnapname = strchr(zfs_get_name(zhp), '@') + 1; if (!ssa->ssa_seenfirst && strcmp(shortsnapname, ssa->ssa_first) == 0) ssa->ssa_seenfirst = B_TRUE; + if (strcmp(shortsnapname, ssa->ssa_last) == 0) + ssa->ssa_seenlast = B_TRUE; if (ssa->ssa_seenfirst) { err = ssa->ssa_func(zhp, ssa->ssa_arg); } else { zfs_close(zhp); } - - if (strcmp(shortsnapname, ssa->ssa_last) == 0) - ssa->ssa_seenlast = B_TRUE; - free(shortsnapname); return (err); } From owner-svn-src-stable@freebsd.org Thu Mar 22 23:54:16 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF592F552B6; Thu, 22 Mar 2018 23:54:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 77C1373AC7; Thu, 22 Mar 2018 23:54:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 726D018369; Thu, 22 Mar 2018 23:54:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNsF2o000911; Thu, 22 Mar 2018 23:54:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNsEcL000899; Thu, 22 Mar 2018 23:54:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222354.w2MNsEcL000899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23: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: r331395 - in stable/11: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/usr.sbin/zfsd sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensol... X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/usr.sbin/zfsd sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sy... X-SVN-Commit-Revision: 331395 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, 22 Mar 2018 23:54:16 -0000 Author: mav Date: Thu Mar 22 23:54:14 2018 New Revision: 331395 URL: https://svnweb.freebsd.org/changeset/base/331395 Log: MFC r329681: MFV r318941: 7446 zpool create should support efi system partition illumos/illumos-gate@7855d95b30fd903e3918bad5a29b777e765db821 https://github.com/illumos/illumos-gate/commit/7855d95b30fd903e3918bad5a29b777e765db821 https://www.illumos.org/issues/7446 Since we support whole-disk configuration for boot pool, we also will need whole disk support with UEFI boot and for this, zpool create should create efi- system partition. I have borrowed the idea from oracle solaris, and introducing zpool create - B switch to provide an way to specify that boot partition should be created. However, there is still an question, how big should the system partition be. For time being, I have set default size 256MB (thats minimum size for FAT32 with 4k blocks). To support custom size, the set on creation "bootsize" property is created and so the custom size can be set as: zpool create B - o bootsize=34MB rpool c0t0d0 After pool is created, the "bootsize" property is read only. When -B switch is not used, the bootsize defaults to 0 and is shown in zpool get output with value ''. Older zfs/zpool implementations are ignoring this property. https://www.illumos.org/rb/r/219/ Reviewed by: Andrew Stormont Reviewed by: Yuri Pankov Approved by: Dan McDonald Author: Toomas Soome This commit makes no sense for FreeBSD, that is why I blocked the option, but it should be good to stay closer to upstream. Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/11/cddl/usr.sbin/zfsd/case_file.cc stable/11/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Mar 22 23:54:14 2018 (r331395) @@ -212,7 +212,8 @@ get_usage(zpool_help_t idx) case HELP_CLEAR: return (gettext("\tclear [-nF] [device]\n")); case HELP_CREATE: - return (gettext("\tcreate [-fnd] [-o property=value] ... \n" + return (gettext("\tcreate [-fnd] [-B] " + "[-o property=value] ... \n" "\t [-O file-system-property=value] ... \n" "\t [-m mountpoint] [-R root] ...\n")); case HELP_DESTROY: @@ -499,6 +500,8 @@ zpool_do_add(int argc, char **argv) int c; nvlist_t *nvroot; char *poolname; + zpool_boot_label_t boot_type; + uint64_t boot_size; int ret; zpool_handle_t *zhp; nvlist_t *config; @@ -547,9 +550,15 @@ zpool_do_add(int argc, char **argv) return (1); } + if (zpool_is_bootable(zhp)) + boot_type = ZPOOL_COPY_BOOT_LABEL; + else + boot_type = ZPOOL_NO_BOOT_LABEL; + /* pass off to get_vdev_spec for processing */ + boot_size = zpool_get_prop_int(zhp, ZPOOL_PROP_BOOTSIZE, NULL); nvroot = make_root_vdev(zhp, force, !force, B_FALSE, dryrun, - argc, argv); + boot_type, boot_size, argc, argv); if (nvroot == NULL) { zpool_close(zhp); return (1); @@ -774,10 +783,11 @@ errout: } /* - * zpool create [-fnd] [-o property=value] ... + * zpool create [-fnd] [-B] [-o property=value] ... * [-O file-system-property=value] ... * [-R root] [-m mountpoint] ... * + * -B Create boot partition. * -f Force creation, even if devices appear in use * -n Do not create the pool, but display the resulting layout if it * were to be created. @@ -794,12 +804,16 @@ errout: * we get the nvlist back from get_vdev_spec(), we either print out the contents * (if '-n' was specified), or pass it to libzfs to do the creation. */ + +#define SYSTEM256 (256 * 1024 * 1024) int zpool_do_create(int argc, char **argv) { boolean_t force = B_FALSE; boolean_t dryrun = B_FALSE; boolean_t enable_all_pool_feat = B_TRUE; + zpool_boot_label_t boot_type = ZPOOL_NO_BOOT_LABEL; + uint64_t boot_size = 0; int c; nvlist_t *nvroot = NULL; char *poolname; @@ -811,7 +825,7 @@ zpool_do_create(int argc, char **argv) char *propval; /* check options */ - while ((c = getopt(argc, argv, ":fndR:m:o:O:")) != -1) { + while ((c = getopt(argc, argv, ":fndBR:m:o:O:")) != -1) { switch (c) { case 'f': force = B_TRUE; @@ -822,6 +836,22 @@ zpool_do_create(int argc, char **argv) case 'd': enable_all_pool_feat = B_FALSE; break; + case 'B': +#ifdef illumos + /* + * We should create the system partition. + * Also make sure the size is set. + */ + boot_type = ZPOOL_CREATE_BOOT_LABEL; + if (boot_size == 0) + boot_size = SYSTEM256; + break; +#else + (void) fprintf(stderr, + gettext("option '%c' is not supported\n"), + optopt); + goto badusage; +#endif case 'R': altroot = optarg; if (add_prop_list(zpool_prop_to_name( @@ -852,6 +882,20 @@ zpool_do_create(int argc, char **argv) goto errout; /* + * Get bootsize value for make_root_vdev(). + */ + if (zpool_name_to_prop(optarg) == ZPOOL_PROP_BOOTSIZE) { + if (zfs_nicestrtonum(g_zfs, propval, + &boot_size) < 0 || boot_size == 0) { + (void) fprintf(stderr, + gettext("bad boot partition size " + "'%s': %s\n"), propval, + libzfs_error_description(g_zfs)); + goto errout; + } + } + + /* * If the user is creating a pool that doesn't support * feature flags, don't enable any features. */ @@ -928,9 +972,43 @@ zpool_do_create(int argc, char **argv) goto errout; } + /* + * Make sure the bootsize is set when ZPOOL_CREATE_BOOT_LABEL is used, + * and not set otherwise. + */ + if (boot_type == ZPOOL_CREATE_BOOT_LABEL) { + const char *propname; + char *strptr, *buf = NULL; + int rv; + + propname = zpool_prop_to_name(ZPOOL_PROP_BOOTSIZE); + if (nvlist_lookup_string(props, propname, &strptr) != 0) { + (void) asprintf(&buf, "%" PRIu64, boot_size); + if (buf == NULL) { + (void) fprintf(stderr, + gettext("internal error: out of memory\n")); + goto errout; + } + rv = add_prop_list(propname, buf, &props, B_TRUE); + free(buf); + if (rv != 0) + goto errout; + } + } else { + const char *propname; + char *strptr; + + propname = zpool_prop_to_name(ZPOOL_PROP_BOOTSIZE); + if (nvlist_lookup_string(props, propname, &strptr) == 0) { + (void) fprintf(stderr, gettext("error: setting boot " + "partition size requires option '-B'\n")); + goto errout; + } + } + /* pass off to get_vdev_spec for bulk processing */ nvroot = make_root_vdev(NULL, force, !force, B_FALSE, dryrun, - argc - 1, argv + 1); + boot_type, boot_size, argc - 1, argv + 1); if (nvroot == NULL) goto errout; @@ -3209,6 +3287,8 @@ zpool_do_attach_or_replace(int argc, char **argv, int nvlist_t *nvroot; char *poolname, *old_disk, *new_disk; zpool_handle_t *zhp; + zpool_boot_label_t boot_type; + uint64_t boot_size; int ret; /* check options */ @@ -3273,8 +3353,14 @@ zpool_do_attach_or_replace(int argc, char **argv, int return (1); } + if (zpool_is_bootable(zhp)) + boot_type = ZPOOL_COPY_BOOT_LABEL; + else + boot_type = ZPOOL_NO_BOOT_LABEL; + + boot_size = zpool_get_prop_int(zhp, ZPOOL_PROP_BOOTSIZE, NULL); nvroot = make_root_vdev(zhp, force, B_FALSE, replacing, B_FALSE, - argc, argv); + boot_type, boot_size, argc, argv); if (nvroot == NULL) { zpool_close(zhp); return (1); Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h Thu Mar 22 23:54:14 2018 (r331395) @@ -44,7 +44,8 @@ uint_t num_logs(nvlist_t *nv); */ nvlist_t *make_root_vdev(zpool_handle_t *zhp, int force, int check_rep, - boolean_t replacing, boolean_t dryrun, int argc, char **argv); + boolean_t replacing, boolean_t dryrun, zpool_boot_label_t boot_type, + uint64_t boot_size, int argc, char **argv); nvlist_t *split_mirror_vdev(zpool_handle_t *zhp, char *newname, nvlist_t *props, splitflags_t flags, int argc, char **argv); Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Thu Mar 22 23:54:14 2018 (r331395) @@ -935,14 +935,15 @@ check_replication(nvlist_t *config, nvlist_t *newroot) * Go through and find any whole disks in the vdev specification, labelling them * as appropriate. When constructing the vdev spec, we were unable to open this * device in order to provide a devid. Now that we have labelled the disk and - * know that slice 0 is valid, we can construct the devid now. + * know the pool slice is valid, we can construct the devid now. * * If the disk was already labeled with an EFI label, we will have gotten the * devid already (because we were able to open the whole disk). Otherwise, we * need to get the devid after we label the disk. */ static int -make_disks(zpool_handle_t *zhp, nvlist_t *nv) +make_disks(zpool_handle_t *zhp, nvlist_t *nv, zpool_boot_label_t boot_type, + uint64_t boot_size) { nvlist_t **child; uint_t c, children; @@ -951,6 +952,7 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) uint64_t wholedisk; int fd; int ret; + int slice; ddi_devid_t devid; char *minor = NULL, *devid_str = NULL; @@ -968,20 +970,36 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) * slice and stat()ing the device. */ verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0); - if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK, - &wholedisk) != 0 || !wholedisk) - return (0); diskname = strrchr(path, '/'); assert(diskname != NULL); diskname++; - if (zpool_label_disk(g_zfs, zhp, diskname) == -1) - return (-1); + if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK, + &wholedisk) != 0 || !wholedisk) { + /* + * This is not whole disk, return error if + * boot partition creation was requested + */ + if (boot_type == ZPOOL_CREATE_BOOT_LABEL) { + (void) fprintf(stderr, + gettext("creating boot partition is only " + "supported on whole disk vdevs: %s\n"), + diskname); + return (-1); + } + return (0); + } + + ret = zpool_label_disk(g_zfs, zhp, diskname, boot_type, + boot_size, &slice); + if (ret == -1) + return (ret); + /* * Fill in the devid, now that we've labeled the disk. */ - (void) snprintf(buf, sizeof (buf), "%ss0", path); + (void) snprintf(buf, sizeof (buf), "%ss%d", path, slice); if ((fd = open(buf, O_RDONLY)) < 0) { (void) fprintf(stderr, gettext("cannot open '%s': %s\n"), @@ -1004,7 +1022,7 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) } /* - * Update the path to refer to the 's0' slice. The presence of + * Update the path to refer to the pool slice. The presence of * the 'whole_disk' field indicates to the CLI that we should * chop off the slice number when displaying the device in * future output. @@ -1016,21 +1034,36 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) return (0); } - for (c = 0; c < children; c++) - if ((ret = make_disks(zhp, child[c])) != 0) + /* illumos kernel does not support booting from multi-vdev pools. */ + if ((boot_type == ZPOOL_CREATE_BOOT_LABEL)) { + if ((strcmp(type, VDEV_TYPE_ROOT) == 0) && children > 1) { + (void) fprintf(stderr, gettext("boot pool " + "can not have more than one vdev\n")); + return (-1); + } + } + + for (c = 0; c < children; c++) { + ret = make_disks(zhp, child[c], boot_type, boot_size); + if (ret != 0) return (ret); + } if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_SPARES, &child, &children) == 0) - for (c = 0; c < children; c++) - if ((ret = make_disks(zhp, child[c])) != 0) + for (c = 0; c < children; c++) { + ret = make_disks(zhp, child[c], boot_type, boot_size); + if (ret != 0) return (ret); + } if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE, &child, &children) == 0) - for (c = 0; c < children; c++) - if ((ret = make_disks(zhp, child[c])) != 0) + for (c = 0; c < children; c++) { + ret = make_disks(zhp, child[c], boot_type, boot_size); + if (ret != 0) return (ret); + } return (0); } @@ -1429,6 +1462,9 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, { nvlist_t *newroot = NULL, **child; uint_t c, children; +#ifdef illumos + zpool_boot_label_t boot_type; +#endif if (argc > 0) { if ((newroot = construct_spec(argc, argv)) == NULL) { @@ -1438,7 +1474,13 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, } #ifdef illumos - if (!flags.dryrun && make_disks(zhp, newroot) != 0) { + if (zpool_is_bootable(zhp)) + boot_type = ZPOOL_COPY_BOOT_LABEL; + else + boot_type = ZPOOL_NO_BOOT_LABEL; + + if (!flags.dryrun && + make_disks(zhp, newroot, boot_type, 0) != 0) { nvlist_free(newroot); return (NULL); } @@ -1483,7 +1525,8 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, */ nvlist_t * make_root_vdev(zpool_handle_t *zhp, int force, int check_rep, - boolean_t replacing, boolean_t dryrun, int argc, char **argv) + boolean_t replacing, boolean_t dryrun, zpool_boot_label_t boot_type, + uint64_t boot_size, int argc, char **argv) { nvlist_t *newroot; nvlist_t *poolconfig = NULL; @@ -1525,7 +1568,7 @@ make_root_vdev(zpool_handle_t *zhp, int force, int che /* * Run through the vdev specification and label any whole disks found. */ - if (!dryrun && make_disks(zhp, newroot) != 0) { + if (!dryrun && make_disks(zhp, newroot, boot_type, boot_size) != 0) { nvlist_free(newroot); return (NULL); } Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Mar 22 23:54:14 2018 (r331395) @@ -135,6 +135,18 @@ typedef enum zfs_error { } zfs_error_t; /* + * UEFI boot support parameters. When creating whole disk boot pool, + * zpool create should allow to create EFI System partition for UEFI boot + * program. In case of BIOS, the EFI System partition is not used + * even if it does exist. + */ +typedef enum zpool_boot_label { + ZPOOL_NO_BOOT_LABEL = 0, + ZPOOL_CREATE_BOOT_LABEL, + ZPOOL_COPY_BOOT_LABEL +} zpool_boot_label_t; + +/* * The following data structures are all part * of the zfs_allow_t data structure which is * used for printing 'allow' permissions. @@ -266,7 +278,8 @@ extern nvlist_t *zpool_find_vdev(zpool_handle_t *, con boolean_t *, boolean_t *); extern nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *, boolean_t *, boolean_t *, boolean_t *); -extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *); +extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *, + zpool_boot_label_t, uint64_t, int *); /* * Functions to manage pool properties @@ -349,6 +362,7 @@ extern nvlist_t *zpool_get_config(zpool_handle_t *, nv extern nvlist_t *zpool_get_features(zpool_handle_t *); extern int zpool_refresh_stats(zpool_handle_t *, boolean_t *); extern int zpool_get_errlog(zpool_handle_t *, nvlist_t **); +extern boolean_t zpool_is_bootable(zpool_handle_t *); /* * Import and export functions Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Mar 22 23:54:14 2018 (r331395) @@ -49,7 +49,7 @@ #include "zfs_comutil.h" #include "zfeature_common.h" -static int read_efi_label(nvlist_t *config, diskaddr_t *sb); +static int read_efi_label(nvlist_t *, diskaddr_t *, boolean_t *); static boolean_t zpool_vdev_is_interior(const char *name); #define BACKUP_SLICE "s2" @@ -316,6 +316,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, (void) zfs_nicenum(intval, buf, len); } break; + case ZPOOL_PROP_BOOTSIZE: case ZPOOL_PROP_EXPANDSZ: if (intval == 0) { (void) strlcpy(buf, "-", len); @@ -517,6 +518,16 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char } break; + case ZPOOL_PROP_BOOTSIZE: + if (!flags.create) { + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "property '%s' can only be set during pool " + "creation"), propname); + (void) zfs_error(hdl, EZFS_BADPROP, errbuf); + goto error; + } + break; + case ZPOOL_PROP_BOOTFS: if (flags.create || flags.import) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, @@ -1990,8 +2001,9 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, bo /* * Search for the requested value. Special cases: * - * - ZPOOL_CONFIG_PATH for whole disk entries. These end in - * "s0" or "s0/old". The "s0" part is hidden from the user, + * - ZPOOL_CONFIG_PATH for whole disk entries. To support + * UEFI boot, these end in "s0" or "s0/old" or "s1" or + * "s1/old". The "s0" or "s1" part is hidden from the user, * but included in the string, so this matches around it. * - looking for a top-level vdev name (i.e. ZPOOL_CONFIG_TYPE). * @@ -2022,14 +2034,16 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, bo /* * strings identical except trailing "s0" */ - if (strcmp(&val[vlen - 2], "s0") == 0 && + if ((strcmp(&val[vlen - 2], "s0") == 0 || + strcmp(&val[vlen - 2], "s1") == 0) && strncmp(srchval, val, slen) == 0) return (nv); /* * strings identical except trailing "s0/old" */ - if (strcmp(&val[vlen - 6], "s0/old") == 0 && + if ((strcmp(&val[vlen - 6], "s0/old") == 0 || + strcmp(&val[vlen - 6], "s1/old") == 0) && strcmp(&srchval[slen - 4], "/old") == 0 && strncmp(srchval, val, slen - 4) == 0) return (nv); @@ -3460,15 +3474,17 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t * char *tmp = zfs_strdup(hdl, path); /* - * If it starts with c#, and ends with "s0", chop - * the "s0" off, or if it ends with "s0/old", remove - * the "s0" from the middle. + * If it starts with c#, and ends with "s0" or "s1", + * chop the slice off, or if it ends with "s0/old" or + * "s1/old", remove the slice from the middle. */ if (CTD_CHECK(tmp)) { - if (strcmp(&tmp[pathlen - 2], "s0") == 0) { + if (strcmp(&tmp[pathlen - 2], "s0") == 0 || + strcmp(&tmp[pathlen - 2], "s1") == 0) { tmp[pathlen - 2] = '\0'; } else if (pathlen > 6 && - strcmp(&tmp[pathlen - 6], "s0/old") == 0) { + (strcmp(&tmp[pathlen - 6], "s0/old") == 0 || + strcmp(&tmp[pathlen - 6], "s1/old") == 0)) { (void) strcpy(&tmp[pathlen - 6], "/old"); } @@ -3873,15 +3889,18 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, * Read the EFI label from the config, if a label does not exist then * pass back the error to the caller. If the caller has passed a non-NULL * diskaddr argument then we set it to the starting address of the EFI - * partition. + * partition. If the caller has passed a non-NULL boolean argument, then + * we set it to indicate if the disk does have efi system partition. */ static int -read_efi_label(nvlist_t *config, diskaddr_t *sb) +read_efi_label(nvlist_t *config, diskaddr_t *sb, boolean_t *system) { char *path; int fd; char diskname[MAXPATHLEN]; + boolean_t boot = B_FALSE; int err = -1; + int slice; if (nvlist_lookup_string(config, ZPOOL_CONFIG_PATH, &path) != 0) return (err); @@ -3892,8 +3911,16 @@ read_efi_label(nvlist_t *config, diskaddr_t *sb) struct dk_gpt *vtoc; if ((err = efi_alloc_and_read(fd, &vtoc)) >= 0) { - if (sb != NULL) - *sb = vtoc->efi_parts[0].p_start; + for (slice = 0; slice < vtoc->efi_nparts; slice++) { + if (vtoc->efi_parts[slice].p_tag == V_SYSTEM) + boot = B_TRUE; + if (vtoc->efi_parts[slice].p_tag == V_USR) + break; + } + if (sb != NULL && vtoc->efi_parts[slice].p_tag == V_USR) + *sb = vtoc->efi_parts[slice].p_start; + if (system != NULL) + *system = boot; efi_free(vtoc); } (void) close(fd); @@ -3920,7 +3947,7 @@ find_start_block(nvlist_t *config) &wholedisk) != 0 || !wholedisk) { return (MAXOFFSET_T); } - if (read_efi_label(config, &sb) < 0) + if (read_efi_label(config, &sb, NULL) < 0) sb = MAXOFFSET_T; return (sb); } @@ -3940,7 +3967,8 @@ find_start_block(nvlist_t *config) * stripped of any leading /dev path. */ int -zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name) +zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name, + zpool_boot_label_t boot_type, uint64_t boot_size, int *slice) { #ifdef illumos char path[MAXPATHLEN]; @@ -3999,15 +4027,6 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t return (zfs_error(hdl, EZFS_NOCAP, errbuf)); } - slice_size = vtoc->efi_last_u_lba + 1; - slice_size -= EFI_MIN_RESV_SIZE; - if (start_block == MAXOFFSET_T) - start_block = NEW_START_BLOCK; - slice_size -= start_block; - - vtoc->efi_parts[0].p_start = start_block; - vtoc->efi_parts[0].p_size = slice_size; - /* * Why we use V_USR: V_BACKUP confuses users, and is considered * disposable by some EFI utilities (since EFI doesn't have a backup @@ -4016,12 +4035,103 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t * etc. were all pretty specific. V_USR is as close to reality as we * can get, in the absence of V_OTHER. */ - vtoc->efi_parts[0].p_tag = V_USR; - (void) strcpy(vtoc->efi_parts[0].p_name, "zfs"); + /* first fix the partition start block */ + if (start_block == MAXOFFSET_T) + start_block = NEW_START_BLOCK; - vtoc->efi_parts[8].p_start = slice_size + start_block; - vtoc->efi_parts[8].p_size = resv; - vtoc->efi_parts[8].p_tag = V_RESERVED; + /* + * EFI System partition is using slice 0. + * ZFS is on slice 1 and slice 8 is reserved. + * We assume the GPT partition table without system + * partition has zfs p_start == NEW_START_BLOCK. + * If start_block != NEW_START_BLOCK, it means we have + * system partition. Correct solution would be to query/cache vtoc + * from existing vdev member. + */ + if (boot_type == ZPOOL_CREATE_BOOT_LABEL) { + if (boot_size % vtoc->efi_lbasize != 0) { + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "boot partition size must be a multiple of %d"), + vtoc->efi_lbasize); + (void) close(fd); + efi_free(vtoc); + return (zfs_error(hdl, EZFS_LABELFAILED, errbuf)); + } + /* + * System partition size checks. + * Note the 1MB is quite arbitrary value, since we + * are creating dedicated pool, it should be enough + * to hold fat + efi bootloader. May need to be + * adjusted if the bootloader size will grow. + */ + if (boot_size < 1024 * 1024) { + char buf[64]; + zfs_nicenum(boot_size, buf, sizeof (buf)); + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "Specified size %s for EFI System partition is too " + "small, the minimum size is 1MB."), buf); + (void) close(fd); + efi_free(vtoc); + return (zfs_error(hdl, EZFS_LABELFAILED, errbuf)); + } + /* 33MB is tested with mkfs -F pcfs */ + if (hdl->libzfs_printerr && + ((vtoc->efi_lbasize == 512 && + boot_size < 33 * 1024 * 1024) || + (vtoc->efi_lbasize == 4096 && + boot_size < 256 * 1024 * 1024))) { + char buf[64]; + zfs_nicenum(boot_size, buf, sizeof (buf)); + (void) fprintf(stderr, dgettext(TEXT_DOMAIN, + "Warning: EFI System partition size %s is " + "not allowing to create FAT32 file\nsystem, which " + "may result in unbootable system.\n"), buf); + } + /* Adjust zfs partition start by size of system partition. */ + start_block += boot_size / vtoc->efi_lbasize; + } + + if (start_block == NEW_START_BLOCK) { + /* + * Use default layout. + * ZFS is on slice 0 and slice 8 is reserved. + */ + slice_size = vtoc->efi_last_u_lba + 1; + slice_size -= EFI_MIN_RESV_SIZE; + slice_size -= start_block; + if (slice != NULL) + *slice = 0; + + vtoc->efi_parts[0].p_start = start_block; + vtoc->efi_parts[0].p_size = slice_size; + + vtoc->efi_parts[0].p_tag = V_USR; + (void) strcpy(vtoc->efi_parts[0].p_name, "zfs"); + + vtoc->efi_parts[8].p_start = slice_size + start_block; + vtoc->efi_parts[8].p_size = resv; + vtoc->efi_parts[8].p_tag = V_RESERVED; + } else { + slice_size = start_block - NEW_START_BLOCK; + vtoc->efi_parts[0].p_start = NEW_START_BLOCK; + vtoc->efi_parts[0].p_size = slice_size; + vtoc->efi_parts[0].p_tag = V_SYSTEM; + (void) strcpy(vtoc->efi_parts[0].p_name, "loader"); + if (slice != NULL) + *slice = 1; + /* prepare slice 1 */ + slice_size = vtoc->efi_last_u_lba + 1 - slice_size; + slice_size -= resv; + slice_size -= NEW_START_BLOCK; + vtoc->efi_parts[1].p_start = start_block; + vtoc->efi_parts[1].p_size = slice_size; + vtoc->efi_parts[1].p_tag = V_USR; + (void) strcpy(vtoc->efi_parts[1].p_name, "zfs"); + + vtoc->efi_parts[8].p_start = slice_size + start_block; + vtoc->efi_parts[8].p_size = resv; + vtoc->efi_parts[8].p_tag = V_RESERVED; + } if (efi_write(fd, vtoc) != 0) { /* Modified: stable/11/cddl/usr.sbin/zfsd/case_file.cc ============================================================================== --- stable/11/cddl/usr.sbin/zfsd/case_file.cc Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/cddl/usr.sbin/zfsd/case_file.cc Thu Mar 22 23:54:14 2018 (r331395) @@ -239,6 +239,8 @@ CaseFile::ReEvaluate(const string &devPath, const stri { ZpoolList zpl(ZpoolList::ZpoolByGUID, &m_poolGUID); zpool_handle_t *pool(zpl.empty() ? NULL : zpl.front()); + zpool_boot_label_t boot_type; + uint64_t boot_size; if (pool == NULL || !RefreshVdevState()) { /* @@ -331,7 +333,13 @@ CaseFile::ReEvaluate(const string &devPath, const stri } /* Write a label on the newly inserted disk. */ - if (zpool_label_disk(g_zfsHandle, pool, devPath.c_str()) != 0) { + if (zpool_is_bootable(pool)) + boot_type = ZPOOL_COPY_BOOT_LABEL; + else + boot_type = ZPOOL_NO_BOOT_LABEL; + boot_size = zpool_get_prop_int(pool, ZPOOL_PROP_BOOTSIZE, NULL); + if (zpool_label_disk(g_zfsHandle, pool, devPath.c_str(), + boot_type, boot_size, NULL) != 0) { syslog(LOG_ERR, "Replace vdev(%s/%s) by physical path (label): %s: %s\n", zpool_get_name(pool), VdevGUIDString().c_str(), Modified: stable/11/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Thu Mar 22 23:54:14 2018 (r331395) @@ -100,6 +100,10 @@ zpool_prop_init(void) PROP_READONLY, ZFS_TYPE_POOL, "<1.00x or higher if deduped>", "DEDUP"); + /* system partition size */ + zprop_register_number(ZPOOL_PROP_BOOTSIZE, "bootsize", 0, PROP_ONETIME, + ZFS_TYPE_POOL, "", "BOOTSIZE"); + /* default number properties */ zprop_register_number(ZPOOL_PROP_VERSION, "version", SPA_VERSION, PROP_DEFAULT, ZFS_TYPE_POOL, "", "VERSION"); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Thu Mar 22 23:54:14 2018 (r331395) @@ -481,6 +481,7 @@ metaslab_class_expandable_space(metaslab_class_t *mc) spa_config_enter(mc->mc_spa, SCL_VDEV, FTAG, RW_READER); for (int c = 0; c < rvd->vdev_children; c++) { + uint64_t tspace; vdev_t *tvd = rvd->vdev_child[c]; metaslab_group_t *mg = tvd->vdev_mg; @@ -493,9 +494,13 @@ metaslab_class_expandable_space(metaslab_class_t *mc) * Calculate if we have enough space to add additional * metaslabs. We report the expandable space in terms * of the metaslab size since that's the unit of expansion. + * Adjust by efi system partition size. */ - space += P2ALIGN(tvd->vdev_max_asize - tvd->vdev_asize, - 1ULL << tvd->vdev_ms_shift); + tspace = tvd->vdev_max_asize - tvd->vdev_asize; + if (tspace > mc->mc_spa->spa_bootsize) { + tspace -= mc->mc_spa->spa_bootsize; + } + space += P2ALIGN(tspace, 1ULL << tvd->vdev_ms_shift); } spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG); return (space); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Mar 22 23:54:14 2018 (r331395) @@ -2818,6 +2818,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t spa_prop_find(spa, ZPOOL_PROP_DELEGATION, &spa->spa_delegation); spa_prop_find(spa, ZPOOL_PROP_FAILUREMODE, &spa->spa_failmode); spa_prop_find(spa, ZPOOL_PROP_AUTOEXPAND, &spa->spa_autoexpand); + spa_prop_find(spa, ZPOOL_PROP_BOOTSIZE, &spa->spa_bootsize); spa_prop_find(spa, ZPOOL_PROP_DEDUPDITTO, &spa->spa_dedup_ditto); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Thu Mar 22 23:54:14 2018 (r331395) @@ -242,6 +242,7 @@ struct spa { int spa_mode; /* FREAD | FWRITE */ spa_log_state_t spa_log_state; /* log state */ uint64_t spa_autoexpand; /* lun expansion on/off */ + uint64_t spa_bootsize; /* efi system partition size */ ddt_t *spa_ddt[ZIO_CHECKSUM_FUNCTIONS]; /* in-core DDTs */ uint64_t spa_ddt_stat_object; /* DDT statistics */ uint64_t spa_dedup_ditto; /* dedup ditto threshold */ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Mar 22 23:54:14 2018 (r331395) @@ -2922,8 +2922,8 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t *vs) * since that determines how much space the pool can expand. */ if (vd->vdev_aux == NULL && tvd != NULL && vd->vdev_max_asize != 0) { - vs->vs_esize = P2ALIGN(vd->vdev_max_asize - vd->vdev_asize, - 1ULL << tvd->vdev_ms_shift); + vs->vs_esize = P2ALIGN(vd->vdev_max_asize - vd->vdev_asize - + spa->spa_bootsize, 1ULL << tvd->vdev_ms_shift); } vs->vs_configured_ashift = vd->vdev_top != NULL ? vd->vdev_top->vdev_ashift : vd->vdev_ashift; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu Mar 22 23:53:18 2018 (r331394) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu Mar 22 23:54:14 2018 (r331395) @@ -211,6 +211,7 @@ typedef enum { ZPOOL_PROP_FRAGMENTATION, ZPOOL_PROP_LEAKED, ZPOOL_PROP_MAXBLOCKSIZE, + ZPOOL_PROP_BOOTSIZE, ZPOOL_NUM_PROPS } zpool_prop_t; From owner-svn-src-stable@freebsd.org Thu Mar 22 23:55:01 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35DC1F553FE; Thu, 22 Mar 2018 23:55:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE66973C32; Thu, 22 Mar 2018 23:55:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D94E01836A; Thu, 22 Mar 2018 23:55:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNt00J001027; Thu, 22 Mar 2018 23:55:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNt0MZ001026; Thu, 22 Mar 2018 23:55:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222355.w2MNt0MZ001026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:55:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331396 - stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent X-SVN-Commit-Revision: 331396 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, 22 Mar 2018 23:55:01 -0000 Author: mav Date: Thu Mar 22 23:55:00 2018 New Revision: 331396 URL: https://svnweb.freebsd.org/changeset/base/331396 Log: MFC r329683: MFV r319736: 6396 remove SVM illumos/illumos-gate@5f10ef697f250374b7b917e10961c4e02d4e3112 https://github.com/illumos/illumos-gate/commit/5f10ef697f250374b7b917e10961c4e02d4e3112 https://www.illumos.org/issues/6396 LVM = SVM = Solaris Volume Manager dead code and not using with ZFS based platform. Reviewed by: Igor Kozhukhov Reviewed by: Toomas Soome Approved by: Hans Rosenfeld Author: Yuri Pankov Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Thu Mar 22 23:54:14 2018 (r331395) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Thu Mar 22 23:55:00 2018 (r331396) @@ -18,9 +18,10 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + * Copyright 2016 Nexenta Systems, Inc. */ #ifndef _SYS_SYSEVENT_EVENTDEFS_H @@ -59,67 +60,6 @@ extern "C" { * by Sun Cluster software. */ #define EC_CLUSTER "EC_Cluster" - -/* - * The following classes are exclusively reserved for use by the - * Solaris Volume Manager (SVM) - */ -#define EC_SVM_CONFIG "EC_SVM_Config" -#define EC_SVM_STATE "EC_SVM_State" - -/* - * EC_SVM_CONFIG subclass definitions - supporting attributes (name/value pairs) - * are found in sys/sysevent/svm.h - */ -#define ESC_SVM_CREATE "ESC_SVM_Create" -#define ESC_SVM_DELETE "ESC_SVM_Delete" -#define ESC_SVM_ADD "ESC_SVM_Add" -#define ESC_SVM_REMOVE "ESC_SVM_Remove" -#define ESC_SVM_REPLACE "ESC_SVM_Replace" -#define ESC_SVM_GROW "ESC_SVM_Grow" -#define ESC_SVM_RENAME_SRC "ESC_SVM_Rename_Src" -#define ESC_SVM_RENAME_DST "ESC_SVM_Rename_Dst" -#define ESC_SVM_MEDIATOR_ADD "ESC_SVM_Mediator_Add" -#define ESC_SVM_MEDIATOR_DELETE "ESC_SVM_Mediator_Delete" -#define ESC_SVM_HOST_ADD "ESC_SVM_Host_Add" -#define ESC_SVM_HOST_DELETE "ESC_SVM_Host_Delete" -#define ESC_SVM_DRIVE_ADD "ESC_SVM_Drive_Add" -#define ESC_SVM_DRIVE_DELETE "ESC_SVM_Drive_Delete" -#define ESC_SVM_DETACH "ESC_SVM_Detach" -#define ESC_SVM_DETACHING "ESC_SVM_Detaching" -#define ESC_SVM_ATTACH "ESC_SVM_Attach" -#define ESC_SVM_ATTACHING "ESC_SVM_Attaching" - -/* - * EC_SVM_STATE subclass definitions - supporting attributes (name/value pairs) - * are found in sys/sysevent/svm.h - */ -#define ESC_SVM_INIT_START "ESC_SVM_Init_Start" -#define ESC_SVM_INIT_FAILED "ESC_SVM_Init_Failed" -#define ESC_SVM_INIT_FATAL "ESC_SVM_Init_Fatal" -#define ESC_SVM_INIT_SUCCESS "ESC_SVM_Init_Success" -#define ESC_SVM_IOERR "ESC_SVM_Ioerr" -#define ESC_SVM_ERRED "ESC_SVM_Erred" -#define ESC_SVM_LASTERRED "ESC_SVM_Lasterred" -#define ESC_SVM_OK "ESC_SVM_Ok" -#define ESC_SVM_ENABLE "ESC_SVM_Enable" -#define ESC_SVM_RESYNC_START "ESC_SVM_Resync_Start" -#define ESC_SVM_RESYNC_FAILED "ESC_SVM_Resync_Failed" -#define ESC_SVM_RESYNC_SUCCESS "ESC_SVM_Resync_Success" -#define ESC_SVM_RESYNC_DONE "ESC_SVM_Resync_Done" -#define ESC_SVM_HOTSPARED "ESC_SVM_Hotspared" -#define ESC_SVM_HS_FREED "ESC_SVM_HS_Freed" -#define ESC_SVM_HS_CHANGED "ESC_SVM_HS_Changed" -#define ESC_SVM_TAKEOVER "ESC_SVM_Takeover" -#define ESC_SVM_RELEASE "ESC_SVM_Release" -#define ESC_SVM_OPEN_FAIL "ESC_SVM_Open_Fail" -#define ESC_SVM_OFFLINE "ESC_SVM_Offline" -#define ESC_SVM_ONLINE "ESC_SVM_Online" -#define ESC_SVM_CHANGE "ESC_SVM_Change" -#define ESC_SVM_EXCHANGE "ESC_SVM_Exchange" -#define ESC_SVM_REGEN_START "ESC_SVM_Regen_Start" -#define ESC_SVM_REGEN_DONE "ESC_SVM_Regen_Done" -#define ESC_SVM_REGEN_FAILED "ESC_SVM_Regen_Failed" /* * EC_DR subclass definitions - supporting attributes (name/value pairs) From owner-svn-src-stable@freebsd.org Thu Mar 22 23:56:19 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2ED4EF555EC; Thu, 22 Mar 2018 23:56:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D58FD73DC8; Thu, 22 Mar 2018 23:56:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D03181836B; Thu, 22 Mar 2018 23:56:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNuIc9001133; Thu, 22 Mar 2018 23:56:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNuISt001125; Thu, 22 Mar 2018 23:56:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222356.w2MNuISt001125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:56: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: r331397 - in stable/11/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs sys/sysevent X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs sys/sysevent X-SVN-Commit-Revision: 331397 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, 22 Mar 2018 23:56:19 -0000 Author: mav Date: Thu Mar 22 23:56:17 2018 New Revision: 331397 URL: https://svnweb.freebsd.org/changeset/base/331397 Log: MFC r329690: MFV r319737: 6939 add sysevents to zfs core for commands illumos/illumos-gate@ce1577b04976f1d8bb5f235b6eaaab15b46a3068 https://github.com/illumos/illumos-gate/commit/ce1577b04976f1d8bb5f235b6eaaab15b46a3068 https://www.illumos.org/issues/6939 Originally created https://smartos.org/bugview/OS-4489 sysevents should be fired in the kernel from ZFS whenever a command is run that is logged in zpool history. Example output Terminal 1 root - gz sunos ~ # zfs create zones/foobar root - gz sunos ~ # zfs set quota=10g zones/foobar root - gz sunos ~ # zfs destroy zones/foobar Terminal 2 root - gz sunos ~ # sysevent EC_zfs nvlist version: 0 date = 2016-04-28T14:50:08.964Z vendor = SUNW publisher = zfs class = EC_zfs subclass = ESC_ZFS_history_event pid = 0 data = (embedded nvlist) nvlist version: 0 pool_name = zones pool_guid = 0x40c964e8f9a7a694 history_record = (embedded nvlist) nvlist version: 0 dsname = zones/foobar dsid = 0x1525 history internal str = internal_name = create history txg = 0x4c4ef3 Reviewed by: Patrick Mooney Reviewed by: Joshua M. Clulow Reviewed by: Josh Wilsdon Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Richard Elling Reviewed by: Alan Somers Reviewed by: Andrew Stormont Approved by: Matthew Ahrens Author: Dave Eddy Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Mar 22 23:56:17 2018 (r331397) @@ -22,6 +22,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2016 Gary Mills * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. */ @@ -242,9 +243,10 @@ dsl_scan_setup_sync(void *arg, dmu_tx_t *tx) if (vdev_resilver_needed(spa->spa_root_vdev, &scn->scn_phys.scn_min_txg, &scn->scn_phys.scn_max_txg)) { - spa_event_notify(spa, NULL, ESC_ZFS_RESILVER_START); + spa_event_notify(spa, NULL, NULL, + ESC_ZFS_RESILVER_START); } else { - spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_START); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_START); } spa->spa_scrub_started = B_TRUE; @@ -353,7 +355,8 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu vdev_dtl_reassess(spa->spa_root_vdev, tx->tx_txg, complete ? scn->scn_phys.scn_max_txg : 0, B_TRUE); if (complete) { - spa_event_notify(spa, NULL, scn->scn_phys.scn_min_txg ? + spa_event_notify(spa, NULL, NULL, + scn->scn_phys.scn_min_txg ? ESC_ZFS_RESILVER_FINISH : ESC_ZFS_SCRUB_FINISH); } spa_errlog_rotate(spa); @@ -387,7 +390,7 @@ dsl_scan_cancel_sync(void *arg, dmu_tx_t *tx) dsl_scan_done(scn, B_FALSE, tx); dsl_scan_sync_state(scn, tx); - spa_event_notify(scn->scn_dp->dp_spa, NULL, ESC_ZFS_SCRUB_ABORT); + spa_event_notify(scn->scn_dp->dp_spa, NULL, NULL, ESC_ZFS_SCRUB_ABORT); } int @@ -442,7 +445,7 @@ dsl_scrub_pause_resume_sync(void *arg, dmu_tx_t *tx) spa->spa_scan_pass_scrub_pause = gethrestime_sec(); scn->scn_phys.scn_flags |= DSF_SCRUB_PAUSED; dsl_scan_sync_state(scn, tx); - spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_PAUSED); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_PAUSED); } else { ASSERT3U(*cmd, ==, POOL_SCRUB_NORMAL); if (dsl_scan_is_paused_scrub(scn)) { @@ -2015,7 +2018,7 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_t func) int err = dsl_scrub_set_pause_resume(scn->scn_dp, POOL_SCRUB_NORMAL); if (err == 0) { - spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_RESUME); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_RESUME); return (ECANCELED); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Mar 22 23:56:17 2018 (r331397) @@ -27,6 +27,7 @@ * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2013 Saso Kiselkov. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. */ @@ -153,7 +154,8 @@ const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* IOCTL */ }; -static sysevent_t *spa_event_create(spa_t *spa, vdev_t *vd, const char *name); +static sysevent_t *spa_event_create(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl, + const char *name); static void spa_event_post(sysevent_t *ev); static void spa_sync_version(void *arg, dmu_tx_t *tx); static void spa_sync_props(void *arg, dmu_tx_t *tx); @@ -805,7 +807,7 @@ spa_change_guid(spa_t *spa) if (error == 0) { spa_config_sync(spa, B_FALSE, B_TRUE); - spa_event_notify(spa, NULL, ESC_ZFS_POOL_REGUID); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_REGUID); } mutex_exit(&spa_namespace_lock); @@ -1679,7 +1681,7 @@ spa_check_removed(vdev_t *vd) if (vd->vdev_ops->vdev_op_leaf && vdev_is_dead(vd) && !vd->vdev_ishole) { zfs_post_autoreplace(vd->vdev_spa, vd); - spa_event_notify(vd->vdev_spa, vd, ESC_ZFS_VDEV_CHECK); + spa_event_notify(vd->vdev_spa, vd, NULL, ESC_ZFS_VDEV_CHECK); } } @@ -3920,7 +3922,7 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ txg_wait_synced(spa->spa_dsl_pool, txg); spa_config_sync(spa, B_FALSE, B_TRUE); - spa_event_notify(spa, NULL, ESC_ZFS_POOL_CREATE); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_CREATE); spa_history_log_version(spa, "create"); @@ -4392,7 +4394,7 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ spa_configfile_set(spa, props, B_FALSE); spa_config_sync(spa, B_FALSE, B_TRUE); - spa_event_notify(spa, NULL, ESC_ZFS_POOL_IMPORT); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_IMPORT); mutex_exit(&spa_namespace_lock); return (0); @@ -4525,7 +4527,7 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ spa_history_log_version(spa, "import"); - spa_event_notify(spa, NULL, ESC_ZFS_POOL_IMPORT); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_IMPORT); mutex_exit(&spa_namespace_lock); @@ -4719,7 +4721,7 @@ spa_export_common(char *pool, int new_state, nvlist_t } } - spa_event_notify(spa, NULL, ESC_ZFS_POOL_DESTROY); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_DESTROY); if (spa->spa_state != POOL_STATE_UNINITIALIZED) { spa_unload(spa); @@ -4874,7 +4876,7 @@ spa_vdev_add(spa_t *spa, nvlist_t *nvroot) mutex_enter(&spa_namespace_lock); spa_config_update(spa, SPA_CONFIG_UPDATE_POOL); - spa_event_notify(spa, NULL, ESC_ZFS_VDEV_ADD); + spa_event_notify(spa, NULL, NULL, ESC_ZFS_VDEV_ADD); mutex_exit(&spa_namespace_lock); return (0); @@ -5050,7 +5052,7 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *n if (newvd->vdev_isspare) { spa_spare_activate(newvd); - spa_event_notify(spa, newvd, ESC_ZFS_VDEV_SPARE); + spa_event_notify(spa, newvd, NULL, ESC_ZFS_VDEV_SPARE); } oldvdpath = spa_strdup(oldvd->vdev_path); @@ -5070,9 +5072,9 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *n dsl_resilver_restart(spa->spa_dsl_pool, dtl_max_txg); if (spa->spa_bootfs) - spa_event_notify(spa, newvd, ESC_ZFS_BOOTFS_VDEV_ATTACH); + spa_event_notify(spa, newvd, NULL, ESC_ZFS_BOOTFS_VDEV_ATTACH); - spa_event_notify(spa, newvd, ESC_ZFS_VDEV_ATTACH); + spa_event_notify(spa, newvd, NULL, ESC_ZFS_VDEV_ATTACH); /* * Commit the config @@ -5286,7 +5288,7 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pg vd->vdev_detached = B_TRUE; vdev_dirty(tvd, VDD_DTL, vd, txg); - spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE); + spa_event_notify(spa, vd, NULL, ESC_ZFS_VDEV_REMOVE); /* hang on to the spa before we release the lock */ spa_open_ref(spa, FTAG); @@ -5802,7 +5804,8 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t u if (vd == NULL || unspare) { if (vd == NULL) vd = spa_lookup_by_guid(spa, guid, B_TRUE); - ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX); + ev = spa_event_create(spa, vd, NULL, + ESC_ZFS_VDEV_REMOVE_AUX); spa_vdev_remove_aux(spa->spa_spares.sav_config, ZPOOL_CONFIG_SPARES, spares, nspares, nv); spa_load_spares(spa); @@ -5818,7 +5821,7 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t u * Cache devices can always be removed. */ vd = spa_lookup_by_guid(spa, guid, B_TRUE); - ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX); + ev = spa_event_create(spa, vd, NULL, ESC_ZFS_VDEV_REMOVE_AUX); spa_vdev_remove_aux(spa->spa_l2cache.sav_config, ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv); spa_load_l2cache(spa); @@ -5859,7 +5862,7 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t u /* * Clean up the vdev namespace. */ - ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV); + ev = spa_event_create(spa, vd, NULL, ESC_ZFS_VDEV_REMOVE_DEV); spa_vdev_remove_from_namespace(spa, vd); } else if (vd != NULL) { @@ -7331,7 +7334,7 @@ spa_has_active_shared_spare(spa_t *spa) } static sysevent_t * -spa_event_create(spa_t *spa, vdev_t *vd, const char *name) +spa_event_create(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl, const char *name) { sysevent_t *ev = NULL; #ifdef _KERNEL @@ -7368,6 +7371,10 @@ spa_event_create(spa_t *spa, vdev_t *vd, const char *n } } + if (hist_nvl != NULL) { + fnvlist_merge((nvlist_t *)attr, hist_nvl); + } + if (sysevent_attach_attributes(ev, attr) != 0) goto done; attr = NULL; @@ -7394,12 +7401,12 @@ spa_event_post(sysevent_t *ev) /* * Post a sysevent corresponding to the given event. The 'name' must be one of * the event definitions in sys/sysevent/eventdefs.h. The payload will be - * filled in from the spa and (optionally) the vdev. This doesn't do anything - * in the userland libzpool, as we don't want consumers to misinterpret ztest - * or zdb as real changes. + * filled in from the spa and (optionally) the vdev and history nvl. This + * doesn't do anything in the userland libzpool, as we don't want consumers to + * misinterpret ztest or zdb as real changes. */ void -spa_event_notify(spa_t *spa, vdev_t *vd, const char *name) +spa_event_notify(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl, const char *name) { - spa_event_post(spa_event_create(spa, vd, name)); + spa_event_post(spa_event_create(spa, vd, hist_nvl, name)); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Thu Mar 22 23:56:17 2018 (r331397) @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright 2017 Joyent, Inc. */ #include @@ -321,7 +322,7 @@ spa_config_sync(spa_t *target, boolean_t removing, boo spa_config_generation++; if (postsysevent) - spa_event_notify(target, NULL, ESC_ZFS_CONFIG_SYNC); + spa_event_notify(target, NULL, NULL, ESC_ZFS_CONFIG_SYNC); } /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c Thu Mar 22 23:56:17 2018 (r331397) @@ -23,6 +23,7 @@ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. */ #include @@ -191,6 +192,71 @@ spa_history_zone(void) } /* + * Post a history sysevent. + * + * The nvlist_t* passed into this function will be transformed into a new + * nvlist where: + * + * 1. Nested nvlists will be flattened to a single level + * 2. Keys will have their names normalized (to remove any problematic + * characters, such as whitespace) + * + * The nvlist_t passed into this function will duplicated and should be freed + * by caller. + * + */ +static void +spa_history_log_notify(spa_t *spa, nvlist_t *nvl) +{ + nvlist_t *hist_nvl = fnvlist_alloc(); + uint64_t uint64; + char *string; + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_CMD, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_CMD, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_INT_NAME, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_INT_NAME, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_ZONE, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_ZONE, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_HOST, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_HOST, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_DSNAME, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_DSNAME, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_INT_STR, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_INT_STR, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_IOCTL, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_IOCTL, string); + + if (nvlist_lookup_string(nvl, ZPOOL_HIST_INT_NAME, &string) == 0) + fnvlist_add_string(hist_nvl, ZFS_EV_HIST_INT_NAME, string); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_DSID, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_DSID, uint64); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_TXG, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_TXG, uint64); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_TIME, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_TIME, uint64); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_WHO, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_WHO, uint64); + + if (nvlist_lookup_uint64(nvl, ZPOOL_HIST_INT_EVENT, &uint64) == 0) + fnvlist_add_uint64(hist_nvl, ZFS_EV_HIST_INT_EVENT, uint64); + + spa_event_notify(spa, NULL, hist_nvl, ESC_ZFS_HISTORY_EVENT); + + nvlist_free(hist_nvl); +} + +/* * Write out a history event. */ /*ARGSUSED*/ @@ -254,6 +320,22 @@ spa_history_log_sync(void *arg, dmu_tx_t *tx) fnvlist_lookup_string(nvl, ZPOOL_HIST_INT_NAME), fnvlist_lookup_string(nvl, ZPOOL_HIST_INT_STR)); } + /* + * The history sysevent is posted only for internal history + * messages to show what has happened, not how it happened. For + * example, the following command: + * + * # zfs destroy -r tank/foo + * + * will result in one sysevent posted per dataset that is + * destroyed as a result of the command - which could be more + * than one event in total. By contrast, if the sysevent was + * posted as a result of the ZPOOL_HIST_CMD key being present + * it would result in only one sysevent being posted with the + * full command line arguments, requiring the consumer to know + * how to parse and understand zfs(1M) command invocations. + */ + spa_history_log_notify(spa, nvl); } else if (nvlist_exists(nvl, ZPOOL_HIST_IOCTL)) { zfs_dbgmsg("ioctl %s", fnvlist_lookup_string(nvl, ZPOOL_HIST_IOCTL)); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Thu Mar 22 23:56:17 2018 (r331397) @@ -25,6 +25,7 @@ * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2013 Saso Kiselkov. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. */ @@ -898,7 +899,8 @@ extern void spa_prop_clear_bootfs(spa_t *spa, uint64_t extern void spa_configfile_set(spa_t *, nvlist_t *, boolean_t); /* asynchronous event notification */ -extern void spa_event_notify(spa_t *spa, vdev_t *vdev, const char *name); +extern void spa_event_notify(spa_t *spa, vdev_t *vdev, nvlist_t *hist_nvl, + const char *name); #ifdef ZFS_DEBUG #define dprintf_bp(bp, fmt, ...) do { \ Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Mar 22 23:56:17 2018 (r331397) @@ -25,6 +25,7 @@ * Copyright 2017 Nexenta Systems, Inc. * Copyright 2013 Martin Matuska . All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. */ #include @@ -2651,7 +2652,7 @@ vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, if (wasoffline || (oldstate < VDEV_STATE_DEGRADED && vd->vdev_state >= VDEV_STATE_DEGRADED)) - spa_event_notify(spa, vd, ESC_ZFS_VDEV_ONLINE); + spa_event_notify(spa, vd, NULL, ESC_ZFS_VDEV_ONLINE); return (spa_vdev_state_exit(spa, vd, 0)); } @@ -2822,7 +2823,7 @@ vdev_clear(spa_t *spa, vdev_t *vd) if (vd->vdev_aux == NULL && !vdev_is_dead(vd)) spa_async_request(spa, SPA_ASYNC_RESILVER); - spa_event_notify(spa, vd, ESC_ZFS_VDEV_CLEAR); + spa_event_notify(spa, vd, NULL, ESC_ZFS_VDEV_CLEAR); } /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu Mar 22 23:56:17 2018 (r331397) @@ -23,9 +23,9 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2012, Martin Matuska . All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. */ @@ -1019,11 +1019,45 @@ typedef enum { * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional) * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64 + * + * ESC_ZFS_HISTORY_EVENT + * + * ZFS_EV_POOL_NAME DATA_TYPE_STRING + * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 + * ZFS_EV_HIST_TIME DATA_TYPE_UINT64 (optional) + * ZFS_EV_HIST_CMD DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_WHO DATA_TYPE_UINT64 (optional) + * ZFS_EV_HIST_ZONE DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_HOST DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_TXG DATA_TYPE_UINT64 (optional) + * ZFS_EV_HIST_INT_EVENT DATA_TYPE_UINT64 (optional) + * ZFS_EV_HIST_INT_STR DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_INT_NAME DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_IOCTL DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_DSNAME DATA_TYPE_STRING (optional) + * ZFS_EV_HIST_DSID DATA_TYPE_UINT64 (optional) + * + * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the + * history log nvlist. The keynames will be free of any spaces or other + * characters that could be potentially unexpected to consumers of the + * sysevents. */ #define ZFS_EV_POOL_NAME "pool_name" #define ZFS_EV_POOL_GUID "pool_guid" #define ZFS_EV_VDEV_PATH "vdev_path" #define ZFS_EV_VDEV_GUID "vdev_guid" +#define ZFS_EV_HIST_TIME "history_time" +#define ZFS_EV_HIST_CMD "history_command" +#define ZFS_EV_HIST_WHO "history_who" +#define ZFS_EV_HIST_ZONE "history_zone" +#define ZFS_EV_HIST_HOST "history_hostname" +#define ZFS_EV_HIST_TXG "history_txg" +#define ZFS_EV_HIST_INT_EVENT "history_internal_event" +#define ZFS_EV_HIST_INT_STR "history_internal_str" +#define ZFS_EV_HIST_INT_NAME "history_internal_name" +#define ZFS_EV_HIST_IOCTL "history_ioctl" +#define ZFS_EV_HIST_DSNAME "history_dsname" +#define ZFS_EV_HIST_DSID "history_dsid" #ifdef __cplusplus } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Thu Mar 22 23:55:00 2018 (r331396) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Thu Mar 22 23:56:17 2018 (r331397) @@ -22,6 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2016 Nexenta Systems, Inc. + * Copyright 2017 Joyent, Inc. */ #ifndef _SYS_SYSEVENT_EVENTDEFS_H @@ -208,6 +209,7 @@ extern "C" { #define ESC_ZFS_VDEV_SPARE "ESC_ZFS_vdev_spare" #define ESC_ZFS_BOOTFS_VDEV_ATTACH "ESC_ZFS_bootfs_vdev_attach" #define ESC_ZFS_POOL_REGUID "ESC_ZFS_pool_reguid" +#define ESC_ZFS_HISTORY_EVENT "ESC_ZFS_history_event" #define ESC_ZFS_VDEV_AUTOEXPAND "ESC_ZFS_vdev_autoexpand" /* From owner-svn-src-stable@freebsd.org Thu Mar 22 23:56:54 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94168F556F1; Thu, 22 Mar 2018 23:56:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4775673F04; Thu, 22 Mar 2018 23:56:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41C2E1836C; Thu, 22 Mar 2018 23:56:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNusMe001212; Thu, 22 Mar 2018 23:56:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNusQ2001211; Thu, 22 Mar 2018 23:56:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222356.w2MNusQ2001211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:56:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331398 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 331398 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, 22 Mar 2018 23:56:54 -0000 Author: mav Date: Thu Mar 22 23:56:53 2018 New Revision: 331398 URL: https://svnweb.freebsd.org/changeset/base/331398 Log: MFC r329691: MFV r322231: 8430 dir_is_empty_readdir() doesn't properly handle error from fdopendir() illumos/illumos-gate@ba6e7e6505150388de6dc6a88741164118a421bf https://github.com/illumos/illumos-gate/commit/ba6e7e6505150388de6dc6a88741164118a421bf https://www.illumos.org/issues/8430 we should close dirfd if fdopendir() fails. Reviewed by: Serapheim Dimitropoulos Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Reviewed by: Yuri Pankov Reviewed by: Igor Kozhukhov Approved by: Robert Mustacchi Author: Sowrabha Gopal Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:56:17 2018 (r331397) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Thu Mar 22 23:56:53 2018 (r331398) @@ -216,6 +216,7 @@ dir_is_empty_readdir(const char *dirname) } if ((dirp = fdopendir(dirfd)) == NULL) { + (void) close(dirfd); return (B_TRUE); } From owner-svn-src-stable@freebsd.org Thu Mar 22 23:58:06 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD946F55A4C; Thu, 22 Mar 2018 23:58:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 67FCE740EF; Thu, 22 Mar 2018 23:58:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F50218398; Thu, 22 Mar 2018 23:58:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MNw62r001321; Thu, 22 Mar 2018 23:58:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MNw5kP001312; Thu, 22 Mar 2018 23:58:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201803222358.w2MNw5kP001312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Mar 2018 23:58: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: r331399 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 331399 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, 22 Mar 2018 23:58:07 -0000 Author: mav Date: Thu Mar 22 23:58:05 2018 New Revision: 331399 URL: https://svnweb.freebsd.org/changeset/base/331399 Log: MFC r329694: MFV r324198: 8081 Compiler warnings in zdb illumos/illumos-gate@3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://github.com/illumos/illumos-gate/commit/3f7978d02b206a6ebc5652c91aa9f42da6fbe00c https://www.illumos.org/issues/8081 zdb(8) is full of minor problems that generate compiler warnings. On FreeBSD, which uses -WError, the only way to build it is to disable all compiler warnings. This makes it much harder to detect newly introduced bugs. We should cleanup all the warnings. Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Approved by: Richard Lowe Author: Alan Somers Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Mar 22 23:58:05 2018 (r331399) @@ -4458,8 +4458,9 @@ arc_kmem_reap_now(void) * This possible deadlock is avoided by always acquiring a hash lock * using mutex_tryenter() from arc_reclaim_thread(). */ +/* ARGSUSED */ static void -arc_reclaim_thread(void *dummy __unused) +arc_reclaim_thread(void *unused __unused) { hrtime_t growtime = 0; callb_cpr_t cpr; @@ -7596,8 +7597,9 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint * This thread feeds the L2ARC at regular intervals. This is the beating * heart of the L2ARC. */ +/* ARGSUSED */ static void -l2arc_feed_thread(void *dummy __unused) +l2arc_feed_thread(void *unused __unused) { callb_cpr_t cpr; l2arc_dev_t *dev; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Mar 22 23:58:05 2018 (r331399) @@ -505,8 +505,9 @@ dbuf_evict_one(void) * of the dbuf cache is at or below the maximum size. Once the dbuf is aged * out of the cache it is destroyed and becomes eligible for arc eviction. */ +/* ARGSUSED */ static void -dbuf_evict_thread(void *dummy __unused) +dbuf_evict_thread(void *unused __unused) { callb_cpr_t cpr; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Mar 22 23:58:05 2018 (r331399) @@ -6180,7 +6180,7 @@ spa_async_autoexpand(spa_t *spa, vdev_t *vd) static void spa_async_thread(void *arg) { - spa_t *spa = arg; + spa_t *spa = (spa_t *)arg; int tasks; ASSERT(spa->spa_sync_on); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h Thu Mar 22 23:58:05 2018 (r331399) @@ -41,7 +41,7 @@ extern "C" { * particular object, use FTAG (which is a string) for the holder_tag. * Otherwise, use the object that holds the reference. */ -#define FTAG ((char *)__func__) +#define FTAG ((char *)(uintptr_t)__func__) #ifdef ZFS_DEBUG typedef struct reference { Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h Thu Mar 22 23:58:05 2018 (r331399) @@ -147,8 +147,8 @@ int sa_replace_all_by_template(sa_handle_t *, sa_bulk_ int sa_replace_all_by_template_locked(sa_handle_t *, sa_bulk_attr_t *, int, dmu_tx_t *); boolean_t sa_enabled(objset_t *); -void sa_cache_init(); -void sa_cache_fini(); +void sa_cache_init(void); +void sa_cache_fini(void); int sa_set_sa_object(objset_t *, uint64_t); int sa_hdrsize(void *); void sa_handle_lock(sa_handle_t *); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Thu Mar 22 23:58:05 2018 (r331399) @@ -890,7 +890,7 @@ extern void vdev_cache_stat_fini(void); /* Initialization and termination */ extern void spa_init(int flags); extern void spa_fini(void); -extern void spa_boot_init(); +extern void spa_boot_init(void); /* properties */ extern int spa_prop_set(spa_t *spa, nvlist_t *nvp); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Thu Mar 22 23:58:05 2018 (r331399) @@ -389,7 +389,7 @@ typedef int zil_parse_blk_func_t(zilog_t *zilog, blkpt uint64_t txg); typedef int zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg, uint64_t txg); -typedef int zil_replay_func_t(); +typedef int zil_replay_func_t(void *arg1, void *arg2, boolean_t byteswap); typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, struct lwb *lwb, zio_t *zio); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c Thu Mar 22 23:58:05 2018 (r331399) @@ -72,7 +72,7 @@ zfs_init_vattr(vattr_t *vap, uint64_t mask, uint64_t m /* ARGSUSED */ static int -zfs_replay_error(zfsvfs_t *zfsvfs, lr_t *lr, boolean_t byteswap) +zfs_replay_error(void *arg1, void *arg2, boolean_t byteswap) { return (SET_ERROR(ENOTSUP)); } @@ -265,9 +265,10 @@ zfs_replay_swap_attrs(lr_attr_t *lrattr) * as option FUID information. */ static int -zfs_replay_create_acl(zfsvfs_t *zfsvfs, - lr_acl_create_t *lracl, boolean_t byteswap) +zfs_replay_create_acl(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_acl_create_t *lracl = arg2; char *name = NULL; /* location determined later */ lr_create_t *lr = (lr_create_t *)lracl; znode_t *dzp; @@ -414,8 +415,10 @@ bail: } static int -zfs_replay_create(zfsvfs_t *zfsvfs, lr_create_t *lr, boolean_t byteswap) +zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_create_t *lr = arg2; char *name = NULL; /* location determined later */ char *link; /* symlink content follows name */ znode_t *dzp; @@ -546,8 +549,10 @@ out: } static int -zfs_replay_remove(zfsvfs_t *zfsvfs, lr_remove_t *lr, boolean_t byteswap) +zfs_replay_remove(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_remove_t *lr = arg2; char *name = (char *)(lr + 1); /* name follows lr_remove_t */ znode_t *dzp; struct componentname cn; @@ -597,8 +602,10 @@ fail: } static int -zfs_replay_link(zfsvfs_t *zfsvfs, lr_link_t *lr, boolean_t byteswap) +zfs_replay_link(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_link_t *lr = arg2; char *name = (char *)(lr + 1); /* name follows lr_link_t */ znode_t *dzp, *zp; struct componentname cn; @@ -637,8 +644,10 @@ zfs_replay_link(zfsvfs_t *zfsvfs, lr_link_t *lr, boole } static int -zfs_replay_rename(zfsvfs_t *zfsvfs, lr_rename_t *lr, boolean_t byteswap) +zfs_replay_rename(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_rename_t *lr = arg2; char *sname = (char *)(lr + 1); /* sname and tname follow lr_rename_t */ char *tname = sname + strlen(sname) + 1; znode_t *sdzp, *tdzp; @@ -707,8 +716,10 @@ fail: } static int -zfs_replay_write(zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap) +zfs_replay_write(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_write_t *lr = arg2; char *data = (char *)(lr + 1); /* data follows lr_write_t */ znode_t *zp; int error; @@ -773,8 +784,10 @@ zfs_replay_write(zfsvfs_t *zfsvfs, lr_write_t *lr, boo * the file is grown. */ static int -zfs_replay_write2(zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap) +zfs_replay_write2(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_write_t *lr = arg2; znode_t *zp; int error; uint64_t end; @@ -818,9 +831,11 @@ top: } static int -zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *lr, boolean_t byteswap) +zfs_replay_truncate(void *arg1, void *arg2, boolean_t byteswap) { #ifdef illumos + zfsvfs_t *zfsvfs = arg1; + lr_truncate_t *lr = arg2; znode_t *zp; flock64_t fl; int error; @@ -850,8 +865,10 @@ zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *l } static int -zfs_replay_setattr(zfsvfs_t *zfsvfs, lr_setattr_t *lr, boolean_t byteswap) +zfs_replay_setattr(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_setattr_t *lr = arg2; znode_t *zp; xvattr_t xva; vattr_t *vap = &xva.xva_vattr; @@ -909,8 +926,10 @@ extern int zfs_setsecattr(vnode_t *vp, vsecattr_t *vse caller_context_t *ct); static int -zfs_replay_acl_v0(zfsvfs_t *zfsvfs, lr_acl_v0_t *lr, boolean_t byteswap) +zfs_replay_acl_v0(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_acl_v0_t *lr = arg2; ace_t *ace = (ace_t *)(lr + 1); /* ace array follows lr_acl_t */ vsecattr_t vsa; vnode_t *vp; @@ -957,8 +976,10 @@ zfs_replay_acl_v0(zfsvfs_t *zfsvfs, lr_acl_v0_t *lr, b * */ static int -zfs_replay_acl(zfsvfs_t *zfsvfs, lr_acl_t *lr, boolean_t byteswap) +zfs_replay_acl(void *arg1, void *arg2, boolean_t byteswap) { + zfsvfs_t *zfsvfs = arg1; + lr_acl_t *lr = arg2; ace_t *ace = (ace_t *)(lr + 1); vsecattr_t vsa; znode_t *zp; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Mar 22 23:56:53 2018 (r331398) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Mar 22 23:58:05 2018 (r331399) @@ -495,8 +495,10 @@ zvol_create_cb(objset_t *os, void *arg, cred_t *cr, dm * implement DKIOCFREE/free-long-range. */ static int -zvol_replay_truncate(zvol_state_t *zv, lr_truncate_t *lr, boolean_t byteswap) +zvol_replay_truncate(void *arg1, void *arg2, boolean_t byteswap) { + zvol_state_t *zv = arg1; + lr_truncate_t *lr = arg2; uint64_t offset, length; if (byteswap) @@ -513,8 +515,10 @@ zvol_replay_truncate(zvol_state_t *zv, lr_truncate_t * * after a system failure */ static int -zvol_replay_write(zvol_state_t *zv, lr_write_t *lr, boolean_t byteswap) +zvol_replay_write(void *arg1, void *arg2, boolean_t byteswap) { + zvol_state_t *zv = arg1; + lr_write_t *lr = arg2; objset_t *os = zv->zv_objset; char *data = (char *)(lr + 1); /* data follows lr_write_t */ uint64_t offset, length; @@ -551,7 +555,7 @@ zvol_replay_write(zvol_state_t *zv, lr_write_t *lr, bo /* ARGSUSED */ static int -zvol_replay_err(zvol_state_t *zv, lr_t *lr, boolean_t byteswap) +zvol_replay_err(void *arg1, void *arg2, boolean_t byteswap) { return (SET_ERROR(ENOTSUP)); } From owner-svn-src-stable@freebsd.org Fri Mar 23 01:37:33 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC0A9F5D907; Fri, 23 Mar 2018 01:37:32 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A1EDC780BA; Fri, 23 Mar 2018 01:37:32 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CA9A194E0; Fri, 23 Mar 2018 01:37:32 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N1bWnS050989; Fri, 23 Mar 2018 01:37:32 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N1bW84050982; Fri, 23 Mar 2018 01:37:32 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201803230137.w2N1bW84050982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 23 Mar 2018 01:37:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331402 - in stable/11/sys/arm: conf versatile X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/11/sys/arm: conf versatile X-SVN-Commit-Revision: 331402 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, 23 Mar 2018 01:37:33 -0000 Author: gonzo Date: Fri Mar 23 01:37:31 2018 New Revision: 331402 URL: https://svnweb.freebsd.org/changeset/base/331402 Log: MFC r316370-r316371 r316370: [versatilepb] Convert VERSATILEPB kernel to INTRNG and switch to upstream DTB Scope of this change is somewhat larger than just converting to INTRNG. The reason for this is that INTRNG support required switching from custom to upstream DTS because custom DTS didn't have interrup routing information. This switch caused rewrite of PCI and CLCD drivers and adding SCM module. List of changes in this commit: - Enable INTRNG and switch to versatile-pb.dts - Add SCM driver that controls various peripheral devices like LCD or PCI controller. Previously registers required for power-up and configuring peripherals were part of their respective nodes. Upstream DTS has dedicated node for SCM - Convert PL190 driver to INTRNG - Convert Versatile SIC (secondary interrupt controller) to INTRNG - Refactor CLCD driver to use SCM API to power up and configuration - Refactor PCI driver to use SCM API to enable controller - Refactor PCI driver to use interrupt map provided in DTS for interrupt routing. As a result it fixes broken IRQ routing and it's no longer required to run QEMU with "-global versatile_pci.broken-irq-mapping=1" command-line arguments r316371: [versatilepb] Fix keyboard driver after switching to upstream DTS FreeBSD's DTS contained only one PL050 node and driver considered it to be PS/2 keyboard. In reality PL050 is a PS/2 port that pushes bytes to/from the periphers connected to it. New DTS contains two nodes and QEMU emulates keyboard connected to port #0 and mouse connected to port #1. Since there is no way to say what's connected to port by checking DTS we hardcode this knowledge in the driver: it assumes keyboard on port #0 and ignores port #1 altogether. Also QEMU defaults emulated keyboard to scan code set 2 while driver used to work with scan code set 1 so when initializing driver make sure keyboard is switched to scan code set 1 Added: stable/11/sys/arm/versatile/versatile_scm.c - copied unchanged from r316371, head/sys/arm/versatile/versatile_scm.c stable/11/sys/arm/versatile/versatile_scm.h - copied unchanged from r316371, head/sys/arm/versatile/versatile_scm.h Modified: stable/11/sys/arm/conf/VERSATILEPB stable/11/sys/arm/versatile/files.versatile stable/11/sys/arm/versatile/pl050.c stable/11/sys/arm/versatile/versatile_clcd.c stable/11/sys/arm/versatile/versatile_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/conf/VERSATILEPB ============================================================================== --- stable/11/sys/arm/conf/VERSATILEPB Fri Mar 23 00:40:08 2018 (r331401) +++ stable/11/sys/arm/conf/VERSATILEPB Fri Mar 23 01:37:31 2018 (r331402) @@ -68,7 +68,9 @@ makeoptions SC_DFLT_FONT=cp437 device md device random # Entropy device +options INTRNG + # Flattened Device Tree options FDT # Configure using FDT/DTB data options FDT_DTB_STATIC -makeoptions FDT_DTS_FILE=versatilepb.dts +makeoptions FDT_DTS_FILE=versatile-pb.dts Modified: stable/11/sys/arm/versatile/files.versatile ============================================================================== --- stable/11/sys/arm/versatile/files.versatile Fri Mar 23 00:40:08 2018 (r331401) +++ stable/11/sys/arm/versatile/files.versatile Fri Mar 23 01:37:31 2018 (r331402) @@ -6,6 +6,7 @@ arm/versatile/versatile_machdep.c standard arm/versatile/versatile_clcd.c optional sc arm/versatile/versatile_common.c standard arm/versatile/versatile_pci.c optional pci +arm/versatile/versatile_scm.c standard arm/versatile/versatile_sic.c standard arm/versatile/versatile_timer.c standard Modified: stable/11/sys/arm/versatile/pl050.c ============================================================================== --- stable/11/sys/arm/versatile/pl050.c Fri Mar 23 00:40:08 2018 (r331401) +++ stable/11/sys/arm/versatile/pl050.c Fri Mar 23 01:37:31 2018 (r331402) @@ -109,7 +109,10 @@ __FBSDID("$FreeBSD$"); #define KMI_DRIVER_NAME "kmi" #define KMI_NFKEY (sizeof(fkey_tab)/sizeof(fkey_tab[0])) /* units */ +#define SET_SCANCODE_SET 0xf0 + struct kmi_softc { + device_t sc_dev; keyboard_t sc_kbd; keymap_t sc_keymap; accentmap_t sc_accmap; @@ -145,6 +148,8 @@ static int kmi_ioctl(keyboard_t *, u_long, caddr_t); static int kmi_enable(keyboard_t *); static int kmi_disable(keyboard_t *); +static int kmi_attached = 0; + /* early keyboard probe, not supported */ static int kmi_configure(int flags) @@ -483,7 +488,6 @@ kmi_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) } } - /* clear the internal state of the keyboard */ static void kmi_clear_state(keyboard_t *kbd) @@ -613,6 +617,17 @@ pl050_kmi_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); + /* + * PL050 is plain PS2 port that pushes bytes to/from computer + * VersatilePB has two such ports and QEMU simulates keyboard + * connected to port #0 and mouse connected to port #1. This + * information can't be obtained from device tree so we just + * hardcode this knowledge here. We attach keyboard driver to + * port #0 and ignore port #1 + */ + if (kmi_attached) + return (ENXIO); + if (ofw_bus_is_compatible(dev, "arm,pl050")) { device_set_desc(dev, "PL050 Keyboard/Mouse Interface"); return (BUS_PROBE_DEFAULT); @@ -628,7 +643,9 @@ pl050_kmi_attach(device_t dev) keyboard_t *kbd; int rid; int i; + uint32_t ack; + sc->sc_dev = dev; kbd = &sc->sc_kbd; rid = 0; @@ -657,6 +674,16 @@ pl050_kmi_attach(device_t dev) /* TODO: clock & divisor */ + pl050_kmi_write_4(sc, KMICR, KMICR_EN); + + pl050_kmi_write_4(sc, KMIDATA, SET_SCANCODE_SET); + /* read out ACK */ + ack = pl050_kmi_read_4(sc, KMIDATA); + /* Set Scan Code set 1 (XT) */ + pl050_kmi_write_4(sc, KMIDATA, 1); + /* read out ACK */ + ack = pl050_kmi_read_4(sc, KMIDATA); + pl050_kmi_write_4(sc, KMICR, KMICR_EN | KMICR_RXINTREN); kbd_init_struct(kbd, KMI_DRIVER_NAME, KB_OTHER, @@ -692,6 +719,7 @@ pl050_kmi_attach(device_t dev) if (bootverbose) { genkbd_diag(kbd, bootverbose); } + kmi_attached = 1; return (0); detach: Modified: stable/11/sys/arm/versatile/versatile_clcd.c ============================================================================== --- stable/11/sys/arm/versatile/versatile_clcd.c Fri Mar 23 00:40:08 2018 (r331401) +++ stable/11/sys/arm/versatile/versatile_clcd.c Fri Mar 23 01:37:31 2018 (r331402) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2012-2017 Oleksandr Tymoshenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,22 +52,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #define PL110_VENDOR_ARM926PXP 1 -#define MEM_SYS 0 -#define MEM_CLCD 1 -#define MEM_REGIONS 2 - -#define SYS_CLCD 0x00 -#define SYS_CLCD_CLCDID_SHIFT 0x08 -#define SYS_CLCD_CLCDID_MASK 0x1f -#define SYS_CLCD_PWR3V5VSWITCH (1 << 4) -#define SYS_CLCD_VDDPOSSWITCH (1 << 3) -#define SYS_CLCD_NLCDIOON (1 << 2) -#define SYS_CLCD_LCD_MODE_MASK 0x03 - #define CLCD_MODE_RGB888 0x0 #define CLCD_MODE_RGB555 0x01 #define CLCD_MODE_RBG565 0x02 @@ -122,18 +112,13 @@ __FBSDID("$FreeBSD$"); #define dprintf(fmt, args...) #endif -#define versatile_clcdc_sys_read_4(sc, reg) \ - bus_read_4((sc)->mem_res[MEM_SYS], (reg)) -#define versatile_clcdc_sys_write_4(sc, reg, val) \ - bus_write_4((sc)->mem_res[MEM_SYS], (reg), (val)) - #define versatile_clcdc_read_4(sc, reg) \ - bus_read_4((sc)->mem_res[MEM_CLCD], (reg)) + bus_read_4((sc)->mem_res, (reg)) #define versatile_clcdc_write_4(sc, reg, val) \ - bus_write_4((sc)->mem_res[MEM_CLCD], (reg), (val)) + bus_write_4((sc)->mem_res, (reg), (val)) struct versatile_clcdc_softc { - struct resource* mem_res[MEM_REGIONS]; + struct resource* mem_res; struct mtx mtx; @@ -208,12 +193,6 @@ static u_char mouse_pointer[16] = { static struct video_adapter_softc va_softc; -static struct resource_spec versatile_clcdc_mem_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE }, - { SYS_RES_MEMORY, 1, RF_ACTIVE }, - { -1, 0, 0 } -}; - static int versatilefb_configure(int); static void versatilefb_update_margins(video_adapter_t *adp); @@ -249,21 +228,25 @@ versatile_clcdc_attach(device_t dev) { struct versatile_clcdc_softc *sc = device_get_softc(dev); struct video_adapter_softc *va_sc = &va_softc; - int err; + int err, rid; uint32_t reg; int clcdid; int dma_size; /* Request memory resources */ - err = bus_alloc_resources(dev, versatile_clcdc_mem_spec, - sc->mem_res); - if (err) { - device_printf(dev, "Error: could not allocate memory resources\n"); + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "could not allocate memory resources\n"); return (ENXIO); } - reg = versatile_clcdc_sys_read_4(sc, SYS_CLCD); - clcdid = (reg >> SYS_CLCD_CLCDID_SHIFT) & SYS_CLCD_CLCDID_MASK; + err = versatile_scm_reg_read_4(SCM_CLCD, ®); + if (err) { + device_printf(dev, "failed to read SCM register\n"); + goto fail; + } + clcdid = (reg >> SCM_CLCD_CLCDID_SHIFT) & SCM_CLCD_CLCDID_MASK; switch (clcdid) { case 31: device_printf(dev, "QEMU VGA 640x480\n"); @@ -275,17 +258,17 @@ versatile_clcdc_attach(device_t dev) goto fail; } - reg &= ~SYS_CLCD_LCD_MODE_MASK; + reg &= ~SCM_CLCD_LCD_MODE_MASK; reg |= CLCD_MODE_RGB565; sc->mode = CLCD_MODE_RGB565; - versatile_clcdc_sys_write_4(sc, SYS_CLCD, reg); - dma_size = sc->width*sc->height*2; - - /* + versatile_scm_reg_write_4(SCM_CLCD, reg); + dma_size = sc->width*sc->height*2; + + /* * Power on LCD */ - reg |= SYS_CLCD_PWR3V5VSWITCH | SYS_CLCD_NLCDIOON; - versatile_clcdc_sys_write_4(sc, SYS_CLCD, reg); + reg |= SCM_CLCD_PWR3V5VSWITCH | SCM_CLCD_NLCDIOON; + versatile_scm_reg_write_4(SCM_CLCD, reg); /* * XXX: hardcoded timing for VGA. For other modes/panels @@ -657,7 +640,6 @@ versatilefb_init(int unit, video_adapter_t *adp, int f sc->xmargin = (sc->width - (vi->vi_width * vi->vi_cwidth)) / 2; sc->ymargin = (sc->height - (vi->vi_height * vi->vi_cheight))/2; - adp->va_window = (vm_offset_t) versatilefb_static_window; adp->va_flags |= V_ADP_FONT /* | V_ADP_COLOR | V_ADP_MODECHANGE */; Modified: stable/11/sys/arm/versatile/versatile_pci.c ============================================================================== --- stable/11/sys/arm/versatile/versatile_pci.c Fri Mar 23 00:40:08 2018 (r331401) +++ stable/11/sys/arm/versatile/versatile_pci.c Fri Mar 23 01:37:31 2018 (r331402) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2012-2017 Oleksandr Tymoshenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,18 +55,18 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include + #include #include -#define MEM_SYS 0 -#define MEM_CORE 1 -#define MEM_BASE 2 -#define MEM_CONF_BASE 3 -#define MEM_REGIONS 4 +#define MEM_CORE 0 +#define MEM_BASE 1 +#define MEM_CONF_BASE 2 +#define MEM_REGIONS 3 -#define SYS_PCICTL 0x00 - #define PCI_CORE_IMAP0 0x00 #define PCI_CORE_IMAP1 0x04 #define PCI_CORE_IMAP2 0x08 @@ -95,12 +95,6 @@ __FBSDID("$FreeBSD$"); #define dprintf(fmt, args...) #endif - -#define versatile_pci_sys_read_4(reg) \ - bus_read_4(sc->mem_res[MEM_SYS], (reg)) -#define versatile_pci_sys_write_4(reg, val) \ - bus_write_4(sc->mem_res[MEM_SYS], (reg), (val)) - #define versatile_pci_core_read_4(reg) \ bus_read_4(sc->mem_res[MEM_CORE], (reg)) #define versatile_pci_core_write_4(reg, val) \ @@ -134,13 +128,13 @@ struct versatile_pci_softc { struct rman mem_rman; struct mtx mtx; + struct ofw_bus_iinfo pci_iinfo; }; static struct resource_spec versatile_pci_mem_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_MEMORY, 1, RF_ACTIVE }, { SYS_RES_MEMORY, 2, RF_ACTIVE }, - { SYS_RES_MEMORY, 3, RF_ACTIVE }, { -1, 0, 0 } }; @@ -151,7 +145,7 @@ versatile_pci_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (ofw_bus_is_compatible(dev, "versatile,pci")) { + if (ofw_bus_is_compatible(dev, "arm,versatile-pci")) { device_set_desc(dev, "Versatile PCI controller"); return (BUS_PROBE_DEFAULT); } @@ -167,7 +161,10 @@ versatile_pci_attach(device_t dev) int slot; uint32_t vendordev_id, class_id; uint32_t val; + phandle_t node; + node = ofw_bus_get_node(dev); + /* Request memory resources */ err = bus_alloc_resources(dev, versatile_pci_mem_spec, sc->mem_res); @@ -191,7 +188,7 @@ versatile_pci_attach(device_t dev) versatile_pci_core_write_4(PCI_CORE_SMAP1, (PCI_NPREFETCH_WINDOW >> 28)); versatile_pci_core_write_4(PCI_CORE_SMAP2, (PCI_NPREFETCH_WINDOW >> 28)); - versatile_pci_sys_write_4(SYS_PCICTL, 1); + versatile_scm_reg_write_4(SCM_PCICTL, 1); for (slot = 0; slot <= PCI_SLOTMAX; slot++) { vendordev_id = versatile_pci_read_4((slot << 11) + PCIR_DEVVENDOR); @@ -268,6 +265,8 @@ versatile_pci_attach(device_t dev) versatile_pci_conf_write_4((slot << 11) + PCIR_COMMAND, val); } + ofw_bus_setup_iinfo(node, &sc->pci_iinfo, sizeof(cell_t)); + device_add_child(dev, "pci", -1); return (bus_generic_attach(dev)); } @@ -321,7 +320,7 @@ versatile_pci_alloc_resource(device_t bus, device_t ch rm = &sc->io_rman; break; case SYS_RES_IRQ: - rm = &sc->irq_rman; + rm = NULL; break; case SYS_RES_MEMORY: rm = &sc->mem_rman; @@ -330,8 +329,11 @@ versatile_pci_alloc_resource(device_t bus, device_t ch return (NULL); } - rv = rman_reserve_resource(rm, start, end, count, flags, child); + if (rm == NULL) + return (BUS_ALLOC_RESOURCE(device_get_parent(bus), + child, type, rid, start, end, count, flags)); + rv = rman_reserve_resource(rm, start, end, count, flags, child); if (rv == NULL) return (NULL); @@ -392,8 +394,6 @@ versatile_pci_teardown_intr(device_t dev, device_t chi return BUS_TEARDOWN_INTR(device_get_parent(dev), dev, ires, cookie); } - - static int versatile_pci_maxslots(device_t dev) { @@ -402,10 +402,33 @@ versatile_pci_maxslots(device_t dev) } static int -versatile_pci_route_interrupt(device_t pcib, device_t device, int pin) +versatile_pci_route_interrupt(device_t bus, device_t dev, int pin) { + struct versatile_pci_softc *sc; + struct ofw_pci_register reg; + uint32_t pintr, mintr[4]; + phandle_t iparent; + int intrcells; - return (27 + ((pci_get_slot(device) + pin - 1) & 3)); + sc = device_get_softc(bus); + pintr = pin; + + bzero(®, sizeof(reg)); + reg.phys_hi = (pci_get_bus(dev) << OFW_PCI_PHYS_HI_BUSSHIFT) | + (pci_get_slot(dev) << OFW_PCI_PHYS_HI_DEVICESHIFT) | + (pci_get_function(dev) << OFW_PCI_PHYS_HI_FUNCTIONSHIFT); + + intrcells = ofw_bus_lookup_imap(ofw_bus_get_node(dev), + &sc->pci_iinfo, ®, sizeof(reg), &pintr, sizeof(pintr), + mintr, sizeof(mintr), &iparent); + if (intrcells) { + pintr = ofw_bus_map_intr(dev, iparent, intrcells, mintr); + return (pintr); + } + + device_printf(bus, "could not route pin %d for device %d.%d\n", + pin, pci_get_slot(dev), pci_get_function(dev)); + return (PCI_INVALID_IRQ); } static uint32_t Copied: stable/11/sys/arm/versatile/versatile_scm.c (from r316371, head/sys/arm/versatile/versatile_scm.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/arm/versatile/versatile_scm.c Fri Mar 23 01:37:31 2018 (r331402, copy of r316371, head/sys/arm/versatile/versatile_scm.c) @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2017 Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Ben Gray. + * 4. The name of the company nor the name of the author may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL BEN GRAY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * SCM - System Control Module + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "versatile_scm.h" + +struct versatile_scm_softc { + device_t sc_dev; + struct resource * sc_mem_res; +}; + +static struct versatile_scm_softc *versatile_scm_sc; + +#define versatile_scm_read_4(sc, reg) \ + bus_read_4((sc)->sc_mem_res, (reg)) +#define versatile_scm_write_4(sc, reg, val) \ + bus_write_4((sc)->sc_mem_res, (reg), (val)) + +static int +versatile_scm_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "syscon")) + return (ENXIO); + + if (versatile_scm_sc) { + return (EEXIST); + } + + device_set_desc(dev, "Versatile Control Module"); + return (BUS_PROBE_DEFAULT); +} + +static int +versatile_scm_attach(device_t dev) +{ + struct versatile_scm_softc *sc; + int rid; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + + if (sc->sc_mem_res == NULL) { + device_printf(dev, "could not allocate memory resources\n"); + return (ENXIO); + } + + versatile_scm_sc = sc; + + return (0); +} + +int +versatile_scm_reg_read_4(uint32_t reg, uint32_t *val) +{ + if (!versatile_scm_sc) + return (ENXIO); + + *val = versatile_scm_read_4(versatile_scm_sc, reg); + return (0); +} + +int +versatile_scm_reg_write_4(uint32_t reg, uint32_t val) +{ + if (!versatile_scm_sc) + return (ENXIO); + + versatile_scm_write_4(versatile_scm_sc, reg, val); + return (0); +} + +static device_method_t versatile_scm_methods[] = { + DEVMETHOD(device_probe, versatile_scm_probe), + DEVMETHOD(device_attach, versatile_scm_attach), + + DEVMETHOD_END +}; + +static driver_t versatile_scm_driver = { + "scm", + versatile_scm_methods, + sizeof(struct versatile_scm_softc), +}; + +static devclass_t versatile_scm_devclass; + +EARLY_DRIVER_MODULE(versatile_scm, simplebus, versatile_scm_driver, versatile_scm_devclass, 0, 0, + BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); Copied: stable/11/sys/arm/versatile/versatile_scm.h (from r316371, head/sys/arm/versatile/versatile_scm.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/arm/versatile/versatile_scm.h Fri Mar 23 01:37:31 2018 (r331402, copy of r316371, head/sys/arm/versatile/versatile_scm.h) @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2017 Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Ben Gray. + * 4. The name of the company nor the name of the author may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL BEN GRAY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _VERSATILE_SCM_H_ +#define _VERSATILE_SCM_H_ + +#define SCM_PCICTL 0x44 +#define SCM_CLCD 0x50 +#define SCM_CLCD_CLCDID_SHIFT 0x08 +#define SCM_CLCD_CLCDID_MASK 0x1f +#define SCM_CLCD_PWR3V5VSWITCH (1 << 4) +#define SCM_CLCD_VDDPOSSWITCH (1 << 3) +#define SCM_CLCD_NLCDIOON (1 << 2) +#define SCM_CLCD_LCD_MODE_MASK 0x03 + +int versatile_scm_reg_read_4(uint32_t reg, uint32_t *val); +int versatile_scm_reg_write_4(uint32_t reg, uint32_t val); + +#endif /* _VERSATILE_SCM_H_ */ From owner-svn-src-stable@freebsd.org Fri Mar 23 01:43:28 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60DFAF5E06C; Fri, 23 Mar 2018 01:43:28 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 05EC4785B3; Fri, 23 Mar 2018 01:43:28 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFF8A19686; Fri, 23 Mar 2018 01:43:27 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2N1hRMX055870; Fri, 23 Mar 2018 01:43:27 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N1hRGQ055869; Fri, 23 Mar 2018 01:43:27 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201803230143.w2N1hRGQ055869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 23 Mar 2018 01: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: r331403 - stable/11/sys/gnu/dts/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/gnu/dts/arm X-SVN-Commit-Revision: 331403 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, 23 Mar 2018 01:43:28 -0000 Author: gonzo Date: Fri Mar 23 01:43:27 2018 New Revision: 331403 URL: https://svnweb.freebsd.org/changeset/base/331403 Log: Fix VERSATILEPB boot after r331402 r331402 MFCed switch from custom DTS to upstream one. stable/11 version still has main bus compatibility as "arm,amba-bus" while in Linux and HEAD it has been changed to "simple-bus". simplebus(4) supports only the latter so VERSATILEPB boot was broken by r331402. To fix this make manual change to stable/11 version of versatile-ab.dts Modified: stable/11/sys/gnu/dts/arm/versatile-ab.dts Modified: stable/11/sys/gnu/dts/arm/versatile-ab.dts ============================================================================== --- stable/11/sys/gnu/dts/arm/versatile-ab.dts Fri Mar 23 01:37:31 2018 (r331402) +++ stable/11/sys/gnu/dts/arm/versatile-ab.dts Fri Mar 23 01:43:27 2018 (r331403) @@ -148,7 +148,7 @@ }; amba { - compatible = "arm,amba-bus"; + compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges; From owner-svn-src-stable@freebsd.org Fri Mar 23 02:33:31 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86708F61D4C; Fri, 23 Mar 2018 02:33:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 39A557A95B; Fri, 23 Mar 2018 02:33: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 349D719E68; Fri, 23 Mar 2018 02:33: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 w2N2XVu8080701; Fri, 23 Mar 2018 02:33:31 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2XVV0080700; Fri, 23 Mar 2018 02:33:31 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803230233.w2N2XVV0080700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 02:33:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331409 - stable/11/sys/dev/drm X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/dev/drm X-SVN-Commit-Revision: 331409 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, 23 Mar 2018 02:33:31 -0000 Author: emaste Date: Fri Mar 23 02:33:30 2018 New Revision: 331409 URL: https://svnweb.freebsd.org/changeset/base/331409 Log: MFC r331339: Correct signedness bug in drm_modeset_ctl drm_modeset_ctl() takes a signed in from userland, does a boundscheck, and then uses it to index into a structure and write to it. The boundscheck only checks upper bound, and never checks for nagative values. If the int coming from userland is negative [after conversion] it will bypass the boundscheck, perform a negative index into an array and write to it, causing memory corruption. Note that this is in the "old" drm driver; this issue does not exist in drm2. Reported by: Ilja Van Sprundel Reviewed by: cem Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/dev/drm/drm_irq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/drm/drm_irq.c ============================================================================== --- stable/11/sys/dev/drm/drm_irq.c Fri Mar 23 02:30:29 2018 (r331408) +++ stable/11/sys/dev/drm/drm_irq.c Fri Mar 23 02:33:30 2018 (r331409) @@ -351,7 +351,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data goto out; crtc = modeset->crtc; - if (crtc >= dev->num_crtcs) { + if (crtc < 0 || crtc >= dev->num_crtcs) { ret = EINVAL; goto out; } From owner-svn-src-stable@freebsd.org Fri Mar 23 02:34:46 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12724F61F49; Fri, 23 Mar 2018 02:34:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BAAD47AAEF; Fri, 23 Mar 2018 02:34:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B577E19E69; Fri, 23 Mar 2018 02:34:45 +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 w2N2Yj7U080797; Fri, 23 Mar 2018 02:34:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2Yj8T080796; Fri, 23 Mar 2018 02:34:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803230234.w2N2Yj8T080796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 02:34:45 +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: r331410 - stable/10/sys/dev/drm X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/dev/drm X-SVN-Commit-Revision: 331410 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, 23 Mar 2018 02:34:46 -0000 Author: emaste Date: Fri Mar 23 02:34:45 2018 New Revision: 331410 URL: https://svnweb.freebsd.org/changeset/base/331410 Log: MFC r331339: Correct signedness bug in drm_modeset_ctl drm_modeset_ctl() takes a signed in from userland, does a boundscheck, and then uses it to index into a structure and write to it. The boundscheck only checks upper bound, and never checks for nagative values. If the int coming from userland is negative [after conversion] it will bypass the boundscheck, perform a negative index into an array and write to it, causing memory corruption. Note that this is in the "old" drm driver; this issue does not exist in drm2. Reported by: Ilja Van Sprundel Reviewed by: cem Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/dev/drm/drm_irq.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/drm/drm_irq.c ============================================================================== --- stable/10/sys/dev/drm/drm_irq.c Fri Mar 23 02:33:30 2018 (r331409) +++ stable/10/sys/dev/drm/drm_irq.c Fri Mar 23 02:34:45 2018 (r331410) @@ -357,7 +357,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data goto out; crtc = modeset->crtc; - if (crtc >= dev->num_crtcs) { + if (crtc < 0 || crtc >= dev->num_crtcs) { ret = EINVAL; goto out; } From owner-svn-src-stable@freebsd.org Fri Mar 23 02:37:09 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39A8FF623DC; Fri, 23 Mar 2018 02:37:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC2E57AF64; Fri, 23 Mar 2018 02:37:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2AD919E6A; Fri, 23 Mar 2018 02:37:08 +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 w2N2b8pr080938; Fri, 23 Mar 2018 02:37:08 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2b8wn080937; Fri, 23 Mar 2018 02:37:08 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803230237.w2N2b8wn080937@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 02:37:08 +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: r331411 - stable/11/sys/dev/drm X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/dev/drm X-SVN-Commit-Revision: 331411 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, 23 Mar 2018 02:37:09 -0000 Author: emaste Date: Fri Mar 23 02:37:08 2018 New Revision: 331411 URL: https://svnweb.freebsd.org/changeset/base/331411 Log: MFC r331333: Fix kernel memory disclosure in drm_infobufs drm_infobufs() has a structure on the stack, fills it out and copies it to userland. There are 2 elements in the struct that are not filled out and left uninitialized. This will leak uninitialized kernel stack data to userland. Submitted by: Domagoj Stolfa Reported by: Ilja Van Sprundel Security: Kernel memory disclosure (798) Modified: stable/11/sys/dev/drm/drm_bufs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/drm/drm_bufs.c ============================================================================== --- stable/11/sys/dev/drm/drm_bufs.c Fri Mar 23 02:34:45 2018 (r331410) +++ stable/11/sys/dev/drm/drm_bufs.c Fri Mar 23 02:37:08 2018 (r331411) @@ -935,6 +935,7 @@ int drm_infobufs(struct drm_device *dev, void *data, s if (dma->bufs[i].buf_count) { struct drm_buf_desc from; + memset(&from, 0, sizeof(from)); from.count = dma->bufs[i].buf_count; from.size = dma->bufs[i].buf_size; from.low_mark = dma->bufs[i].freelist.low_mark; From owner-svn-src-stable@freebsd.org Fri Mar 23 02:38:32 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D100F62618; Fri, 23 Mar 2018 02:38:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1EEDB7B12E; Fri, 23 Mar 2018 02:38:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19A9919E6B; Fri, 23 Mar 2018 02:38:32 +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 w2N2cVxV081042; Fri, 23 Mar 2018 02:38:31 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2N2cV8e081041; Fri, 23 Mar 2018 02:38:31 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201803230238.w2N2cV8e081041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Mar 2018 02:38:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r331412 - stable/10/sys/dev/drm X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/dev/drm X-SVN-Commit-Revision: 331412 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, 23 Mar 2018 02:38:32 -0000 Author: emaste Date: Fri Mar 23 02:38:31 2018 New Revision: 331412 URL: https://svnweb.freebsd.org/changeset/base/331412 Log: MFC r331333: Fix kernel memory disclosure in drm_infobufs drm_infobufs() has a structure on the stack, fills it out and copies it to userland. There are 2 elements in the struct that are not filled out and left uninitialized. This will leak uninitialized kernel stack data to userland. Submitted by: Domagoj Stolfa Reported by: Ilja Van Sprundel Security: Kernel memory disclosure (798) Modified: stable/10/sys/dev/drm/drm_bufs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/drm/drm_bufs.c ============================================================================== --- stable/10/sys/dev/drm/drm_bufs.c Fri Mar 23 02:37:08 2018 (r331411) +++ stable/10/sys/dev/drm/drm_bufs.c Fri Mar 23 02:38:31 2018 (r331412) @@ -935,6 +935,7 @@ int drm_infobufs(struct drm_device *dev, void *data, s if (dma->bufs[i].buf_count) { struct drm_buf_desc from; + memset(&from, 0, sizeof(from)); from.count = dma->bufs[i].buf_count; from.size = dma->bufs[i].buf_size; from.low_mark = dma->bufs[i].freelist.low_mark; From owner-svn-src-stable@freebsd.org Fri Mar 23 16:15:09 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7622F55B86; Fri, 23 Mar 2018 16:15:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 65E037C474; Fri, 23 Mar 2018 16:15:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60B44222D5; Fri, 23 Mar 2018 16:15:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NGF8jr091857; Fri, 23 Mar 2018 16:15:08 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NGF7n0091852; Fri, 23 Mar 2018 16:15:07 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803231615.w2NGF7n0091852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 23 Mar 2018 16:15:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331434 - in stable/11/lib: . libcapsicum X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/lib: . libcapsicum X-SVN-Commit-Revision: 331434 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, 23 Mar 2018 16:15:09 -0000 Author: ian Date: Fri Mar 23 16:15:07 2018 New Revision: 331434 URL: https://svnweb.freebsd.org/changeset/base/331434 Log: MFC r306657, r306673, r306726, r307737, r309366, r310135, r323990, r324414 r306657: libcapsicum: introduce Capsicum helpers Capsicum helpers are a set of inline functions which goal is to reduce duplicated patterns used to Capsicumize applications. Reviewed by: cem, AllanJude, bapt, ed, emaste Differential Revision: https://reviews.freebsd.org/D8013 r306673: libcapsicum: limit stderr Don't limit stdout twice, instead limit stderr. Pointed out by: rpokala@ r306726: Add man pages for Capsicum helpers. Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D8154 r307737: Fix few sentence in the man page. Pointed out by: wblock r309366: capsicum_helpers: Squash errors from closed fds Squash EBADF from closed stdin, stdout, or stderr in caph_limit_stdio(). Any program used during special shell scripts may commonly be forked from a parent process with closed standard stream. Do the common sense thing for this common use. Reported by: Iblis Lin Reviewed by: oshogbo@ (earlier version) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8657 r310135: capsicum_helpers: Add LOOKUP flag Add a helper routine for opening a directory that is restricted to being used for opening relative files as stdio streams. I think this will really help basic adaptation of multi-file programs to Capsicum. Rather than having each program initialize a rights object and ioctl/fcntl arrays for their root fd for relative opens, consolidate in the logical place. Reviewed by: oshogbo@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8743 r323990: capsicum_helpers: Add SEEK to default stdio rights set PR: 219173 Sponsored by: Dell EMC Isilon r324414: capsicum_helpers: Add EVENT to default stdio rights set Without it, calling caph_limit_stdio(3) breaks Irssi. Reviewed by: oshogbo Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D12622 Added: stable/11/lib/libcapsicum/ - copied from r306657, head/lib/libcapsicum/ stable/11/lib/libcapsicum/Makefile.depend - copied unchanged from r308605, head/lib/libcapsicum/Makefile.depend stable/11/lib/libcapsicum/capsicum_helpers.3 - copied, changed from r306726, head/lib/libcapsicum/capsicum_helpers.3 Modified: stable/11/lib/Makefile stable/11/lib/libcapsicum/Makefile stable/11/lib/libcapsicum/capsicum_helpers.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/Makefile ============================================================================== --- stable/11/lib/Makefile Fri Mar 23 15:50:01 2018 (r331433) +++ stable/11/lib/Makefile Fri Mar 23 16:15:07 2018 (r331434) @@ -38,6 +38,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ libbz2 \ libcalendar \ libcam \ + libcapsicum \ ${_libcasper} \ ${_libcom_err} \ libcompat \ Modified: stable/11/lib/libcapsicum/Makefile ============================================================================== --- head/lib/libcapsicum/Makefile Mon Oct 3 20:48:18 2016 (r306657) +++ stable/11/lib/libcapsicum/Makefile Fri Mar 23 16:15:07 2018 (r331434) @@ -4,4 +4,14 @@ PACKAGE=lib${LIB} INCS= capsicum_helpers.h +MAN+= capsicum_helpers.3 + +MLINKS+=capsicum_helpers.3 caph_limit_stream.3 +MLINKS+=capsicum_helpers.3 caph_limit_stdin.3 +MLINKS+=capsicum_helpers.3 caph_limit_stderr.3 +MLINKS+=capsicum_helpers.3 caph_limit_stdout.3 +MLINKS+=capsicum_helpers.3 caph_limit_stdio.3 +MLINKS+=capsicum_helpers.3 caph_cache_tzdata.3 +MLINKS+=capsicum_helpers.3 caph_cache_catpages.3 + .include Copied: stable/11/lib/libcapsicum/Makefile.depend (from r308605, head/lib/libcapsicum/Makefile.depend) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libcapsicum/Makefile.depend Fri Mar 23 16:15:07 2018 (r331434, copy of r308605, head/lib/libcapsicum/Makefile.depend) @@ -0,0 +1,11 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Copied and modified: stable/11/lib/libcapsicum/capsicum_helpers.3 (from r306726, head/lib/libcapsicum/capsicum_helpers.3) ============================================================================== --- head/lib/libcapsicum/capsicum_helpers.3 Wed Oct 5 20:02:34 2016 (r306726, copy source) +++ stable/11/lib/libcapsicum/capsicum_helpers.3 Fri Mar 23 16:15:07 2018 (r331434) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 5, 2016 +.Dd October 21, 2016 .Dt CAPSICUM_HELPERS 3 .Os .Sh NAME @@ -57,7 +57,8 @@ .Sh DESCRIPTION The .Nm capsicum helpers -are a set of a inline functions which simplify Capsicumizing programs. +are a set of a inline functions which simplify modifying programs to use +Capsicum. The goal is to reduce duplicated code patterns. The .Nm capsicum helpers @@ -70,7 +71,7 @@ restricts capabilities on .Fa fd to only those needed by POSIX stream objects (that is, FILEs). .Pp -The following flags can be provided: +These flags can be provided: .Pp .Bl -tag -width "CAPH_IGNORE_EBADF" -compact -offset indent .It Dv CAPH_IGNORE_EBADF Modified: stable/11/lib/libcapsicum/capsicum_helpers.h ============================================================================== --- head/lib/libcapsicum/capsicum_helpers.h Mon Oct 3 20:48:18 2016 (r306657) +++ stable/11/lib/libcapsicum/capsicum_helpers.h Fri Mar 23 16:15:07 2018 (r331434) @@ -41,6 +41,7 @@ #define CAPH_IGNORE_EBADF 0x0001 #define CAPH_READ 0x0002 #define CAPH_WRITE 0x0004 +#define CAPH_LOOKUP 0x0008 static __inline int caph_limit_stream(int fd, int flags) @@ -48,12 +49,15 @@ caph_limit_stream(int fd, int flags) cap_rights_t rights; unsigned long cmds[] = { TIOCGETA, TIOCGWINSZ }; - cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL); + cap_rights_init(&rights, CAP_EVENT, CAP_FCNTL, CAP_FSTAT, + CAP_IOCTL, CAP_SEEK); if ((flags & CAPH_READ) != 0) cap_rights_set(&rights, CAP_READ); if ((flags & CAPH_WRITE) != 0) cap_rights_set(&rights, CAP_WRITE); + if ((flags & CAPH_LOOKUP) != 0) + cap_rights_set(&rights, CAP_LOOKUP); if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS) { if (errno == EBADF && (flags & CAPH_IGNORE_EBADF) != 0) @@ -94,12 +98,12 @@ caph_limit_stdout(void) static __inline int caph_limit_stdio(void) { + const int iebadf = CAPH_IGNORE_EBADF; - if (caph_limit_stdin() == -1 || caph_limit_stdout() == -1 || - caph_limit_stdout() == -1) { + if (caph_limit_stream(STDIN_FILENO, CAPH_READ | iebadf) == -1 || + caph_limit_stream(STDOUT_FILENO, CAPH_WRITE | iebadf) == -1 || + caph_limit_stream(STDERR_FILENO, CAPH_WRITE | iebadf) == -1) return (-1); - } - return (0); } From owner-svn-src-stable@freebsd.org Fri Mar 23 19:30:01 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43E20F675E3; Fri, 23 Mar 2018 19:30:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E678388082; Fri, 23 Mar 2018 19:30:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD106241AA; Fri, 23 Mar 2018 19:30:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NJU0Z2091940; Fri, 23 Mar 2018 19:30:00 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NJU0QR091939; Fri, 23 Mar 2018 19:30:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803231930.w2NJU0QR091939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Mar 2018 19:30:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331458 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 331458 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, 23 Mar 2018 19:30:01 -0000 Author: jhb Date: Fri Mar 23 19:30:00 2018 New Revision: 331458 URL: https://svnweb.freebsd.org/changeset/base/331458 Log: MFC 328909: Always give ELF brands a chance to veto a match. If a brand provides a header_supported hook, check it when trying to find a brand based on a matching interpreter as well as in the final loop for the fallback brand. Previously a brand might reject a binary via a header_supported hook in one of the earlier loops, but still be chosen by one of these later loops. Sponsored by: DARPA / AFRL Modified: stable/11/sys/kern/imgact_elf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/imgact_elf.c ============================================================================== --- stable/11/sys/kern/imgact_elf.c Fri Mar 23 18:41:28 2018 (r331457) +++ stable/11/sys/kern/imgact_elf.c Fri Mar 23 19:30:00 2018 (r331458) @@ -320,7 +320,7 @@ __elfN(get_brandinfo)(struct image_params *imgp, const strcmp((const char *)&hdr->e_ident[OLD_EI_BRAND], bi->compat_3_brand) == 0))) { /* Looks good, but give brand a chance to veto */ - if (!bi->header_supported || + if (bi->header_supported == NULL || bi->header_supported(imgp)) { /* * Again, prefer strictly matching @@ -368,7 +368,8 @@ __elfN(get_brandinfo)(struct image_params *imgp, const /* ELF image p_filesz includes terminating zero */ strlen(bi->interp_path) + 1 == interp_name_len && strncmp(interp, bi->interp_path, interp_name_len) - == 0) + == 0 && (bi->header_supported == NULL || + bi->header_supported(imgp))) return (bi); } } @@ -380,7 +381,9 @@ __elfN(get_brandinfo)(struct image_params *imgp, const (interp != NULL && (bi->flags & BI_BRAND_ONLY_STATIC) != 0)) continue; if (hdr->e_machine == bi->machine && - __elfN(fallback_brand) == bi->brand) + __elfN(fallback_brand) == bi->brand && + (bi->header_supported == NULL || + bi->header_supported(imgp))) return (bi); } return (NULL); From owner-svn-src-stable@freebsd.org Fri Mar 23 20:20:05 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8096AF6B2DF; Fri, 23 Mar 2018 20:20:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2CBD18A34D; Fri, 23 Mar 2018 20:20:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 277C5249C1; Fri, 23 Mar 2018 20:20:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NKK5tP017571; Fri, 23 Mar 2018 20:20:05 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NKK4KY017563; Fri, 23 Mar 2018 20:20:04 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803232020.w2NKK4KY017563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 23 Mar 2018 20:20: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: r331460 - in stable/11: gnu/lib gnu/usr.bin share/man/man5 share/mk tools/build/mk tools/build/options X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11: gnu/lib gnu/usr.bin share/man/man5 share/mk tools/build/mk tools/build/options X-SVN-Commit-Revision: 331460 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, 23 Mar 2018 20:20:05 -0000 Author: ian Date: Fri Mar 23 20:20:04 2018 New Revision: 331460 URL: https://svnweb.freebsd.org/changeset/base/331460 Log: MFC r307656, r307659, r307674-r307675, r307679, r307683 Support for WITHOUT_GNU_DIFF and WITHOUT_GNU_GREP, plus manually regenerated src.conf.5, which seems to have picked up a couple changes beyond what was in this MFC. r307656: Put each SUBDIR on a separate line for ease of maintenance Additional patches to this file are in progress, and having each SUBDIR entry on a separate line makes it easier to change the order in which the patches are reviewed, tested, and applied. r307659: Switch gnu/usr.bin/Makefile to SUBDIR.${MK_*} optional subdir style r307674: Add knobs to make GNU diff and GNU grep optional This is added to facilitate experiments building FreeBSD without copyleft software. If WITHOUT_GNU_DIFF is set no /usr/bin/diff or /usr/bin/diff3 will be built. If WITHOUT_GNU_GREP is set then BSD grep will be installed as /usr/bin/bsdgrep or /usr/bin/grep, depending on the WITH_BSD_GREP knob. Reviewed by: brooks (earlier) Sponsored by: The FreeBSD Foundation Differential Revision: Differential Revision: https://reviews.freebsd.org/D8288 r307675: Remove trailing whitespace from r307674 r307679: Build libgnuregex only if necessary for other components Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D8298 r307683: Correct typo in r307679: the variable is MK_GNU_GREP_COMPAT Added: stable/11/tools/build/options/WITHOUT_GNU_DIFF - copied unchanged from r307675, head/tools/build/options/WITHOUT_GNU_DIFF stable/11/tools/build/options/WITHOUT_GNU_GREP - copied unchanged from r307675, head/tools/build/options/WITHOUT_GNU_GREP Modified: stable/11/gnu/lib/Makefile stable/11/gnu/usr.bin/Makefile stable/11/share/man/man5/src.conf.5 stable/11/share/mk/src.opts.mk stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/gnu/lib/Makefile ============================================================================== --- stable/11/gnu/lib/Makefile Fri Mar 23 19:31:52 2018 (r331459) +++ stable/11/gnu/lib/Makefile Fri Mar 23 20:20:04 2018 (r331460) @@ -2,7 +2,9 @@ .include -SUBDIR= csu libgcc libdialog libregex +SUBDIR= csu +SUBDIR+= libdialog +SUBDIR+= libgcc .if ${MK_GCC} != "no" SUBDIR+= libgcov libgomp @@ -18,6 +20,11 @@ SUBDIR+= tests .if ${MK_BINUTILS} != "no" && ${MK_GDB} != "no" SUBDIR+= libreadline +.endif + +.if ${MK_GNU_DIFF} != "no" || ${MK_GNU_GREP} != "no" || \ + ${MK_GNU_GREP_COMPAT} != "no" || ${MK_GDB} != "no" +SUBDIR+= libregex .endif # libsupc++ uses libstdc++ headers, although 'make includes' should Modified: stable/11/gnu/usr.bin/Makefile ============================================================================== --- stable/11/gnu/usr.bin/Makefile Fri Mar 23 19:31:52 2018 (r331459) +++ stable/11/gnu/usr.bin/Makefile Fri Mar 23 20:20:04 2018 (r331460) @@ -2,53 +2,27 @@ .include -SUBDIR= ${_binutils} \ - ${_cc} \ - diff \ - diff3 \ - ${_dtc} \ - ${_gdb} \ - ${_gperf} \ - grep \ - ${_groff} \ - ${_rcs} \ - ${_tests} - -SUBDIR_DEPEND_gdb= ${_binutils} - .if ${MK_CXX} != "no" -.if ${MK_GCC} != "no" -_gperf= gperf +SUBDIR.${MK_GCC}+= gperf +SUBDIR.${MK_GROFF}+= groff .endif -.if ${MK_GROFF} != "no" -_groff= groff -.endif -.endif -.if ${MK_GPL_DTC} != "no" -_dtc= dtc -.endif +SUBDIR.${MK_BINUTILS}+= binutils +SUBDIR.${MK_DIALOG}+= dialog -.if ${MK_RCS} != "no" -_rcs= rcs -.endif - -.if ${MK_TESTS} != "no" -_tests= tests -.endif - .if ${MK_BINUTILS} != "no" -_binutils= binutils -.if ${MK_GDB} != "no" -_gdb= gdb +SUBDIR.${MK_GDB}+= gdb +SUBDIR_DEPEND_gdb= binutils .endif -.endif -.if ${MK_GCC} != "no" -_cc= cc -.endif +SUBDIR.${MK_GCC}+= cc +SUBDIR.${MK_GNU_DIFF}+= diff diff3 +SUBDIR.${MK_GNU_GREP}+= grep +SUBDIR.${MK_GPL_DTC}+= dtc +SUBDIR.${MK_RCS}+= rcs +SUBDIR.${MK_TESTS}+= tests -SUBDIR.${MK_DIALOG}+= dialog +.info MK_GNU_DIFF=${MK_GNU_DIFF} SUBDIR_PARALLEL= Modified: stable/11/share/man/man5/src.conf.5 ============================================================================== --- stable/11/share/man/man5/src.conf.5 Fri Mar 23 19:31:52 2018 (r331459) +++ stable/11/share/man/man5/src.conf.5 Fri Mar 23 20:20:04 2018 (r331460) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd January 8, 2018 +.Dd March 23, 2018 .Dt SRC.CONF 5 .Os .Sh NAME @@ -392,6 +392,8 @@ When set, it enforces these options: .Va WITHOUT_ELFTOOLCHAIN_BOOTSTRAP .It .Va WITHOUT_GCC_BOOTSTRAP +.It +.Va WITHOUT_LLD_BOOTSTRAP .El .It Va WITHOUT_CRYPT Set to not build any crypto code. @@ -731,6 +733,14 @@ This is the default on platforms where gcc is the syst .Pp This is a default setting on mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. +.It Va WITHOUT_GNU_DIFF +Set to not build GNU +.Xr diff 1 +and +.Xr diff3 1 . +.It Va WITHOUT_GNU_GREP +Set to not build GNU +.Xr grep 1 . .It Va WITHOUT_GNU_GREP_COMPAT Set this option to omit the gnu extensions to grep from being included in BSD grep. @@ -982,6 +992,11 @@ Set to use LLVM's libunwind stack unwinder (instead of .Pp This is a default setting on arm64/aarch64. +.It Va WITH_LOADER_FIREWIRE +Enable firewire support in /boot/loader and /boot/zfsloader on x86. +This option is a nop on all other platforms. +.It Va WITHOUT_LOADER_GELI +Disable inclusion of GELI crypto support in the boot chain binaries. .It Va WITHOUT_LOCALES Set to not build localization files; see .Xr locale 1 . Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Fri Mar 23 19:31:52 2018 (r331459) +++ stable/11/share/mk/src.opts.mk Fri Mar 23 20:20:04 2018 (r331460) @@ -100,6 +100,8 @@ __DEFAULT_YES_OPTIONS = \ GCOV \ GDB \ GNU \ + GNU_DIFF \ + GNU_GREP \ GNU_GREP_COMPAT \ GPIO \ GPL_DTC \ Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Fri Mar 23 19:31:52 2018 (r331459) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Fri Mar 23 20:20:04 2018 (r331460) @@ -2442,6 +2442,39 @@ OLD_FILES+=usr/share/man/man3/gpio_pin_tristate.3.gz OLD_FILES+=usr/share/man/man8/gpioctl.8.gz .endif +.if ${MK_GNU_DIFF} == no +OLD_FILES+=usr/bin/diff +OLD_FILES+=usr/bin/diff3 +OLD_FILES+=usr/share/man/man1/diff.1.gz +OLD_FILES+=usr/share/man/man1/diff3.1.gz +OLD_FILES+=usr/share/man/man7/diff.7.gz +.endif + +.if ${MK_GNU_GREP} == no +OLD_FILES+=usr/bin/gnugrep +OLD_FILES+=usr/share/man/man1/gnugrep.1.gz +.if ${MK_BSD_GREP} == no +OLD_FILES+=usr/bin/bzgrep +OLD_FILES+=usr/bin/bzegrep +OLD_FILES+=usr/bin/bzfgrep +OLD_FILES+=usr/bin/egrep +OLD_FILES+=usr/bin/fgrep +OLD_FILES+=usr/bin/grep +OLD_FILES+=usr/bin/zegrep +OLD_FILES+=usr/bin/zfgrep +OLD_FILES+=usr/bin/zgrep +OLD_FILES+=usr/share/man/man1/bzegrep.1.gz +OLD_FILES+=usr/share/man/man1/bzfgrep.1.gz +OLD_FILES+=usr/share/man/man1/bzgrep.1.gz +OLD_FILES+=usr/share/man/man1/egrep.1.gz +OLD_FILES+=usr/share/man/man1/fgrep.1.gz +OLD_FILES+=usr/share/man/man1/grep.1.gz +OLD_FILES+=usr/share/man/man1/zegrep.1.gz +OLD_FILES+=usr/share/man/man1/zfgrep.1.gz +OLD_FILES+=usr/share/man/man1/zgrep.1.gz +.endif +.endif + # Also includes vgrind(1) .if ${MK_GROFF} == no OLD_FILES+=usr/bin/addftinfo Copied: stable/11/tools/build/options/WITHOUT_GNU_DIFF (from r307675, head/tools/build/options/WITHOUT_GNU_DIFF) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_GNU_DIFF Fri Mar 23 20:20:04 2018 (r331460, copy of r307675, head/tools/build/options/WITHOUT_GNU_DIFF) @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Set to not build GNU +.Xr diff 1 +and +.Xr diff3 1 . Copied: stable/11/tools/build/options/WITHOUT_GNU_GREP (from r307675, head/tools/build/options/WITHOUT_GNU_GREP) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_GNU_GREP Fri Mar 23 20:20:04 2018 (r331460, copy of r307675, head/tools/build/options/WITHOUT_GNU_GREP) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to not build GNU +.Xr grep 1 . From owner-svn-src-stable@freebsd.org Fri Mar 23 21:06:07 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97727F6ED89; Fri, 23 Mar 2018 21:06:07 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 497ED8CC1C; Fri, 23 Mar 2018 21:06:07 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43ECF251F8; Fri, 23 Mar 2018 21:06:07 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NL671q042700; Fri, 23 Mar 2018 21:06:07 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NL66nX042691; Fri, 23 Mar 2018 21:06:06 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803232106.w2NL66nX042691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 23 Mar 2018 21:06:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331465 - in stable/11/usr.bin: . diff diff/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/usr.bin: . diff diff/tests X-SVN-Commit-Revision: 331465 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, 23 Mar 2018 21:06:08 -0000 Author: ian Date: Fri Mar 23 21:06:06 2018 New Revision: 331465 URL: https://svnweb.freebsd.org/changeset/base/331465 Log: MFC r315051, r315101, r315103, r315107, r315180, r315197, r315293, r315319, r315590, r315649, r315726, r315743, r315746-r315747, r315779, r315985, r316002, r316639, r316959, r317187, r317194, r317205-r317207, r317381, r319489, r319847, r321076-r321079, r321227, r326822 Add the BSD-licensed diff from OpenBSD, which is optionally built and installed when WITHOUT_GNU_DIFF is set. r315051: Import diff from OpenBSD Some of the modifications from the previous summer of code has been integrated Modification for compatibility with GNU diff output has been added Main difference with OpenBSD: Implement multiple GNU diff options: * --ignore-file-name-case * --no-ignore-file-name-case * --normal * --tabsize * --strip-trailing-cr Make diff -p compatible with GNU diff Implement diff -l Make diff -r compatible with GNU diff Capsicumize diffing 2 regular files Add a simple test suite Approved by: AsiaBSDcon devsummit Obtained from: OpenBSD, GSoC Relnotes: yes r315101: Fix wrong date in diff(1) Reported by: rgrimes r315103: Implement a stub --horizon-lines=NUM for compatibility with GNU diff3 some options of GNU diff3 would call diff with --horizon-lines, rcs is depending on that. Reported by: antoine r315107: Fix building with recent gcc Reported by: lwhsu, ngie r315180: Readd codes that creates a tmp file for diffing stdout or devices r315197: Do not die if cap_rights_limit reports ENOSYS Reported by: mmel r315293: Integrate contrib/netbsd-tests/usr.bin/diff/t_diff.sh in as .../usr.bin/diff/diff_test Some minor adjustment needed to be done for :same as it currently has the test script hardcoded into the test, instead of using an idiom like $(dirname $0) Sponsored by: Dell EMC Isilon r315319: diff(1): sort long options under -D example in SYNOPSYS Sponsored by: Dell EMC Isilon r315590: diff(1): add --strip-trailing-cr to last example in the SYNOPSIS This syncs the last example in the SYNOPSIS with the other examples. Reviewed by: bapt Sponsored by: Dell EMC Isilon Differential Revision: D10017 r315649: Cache tzdata when running under capsicum PR: 217957 Reported by: tobik@ r315726: diff(1): fix SYNOPSIS section noting non-existent option, --no-ignore-case `--no-ignore-case` should be `--no-ignore-file-name-case` per code for compatibility with [g]diff(1). Sponsored by: Dell EMC Isilon r315743: Use MAX and MIN macros from sys/param.h r315746: Use strndup(3) instead of malloc + memcpy r315747: Use MIN macros from sys/param.h r315779: diff(1): document remaining long options While here, try and tie together some of the short options with their long option equivalents, where possible. Sponsored by: Dell EMC Isilon r315985: diff: Fix mtime of file1 in -u/-c header line. PR: 218018 Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D10140 r316002: diff: Show nanoseconds in -u/-c header line. Show nanoseconds in the -u/-c header line. The present portability conditionals cannot handle the POSIX standard st_mtim, so remove them and unconditionally use st_mtim. PR: 218018 Reported by: jbeich Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D10145 r316639: add a stub --speed-large-files for compatibility with GNU diff There is no intention to implement it, but lots of scripts/tools using diff(1) passes GNU diff option r316959: Clean up headers declaration r317187: Add a regression test for diff -D r317194: Implement a basic --changed-group-format etcupdate(8) requires that option, while GNU diff supports many more variation of that options, their behaviour beside the simple verion implemented here are quite inconsistent as such I do not plan to implement those. The only special keyword supported by this implementation are: %< and %> %= is not implemented as the documentation of GNU diff says: common lines, but it actually when tested print the changes from the first file r317205: Document all long options r317206: Update the TODO list to reflect what has been changed r317207: Cross reference pr(1) which diff might call with -l option r317381: Fix the following warning from gcc 4.2 in usr.bin/diff: usr.bin/diff/diffreg.c: In function 'change': usr.bin/diff/diffreg.c:1085: warning: 'i' may be used uninitialized in this function This version of gcc is not smart enough to see that 'i' cannot actually be used unitialized. However, the variable is confusingly re-used, so it is better to give it another name, and clearly initialize it before attempting to use it. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D10484 r319489: Add -H as an alias for --speed-large-file to match GNU diff. This is undocumented to match GNU diff where -H is also undocumented. Some existing software (such as kompare) uses this option by default. Reviewed by: emaste, rpokala Differential Revision: https://reviews.freebsd.org/D11022 r319847: Add some testcases for `diff --side-by-side` support These are were created proactively, in anticipation of the support being fully implemented sometime in the future. The tests currently fail on ^/head@r319845, however. Expect them to fail. PR: 219933 Tested with: gdiff r321076: Don't emit "diff: diff arguments" when diffing files if -q is specified. This improves compatibility with GNU diff. Found by accident with `diff -Nrq /usr/tests /usr/tests.new | grep Kyuafile`. Relnotes: yes r321077: Add some tests for brief (--brief/-q) format MFC with: r321076 r321078: Fix exit status with -rq when there is a file in one directory but not another, i.e., when print_only is called. Prior to this change, -rq was always returning 0. After this change it will return 1 if there is a difference between two directories. This fixes compatibility with GNU diff and unbreaks backwards compatibility expectations. Found when trying to extend diff_test:brief_format_test. MFC with: r321076, r321077 r321079: Add tests that exercise -q, like -rq and add tests that test -q like -Nrq MFC with: r321076, r321077, r321078 r321227: Use more flexible expression for replacing t_diff in contrib/netbsd-tests/usr.bin/diff/t_diff.sh with the name of the script via `basename $0`. This was a change I forgot to port over from ^/head/gnu/usr.bin/diff/tests/Makefile@r272787. r326822: Replace homemade equivalent of tolower(3) by towlower(3) This will help in the futur making diff -i works with multibyte Relnotes: Yes Added: stable/11/usr.bin/diff/ - copied from r315051, head/usr.bin/diff/ stable/11/usr.bin/diff/tests/diff_test.sh - copied, changed from r315051, head/usr.bin/diff/tests/diff.sh stable/11/usr.bin/diff/tests/group-format.out - copied unchanged from r317194, head/usr.bin/diff/tests/group-format.out stable/11/usr.bin/diff/tests/header.out - copied unchanged from r315985, head/usr.bin/diff/tests/header.out stable/11/usr.bin/diff/tests/header_ns.out - copied unchanged from r316002, head/usr.bin/diff/tests/header_ns.out stable/11/usr.bin/diff/tests/ifdef.out - copied unchanged from r317187, head/usr.bin/diff/tests/ifdef.out Deleted: stable/11/usr.bin/diff/tests/diff.sh Modified: stable/11/usr.bin/Makefile stable/11/usr.bin/diff/TODO stable/11/usr.bin/diff/diff.1 stable/11/usr.bin/diff/diff.c stable/11/usr.bin/diff/diff.h stable/11/usr.bin/diff/diffdir.c stable/11/usr.bin/diff/diffreg.c stable/11/usr.bin/diff/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/Makefile ============================================================================== --- stable/11/usr.bin/Makefile Fri Mar 23 21:02:46 2018 (r331464) +++ stable/11/usr.bin/Makefile Fri Mar 23 21:06:06 2018 (r331465) @@ -217,6 +217,9 @@ SUBDIR.${MK_GAMES}+= number SUBDIR.${MK_GAMES}+= pom SUBDIR.${MK_GAMES}+= primes SUBDIR.${MK_GAMES}+= random +.if ${MK_GNU_DIFF} == "no" +SUBDIR+= diff +.endif .if ${MK_GPL_DTC} != "yes" .if ${COMPILER_FEATURES:Mc++11} SUBDIR+= dtc Modified: stable/11/usr.bin/diff/TODO ============================================================================== --- head/usr.bin/diff/TODO Sat Mar 11 05:01:29 2017 (r315051) +++ stable/11/usr.bin/diff/TODO Fri Mar 23 21:06:06 2018 (r331465) @@ -5,14 +5,14 @@ * make a libsdiff and use that directly to avoid duplicating the code to be implemented: ---suppress-common-lines: depends on -y --ignore-blank-lines --horizon-lines --ignore-tab-expansion --line-format Will probably be not implemented: ---GTYPE-group-format +--GTYPE-group-format (partially implement - minimal) --LTYPE-line-format ---speed-large-file: (Do we need that? only a stub?) --help (We have a manpage already) +--suppress-common-lines: depends on -y (won't be implemented, as it conflicts +the way sdiff expects it and in any case we have sdiff for that feature) Modified: stable/11/usr.bin/diff/diff.1 ============================================================================== --- head/usr.bin/diff/diff.1 Sat Mar 11 05:01:29 2017 (r315051) +++ stable/11/usr.bin/diff/diff.1 Fri Mar 23 21:06:06 2018 (r331465) @@ -30,7 +30,7 @@ .\" @(#)diff.1 8.1 (Berkeley) 6/30/93 .\" $FreeBSD$ .\" -.Dd Septembr 03, 2017 +.Dd April 20, 2017 .Dt DIFF 1 .Os .Sh NAME @@ -43,45 +43,105 @@ .Fl c | e | f | .Fl n | q | u .Oc +.Op Fl -brief +.Op Fl -changed-group-format Ar GFMT +.Op Fl -ed +.Op Fl -expand-tabs +.Op Fl -forward-ed +.Op Fl -ignore-all-space .Op Fl -ignore-case -.Op Fl -no-ignore-case +.Op Fl -ignore-space-change +.Op Fl -initial-tab +.Op Fl -minimal +.Op Fl -no-ignore-file-name-case .Op Fl -normal +.Op Fl -rcs +.Op Fl -show-c-function +.Op Fl -starting-file +.Op Fl -speed-large-files .Op Fl -strip-trailing-cr .Op Fl -tabsize -.Op Fl I Ar pattern -.Op Fl L Ar label +.Op Fl -text +.Op Fl -unified +.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern +.Op Fl L Ar label | Fl -label Ar label .Ar file1 file2 .Nm diff .Op Fl abdilpTtw -.Op Fl I Ar pattern -.Op Fl L Ar label +.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern +.Op Fl L Ar label | Fl -label Ar label +.Op Fl -brief +.Op Fl -changed-group-format Ar GFMT +.Op Fl -ed +.Op Fl -expand-tabs +.Op Fl -forward-ed +.Op Fl -ignore-all-space .Op Fl -ignore-case -.Op Fl -no-ignore-case +.Op Fl -ignore-space-change +.Op Fl -initial-tab +.Op Fl -minimal +.Op Fl -no-ignore-file-name-case .Op Fl -normal +.Op Fl -paginate +.Op Fl -rcs +.Op Fl -show-c-function +.Op Fl -speed-large-files +.Op Fl -starting-file .Op Fl -strip-trailing-cr .Op Fl -tabsize -.Fl C Ar number +.Op Fl -text +.Fl C Ar number | -context Ar number .Ar file1 file2 .Nm diff .Op Fl abdiltw -.Op Fl I Ar pattern +.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern +.Op Fl -brief +.Op Fl -changed-group-format Ar GFMT +.Op Fl -ed +.Op Fl -expand-tabs +.Op Fl -forward-ed +.Op Fl -ignore-all-space .Op Fl -ignore-case -.Op Fl -no-ignore-case +.Op Fl -ignore-space-change +.Op Fl -initial-tab +.Op Fl -minimal +.Op Fl -no-ignore-file-name-case .Op Fl -normal +.Op Fl -paginate +.Op Fl -rcs +.Op Fl -show-c-function +.Op Fl -speed-large-files +.Op Fl -starting-file .Op Fl -strip-trailing-cr .Op Fl -tabsize -.Fl D Ar string +.Op Fl -text +.Fl D Ar string | Fl -ifdef Ar string .Ar file1 file2 .Nm diff .Op Fl abdilpTtw -.Op Fl I Ar pattern -.Op Fl L Ar label +.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern +.Op Fl L Ar label | Fl -label Ar label +.Op Fl -brief +.Op Fl -changed-group-format Ar GFMT +.Op Fl -ed +.Op Fl -expand-tabs +.Op Fl -forward-ed +.Op Fl -ignore-all-space .Op Fl -ignore-case -.Op Fl -no-ignore-case +.Op Fl -ignore-space-change +.Op Fl -initial-tab +.Op Fl -minimal +.Op Fl -no-ignore-file-name-case .Op Fl -normal -.Op Fl -tabsize +.Op Fl -paginate +.Op Fl -rcs +.Op Fl -show-c-function +.Op Fl -speed-large-files +.Op Fl -starting-file .Op Fl -strip-trailing-cr -.Fl U Ar number +.Op Fl -tabsize +.Op Fl -text +.Fl U Ar number | Fl -unified Ar number .Ar file1 file2 .Nm diff .Op Fl abdilNPprsTtw @@ -89,16 +149,37 @@ .Fl c | e | f | .Fl n | q | u .Oc +.Op Fl -brief +.Op Fl -changed-group-format Ar GFMT +.Op Fl -context +.Op Fl -ed +.Op Fl -expand-tabs +.Op Fl -forward-ed +.Op Fl -ignore-all-space .Op Fl -ignore-case -.Op Fl -no-ignore-case +.Op Fl -ignore-space-change +.Op Fl -initial-tab +.Op Fl -minimal +.Op Fl -new-file +.Op Fl -no-ignore-file-name-case .Op Fl -normal +.Op Fl -paginate +.Op Fl -rcs +.Op Fl -recursive +.Op Fl -report-identical-files +.Op Fl -show-c-function +.Op Fl -speed-large-files +.Op Fl -strip-trailing-cr .Op Fl -tabsize -.Op Fl I Ar pattern +.Op Fl -text +.Op Fl -unidirectional-new-file +.Op Fl -unified +.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern .Bk -words -.Op Fl L Ar label -.Op Fl S Ar name -.Op Fl X Ar file -.Op Fl x Ar pattern +.Op Fl L Ar label | Fl -label Ar label +.Op Fl S Ar name | Fl -starting-file Ar name +.Op Fl X Ar file | Fl -exclude-from Ar file +.Op Fl x Ar pattern | Fl -exclude Ar pattern .Ek .Ar dir1 dir2 .Sh DESCRIPTION @@ -114,7 +195,7 @@ No output is produced if the files are identical. .Pp Output options (mutually exclusive): .Bl -tag -width Ds -.It Fl C Ar number +.It Fl C Ar number Fl -context Ar number Like .Fl c but produces a diff with @@ -142,7 +223,7 @@ both files with .Sq !\ \& . Changes which lie within 3 lines of each other are grouped together on output. -.It Fl D Ar string +.It Fl D Ar string Fl -ifdef Ar string Creates a merged version of .Ar file1 and @@ -156,7 +237,7 @@ while defining .Ar string will yield .Ar file2 . -.It Fl e +.It Fl e -ed Produces output in a form suitable as input for the editor utility, .Xr ed 1 , which can then be used to convert file1 into file2. @@ -170,7 +251,7 @@ from their state in .Ar dir1 to their state in .Ar dir2 . -.It Fl f +.It Fl f -forward-ed Identical output to that of the .Fl e flag, but in reverse order. @@ -183,10 +264,10 @@ but in the opposite order and with a count of changed insert or delete command. This is the form used by .Xr rcsdiff 1 . -.It Fl q +.It Fl q -brief Just print a line when the files differ. Does not output a list of changes. -.It Fl U Ar number +.It Fl U Ar number Fl -unified Ar number Like .Fl u but produces a diff with @@ -207,7 +288,7 @@ a single section. .Pp Comparison options: .Bl -tag -width Ds -.It Fl a +.It Fl a -text Treat all files as .Tn ASCII text. @@ -222,11 +303,11 @@ to produce a diff. .It Fl b Causes trailing blanks (spaces and tabs) to be ignored, and other strings of blanks to compare equal. -.It Fl d +.It Fl d -minimal Try very hard to produce a diff as small as possible. This may consume a lot of processing power and memory when processing large files with many changes. -.It Fl I Ar pattern +.It Fl I Ar pattern Fl -ignore-matching-lines Ar pattern Ignores changes, insertions, and deletions whose lines match the extended regular expression .Ar pattern . @@ -238,32 +319,32 @@ ignored. See .Xr re_format 7 for more information on regular expression patterns. -.It Fl i +.It Fl i -ignore-case Ignores the case of letters. E.g., .Dq A will compare equal to .Dq a . -.It Fl l +.It Fl l -paginate Pass the output through .Xr pr 1 to paginate it. -.It Fl L Ar label +.It Fl L Ar label Fl -label Ar label Print .Ar label instead of the first (and second, if this option is specified twice) file name and time in the context or unified diff header. -.It Fl p +.It Fl p -show-c-function With unified and context diffs, show with each change the first 40 characters of the last line before the context beginning with a letter, an underscore or a dollar sign. For C source code following standard layout conventions, this will show the prototype of the function the change applies to. -.It Fl T +.It Fl T -initial-tab Print a tab rather than a space before the rest of the line for the normal, context or unified output formats. This makes the alignment of tabs in the line consistent. -.It Fl t +.It Fl t -expand-tabs Will expand tabs in output lines. Normal or .Fl c @@ -271,48 +352,70 @@ output adds character(s) to the front of each line whi the indentation of the original source lines and make the output listing difficult to interpret. This option will preserve the original source's indentation. -.It Fl w +.It Fl w -ignore-all-blanks Is similar to -.Fl b +.Fl b -ignore-space-change but causes whitespace (blanks and tabs) to be totally ignored. E.g., .Dq if (\ \&a == b \&) will compare equal to .Dq if(a==b) . +.It Fl -changed-group-format Ar GFMT +Format input groups in the provided +.Pp +the format is a string with special keywords: +.Bl -tag -width %< +.It %< +lines from FILE1 +.It %< +lines from FILE2 .El +.It Fl -ignore-file-name-case +ignore case when comparing file names +.It Fl -no-ignore-file-name-case +do not ignore case wen comparing file names (default) +.It Fl -normal +default diff output +.It Fl -speed-large-files +stub option for compatibility with GNU diff +.It Fl -strip-trailing-cr +strip carriage return on input files +.It Fl tabsize Ar number +Number of spaces representing a tab (default 8) +.El .Pp Directory comparison options: .Bl -tag -width Ds -.It Fl N +.It Fl N -new-file If a file is found in only one directory, act as if it was found in the other directory too but was of zero size. -.It Fl P +.It Fl P -unidirectional-new-file If a file is found only in .Ar dir2 , act as if it was found in .Ar dir1 too but was of zero size. -.It Fl r +.It Fl r -recursive Causes application of .Nm recursively to common subdirectories encountered. -.It Fl S Ar name +.It Fl S Ar name Fl -starting-file Ar name Re-starts a directory .Nm in the middle, beginning with file .Ar name . -.It Fl s +.It Fl s -report-identical-files Causes .Nm to report files which are the same, which are otherwise not mentioned. -.It Fl X Ar file +.It Fl X Ar file Fl -exclude-from Ar file Exclude files and subdirectories from comparison whose basenames match lines in .Ar file . Multiple .Fl X options may be specified. -.It Fl x Ar pattern +.It Fl x Ar pattern Fl -exclude Ar pattern Exclude files and subdirectories from comparison whose basenames match .Ar pattern . Patterns are matched using shell-style globbing via @@ -360,7 +463,7 @@ The default (without .Fl e , .Fl c , or -.Fl n +.Fl n -rcs .\" -C options) output contains lines of these forms, where @@ -480,6 +583,7 @@ An error occurred. .Xr diff3 1 , .Xr ed 1 , .Xr patch 1 , +.Xr pr 1 , .Xr sdiff 1 .Rs .%A James W. Hunt Modified: stable/11/usr.bin/diff/diff.c ============================================================================== --- head/usr.bin/diff/diff.c Sat Mar 11 05:01:29 2017 (r315051) +++ stable/11/usr.bin/diff/diff.c Fri Mar 23 21:06:06 2018 (r331465) @@ -27,11 +27,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include -#include #include #include #include @@ -43,17 +41,20 @@ int lflag, Nflag, Pflag, rflag, sflag, Tflag, cflag; int diff_format, diff_context, status, ignore_file_case; int tabsize = 8; char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; +char *group_format = NULL; struct stat stb1, stb2; struct excludes *excludes_list; regex_t ignore_re; -#define OPTIONS "0123456789aBbC:cdD:efhI:iL:lnNPpqrS:sTtU:uwX:x:" +#define OPTIONS "0123456789aBbC:cdD:efHhI:iL:lnNPpqrS:sTtU:uwX:x:" enum { OPT_TSIZE = CHAR_MAX + 1, OPT_STRIPCR, OPT_IGN_FN_CASE, OPT_NO_IGN_FN_CASE, OPT_NORMAL, + OPT_HORIZON_LINES, + OPT_CHANGED_GROUP_FORMAT, }; static struct option longopts[] = { @@ -64,6 +65,7 @@ static struct option longopts[] = { { "minimal", no_argument, 0, 'd' }, { "ed", no_argument, 0, 'e' }, { "forward-ed", no_argument, 0, 'f' }, + { "speed-large-files", no_argument, NULL, 'H' }, { "ignore-matching-lines", required_argument, 0, 'I' }, { "ignore-case", no_argument, 0, 'i' }, { "paginate", no_argument, NULL, 'l' }, @@ -83,10 +85,12 @@ static struct option longopts[] = { { "exclude", required_argument, 0, 'x' }, { "exclude-from", required_argument, 0, 'X' }, { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE }, + { "horizon-lines", required_argument, NULL, OPT_HORIZON_LINES }, { "no-ignore-file-name-case", no_argument, NULL, OPT_NO_IGN_FN_CASE }, { "normal", no_argument, NULL, OPT_NORMAL }, { "strip-trailing-cr", no_argument, NULL, OPT_STRIPCR }, { "tabsize", optional_argument, NULL, OPT_TSIZE }, + { "changed-group-format", required_argument, NULL, OPT_CHANGED_GROUP_FORMAT}, { NULL, 0, 0, '\0'} }; @@ -154,6 +158,9 @@ main(int argc, char **argv) case 'f': diff_format = D_REVERSE; break; + case 'H': + /* ignore but needed for compatibility with GNU diff */ + break; case 'h': /* silently ignore for backwards compatibility */ break; @@ -225,6 +232,12 @@ main(int argc, char **argv) case 'x': push_excludes(optarg); break; + case OPT_CHANGED_GROUP_FORMAT: + diff_format = D_GFORMAT; + group_format = optarg; + break; + case OPT_HORIZON_LINES: + break; /* XXX TODO for compatibility with GNU diff3 */ case OPT_IGN_FN_CASE: ignore_file_case = 1; break; @@ -347,9 +360,8 @@ read_excludes_file(char *file) while ((buf = fgetln(fp, &len)) != NULL) { if (buf[len - 1] == '\n') len--; - pattern = xmalloc(len + 1); - memcpy(pattern, buf, len); - pattern[len] = '\0'; + if ((pattern = strndup(buf, len)) == NULL) + err(2, "xstrndup"); push_excludes(pattern); } if (strcmp(file, "-") != 0) Modified: stable/11/usr.bin/diff/diff.h ============================================================================== --- head/usr.bin/diff/diff.h Sat Mar 11 05:01:29 2017 (r315051) +++ stable/11/usr.bin/diff/diff.h Fri Mar 23 21:06:06 2018 (r331465) @@ -47,6 +47,7 @@ #define D_NREVERSE 5 /* Reverse ed script with numbered lines and no trailing . */ #define D_BRIEF 6 /* Say if the files differ */ +#define D_GFORMAT 7 /* Diff with defined changed group format */ /* * Output flags @@ -87,6 +88,7 @@ extern int lflag, Nflag, Pflag, rflag, sflag, Tflag, c extern int diff_format, diff_context, status, ignore_file_case; extern int tabsize; extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; +extern char *group_format; extern struct stat stb1, stb2; extern struct excludes *excludes_list; extern regex_t ignore_re; Modified: stable/11/usr.bin/diff/diffdir.c ============================================================================== --- head/usr.bin/diff/diffdir.c Sat Mar 11 05:01:29 2017 (r315051) +++ stable/11/usr.bin/diff/diffdir.c Fri Mar 23 21:06:06 2018 (r331465) @@ -28,17 +28,13 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include #include #include #include -#include #include #include "diff.h" -#include "xmalloc.h" static int selectfile(const struct dirent *); static void diffit(struct dirent *, char *, size_t, char *, size_t, int); @@ -57,6 +53,8 @@ diffdir(char *p1, char *p2, int flags) char path1[PATH_MAX], path2[PATH_MAX]; int pos; + edp1 = edp2 = NULL; + dirlen1 = strlcpy(path1, *p1 ? p1 : ".", sizeof(path1)); if (dirlen1 >= sizeof(path1) - 1) { warnc(ENAMETOOLONG, "%s", p1); @@ -136,16 +134,20 @@ diffdir(char *p1, char *p2, int flags) if (Nflag) diffit(dent1, path1, dirlen1, path2, dirlen2, flags); - else + else { print_only(path1, dirlen1, dent1->d_name); + status = 1; + } dp1++; } else { /* file only in second dir, only diff if -N or -P */ if (Nflag || Pflag) diffit(dent2, path1, dirlen1, path2, dirlen2, flags); - else + else { print_only(path2, dirlen2, dent2->d_name); + status = 1; + } dp2++; } } Modified: stable/11/usr.bin/diff/diffreg.c ============================================================================== --- head/usr.bin/diff/diffreg.c Sat Mar 11 05:01:29 2017 (r315051) +++ stable/11/usr.bin/diff/diffreg.c Fri Mar 23 21:06:06 2018 (r331465) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -94,15 +95,6 @@ __FBSDID("$FreeBSD$"); #define _PATH_PR "/usr/bin/pr" -#ifdef ST_MTIM_NSEC -# define TIMESPEC_NS(timespec) ((timespec).ST_MTIM_NSEC) -#else -# define TIMESPEC_NS(timespec) 0 -#endif - -#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) -#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) - /* * diff - compare two files. */ @@ -194,13 +186,14 @@ struct context_vec { }; #define diff_output printf +static FILE *opentemp(const char *); static void output(char *, FILE *, char *, FILE *, int); static void check(FILE *, FILE *, int); static void range(int, int, const char *); static void uni_range(int, int); static void dump_context_vec(FILE *, FILE *, int); static void dump_unified_vec(FILE *, FILE *, int); -static void prepare(int, FILE *, off_t, int); +static void prepare(int, FILE *, size_t, int); static void prune(void); static void equiv(struct line *, int, struct line *, int, int *); static void unravel(int); @@ -236,7 +229,7 @@ static long *ixold; /* will be overlaid on klist */ static struct cand *clist; /* merely a free storage pot for candidates */ static int clistlen; /* the length of clist */ static struct line *sfile[2]; /* shortened by pruning common prefix/suffix */ -static u_char *chrtran; /* translation table for case-folding */ +static int (*chrtran)(int); /* translation table for case-folding */ static struct context_vec *context_vec_start; static struct context_vec *context_vec_end; static struct context_vec *context_vec_ptr; @@ -246,65 +239,20 @@ static char lastbuf[FUNCTION_CONTEXT_SIZE]; static int lastline; static int lastmatchline; +static int +clow2low(int c) +{ -/* - * chrtran points to one of 2 translation tables: cup2low if folding upper to - * lower case clow2low if not folding case - */ -static u_char clow2low[256] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, - 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, - 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, - 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, - 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, - 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, - 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, - 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, - 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, - 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, - 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, - 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, - 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, - 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, - 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, - 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, - 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, - 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, - 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, - 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, - 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, - 0xfd, 0xfe, 0xff -}; + return (c); +} -static u_char cup2low[256] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, - 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, - 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, - 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, - 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x60, 0x61, - 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, - 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, - 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x60, 0x61, 0x62, - 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, - 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, - 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, - 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, - 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, - 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, - 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, - 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, - 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, - 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, - 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, - 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, - 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, - 0xfd, 0xfe, 0xff -}; +static int +cup2low(int c) +{ + return tolower(c); +} + int diffreg(char *file1, char *file2, int flags, int capsicum) { @@ -315,6 +263,8 @@ diffreg(char *file1, char *file2, int flags, int capsi struct kevent *e; cap_rights_t rights_ro; + e = NULL; + kq = -1; f1 = f2 = NULL; rval = D_SAME; anychange = 0; @@ -333,7 +283,14 @@ diffreg(char *file1, char *file2, int flags, int capsi if (flags & D_EMPTY1) f1 = fopen(_PATH_DEVNULL, "r"); else { - if (strcmp(file1, "-") == 0) + if (!S_ISREG(stb1.st_mode)) { + if ((f1 = opentemp(file1)) == NULL || + fstat(fileno(f1), &stb1) < 0) { + warn("%s", file1); + status |= 2; + goto closem; + } + } else if (strcmp(file1, "-") == 0) f1 = stdin; else f1 = fopen(file1, "r"); @@ -347,7 +304,14 @@ diffreg(char *file1, char *file2, int flags, int capsi if (flags & D_EMPTY2) f2 = fopen(_PATH_DEVNULL, "r"); else { - if (strcmp(file2, "-") == 0) + if (!S_ISREG(stb2.st_mode)) { + if ((f2 = opentemp(file2)) == NULL || + fstat(fileno(f2), &stb2) < 0) { + warn("%s", file2); + status |= 2; + goto closem; + } + } else if (strcmp(file2, "-") == 0) f2 = stdin; else f2 = fopen(file2, "r"); @@ -407,9 +371,11 @@ diffreg(char *file1, char *file2, int flags, int capsi if (capsicum) { cap_rights_init(&rights_ro, CAP_READ, CAP_FSTAT, CAP_SEEK); - if (cap_rights_limit(fileno(f1), &rights_ro) < 0) + if (cap_rights_limit(fileno(f1), &rights_ro) < 0 + && errno != ENOSYS) err(2, "unable to limit rights on: %s", file1); - if (cap_rights_limit(fileno(f2), &rights_ro) < 0) + if (cap_rights_limit(fileno(f2), &rights_ro) < 0 && + errno != ENOSYS) err(2, "unable to limit rights on: %s", file2); if (fileno(f1) == STDIN_FILENO || fileno(f2) == STDIN_FILENO) { /* stding has already been limited */ @@ -421,6 +387,7 @@ diffreg(char *file1, char *file2, int flags, int capsi err(2, "unable to limit stdio"); caph_cache_catpages(); + caph_cache_tzdata(); if (cap_enter() < 0 && errno != ENOSYS) err(2, "unable to enter capability mode"); } @@ -474,7 +441,7 @@ diffreg(char *file1, char *file2, int flags, int capsi ixnew = xreallocarray(ixnew, len[1] + 2, sizeof(*ixnew)); check(f1, f2, flags); output(file1, f1, file2, f2, flags); - if (ostdout != -1) { + if (ostdout != -1 && e != NULL) { /* close the pipe to pr and restore stdout */ int wstatus; @@ -537,6 +504,37 @@ files_differ(FILE *f1, FILE *f2, int flags) } } +static FILE * +opentemp(const char *f) +{ + char buf[BUFSIZ], tempfile[PATH_MAX]; + ssize_t nread; + int ifd, ofd; + + if (strcmp(f, "-") == 0) + ifd = STDIN_FILENO; + else if ((ifd = open(f, O_RDONLY, 0644)) < 0) + return (NULL); + + (void)strlcpy(tempfile, _PATH_TMP "/diff.XXXXXXXX", sizeof(tempfile)); + + if ((ofd = mkstemp(tempfile)) < 0) { + close(ifd); + return (NULL); + } + unlink(tempfile); + while ((nread = read(ifd, buf, BUFSIZ)) > 0) { + if (write(ofd, buf, nread) != nread) { + close(ifd); + close(ofd); + return (NULL); + } + } + close(ifd); + lseek(ofd, (off_t)0, SEEK_SET); + return (fdopen(ofd, "r")); +} + char * splice(char *dir, char *path) { @@ -555,7 +553,7 @@ splice(char *dir, char *path) } static void -prepare(int i, FILE *fd, off_t filesize, int flags) +prepare(int i, FILE *fd, size_t filesize, int flags) { struct line *p; int h; @@ -563,7 +561,7 @@ prepare(int i, FILE *fd, off_t filesize, int flags) rewind(fd); - sz = ((unsigned long)filesize <= SIZE_MAX ? filesize : SIZE_MAX) / 25; + sz = MIN(filesize, SIZE_MAX) / 25; if (sz < 100) sz = 100; @@ -658,7 +656,7 @@ stone(int *a, int n, int *b, int *c, int flags) bound = UINT_MAX; else { sq = isqrt(n); - bound = MAXIMUM(256, sq); + bound = MAX(256, sq); } k = 0; @@ -830,7 +828,7 @@ check(FILE *f1, FILE *f2, int flags) ctnew++; } } - if (chrtran[c] != chrtran[d]) { + if (chrtran(c) != chrtran(d)) { jackpot++; J[i] = 0; if (c != '\n' && c != EOF) @@ -965,7 +963,7 @@ output(char *file1, FILE *f1, char *file2, FILE *f2, i } if (m == 0) change(file1, f1, file2, f2, 1, 0, 1, len[1], &flags); - if (diff_format == D_IFDEF) { + if (diff_format == D_IFDEF || diff_format == D_GFORMAT) { for (;;) { #define c i0 if ((c = getc(f1)) == EOF) @@ -1038,10 +1036,13 @@ change(char *file1, FILE *f1, char *file2, FILE *f2, i int *pflags) { static size_t max_context = 64; - int i; + long curpos; + int i, nc, f; + const char *walk; restart: - if (diff_format != D_IFDEF && a > b && c > d) + if ((diff_format != D_IFDEF || diff_format == D_GFORMAT) && + a > b && c > d) return; if (ignore_pats != NULL) { char *line; @@ -1069,7 +1070,7 @@ restart: return; } proceed: - if (*pflags & D_HEADER) { + if (*pflags & D_HEADER && diff_format != D_BRIEF) { diff_output("%s %s %s\n", diffargs, file1, file2); *pflags &= ~D_HEADER; } @@ -1138,13 +1139,40 @@ proceed: } break; } + if (diff_format == D_GFORMAT) { + curpos = ftell(f1); + /* print through if append (a>b), else to (nb: 0 vs 1 orig) */ + nc = ixold[a > b ? b : a - 1] - curpos; + for (i = 0; i < nc; i++) + diff_output("%c", getc(f1)); + for (walk = group_format; *walk != '\0'; walk++) { + if (*walk == '%') { + walk++; + switch (*walk) { + case '<': + fetch(ixold, a, b, f1, '<', 1, *pflags); + break; + case '>': + fetch(ixnew, c, d, f2, '>', 0, *pflags); + break; + default: + diff_output("%%%c", *walk); + break; + } + continue; + } + diff_output("%c", *walk); + } + } if (diff_format == D_NORMAL || diff_format == D_IFDEF) { fetch(ixold, a, b, f1, '<', 1, *pflags); if (a <= b && c <= d && diff_format == D_NORMAL) diff_output("---\n"); } - i = fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : '\0', 0, *pflags); - if (i != 0 && diff_format == D_EDIT) { + f = 0; + if (diff_format != D_GFORMAT) + f = fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : '\0', 0, *pflags); + if (f != 0 && diff_format == D_EDIT) { /* * A non-zero return value for D_EDIT indicates that the * last line printed was a bare dot (".") that has been @@ -1153,10 +1181,10 @@ proceed: * back and restart where we left off. */ diff_output(".\n"); - diff_output("%ds/.//\n", a + i - 1); - b = a + i - 1; + diff_output("%ds/.//\n", a + f - 1); + b = a + f - 1; a = b + 1; - c += i; + c += f; goto restart; } if ((diff_format == D_EDIT || diff_format == D_REVERSE) && c <= d) @@ -1177,7 +1205,7 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int old * When doing #ifdef's, copy down to current line * if this is the first file, so that stuff makes it to output. */ - if (diff_format == D_IFDEF && oldfile) { + if ((diff_format == D_IFDEF) && oldfile) { long curpos = ftell(lb); /* print through if append (a>b), else to (nb: 0 vs 1 orig) */ nc = f[a > b ? b : a - 1] - curpos; @@ -1201,7 +1229,8 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int old for (i = a; i <= b; i++) { fseek(lb, f[i - 1], SEEK_SET); nc = f[i] - f[i - 1]; - if (diff_format != D_IFDEF && ch != '\0') { + if ((diff_format != D_IFDEF && diff_format != D_GFORMAT) && + ch != '\0') { diff_output("%c", ch); if (Tflag && (diff_format == D_NORMAL || diff_format == D_CONTEXT || diff_format == D_UNIFIED)) @@ -1271,7 +1300,7 @@ readhash(FILE *f, int flags) return (0); break; } - sum = sum * 127 + chrtran[t]; + sum = sum * 127 + chrtran(t); } else for (i = 0; (t = getc(f)) != '\n'; i++) { @@ -1303,7 +1332,7 @@ readhash(FILE *f, int flags) i++; space = 0; } - sum = sum * 127 + chrtran[t]; + sum = sum * 127 + chrtran(t); i++; continue; case EOF: @@ -1395,10 +1424,10 @@ dump_context_vec(FILE *f1, FILE *f2, int flags) return; b = d = 0; /* gcc */ - lowa = MAXIMUM(1, cvp->a - diff_context); - upb = MINIMUM(len[0], context_vec_ptr->b + diff_context); - lowc = MAXIMUM(1, cvp->c - diff_context); - upd = MINIMUM(len[1], context_vec_ptr->d + diff_context); + lowa = MAX(1, cvp->a - diff_context); + upb = MIN(len[0], context_vec_ptr->b + diff_context); + lowc = MAX(1, cvp->c - diff_context); + upd = MIN(len[1], context_vec_ptr->d + diff_context); diff_output("***************"); if ((flags & D_PROTOTYPE)) { @@ -1498,10 +1527,10 @@ dump_unified_vec(FILE *f1, FILE *f2, int flags) return; b = d = 0; /* gcc */ - lowa = MAXIMUM(1, cvp->a - diff_context); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Sat Mar 24 00:26:43 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 385AEF5A7B4; Sat, 24 Mar 2018 00:26:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E02906D7B6; Sat, 24 Mar 2018 00:26:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAFF4272E2; Sat, 24 Mar 2018 00:26:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O0QgRp044071; Sat, 24 Mar 2018 00:26:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O0Qgun044067; Sat, 24 Mar 2018 00:26:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803240026.w2O0Qgun044067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 24 Mar 2018 00:26:42 +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: r331471 - in stable: 10/bin/ps 11/bin/ps X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/bin/ps 11/bin/ps X-SVN-Commit-Revision: 331471 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, 24 Mar 2018 00:26:43 -0000 Author: jhb Date: Sat Mar 24 00:26:42 2018 New Revision: 331471 URL: https://svnweb.freebsd.org/changeset/base/331471 Log: MFC 330872: Add a "jail" keyword to list the name of a jail rather than its ID. Modified: stable/10/bin/ps/extern.h stable/10/bin/ps/keyword.c stable/10/bin/ps/print.c stable/10/bin/ps/ps.1 Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/bin/ps/extern.h stable/11/bin/ps/keyword.c stable/11/bin/ps/print.c stable/11/bin/ps/ps.1 Directory Properties: stable/11/ (props changed) Modified: stable/10/bin/ps/extern.h ============================================================================== --- stable/10/bin/ps/extern.h Fri Mar 23 23:46:59 2018 (r331470) +++ stable/10/bin/ps/extern.h Sat Mar 24 00:26:42 2018 (r331471) @@ -53,6 +53,7 @@ char *emulname(KINFO *, VARENT *); VARENT *find_varentry(VAR *); const char *fmt_argv(char **, char *, char *, size_t); double getpcpu(const KINFO *); +char *jailname(KINFO *, VARENT *); char *kvar(KINFO *, VARENT *); char *label(KINFO *, VARENT *); char *loginclass(KINFO *, VARENT *); Modified: stable/10/bin/ps/keyword.c ============================================================================== --- stable/10/bin/ps/keyword.c Fri Mar 23 23:46:59 2018 (r331470) +++ stable/10/bin/ps/keyword.c Sat Mar 24 00:26:42 2018 (r331471) @@ -96,6 +96,7 @@ static VAR var[] = { {"ignored", "", "sigignore", 0, NULL, 0, CHAR, NULL, 0}, {"inblk", "INBLK", NULL, USER, rvar, ROFF(ru_inblock), LONG, "ld", 0}, {"inblock", "", "inblk", 0, NULL, 0, CHAR, NULL, 0}, + {"jail", "JAIL", NULL, LJUST, jailname, 0, CHAR, NULL, 0}, {"jid", "JID", NULL, 0, kvar, KOFF(ki_jid), INT, "d", 0}, {"jobc", "JOBC", NULL, 0, kvar, KOFF(ki_jobc), SHORT, "d", 0}, {"ktrace", "KTRACE", NULL, 0, kvar, KOFF(ki_traceflag), INT, "x", 0}, Modified: stable/10/bin/ps/print.c ============================================================================== --- stable/10/bin/ps/print.c Fri Mar 23 23:46:59 2018 (r331470) +++ stable/10/bin/ps/print.c Sat Mar 24 00:26:42 2018 (r331471) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -839,4 +840,17 @@ loginclass(KINFO *k, VARENT *ve __unused) return (strdup("-")); } return (strdup(k->ki_p->ki_loginclass)); +} + +char * +jailname(KINFO *k, VARENT *ve __unused) +{ + char *name; + + if (k->ki_p->ki_jid == 0) + return (strdup("-")); + name = jail_getname(k->ki_p->ki_jid); + if (name == NULL) + return (strdup("-")); + return (name); } Modified: stable/10/bin/ps/ps.1 ============================================================================== --- stable/10/bin/ps/ps.1 Fri Mar 23 23:46:59 2018 (r331470) +++ stable/10/bin/ps/ps.1 Sat Mar 24 00:26:42 2018 (r331471) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd August 12, 2016 +.Dd March 13, 2018 .Dt PS 1 .Os .Sh NAME @@ -554,6 +554,8 @@ group name (from egid) (alias .It Cm inblk total blocks read (alias .Cm inblock ) +.It Cm jail +jail name .It Cm jid jail ID .It Cm jobc From owner-svn-src-stable@freebsd.org Sat Mar 24 00:26:43 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCB3DF5A7BD; Sat, 24 Mar 2018 00:26:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6ACED6D7B8; Sat, 24 Mar 2018 00:26:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65B64272E3; Sat, 24 Mar 2018 00:26:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O0QhoZ044080; Sat, 24 Mar 2018 00:26:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O0Qgm3044076; Sat, 24 Mar 2018 00:26:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803240026.w2O0Qgm3044076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 24 Mar 2018 00:26: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: r331471 - in stable: 10/bin/ps 11/bin/ps X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/bin/ps 11/bin/ps X-SVN-Commit-Revision: 331471 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, 24 Mar 2018 00:26:44 -0000 Author: jhb Date: Sat Mar 24 00:26:42 2018 New Revision: 331471 URL: https://svnweb.freebsd.org/changeset/base/331471 Log: MFC 330872: Add a "jail" keyword to list the name of a jail rather than its ID. Modified: stable/11/bin/ps/extern.h stable/11/bin/ps/keyword.c stable/11/bin/ps/print.c stable/11/bin/ps/ps.1 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/bin/ps/extern.h stable/10/bin/ps/keyword.c stable/10/bin/ps/print.c stable/10/bin/ps/ps.1 Directory Properties: stable/10/ (props changed) Modified: stable/11/bin/ps/extern.h ============================================================================== --- stable/11/bin/ps/extern.h Fri Mar 23 23:46:59 2018 (r331470) +++ stable/11/bin/ps/extern.h Sat Mar 24 00:26:42 2018 (r331471) @@ -55,6 +55,7 @@ char *emulname(KINFO *, VARENT *); VARENT *find_varentry(VAR *); const char *fmt_argv(char **, char *, char *, size_t); double getpcpu(const KINFO *); +char *jailname(KINFO *, VARENT *); char *kvar(KINFO *, VARENT *); char *label(KINFO *, VARENT *); char *loginclass(KINFO *, VARENT *); Modified: stable/11/bin/ps/keyword.c ============================================================================== --- stable/11/bin/ps/keyword.c Fri Mar 23 23:46:59 2018 (r331470) +++ stable/11/bin/ps/keyword.c Sat Mar 24 00:26:42 2018 (r331471) @@ -108,6 +108,7 @@ static VAR var[] = { {"inblk", "INBLK", NULL, "read-blocks", USER, rvar, ROFF(ru_inblock), LONG, "ld", 0}, {"inblock", "", "inblk", NULL, 0, NULL, 0, CHAR, NULL, 0}, + {"jail", "JAIL", NULL, "jail-name", LJUST, jailname, 0, CHAR, NULL, 0}, {"jid", "JID", NULL, "jail-id", 0, kvar, KOFF(ki_jid), INT, "d", 0}, {"jobc", "JOBC", NULL, "job-control-count", 0, kvar, KOFF(ki_jobc), SHORT, "d", 0}, Modified: stable/11/bin/ps/print.c ============================================================================== --- stable/11/bin/ps/print.c Fri Mar 23 23:46:59 2018 (r331470) +++ stable/11/bin/ps/print.c Sat Mar 24 00:26:42 2018 (r331471) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -839,4 +840,17 @@ loginclass(KINFO *k, VARENT *ve __unused) return (strdup("-")); } return (strdup(k->ki_p->ki_loginclass)); +} + +char * +jailname(KINFO *k, VARENT *ve __unused) +{ + char *name; + + if (k->ki_p->ki_jid == 0) + return (strdup("-")); + name = jail_getname(k->ki_p->ki_jid); + if (name == NULL) + return (strdup("-")); + return (name); } Modified: stable/11/bin/ps/ps.1 ============================================================================== --- stable/11/bin/ps/ps.1 Fri Mar 23 23:46:59 2018 (r331470) +++ stable/11/bin/ps/ps.1 Sat Mar 24 00:26:42 2018 (r331471) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd January 23, 2018 +.Dd March 13, 2018 .Dt PS 1 .Os .Sh NAME @@ -566,6 +566,8 @@ group name (from egid) (alias .It Cm inblk total blocks read (alias .Cm inblock ) +.It Cm jail +jail name .It Cm jid jail ID .It Cm jobc From owner-svn-src-stable@freebsd.org Sat Mar 24 01:15:39 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F289EF5E52B; Sat, 24 Mar 2018 01:15:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6D626F96D; Sat, 24 Mar 2018 01:15:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1BE927B17; Sat, 24 Mar 2018 01:15:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O1FcC3068559; Sat, 24 Mar 2018 01:15:38 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O1FcFB068558; Sat, 24 Mar 2018 01:15:38 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803240115.w2O1FcFB068558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 24 Mar 2018 01:15:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331473 - stable/11/share/misc X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/misc X-SVN-Commit-Revision: 331473 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, 24 Mar 2018 01:15:39 -0000 Author: eadler Date: Sat Mar 24 01:15:38 2018 New Revision: 331473 URL: https://svnweb.freebsd.org/changeset/base/331473 Log: MFC: r331285 [bsd-family-tree] Announce NetBSD 7.1.2 Modified: stable/11/share/misc/bsd-family-tree Directory Properties: stable/11/ (props changed) Modified: stable/11/share/misc/bsd-family-tree ============================================================================== --- stable/11/share/misc/bsd-family-tree Sat Mar 24 01:07:58 2018 (r331472) +++ stable/11/share/misc/bsd-family-tree Sat Mar 24 01:15:38 2018 (r331473) @@ -365,6 +365,8 @@ FreeBSD 5.2 | | | | | | | | | | | | | | NetBSD 7.1.1 | DragonFly 5.0.2 | | | | | | | + | | | | NetBSD 7.1.2 | | + | | | | | | | | | | | v | | | v | | | | | | | | | @@ -736,6 +738,7 @@ DragonFly 5.0.0 2017-10-16 [DFB] DragonFly 5.0.1 2017-11-06 [DFB] DragonFly 5.0.2 2017-12-04 [DFB] NetBSD 7.1.1 2017-12-22 [NBD] +NetBSD 7.1.2 2018-03-15 [NBD] Bibliography ------------------------ From owner-svn-src-stable@freebsd.org Sat Mar 24 18:06:35 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80C3EF615E3; Sat, 24 Mar 2018 18:06:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3006477CC2; Sat, 24 Mar 2018 18:06:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 264DF12B69; Sat, 24 Mar 2018 18:06:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OI6YR5072691; Sat, 24 Mar 2018 18:06:34 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OI6YCk072690; Sat, 24 Mar 2018 18:06:34 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803241806.w2OI6YCk072690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 18:06: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: r331492 - stable/11/sys/powerpc/powerpc X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/powerpc/powerpc X-SVN-Commit-Revision: 331492 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, 24 Mar 2018 18:06:35 -0000 Author: ian Date: Sat Mar 24 18:06:34 2018 New Revision: 331492 URL: https://svnweb.freebsd.org/changeset/base/331492 Log: To fix the powerpc build, back out r331184, which was this mfc: MFC r326859: Add identifier for POWER9 CPU to CPU list Without the identifier in the list booting FreeBSD results in printing the following (from a PowerKVM boot): cpu0: Unknown PowerPC CPU revision 0x1201, 2550.00 MHz For now, add the same feature list as POWER8. As new capabilities are added to support POWER9 specific features, they will be added to this. PR: 224344 Modified: stable/11/sys/powerpc/powerpc/cpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/powerpc/cpu.c ============================================================================== --- stable/11/sys/powerpc/powerpc/cpu.c Sat Mar 24 15:36:25 2018 (r331491) +++ stable/11/sys/powerpc/powerpc/cpu.c Sat Mar 24 18:06:34 2018 (r331492) @@ -163,12 +163,6 @@ static const struct cputab models[] = { PPC_FEATURE_HAS_VSX, PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM | PPC_FEATURE2_HAS_VCRYPTO, NULL }, - { "IBM POWER9", IBMPOWER9, REVFMT_MAJMIN, - PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU | - PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 | - PPC_FEATURE_HAS_VSX, - PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM | PPC_FEATURE2_ISEL | - PPC_FEATURE2_HAS_VCRYPTO, NULL }, { "Motorola PowerPC 7400", MPC7400, REVFMT_MAJMIN, PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 7410", MPC7410, REVFMT_MAJMIN, From owner-svn-src-stable@freebsd.org Sat Mar 24 18:42:46 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0D4AF64974; Sat, 24 Mar 2018 18:42:46 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 51E207963A; Sat, 24 Mar 2018 18:42:46 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CC58131E2; Sat, 24 Mar 2018 18:42:46 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OIgkN3092713; Sat, 24 Mar 2018 18:42:46 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OIgj91092707; Sat, 24 Mar 2018 18:42:45 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803241842.w2OIgj91092707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 18:42: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: r331493 - in stable/11/sys: arm/allwinner arm/freescale/imx arm/nvidia dev/ahci X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: arm/allwinner arm/freescale/imx arm/nvidia dev/ahci X-SVN-Commit-Revision: 331493 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, 24 Mar 2018 18:42:47 -0000 Author: ian Date: Sat Mar 24 18:42:45 2018 New Revision: 331493 URL: https://svnweb.freebsd.org/changeset/base/331493 Log: MFC r324186: Define a single instance of ahci_devclass and reference it from all the attachment code for various SOCs and busses. Remove all the static and should-have-been-static and named-differently instances of it. This should eliminate the recently-grown build warnings about multiple definitions when building arm kernels. Modified: stable/11/sys/arm/allwinner/a10_ahci.c stable/11/sys/arm/freescale/imx/imx6_ahci.c stable/11/sys/arm/nvidia/tegra_ahci.c stable/11/sys/dev/ahci/ahci.c stable/11/sys/dev/ahci/ahci.h stable/11/sys/dev/ahci/ahci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/a10_ahci.c ============================================================================== --- stable/11/sys/arm/allwinner/a10_ahci.c Sat Mar 24 18:06:34 2018 (r331492) +++ stable/11/sys/arm/allwinner/a10_ahci.c Sat Mar 24 18:42:45 2018 (r331493) @@ -373,8 +373,6 @@ ahci_a10_detach(device_t dev) return (ahci_detach(dev)); } -static devclass_t ahci_devclass; - static device_method_t ahci_ata_methods[] = { DEVMETHOD(device_probe, ahci_a10_probe), DEVMETHOD(device_attach, ahci_a10_attach), Modified: stable/11/sys/arm/freescale/imx/imx6_ahci.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_ahci.c Sat Mar 24 18:06:34 2018 (r331492) +++ stable/11/sys/arm/freescale/imx/imx6_ahci.c Sat Mar 24 18:42:45 2018 (r331493) @@ -330,8 +330,6 @@ imx6_ahci_detach(device_t dev) return (ahci_detach(dev)); } -devclass_t ahci_devclass; - static device_method_t imx6_ahci_ata_methods[] = { /* device probe, attach and detach methods */ DEVMETHOD(device_probe, imx6_ahci_probe), Modified: stable/11/sys/arm/nvidia/tegra_ahci.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra_ahci.c Sat Mar 24 18:06:34 2018 (r331492) +++ stable/11/sys/arm/nvidia/tegra_ahci.c Sat Mar 24 18:42:45 2018 (r331493) @@ -619,8 +619,7 @@ static device_method_t tegra_ahci_methods[] = { DEVMETHOD_END }; -static devclass_t tegra_ahci_devclass; static DEFINE_CLASS_0(ahci, tegra_ahci_driver, tegra_ahci_methods, sizeof(struct tegra_ahci_sc)); -DRIVER_MODULE(tegra_ahci, simplebus, tegra_ahci_driver, tegra_ahci_devclass, +DRIVER_MODULE(tegra_ahci, simplebus, tegra_ahci_driver, ahci_devclass, NULL, NULL); Modified: stable/11/sys/dev/ahci/ahci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci.c Sat Mar 24 18:06:34 2018 (r331492) +++ stable/11/sys/dev/ahci/ahci.c Sat Mar 24 18:42:45 2018 (r331493) @@ -2740,5 +2740,8 @@ ahcipoll(struct cam_sim *sim) ahci_reset_to(ch); } } + +devclass_t ahci_devclass; + MODULE_VERSION(ahci, 1); MODULE_DEPEND(ahci, cam, 1, 1, 1); Modified: stable/11/sys/dev/ahci/ahci.h ============================================================================== --- stable/11/sys/dev/ahci/ahci.h Sat Mar 24 18:06:34 2018 (r331492) +++ stable/11/sys/dev/ahci/ahci.h Sat Mar 24 18:42:45 2018 (r331493) @@ -648,3 +648,6 @@ bus_dma_tag_t ahci_get_dma_tag(device_t dev, device_t int ahci_ctlr_reset(device_t dev); int ahci_ctlr_setup(device_t dev); void ahci_free_mem(device_t dev); + +extern devclass_t ahci_devclass; + Modified: stable/11/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci_pci.c Sat Mar 24 18:06:34 2018 (r331492) +++ stable/11/sys/dev/ahci/ahci_pci.c Sat Mar 24 18:42:45 2018 (r331493) @@ -642,7 +642,6 @@ ahci_pci_resume(device_t dev) return (bus_generic_resume(dev)); } -devclass_t ahci_devclass; static device_method_t ahci_methods[] = { DEVMETHOD(device_probe, ahci_probe), DEVMETHOD(device_attach, ahci_pci_attach), From owner-svn-src-stable@freebsd.org Sat Mar 24 19:06:00 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FAD9F66995; Sat, 24 Mar 2018 19:06:00 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 064F77A5A8; Sat, 24 Mar 2018 19:06:00 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB93113525; Sat, 24 Mar 2018 19:05:59 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OJ5xRx003103; Sat, 24 Mar 2018 19:05:59 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OJ5x4n003102; Sat, 24 Mar 2018 19:05:59 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803241905.w2OJ5x4n003102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 19:05: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: r331494 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 331494 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, 24 Mar 2018 19:06:00 -0000 Author: ian Date: Sat Mar 24 19:05:59 2018 New Revision: 331494 URL: https://svnweb.freebsd.org/changeset/base/331494 Log: Record-only merge of r324416. The actual code was merged in 327633, but I forgot to add the merge info then (it wasn't so much a merge as recreating on the branch the same conceptual change as was done on head). Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable@freebsd.org Sat Mar 24 19:57:09 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7834F6ABEC; Sat, 24 Mar 2018 19:57:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 83D447C5F9; Sat, 24 Mar 2018 19:57:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A7E213D5B; Sat, 24 Mar 2018 19:57:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OJv8GK028213; Sat, 24 Mar 2018 19:57:08 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OJv8ET028212; Sat, 24 Mar 2018 19:57:08 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803241957.w2OJv8ET028212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 19:57:08 +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: r331495 - stable/11/sys/dev/iicbus X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/dev/iicbus X-SVN-Commit-Revision: 331495 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, 24 Mar 2018 19:57:09 -0000 Author: ian Date: Sat Mar 24 19:57:08 2018 New Revision: 331495 URL: https://svnweb.freebsd.org/changeset/base/331495 Log: MFC r327756-r327758 r327756: Bugfix: on RTC chips with a 32-bit binary counter, after reading the time, return immediately rather than falling through to the logic that reads BCD-encoded time. r327757: Bugfix: don't lose the am/pm mode flag when setting the time. Unlike most RTC chips that have a control register bit for am/pm mode, the DS13xx series uses one of the high bits in the hour register. Thus, when setting the time in am/pm mode, the am/pm mode flag has to be ORed into the hour. r327758: Convert a collection of unrelated bitwise flags to a collection of boolean vars in the softc. It makes the code more compact and readable, and actually uses less memory too. Modified: stable/11/sys/dev/iicbus/ds13rtc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iicbus/ds13rtc.c ============================================================================== --- stable/11/sys/dev/iicbus/ds13rtc.c Sat Mar 24 19:05:59 2018 (r331494) +++ stable/11/sys/dev/iicbus/ds13rtc.c Sat Mar 24 19:57:08 2018 (r331495) @@ -162,16 +162,14 @@ struct time_regs { struct ds13rtc_softc { device_t dev; device_t busdev; - u_int flags; /* SC_F_* flags */ u_int chiptype; /* Type of DS13xx chip */ uint8_t secaddr; /* Address of seconds register */ uint8_t osfaddr; /* Address of register with OSF */ + bool use_ampm; /* Use AM/PM mode. */ + bool use_century; /* Use the Century bit. */ + bool is_binary_counter; /* Chip has 32-bit binary counter. */ }; -#define SC_F_BINARY (1u << 0) /* Time is 32-bit binary counter */ -#define SC_F_AMPM (1u << 1) /* Use PM flag in hours reg */ -#define SC_F_CENTURY (1u << 2) /* Use century bit */ - /* * We use the compat_data table to look up hint strings in the non-FDT case, so * define the struct locally when we don't get it from ofw_bus_subr.h. @@ -326,14 +324,14 @@ ds13rtc_start(void *arg) * chips that do AM/PM mode, the flag bit is in the hours register, * which is secaddr+2. */ - if ((sc->chiptype != TYPE_DS1340) && !(sc->flags & SC_F_BINARY)) { + if ((sc->chiptype != TYPE_DS1340) && !sc->is_binary_counter) { if (read_reg(sc, sc->secaddr + 2, &statreg) != 0) { device_printf(sc->dev, "cannot read RTC clock AM/PM bit\n"); return; } if (statreg & DS13xx_B_HOUR_AMPM) - sc->flags |= SC_F_AMPM; + sc->use_ampm = true; } /* @@ -363,10 +361,9 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) return (EINVAL); /* hardware is good, time is not. */ /* If the chip counts time in binary, we just read and return it. */ - if (sc->flags & SC_F_BINARY) { - if ((err = read_timeword(sc, &ts->tv_sec)) != 0) - return (err); + if (sc->is_binary_counter) { ts->tv_nsec = 0; + return (read_timeword(sc, &ts->tv_sec)); } /* @@ -377,7 +374,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) return (err); } - if (sc->flags & SC_F_AMPM) + if (sc->use_ampm) hourmask = DS13xx_M_12HOUR; else hourmask = DS13xx_M_24HOUR; @@ -390,7 +387,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) ct.year = FROMBCD(tregs.year & DS13xx_M_YEAR); ct.nsec = 0; - if (sc->flags & SC_F_AMPM) { + if (sc->use_ampm) { if (ct.hour == 12) ct.hour = 0; if (tregs.hour & DS13xx_B_HOUR_PM) @@ -401,7 +398,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) * If this chip has a century bit, honor it. Otherwise let * clock_ct_to_ts() infer the century from the 2-digit year. */ - if (sc->flags & SC_F_CENTURY) + if (sc->use_century) ct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 2000 : 1900; err = clock_ct_to_ts(&ct, ts); @@ -416,7 +413,7 @@ ds13rtc_settime(device_t dev, struct timespec *ts) struct time_regs tregs; struct ds13rtc_softc *sc; int err; - uint8_t cflag, statreg, pmflag; + uint8_t cflag, statreg, pmflags; sc = device_get_softc(dev); @@ -427,17 +424,18 @@ ds13rtc_settime(device_t dev, struct timespec *ts) ts->tv_sec -= utc_offset(); /* If the chip counts time in binary, store tv_sec and we're done. */ - if (sc->flags & SC_F_BINARY) + if (sc->is_binary_counter) return (write_timeword(sc, ts->tv_sec)); clock_ts_to_ct(ts, &ct); /* If the chip is in AMPM mode deal with the PM flag. */ - pmflag = 0; - if (sc->flags & SC_F_AMPM) { + pmflags = 0; + if (sc->use_ampm) { + pmflags = DS13xx_B_HOUR_AMPM; if (ct.hour >= 12) { ct.hour -= 12; - pmflag = DS13xx_B_HOUR_PM; + pmflags |= DS13xx_B_HOUR_PM; } if (ct.hour == 0) ct.hour = 12; @@ -445,14 +443,14 @@ ds13rtc_settime(device_t dev, struct timespec *ts) /* If the chip has a century bit, set it as needed. */ cflag = 0; - if (sc->flags & SC_F_CENTURY) { + if (sc->use_century) { if (ct.year >= 2000) cflag |= DS13xx_B_MONTH_CENTURY; } tregs.sec = TOBCD(ct.sec); tregs.min = TOBCD(ct.min); - tregs.hour = TOBCD(ct.hour) | pmflag; + tregs.hour = TOBCD(ct.hour) | pmflags; tregs.day = TOBCD(ct.day); tregs.month = TOBCD(ct.mon) | cflag; tregs.year = TOBCD(ct.year % 100); @@ -572,7 +570,7 @@ ds13rtc_attach(device_t dev) case TYPE_DS1342: case TYPE_DS1375: sc->osfaddr = DS133x_R_STATUS; - sc->flags |= SC_F_CENTURY; + sc->use_century = true; break; case TYPE_DS1340: sc->osfaddr = DS1340_R_STATUS; @@ -581,7 +579,7 @@ ds13rtc_attach(device_t dev) case TYPE_DS1372: case TYPE_DS1374: sc->osfaddr = DS137x_R_STATUS; - sc->flags |= SC_F_BINARY; + sc->is_binary_counter = true; break; case TYPE_DS1388: sc->osfaddr = DS1388_R_STATUS; From owner-svn-src-stable@freebsd.org Sat Mar 24 20:40:17 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FE35F6DF32; Sat, 24 Mar 2018 20:40:17 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E19B27DCE8; Sat, 24 Mar 2018 20:40:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8029143E5; Sat, 24 Mar 2018 20:40:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OKeGia048047; Sat, 24 Mar 2018 20:40:16 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OKeG3W048040; Sat, 24 Mar 2018 20:40:16 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242040.w2OKeG3W048040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 20:40: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: r331496 - in stable/11/sys: dev/iicbus kern sys x86/isa X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: dev/iicbus kern sys x86/isa X-SVN-Commit-Revision: 331496 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, 24 Mar 2018 20:40:17 -0000 Author: ian Date: Sat Mar 24 20:40:16 2018 New Revision: 331496 URL: https://svnweb.freebsd.org/changeset/base/331496 Log: MFC r306288, r314936, r325527, r327971, r328005, r328039, r328068-r328069, r328301-r328303 r306288: Fix ds1307 probing 'compat' can never be NULL, because the compatible check loop ends when compat->ocd_str is NULL. This causes ds1307 to attach to any unclaimed i2c device. r314936: Validate values read from the RTC before trying BCD decoding Submitted by: cem Reported by: Michael Gmelin Tested by: Oleksandr Tymoshenko Sponsored by: Dell EMC r325527: DS1307: Add the mcp7941x enable bit Summary: Existing code recognizes the mcp7941x RTC, but this RTC has an enable bit at the same location as the "Clock Halt" bit on the ds1307, with an opposite assertion (set == on, whereas CH set == clock stopped). Thus the current code halts the clock, with no way to enable it. Reviewed By: ian Differential Revision: https://reviews.freebsd.org/D12961 r327971: Add RTC clock conversions for BCD values, with non-panic validation. RTC clock hardware frequently uses BCD numbers. Currently the low-level bcd2bin() and bin2bcd() functions will KASSERT if given out-of-range BCD values. Every RTC driver must implement its own code for validating the unreliable data coming from the hardware to avoid a potential kernel panic. This change introduces two new functions, clock_bcd_to_ts() and clock_ts_to_bcd(). The former validates its inputs and returns EINVAL if any values are out of range. The latter guarantees the returned data will be valid BCD in a known format (4-digit years, etc). A new bcd_clocktime structure is used with the new functions. It is similar to the original clocktime structure, but defines the fields holding BCD values as uint8_t (uint16_t for year), and adds a PM flag for handling hours using AM/PM mode. PR: 224813 Differential Revision: https://reviews.freebsd.org/D13730 (no reviewers) r328005: Convert the x86 RTC driver to use new validated BCD<->timespec conversions. New common routines were added to kern/subr_clock.c for converting between calendrical time expressed in BCD and struct timespec. The new functions return EINVAL on error, as expected when the clock hardware does not provide valid time. PR: 224813 Differential Revision: https://reviews.freebsd.org/D13731 (no reviewers) r328039: Add static inline rtcin_locked() and rtcout_locked() functions for doing a related series of operations without doing a lock/unlock for each byte. Use them when reading and writing the entire set of time registers. The original rtcin() and writertc() functions which do lock/unlock on each byte still exist, because they are public and called by outside code. r328068: Move some code around and rename a couple variables; no functional changes. The static atrtc_set() function was called only from clock_settime(), so just move its contents entirely into clock_settime() and delete atrtc_set(). Rename the struct bcd_clocktime variables from 'ct' to 'bct'. I had originally wanted to emphasize how identical the clocktime and bcd_clocktime structs were, but things evolved to the point where the structs are not at all identical anymore, so now emphasizing the difference seems better. r328069: Remove redundant critical_enter/exit() calls. The block of code delimited by these calls is now protected by a spin mutex (obscured within the RTC_LOCK/RTC_UNLOCK macros). Reported by: bde@ r328301: Switch to using the bcd_clocktime conversion functinos that validate the BCD data without panicking, and have common code for handling AM/PM mode. r328302: Switch to using the bcd_clocktime conversion functions that validate the BCD data without panicking, and have common code for handling AM/PM mode. r328303: Switch to using the bcd_clocktime conversion functions that validate the BCD data without panicking, and have common code for handling AM/PM mode. Modified: stable/11/sys/dev/iicbus/ds1307.c stable/11/sys/dev/iicbus/ds1307reg.h stable/11/sys/dev/iicbus/ds13rtc.c stable/11/sys/dev/iicbus/nxprtc.c stable/11/sys/kern/subr_clock.c stable/11/sys/sys/clock.h stable/11/sys/x86/isa/atrtc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iicbus/ds1307.c ============================================================================== --- stable/11/sys/dev/iicbus/ds1307.c Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/dev/iicbus/ds1307.c Sat Mar 24 20:40:16 2018 (r331496) @@ -217,7 +217,7 @@ ds1307_probe(device_t dev) compat = ofw_bus_search_compatible(dev, ds1307_compat_data); - if (compat == NULL) + if (compat->ocd_str == NULL) return (ENXIO); device_set_desc(dev, (const char *)compat->ocd_data); @@ -272,6 +272,7 @@ ds1307_start(void *xdev) struct sysctl_oid *tree_node; struct sysctl_oid_list *tree; uint8_t secs; + uint8_t osc_en; dev = (device_t)xdev; sc = device_get_softc(dev); @@ -286,7 +287,12 @@ ds1307_start(void *xdev) device_printf(sc->sc_dev, "cannot read from RTC.\n"); return; } - if ((secs & DS1307_SECS_CH) != 0) { + if (sc->sc_mcp7941x) + osc_en = 0x80; + else + osc_en = 0x00; + + if (((secs & DS1307_SECS_CH) ^ osc_en) != 0) { device_printf(sc->sc_dev, "WARNING: RTC clock stopped, check the battery.\n"); } @@ -316,9 +322,9 @@ static int ds1307_gettime(device_t dev, struct timespec *ts) { int error; - struct clocktime ct; + struct bcd_clocktime bct; struct ds1307_softc *sc; - uint8_t data[7], hourmask; + uint8_t data[7], hourmask, st_mask; sc = device_get_softc(dev); error = iicdev_readfrom(sc->sc_dev, DS1307_SECS, data, sizeof(data), @@ -329,7 +335,12 @@ ds1307_gettime(device_t dev, struct timespec *ts) } /* If the clock halted, we don't have good data. */ - if (data[DS1307_SECS] & DS1307_SECS_CH) + if (sc->sc_mcp7941x) + st_mask = 0x80; + else + st_mask = 0x00; + + if (((data[DS1307_SECS] & DS1307_SECS_CH) ^ st_mask) != 0) return (EINVAL); /* If chip is in AM/PM mode remember that. */ @@ -339,30 +350,24 @@ ds1307_gettime(device_t dev, struct timespec *ts) } else hourmask = DS1307_HOUR_MASK_24HR; - ct.nsec = 0; - ct.sec = FROMBCD(data[DS1307_SECS] & DS1307_SECS_MASK); - ct.min = FROMBCD(data[DS1307_MINS] & DS1307_MINS_MASK); - ct.hour = FROMBCD(data[DS1307_HOUR] & hourmask); - ct.day = FROMBCD(data[DS1307_DATE] & DS1307_DATE_MASK); - ct.mon = FROMBCD(data[DS1307_MONTH] & DS1307_MONTH_MASK); - ct.year = FROMBCD(data[DS1307_YEAR] & DS1307_YEAR_MASK); + bct.nsec = 0; + bct.ispm = (data[DS1307_HOUR] & DS1307_HOUR_IS_PM) != 0; + bct.sec = data[DS1307_SECS] & DS1307_SECS_MASK; + bct.min = data[DS1307_MINS] & DS1307_MINS_MASK; + bct.hour = data[DS1307_HOUR] & hourmask; + bct.day = data[DS1307_DATE] & DS1307_DATE_MASK; + bct.mon = data[DS1307_MONTH] & DS1307_MONTH_MASK; + bct.year = data[DS1307_YEAR] & DS1307_YEAR_MASK; - if (sc->sc_use_ampm) { - if (ct.hour == 12) - ct.hour = 0; - if (data[DS1307_HOUR] & DS1307_HOUR_IS_PM) - ct.hour += 12; - } - - return (clock_ct_to_ts(&ct, ts)); + return (clock_bcd_to_ts(&bct, ts, sc->sc_use_ampm)); } static int ds1307_settime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct ds1307_softc *sc; - int error; + int error, year; uint8_t data[7]; uint8_t pmflags; @@ -373,27 +378,30 @@ ds1307_settime(device_t dev, struct timespec *ts) * disables utc adjustment, so apply that ourselves. */ ts->tv_sec -= utc_offset(); - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, sc->sc_use_ampm); /* If the chip is in AM/PM mode, adjust hour and set flags as needed. */ if (sc->sc_use_ampm) { pmflags = DS1307_HOUR_USE_AMPM; - if (ct.hour >= 12) { - ct.hour -= 12; + if (bct.ispm) pmflags |= DS1307_HOUR_IS_PM; - } - if (ct.hour == 0) - ct.hour = 12; } else pmflags = 0; - data[DS1307_SECS] = TOBCD(ct.sec); - data[DS1307_MINS] = TOBCD(ct.min); - data[DS1307_HOUR] = TOBCD(ct.hour) | pmflags; - data[DS1307_DATE] = TOBCD(ct.day); - data[DS1307_WEEKDAY] = ct.dow; - data[DS1307_MONTH] = TOBCD(ct.mon); - data[DS1307_YEAR] = TOBCD(ct.year % 100); + data[DS1307_SECS] = bct.sec; + data[DS1307_MINS] = bct.min; + data[DS1307_HOUR] = bct.hour | pmflags; + data[DS1307_DATE] = bct.day; + data[DS1307_WEEKDAY] = bct.dow; + data[DS1307_MONTH] = bct.mon; + data[DS1307_YEAR] = bct.year & 0xff; + if (sc->sc_mcp7941x) { + data[DS1307_SECS] |= MCP7941X_SECS_ST; + data[DS1307_WEEKDAY] |= MCP7941X_WEEKDAY_VBATEN; + year = bcd2bin(bct.year >> 8) * 100 + bcd2bin(bct.year & 0xff); + if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) + data[DS1307_MONTH] |= MCP7941X_MONTH_LPYR; + } /* Write the time back to RTC. */ error = iicdev_writeto(sc->sc_dev, DS1307_SECS, data, sizeof(data), IIC_INTRWAIT); Modified: stable/11/sys/dev/iicbus/ds1307reg.h ============================================================================== --- stable/11/sys/dev/iicbus/ds1307reg.h Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/dev/iicbus/ds1307reg.h Sat Mar 24 20:40:16 2018 (r331496) @@ -36,6 +36,7 @@ #define DS1307_SECS 0x00 #define DS1307_SECS_MASK 0x7f #define DS1307_SECS_CH 0x80 +#define MCP7941X_SECS_ST 0x80 #define DS1307_MINS 0x01 #define DS1307_MINS_MASK 0x7f #define DS1307_HOUR 0x02 @@ -44,10 +45,12 @@ #define DS1307_HOUR_IS_PM 0x20 #define DS1307_HOUR_USE_AMPM 0x40 #define DS1307_WEEKDAY 0x03 +#define MCP7941X_WEEKDAY_VBATEN 0x08 #define DS1307_WEEKDAY_MASK 0x07 #define DS1307_DATE 0x04 #define DS1307_DATE_MASK 0x3f #define DS1307_MONTH 0x05 +#define MCP7941X_MONTH_LPYR 0x20 #define DS1307_MONTH_MASK 0x1f #define DS1307_YEAR 0x06 #define DS1307_YEAR_MASK 0xff Modified: stable/11/sys/dev/iicbus/ds13rtc.c ============================================================================== --- stable/11/sys/dev/iicbus/ds13rtc.c Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/dev/iicbus/ds13rtc.c Sat Mar 24 20:40:16 2018 (r331496) @@ -345,7 +345,7 @@ ds13rtc_start(void *arg) static int ds13rtc_gettime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; struct ds13rtc_softc *sc; int err; @@ -379,29 +379,23 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) else hourmask = DS13xx_M_24HOUR; - ct.sec = FROMBCD(tregs.sec & DS13xx_M_SECOND); - ct.min = FROMBCD(tregs.min & DS13xx_M_MINUTE); - ct.hour = FROMBCD(tregs.hour & hourmask); - ct.day = FROMBCD(tregs.day & DS13xx_M_DAY); - ct.mon = FROMBCD(tregs.month & DS13xx_M_MONTH); - ct.year = FROMBCD(tregs.year & DS13xx_M_YEAR); - ct.nsec = 0; + bct.nsec = 0; + bct.ispm = tregs.hour & DS13xx_B_HOUR_PM; + bct.sec = tregs.sec & DS13xx_M_SECOND; + bct.min = tregs.min & DS13xx_M_MINUTE; + bct.hour = tregs.hour & hourmask; + bct.day = tregs.day & DS13xx_M_DAY; + bct.mon = tregs.month & DS13xx_M_MONTH; + bct.year = tregs.year & DS13xx_M_YEAR; - if (sc->use_ampm) { - if (ct.hour == 12) - ct.hour = 0; - if (tregs.hour & DS13xx_B_HOUR_PM) - ct.hour += 12; - } - /* * If this chip has a century bit, honor it. Otherwise let * clock_ct_to_ts() infer the century from the 2-digit year. */ if (sc->use_century) - ct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 2000 : 1900; + bct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 0x100 : 0; - err = clock_ct_to_ts(&ct, ts); + err = clock_bcd_to_ts(&bct, ts, sc->use_ampm); return (err); } @@ -409,7 +403,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) static int ds13rtc_settime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; struct ds13rtc_softc *sc; int err; @@ -427,34 +421,30 @@ ds13rtc_settime(device_t dev, struct timespec *ts) if (sc->is_binary_counter) return (write_timeword(sc, ts->tv_sec)); - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, sc->use_ampm); /* If the chip is in AMPM mode deal with the PM flag. */ pmflags = 0; if (sc->use_ampm) { pmflags = DS13xx_B_HOUR_AMPM; - if (ct.hour >= 12) { - ct.hour -= 12; + if (bct.ispm) pmflags |= DS13xx_B_HOUR_PM; - } - if (ct.hour == 0) - ct.hour = 12; } /* If the chip has a century bit, set it as needed. */ cflag = 0; if (sc->use_century) { - if (ct.year >= 2000) + if (bct.year >= 2000) cflag |= DS13xx_B_MONTH_CENTURY; } - tregs.sec = TOBCD(ct.sec); - tregs.min = TOBCD(ct.min); - tregs.hour = TOBCD(ct.hour) | pmflags; - tregs.day = TOBCD(ct.day); - tregs.month = TOBCD(ct.mon) | cflag; - tregs.year = TOBCD(ct.year % 100); - tregs.wday = ct.dow; + tregs.sec = bct.sec; + tregs.min = bct.min; + tregs.hour = bct.hour | pmflags; + tregs.day = bct.day; + tregs.month = bct.mon | cflag; + tregs.year = bct.year & 0xff; + tregs.wday = bct.dow; /* * Set the time. Reset the OSF bit if it is on and it is not part of Modified: stable/11/sys/dev/iicbus/nxprtc.c ============================================================================== --- stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 20:40:16 2018 (r331496) @@ -192,10 +192,10 @@ struct nxprtc_softc { uint8_t secaddr; /* Address of seconds register */ uint8_t tmcaddr; /* Address of timer count register */ bool use_timer; /* Use timer for fractional sec */ + bool use_ampm; /* Chip is set to use am/pm mode */ }; #define SC_F_CPOL (1 << 0) /* Century bit means 19xx */ -#define SC_F_AMPM (1 << 1) /* Use PM flag in hours reg */ /* * We use the compat_data table to look up hint strings in the non-FDT case, so @@ -382,10 +382,10 @@ pcf8523_start(struct nxprtc_softc *sc) /* Remember whether we're running in AM/PM mode. */ if (is2129) { if (cs1 & PCF2129_B_CS1_12HR) - sc->flags |= SC_F_AMPM; + sc->use_ampm = true; } else { if (cs1 & PCF8523_B_CS1_12HR) - sc->flags |= SC_F_AMPM; + sc->use_ampm = true; } return (0); @@ -543,7 +543,7 @@ nxprtc_start(void *dev) static int nxprtc_gettime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; struct nxprtc_softc *sc; int err; @@ -570,21 +570,19 @@ nxprtc_gettime(device_t dev, struct timespec *ts) return (EINVAL); /* hardware is good, time is not. */ } - if (sc->flags & SC_F_AMPM) + if (sc->use_ampm) hourmask = PCF85xx_M_12HOUR; else hourmask = PCF85xx_M_24HOUR; - ct.nsec = ((uint64_t)tmrcount * 1000000000) / TMR_TICKS_SEC; - ct.sec = FROMBCD(tregs.sec & PCF85xx_M_SECOND); - ct.min = FROMBCD(tregs.min & PCF85xx_M_MINUTE); - ct.hour = FROMBCD(tregs.hour & hourmask); - ct.day = FROMBCD(tregs.day & PCF85xx_M_DAY); - ct.mon = FROMBCD(tregs.month & PCF85xx_M_MONTH); - ct.year = FROMBCD(tregs.year & PCF85xx_M_YEAR); - ct.year += 1900; - if (ct.year < POSIX_BASE_YEAR) - ct.year += 100; /* assume [1970, 2069] */ + bct.nsec = ((uint64_t)tmrcount * 1000000000) / TMR_TICKS_SEC; + bct.ispm = (tregs.hour & PCF8523_B_HOUR_PM) != 0; + bct.sec = tregs.sec & PCF85xx_M_SECOND; + bct.min = tregs.min & PCF85xx_M_MINUTE; + bct.hour = tregs.hour & hourmask; + bct.day = tregs.day & PCF85xx_M_DAY; + bct.mon = tregs.month & PCF85xx_M_MONTH; + bct.year = tregs.year & PCF85xx_M_YEAR; /* * Old PCF8563 datasheets recommended that the C bit be 1 for 19xx and 0 @@ -594,21 +592,13 @@ nxprtc_gettime(device_t dev, struct timespec *ts) */ if (sc->chiptype == TYPE_PCF8563) { if (tregs.month & PCF8563_B_MONTH_C) { - if (ct.year >= 2000) + if (bct.year < 0x70) sc->flags |= SC_F_CPOL; - } else if (ct.year < 2000) + } else if (bct.year >= 0x70) sc->flags |= SC_F_CPOL; } - /* If this chip is running in 12-hour/AMPM mode, deal with it. */ - if (sc->flags & SC_F_AMPM) { - if (ct.hour == 12) - ct.hour = 0; - if (tregs.hour & PCF8523_B_HOUR_PM) - ct.hour += 12; - } - - err = clock_ct_to_ts(&ct, ts); + err = clock_bcd_to_ts(&bct, ts, sc->use_ampm); ts->tv_sec += utc_offset(); return (err); @@ -617,11 +607,11 @@ nxprtc_gettime(device_t dev, struct timespec *ts) static int nxprtc_settime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; struct nxprtc_softc *sc; int err; - uint8_t cflag, cs1, pmflag; + uint8_t cflag, cs1; sc = device_get_softc(dev); @@ -647,36 +637,25 @@ nxprtc_settime(device_t dev, struct timespec *ts) getnanotime(ts); ts->tv_sec -= utc_offset(); ts->tv_nsec = 0; - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, sc->use_ampm); - /* If the chip is in AMPM mode deal with the PM flag. */ - pmflag = 0; - if (sc->flags & SC_F_AMPM) { - if (ct.hour >= 12) { - ct.hour -= 12; - pmflag = PCF8523_B_HOUR_PM; - } - if (ct.hour == 0) - ct.hour = 12; - } - /* On 8563 set the century based on the polarity seen when reading. */ cflag = 0; if (sc->chiptype == TYPE_PCF8563) { if ((sc->flags & SC_F_CPOL) != 0) { - if (ct.year >= 2000) + if (bct.year >= 0x2000) cflag = PCF8563_B_MONTH_C; - } else if (ct.year < 2000) + } else if (bct.year < 0x2000) cflag = PCF8563_B_MONTH_C; } - tregs.sec = TOBCD(ct.sec); - tregs.min = TOBCD(ct.min); - tregs.hour = TOBCD(ct.hour) | pmflag; - tregs.day = TOBCD(ct.day); - tregs.month = TOBCD(ct.mon); - tregs.year = TOBCD(ct.year % 100) | cflag; - tregs.wday = ct.dow; + tregs.sec = bct.sec; + tregs.min = bct.min; + tregs.hour = bct.hour | (bct.ispm ? PCF8523_B_HOUR_PM : 0); + tregs.day = bct.day; + tregs.month = bct.mon; + tregs.year = (bct.year & 0xff) | cflag; + tregs.wday = bct.dow; /* * Set the time, reset the timer count register, then start the clocks. Modified: stable/11/sys/kern/subr_clock.c ============================================================================== --- stable/11/sys/kern/subr_clock.c Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/kern/subr_clock.c Sat Mar 24 20:40:16 2018 (r331496) @@ -199,6 +199,55 @@ clock_ct_to_ts(struct clocktime *ct, struct timespec * return (0); } +int +clock_bcd_to_ts(struct bcd_clocktime *bct, struct timespec *ts, bool ampm) +{ + struct clocktime ct; + int bcent, byear; + + /* + * Year may come in as 2-digit or 4-digit BCD. Split the value into + * separate BCD century and year values for validation and conversion. + */ + bcent = bct->year >> 8; + byear = bct->year & 0xff; + + /* + * Ensure that all values are valid BCD numbers, to avoid assertions in + * the BCD-to-binary conversion routines. clock_ct_to_ts() will further + * validate the field ranges (such as 0 <= min <= 59) during conversion. + */ + if (!validbcd(bcent) || !validbcd(byear) || !validbcd(bct->mon) || + !validbcd(bct->day) || !validbcd(bct->hour) || + !validbcd(bct->min) || !validbcd(bct->sec)) { + if (ct_debug) + printf("clock_bcd_to_ts: bad BCD: " + "[%04x-%02x-%02x %02x:%02x:%02x]\n", + bct->year, bct->mon, bct->day, + bct->hour, bct->min, bct->sec); + return (EINVAL); + } + + ct.year = FROMBCD(byear) + FROMBCD(bcent) * 100; + ct.mon = FROMBCD(bct->mon); + ct.day = FROMBCD(bct->day); + ct.hour = FROMBCD(bct->hour); + ct.min = FROMBCD(bct->min); + ct.sec = FROMBCD(bct->sec); + ct.dow = bct->dow; + ct.nsec = bct->nsec; + + /* If asked to handle am/pm, convert from 12hr+pmflag to 24hr. */ + if (ampm) { + if (ct.hour == 12) + ct.hour = 0; + if (bct->ispm) + ct.hour += 12; + } + + return (clock_ct_to_ts(&ct, ts)); +} + void clock_ts_to_ct(struct timespec *ts, struct clocktime *ct) { @@ -244,6 +293,34 @@ clock_ts_to_ct(struct timespec *ts, struct clocktime * print_ct(ct); printf("\n"); } +} + +void +clock_ts_to_bcd(struct timespec *ts, struct bcd_clocktime *bct, bool ampm) +{ + struct clocktime ct; + + clock_ts_to_ct(ts, &ct); + + /* If asked to handle am/pm, convert from 24hr to 12hr+pmflag. */ + bct->ispm = false; + if (ampm) { + if (ct.hour >= 12) { + ct.hour -= 12; + bct->ispm = true; + } + if (ct.hour == 0) + ct.hour = 12; + } + + bct->year = TOBCD(ct.year % 100) | (TOBCD(ct.year / 100) << 8); + bct->mon = TOBCD(ct.mon); + bct->day = TOBCD(ct.day); + bct->hour = TOBCD(ct.hour); + bct->min = TOBCD(ct.min); + bct->sec = TOBCD(ct.sec); + bct->dow = ct.dow; + bct->nsec = ct.nsec; } int Modified: stable/11/sys/sys/clock.h ============================================================================== --- stable/11/sys/sys/clock.h Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/sys/clock.h Sat Mar 24 20:40:16 2018 (r331496) @@ -60,9 +60,22 @@ extern int tz_dsttime; int utc_offset(void); /* - * Structure to hold the values typically reported by time-of-day clocks. - * This can be passed to the generic conversion functions to be converted - * to a struct timespec. + * Structure to hold the values typically reported by time-of-day clocks, + * expressed as binary integers (see below for a BCD version). This can be + * passed to the conversion functions to be converted to/from a struct timespec. + * + * On input, the year is interpreted as follows: + * 0 - 69 = 2000 - 2069 + * 70 - 99 = 1970 - 1999 + * 100 - 199 = 2000 - 2099 (Supports hardware "century bit".) + * 200 - 1969 = Invalid. + * 1970 - 9999 = Full 4-digit century+year. + * + * The dow field is ignored (not even validated) on input, but is always + * populated with day-of-week on output. + * + * clock_ct_to_ts() returns EINVAL if any values are out of range. The year + * field will always be 4-digit on output. */ struct clocktime { int year; /* year (4 digit year) */ @@ -77,6 +90,43 @@ struct clocktime { int clock_ct_to_ts(struct clocktime *, struct timespec *); void clock_ts_to_ct(struct timespec *, struct clocktime *); + +/* + * Structure to hold the values typically reported by time-of-day clocks, + * expressed as BCD. This can be passed to the conversion functions to be + * converted to/from a struct timespec. + * + * The clock_bcd_to_ts() function interprets the values in the year through sec + * fields as BCD numbers, and returns EINVAL if any BCD values are out of range. + * After conversion to binary, the values are passed to clock_ct_to_ts() and + * undergo further validation as described above. Year may be 2 or 4-digit BCD, + * interpreted as described above. The nsec field is binary. If the ampm arg + * is true, the incoming hour and ispm values are interpreted as 12-hour am/pm + * representation of the hour, otherwise hour is interpreted as 24-hour and ispm + * is ignored. + * + * The clock_ts_to_bcd() function converts the timespec to BCD values stored + * into year through sec. The value in year will be 4-digit BCD (e.g., + * 0x2017). The mon through sec values will be 2-digit BCD. The nsec field will + * be binary, and the range of dow makes its binary and BCD values identical. + * If the ampm arg is true, the hour and ispm fields are set to the 12-hour + * time plus a pm flag, otherwise the hour is set to 24-hour time and ispm is + * set to false. + */ +struct bcd_clocktime { + uint16_t year; /* year (2 or 4 digit year) */ + uint8_t mon; /* month (1 - 12) */ + uint8_t day; /* day (1 - 31) */ + uint8_t hour; /* hour (0 - 23 or 1 - 12) */ + uint8_t min; /* minute (0 - 59) */ + uint8_t sec; /* second (0 - 59) */ + uint8_t dow; /* day of week (0 - 6; 0 = Sunday) */ + long nsec; /* nanoseconds */ + bool ispm; /* true if hour represents pm time */ +}; + +int clock_bcd_to_ts(struct bcd_clocktime *, struct timespec *, bool ampm); +void clock_ts_to_bcd(struct timespec *, struct bcd_clocktime *, bool ampm); /* * Time-of-day clock functions and flags. These functions might sleep. Modified: stable/11/sys/x86/isa/atrtc.c ============================================================================== --- stable/11/sys/x86/isa/atrtc.c Sat Mar 24 19:57:08 2018 (r331495) +++ stable/11/sys/x86/isa/atrtc.c Sat Mar 24 20:40:16 2018 (r331496) @@ -74,28 +74,23 @@ static u_char rtc_statusb = RTCSB_24HR; * RTC support routines */ -int -rtcin(int reg) +static inline u_char +rtcin_locked(int reg) { - u_char val; - RTC_LOCK; if (rtc_reg != reg) { inb(0x84); outb(IO_RTC, reg); rtc_reg = reg; inb(0x84); } - val = inb(IO_RTC + 1); - RTC_UNLOCK; - return (val); + return (inb(IO_RTC + 1)); } -void -writertc(int reg, u_char val) +static inline void +rtcout_locked(int reg, u_char val) { - RTC_LOCK; if (rtc_reg != reg) { inb(0x84); outb(IO_RTC, reg); @@ -104,13 +99,26 @@ writertc(int reg, u_char val) } outb(IO_RTC + 1, val); inb(0x84); +} + +int +rtcin(int reg) +{ + u_char val; + + RTC_LOCK; + val = rtcin_locked(reg); RTC_UNLOCK; + return (val); } -static __inline int -readrtc(int port) +void +writertc(int reg, u_char val) { - return(bcd2bin(rtcin(port))); + + RTC_LOCK; + rtcout_locked(reg, val); + RTC_UNLOCK; } static void @@ -159,37 +167,6 @@ atrtc_restore(void) rtcin(RTC_INTR); } -static void -atrtc_set(struct timespec *ts) -{ - struct clocktime ct; - - clock_ts_to_ct(ts, &ct); - - mtx_lock(&atrtc_time_lock); - - /* Disable RTC updates and interrupts. */ - writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); - - writertc(RTC_SEC, bin2bcd(ct.sec)); /* Write back Seconds */ - writertc(RTC_MIN, bin2bcd(ct.min)); /* Write back Minutes */ - writertc(RTC_HRS, bin2bcd(ct.hour)); /* Write back Hours */ - - writertc(RTC_WDAY, ct.dow + 1); /* Write back Weekday */ - writertc(RTC_DAY, bin2bcd(ct.day)); /* Write back Day */ - writertc(RTC_MONTH, bin2bcd(ct.mon)); /* Write back Month */ - writertc(RTC_YEAR, bin2bcd(ct.year % 100)); /* Write back Year */ -#ifdef USE_RTC_CENTURY - writertc(RTC_CENTURY, bin2bcd(ct.year / 100)); /* ... and Century */ -#endif - - /* Re-enable RTC updates and interrupts. */ - writertc(RTC_STATUSB, rtc_statusb); - rtcin(RTC_INTR); - - mtx_unlock(&atrtc_time_lock); -} - /********************************************************************** * RTC driver for subr_rtc */ @@ -336,15 +313,44 @@ atrtc_resume(device_t dev) static int atrtc_settime(device_t dev __unused, struct timespec *ts) { + struct bcd_clocktime bct; - atrtc_set(ts); + clock_ts_to_bcd(ts, &bct, false); + + mtx_lock(&atrtc_time_lock); + RTC_LOCK; + + /* Disable RTC updates and interrupts. */ + rtcout_locked(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); + + /* Write all the time registers. */ + rtcout_locked(RTC_SEC, bct.sec); + rtcout_locked(RTC_MIN, bct.min); + rtcout_locked(RTC_HRS, bct.hour); + rtcout_locked(RTC_WDAY, bct.dow + 1); + rtcout_locked(RTC_DAY, bct.day); + rtcout_locked(RTC_MONTH, bct.mon); + rtcout_locked(RTC_YEAR, bct.year & 0xff); +#ifdef USE_RTC_CENTURY + rtcout_locked(RTC_CENTURY, bct.year >> 8); +#endif + + /* + * Re-enable RTC updates and interrupts. + */ + rtcout_locked(RTC_STATUSB, rtc_statusb); + rtcin_locked(RTC_INTR); + + RTC_UNLOCK; + mtx_unlock(&atrtc_time_lock); + return (0); } static int atrtc_gettime(device_t dev, struct timespec *ts) { - struct clocktime ct; + struct bcd_clocktime bct; /* Look if we have a RTC present and the time is valid */ if (!(rtcin(RTC_STATUSD) & RTCSD_PWR)) { @@ -362,25 +368,22 @@ atrtc_gettime(device_t dev, struct timespec *ts) mtx_lock(&atrtc_time_lock); while (rtcin(RTC_STATUSA) & RTCSA_TUP) continue; - critical_enter(); - ct.nsec = 0; - ct.sec = readrtc(RTC_SEC); - ct.min = readrtc(RTC_MIN); - ct.hour = readrtc(RTC_HRS); - ct.day = readrtc(RTC_DAY); - ct.dow = readrtc(RTC_WDAY) - 1; - ct.mon = readrtc(RTC_MONTH); - ct.year = readrtc(RTC_YEAR); + RTC_LOCK; + bct.sec = rtcin_locked(RTC_SEC); + bct.min = rtcin_locked(RTC_MIN); + bct.hour = rtcin_locked(RTC_HRS); + bct.day = rtcin_locked(RTC_DAY); + bct.mon = rtcin_locked(RTC_MONTH); + bct.year = rtcin_locked(RTC_YEAR); #ifdef USE_RTC_CENTURY - ct.year += readrtc(RTC_CENTURY) * 100; -#else - ct.year += (ct.year < 80 ? 2000 : 1900); + bct.year |= rtcin_locked(RTC_CENTURY) << 8; #endif - critical_exit(); + RTC_UNLOCK; mtx_unlock(&atrtc_time_lock); - /* Set dow = -1 because some clocks don't set it correctly. */ - ct.dow = -1; - return (clock_ct_to_ts(&ct, ts)); + /* dow is unused in timespec conversion and we have no nsec info. */ + bct.dow = 0; + bct.nsec = 0; + return (clock_bcd_to_ts(&bct, ts, false)); } static device_method_t atrtc_methods[] = { From owner-svn-src-stable@freebsd.org Sat Mar 24 21:22:29 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F246F4A476; Sat, 24 Mar 2018 21:22:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 10D8B8069F; Sat, 24 Mar 2018 21:22:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BCF614C28; Sat, 24 Mar 2018 21:22:29 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OLMSsx076297; Sat, 24 Mar 2018 21:22:28 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OLMSF8076293; Sat, 24 Mar 2018 21:22:28 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242122.w2OLMSF8076293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 21:22: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: r331497 - stable/11/sys/dev/iicbus X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/dev/iicbus X-SVN-Commit-Revision: 331497 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, 24 Mar 2018 21:22:29 -0000 Author: ian Date: Sat Mar 24 21:22:28 2018 New Revision: 331497 URL: https://svnweb.freebsd.org/changeset/base/331497 Log: MFC r328307, r328311-r328312 r328307: Fix a bug introduced with recursive bus ownership support in r321584. The recursive ownership support added in r321584 was unconditionally in effect all the time -- whenever a given i2c slave device instance tried to lock the i2c bus for exclusive use when it already owned the bus, the call returned immediately without waiting. However, many i2c slave drivers use bus ownership to enforce that only a single thread at a time can be using the slave device. The recursive locking changes broke this use case. Now there is a new flag, IIC_RECURSIVE, which can be mixed in with the other flags passed to iicbus_acquire_bus() to allow drivers to indicate when recursive locking is desired. Using the flag implies that the driver is managing concurrent access to the device by different threads in some way. This immediately fixes all existing i2c slave drivers except for the two i2c RTC drivers which use the recursive locking feature; those will be fixed in a followup commit. r328311 and r328312: Follow changes in r328307 by using new IIC_RECURSIVE flag. The driver now ensures only one thread at a time is running in the API functions (clock_gettime() and clock_settime()) by specifically requesting ownership of the i2c bus without using IIC_RECURSIVE, then it does all IO using IIC_RECURSIVE so that each individual IO operation doesn't try to re-acquire the bus. The other IO done by the driver happens at attach or intr_config_hooks time, when there can't be multiple threads running with the same device instance. So, the IIC_RECURSIVE flag can be safely ORed into the wait flags for all IO done by the driver, because it's all either done in a single-threaded environment, or protected within a block bounded by explict iicbus_acquire_bus() and iicbus_release_bus() calls. Modified: stable/11/sys/dev/iicbus/iiconf.c stable/11/sys/dev/iicbus/iiconf.h stable/11/sys/dev/iicbus/isl12xx.c stable/11/sys/dev/iicbus/nxprtc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iicbus/iiconf.c ============================================================================== --- stable/11/sys/dev/iicbus/iiconf.c Sat Mar 24 20:40:16 2018 (r331496) +++ stable/11/sys/dev/iicbus/iiconf.c Sat Mar 24 21:22:28 2018 (r331497) @@ -84,7 +84,7 @@ iicbus_poll(struct iicbus_softc *sc, int how) int error; IICBUS_ASSERT_LOCKED(sc); - switch (how) { + switch (how & IIC_INTRWAIT) { case IIC_WAIT | IIC_INTR: error = mtx_sleep(sc, &sc->lock, IICPRI|PCATCH, "iicreq", 0); break; @@ -115,8 +115,14 @@ iicbus_request_bus(device_t bus, device_t dev, int how IICBUS_LOCK(sc); - while (error == 0 && sc->owner != NULL && sc->owner != dev) - error = iicbus_poll(sc, how); + for (;;) { + if (sc->owner == NULL) + break; + if ((how & IIC_RECURSIVE) && sc->owner == dev) + break; + if ((error = iicbus_poll(sc, how)) != 0) + break; + } if (error == 0) { ++sc->owncount; Modified: stable/11/sys/dev/iicbus/iiconf.h ============================================================================== --- stable/11/sys/dev/iicbus/iiconf.h Sat Mar 24 20:40:16 2018 (r331496) +++ stable/11/sys/dev/iicbus/iiconf.h Sat Mar 24 21:22:28 2018 (r331497) @@ -39,13 +39,14 @@ #define LSB 0x1 /* - * How tsleep() is called in iic_request_bus(). + * Options affecting iicbus_request_bus() */ #define IIC_DONTWAIT 0 #define IIC_NOINTR 0 #define IIC_WAIT 0x1 #define IIC_INTR 0x2 #define IIC_INTRWAIT (IIC_INTR | IIC_WAIT) +#define IIC_RECURSIVE 0x4 /* * i2c modes Modified: stable/11/sys/dev/iicbus/isl12xx.c ============================================================================== --- stable/11/sys/dev/iicbus/isl12xx.c Sat Mar 24 20:40:16 2018 (r331496) +++ stable/11/sys/dev/iicbus/isl12xx.c Sat Mar 24 21:22:28 2018 (r331497) @@ -137,18 +137,27 @@ static struct ofw_compat_data compat_data[] = { }; #endif +/* + * When doing i2c IO, indicate that we need to wait for exclusive bus ownership, + * but that we should not wait if we already own the bus. This lets us put + * iicbus_acquire_bus() calls with a non-recursive wait at the entry of our API + * functions to ensure that only one client at a time accesses the hardware for + * the entire series of operations it takes to read or write the clock. + */ +#define WAITFLAGS (IIC_WAIT | IIC_RECURSIVE) + static inline int isl12xx_read1(struct isl12xx_softc *sc, uint8_t reg, uint8_t *data) { - return (iicdev_readfrom(sc->dev, reg, data, 1, IIC_WAIT)); + return (iicdev_readfrom(sc->dev, reg, data, 1, WAITFLAGS)); } static inline int isl12xx_write1(struct isl12xx_softc *sc, uint8_t reg, uint8_t val) { - return (iicdev_writeto(sc->dev, reg, &val, 1, IIC_WAIT)); + return (iicdev_writeto(sc->dev, reg, &val, 1, WAITFLAGS)); } static void @@ -229,17 +238,23 @@ isl12xx_gettime(device_t dev, struct timespec *ts) int err; uint8_t hourmask, sreg; - /* If power failed, we can't provide valid time. */ - if ((err = isl12xx_read1(sc, ISL12XX_SR_REG, &sreg)) != 0) + /* + * Read the status and time registers. + */ + if ((err = iicbus_request_bus(sc->busdev, sc->dev, IIC_WAIT)) == 0) { + if ((err = isl12xx_read1(sc, ISL12XX_SR_REG, &sreg)) == 0) { + err = iicdev_readfrom(sc->dev, ISL12XX_SC_REG, &tregs, + sizeof(tregs), WAITFLAGS); + } + iicbus_release_bus(sc->busdev, sc->dev); + } + if (err != 0) return (err); + + /* If power failed, we can't provide valid time. */ if (sreg & ISL12XX_SR_RTCF) return (EINVAL); - /* Read the bcd time registers. */ - if ((err = iicdev_readfrom(sc->dev, ISL12XX_SC_REG, &tregs, sizeof(tregs), - IIC_WAIT)) != 0) - return (EINVAL); - /* If chip is in AM/PM mode remember that for when we set time. */ if (tregs.hour & ISL12XX_24HR_FLAG) { hourmask = ISL12xx_24HR_MASK; @@ -319,7 +334,7 @@ isl12xx_settime(device_t dev, struct timespec *ts) sreg |= ISL12XX_SR_WRTC | ISL12XX_SR_W0C_BITS; if ((err = isl12xx_write1(sc, ISL12XX_SR_REG, sreg)) == 0) { err = iicdev_writeto(sc->dev, ISL12XX_SC_REG, &tregs, - sizeof(tregs), IIC_WAIT); + sizeof(tregs), WAITFLAGS); sreg &= ~ISL12XX_SR_WRTC; isl12xx_write1(sc, ISL12XX_SR_REG, sreg); } Modified: stable/11/sys/dev/iicbus/nxprtc.c ============================================================================== --- stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 20:40:16 2018 (r331496) +++ stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 21:22:28 2018 (r331497) @@ -198,6 +198,15 @@ struct nxprtc_softc { #define SC_F_CPOL (1 << 0) /* Century bit means 19xx */ /* + * When doing i2c IO, indicate that we need to wait for exclusive bus ownership, + * but that we should not wait if we already own the bus. This lets us put + * iicbus_acquire_bus() calls with a non-recursive wait at the entry of our API + * functions to ensure that only one client at a time accesses the hardware for + * the entire series of operations it takes to read or write the clock. + */ +#define WAITFLAGS (IIC_WAIT | IIC_RECURSIVE) + +/* * We use the compat_data table to look up hint strings in the non-FDT case, so * define the struct locally when we don't get it from ofw_bus_subr.h. */ @@ -230,14 +239,14 @@ static int read_reg(struct nxprtc_softc *sc, uint8_t reg, uint8_t *val) { - return (iicdev_readfrom(sc->dev, reg, val, sizeof(*val), IIC_WAIT)); + return (iicdev_readfrom(sc->dev, reg, val, sizeof(*val), WAITFLAGS)); } static int write_reg(struct nxprtc_softc *sc, uint8_t reg, uint8_t val) { - return (iicdev_writeto(sc->dev, reg, &val, sizeof(val), IIC_WAIT)); + return (iicdev_writeto(sc->dev, reg, &val, sizeof(val), WAITFLAGS)); } static int @@ -264,7 +273,7 @@ read_timeregs(struct nxprtc_softc *sc, struct time_reg continue; } if ((err = iicdev_readfrom(sc->dev, sc->secaddr, tregs, - sizeof(*tregs), IIC_WAIT)) != 0) + sizeof(*tregs), WAITFLAGS)) != 0) break; } while (sc->use_timer && tregs->sec != sec); @@ -294,7 +303,7 @@ write_timeregs(struct nxprtc_softc *sc, struct time_re { return (iicdev_writeto(sc->dev, sc->secaddr, tregs, - sizeof(*tregs), IIC_WAIT)); + sizeof(*tregs), WAITFLAGS)); } static int @@ -557,14 +566,15 @@ nxprtc_gettime(device_t dev, struct timespec *ts) * bit is not set in the control reg. The latter can happen if there * was an error when setting the time. */ - if ((err = read_timeregs(sc, &tregs, &tmrcount)) != 0) { - device_printf(dev, "cannot read RTC time\n"); - return (err); + if ((err = iicbus_request_bus(sc->busdev, sc->dev, IIC_WAIT)) == 0) { + if ((err = read_timeregs(sc, &tregs, &tmrcount)) == 0) { + err = read_reg(sc, PCF85xx_R_CS1, &cs1); + } + iicbus_release_bus(sc->busdev, sc->dev); } - if ((err = read_reg(sc, PCF85xx_R_CS1, &cs1)) != 0) { - device_printf(dev, "cannot read RTC time\n"); + if (err != 0) return (err); - } + if ((tregs.sec & PCF85xx_B_SECOND_OS) || (cs1 & PCF85xx_B_CS1_STOP)) { device_printf(dev, "RTC clock not running\n"); return (EINVAL); /* hardware is good, time is not. */ From owner-svn-src-stable@freebsd.org Sat Mar 24 21:27:11 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88C9EF4AA34; Sat, 24 Mar 2018 21:27:11 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3278A8093C; Sat, 24 Mar 2018 21:27:11 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29D7114C34; Sat, 24 Mar 2018 21:27:11 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OLRBOs076519; Sat, 24 Mar 2018 21:27:11 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OLRACu076515; Sat, 24 Mar 2018 21:27:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242127.w2OLRACu076515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 21:27: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: r331498 - stable/11/sys/arm/freescale/imx X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/freescale/imx X-SVN-Commit-Revision: 331498 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, 24 Mar 2018 21:27:12 -0000 Author: ian Date: Sat Mar 24 21:27:10 2018 New Revision: 331498 URL: https://svnweb.freebsd.org/changeset/base/331498 Log: MFC r328345, r328349, r328405, r328407, r328442 r328345: Reformat indentation to match other imx5/6 register definition headers, and tweak some comments. No functional changes. r328349: Make the trivial imx_soc_family() function an inline in imx_machdep.h. The imx_machdep.c file is on the fast path to non-existance and this would be the only thing left in it after some watchdog changes are completed. r328405: Minor cleanups... Move DRIVER_MODULE() and other boilerplate stuff to the bottom of the file, where it is in most imx5/6 drivers. Switch from an RD2 macro using bus_space_read_2() to an inline function using bus_read_2(); likewise for WR2. Use RESOURCE_SPEC_END to end the resource_spec list. Net effect should be no functional changes. r328407: Fix return style in RD2. Remove bogus return value from a void function in WR2 (I have no idea why that didn't result in a compile error). r328442: Add support to the imx5/6 watchdog for the external reset signal. Also, if the "power down" watchdog used by the ROM boot code is still active when the regular watchdog is activated, turn off the power-down watchdog. This adds support for the "fsl,ext-reset-output" FDT property. When present, that property indicates that a chip reset is accomplished by asserting the WDOG1_B external signal, which is supposed to trigger some external component such as a PMIC to ready the hardware for reset (for example, adjusting voltages from idle to full-power levels), and assert the POR signal to SoC when ready. To guard against misconfiguation leading to a non-rebootable system, the external reset signal is backstopped by code that asserts a normal internal chip reset if nothing responds to the external reset signal within one second. Modified: stable/11/sys/arm/freescale/imx/imx_machdep.c stable/11/sys/arm/freescale/imx/imx_machdep.h stable/11/sys/arm/freescale/imx/imx_wdog.c stable/11/sys/arm/freescale/imx/imx_wdogreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_machdep.c Sat Mar 24 21:22:28 2018 (r331497) +++ stable/11/sys/arm/freescale/imx/imx_machdep.c Sat Mar 24 21:27:10 2018 (r331498) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -65,27 +66,51 @@ SYSCTL_STRING(_hw_imx, OID_AUTO, last_reset_reason, CT void imx_wdog_cpu_reset(vm_offset_t wdcr_physaddr) { - volatile uint16_t * pcr; + volatile uint16_t cr, *pcr; + if ((pcr = devmap_ptov(wdcr_physaddr, sizeof(*pcr))) == NULL) { + printf("imx_wdog_cpu_reset(): " + "cannot find control register... locking up now."); + for (;;) + cpu_spinwait(); + } + cr = *pcr; + /* - * Trigger an immediate reset by clearing the SRS bit in the watchdog - * control register. The reset happens on the next cycle of the wdog - * 32KHz clock, so hang out in a spin loop until the reset takes effect. + * If the watchdog hardware has been set up to trigger an external reset + * signal on watchdog timeout, then we do software-requested rebooting + * the same way, by asserting the external reset signal. * + * Asserting external reset is supposed to result in some external + * component asserting the POR pin on the SoC, possibly after adjusting + * and stabilizing system voltages, or taking other system-wide reset + * actions. Just in case there is some kind of misconfiguration, we + * hang out and do nothing for a full second, then continue on into + * the code to assert a software reset as well. + */ + if (cr & WDOG_CR_WDT) { + cr &= ~WDOG_CR_WDA; /* Assert active-low ext reset bit. */ + *pcr = cr; + DELAY(1000000); + printf("imx_wdog_cpu_reset(): " + "External reset failed, trying internal cpu-reset\n"); + DELAY(10000); /* Time for printf to appear */ + } + + /* * Imx6 erratum ERR004346 says the SRS bit has to be cleared twice * within the same cycle of the 32khz clock to reliably trigger the * reset. Writing it 3 times in a row ensures at least 2 of the writes * happen in the same 32k clock cycle. */ - if ((pcr = devmap_ptov(wdcr_physaddr, sizeof(*pcr))) == NULL) { - printf("cpu_reset() can't find its control register... locking up now."); - } else { - *pcr &= ~WDOG_CR_SRS; - *pcr &= ~WDOG_CR_SRS; - *pcr &= ~WDOG_CR_SRS; - } + cr &= ~WDOG_CR_SRS; /* Assert active-low software reset bit. */ + *pcr = cr; + *pcr = cr; + *pcr = cr; + + /* Reset happens on the next tick of the 32khz clock, wait for it. */ for (;;) - continue; + cpu_spinwait(); } void @@ -104,11 +129,4 @@ imx_wdog_init_last_reset(vm_offset_t wdsr_phys) sysctl___hw_imx_last_reset_reason.oid_arg1 = "PowerOnReset"; } } - -u_int -imx_soc_family(void) -{ - return (imx_soc_type() >> IMXSOC_FAMSHIFT); -} - Modified: stable/11/sys/arm/freescale/imx/imx_machdep.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_machdep.h Sat Mar 24 21:22:28 2018 (r331497) +++ stable/11/sys/arm/freescale/imx/imx_machdep.h Sat Mar 24 21:27:10 2018 (r331498) @@ -61,7 +61,12 @@ void imx_wdog_init_last_reset(vm_offset_t _wdsr_phys); #define IMXSOC_FAMSHIFT 28 u_int imx_soc_type(void); -u_int imx_soc_family(void); + +static inline u_int +imx_soc_family(void) +{ + return (imx_soc_type() >> IMXSOC_FAMSHIFT); +} #endif Modified: stable/11/sys/arm/freescale/imx/imx_wdog.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_wdog.c Sat Mar 24 21:22:28 2018 (r331497) +++ stable/11/sys/arm/freescale/imx/imx_wdog.c Sat Mar 24 21:27:10 2018 (r331498) @@ -50,23 +50,27 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include struct imx_wdog_softc { struct mtx sc_mtx; device_t sc_dev; - bus_space_tag_t sc_bst; - bus_space_handle_t sc_bsh; struct resource *sc_res[2]; + void *sc_ih; uint32_t sc_timeout; + bool sc_pde_enabled; }; static struct resource_spec imx_wdog_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, - { -1, 0 } + RESOURCE_SPEC_END }; +#define MEMRES 0 +#define IRQRES 1 + static struct ofw_compat_data compat_data[] = { {"fsl,imx6sx-wdt", 1}, {"fsl,imx6sl-wdt", 1}, @@ -81,28 +85,19 @@ static struct ofw_compat_data compat_data[] = { {NULL, 0} }; -static void imx_watchdog(void *, u_int, int *); -static int imx_wdog_probe(device_t); -static int imx_wdog_attach(device_t); +static inline uint16_t +RD2(struct imx_wdog_softc *sc, bus_size_t offs) +{ -static device_method_t imx_wdog_methods[] = { - DEVMETHOD(device_probe, imx_wdog_probe), - DEVMETHOD(device_attach, imx_wdog_attach), - DEVMETHOD_END -}; + return (bus_read_2(sc->sc_res[MEMRES], offs)); +} -static driver_t imx_wdog_driver = { - "imx_wdog", - imx_wdog_methods, - sizeof(struct imx_wdog_softc), -}; -static devclass_t imx_wdog_devclass; -DRIVER_MODULE(imx_wdog, simplebus, imx_wdog_driver, imx_wdog_devclass, 0, 0); +static inline void +WR2(struct imx_wdog_softc *sc, bus_size_t offs, uint16_t val) +{ -#define RD2(_sc, _r) \ - bus_space_read_2((_sc)->sc_bst, (_sc)->sc_bsh, (_r)) -#define WR2(_sc, _r, _v) \ - bus_space_write_2((_sc)->sc_bst, (_sc)->sc_bsh, (_r), (_v)) + bus_write_2(sc->sc_res[MEMRES], offs, val); +} static void imx_watchdog(void *arg, u_int cmd, int *error) @@ -131,6 +126,12 @@ imx_watchdog(void *arg, u_int cmd, int *error) /* Refresh counter */ WR2(sc, WDOG_SR_REG, WDOG_SR_STEP1); WR2(sc, WDOG_SR_REG, WDOG_SR_STEP2); + /* Watchdog active, can disable rom-boot watchdog. */ + if (sc->sc_pde_enabled) { + sc->sc_pde_enabled = false; + reg = RD2(sc, WDOG_MCR_REG); + WR2(sc, WDOG_MCR_REG, reg & ~WDOG_MCR_PDE); + } *error = 0; } } @@ -138,6 +139,27 @@ imx_watchdog(void *arg, u_int cmd, int *error) } static int +imx_wdog_intr(void *arg) +{ + struct imx_wdog_softc *sc = arg; + + /* + * When configured for external reset, the actual reset is supposed to + * happen when some external device responds to the assertion of the + * WDOG_B signal by asserting the POR signal to the chip. This + * interrupt handler is a backstop mechanism; it is set up to fire + * simultaneously with WDOG_B, and if the external reset happens we'll + * never actually make it to here. If we do make it here, just trigger + * a software reset. That code will see that external reset is + * configured, and it will wait for 1 second for it to take effect, then + * it will do a software reset as a fallback. + */ + imx_wdog_cpu_reset(BUS_SPACE_PHYSADDR(sc->sc_res[MEMRES], WDOG_CR_REG)); + + return (FILTER_HANDLED); /* unreached */ +} + +static int imx_wdog_probe(device_t dev) { @@ -166,12 +188,43 @@ imx_wdog_attach(device_t dev) mtx_init(&sc->sc_mtx, device_get_nameunit(dev), "imx_wdt", MTX_DEF); - sc->sc_dev = dev; - sc->sc_bst = rman_get_bustag(sc->sc_res[0]); - sc->sc_bsh = rman_get_bushandle(sc->sc_res[0]); + /* + * If we're configured to assert an external reset signal, set up the + * hardware to do so, and install an interrupt handler whose only + * purpose is to backstop the external reset. Don't worry if the + * interrupt setup fails, since it's only a backstop measure. + */ + if (ofw_bus_has_prop(sc->sc_dev, "fsl,ext-reset-output")) { + WR2(sc, WDOG_CR_REG, WDOG_CR_WDT | RD2(sc, WDOG_CR_REG)); + bus_setup_intr(sc->sc_dev, sc->sc_res[IRQRES], + INTR_TYPE_MISC | INTR_MPSAFE, imx_wdog_intr, NULL, sc, + &sc->sc_ih); + WR2(sc, WDOG_ICR_REG, WDOG_ICR_WIE); /* Enable, count is 0. */ + } - /* TODO: handle interrupt */ + /* + * Note whether the rom-boot so-called "power-down" watchdog is active, + * so we can disable it when the regular watchdog is first enabled. + */ + if (RD2(sc, WDOG_MCR_REG) & WDOG_MCR_PDE) + sc->sc_pde_enabled = true; EVENTHANDLER_REGISTER(watchdog_list, imx_watchdog, sc, 0); return (0); } + +static device_method_t imx_wdog_methods[] = { + DEVMETHOD(device_probe, imx_wdog_probe), + DEVMETHOD(device_attach, imx_wdog_attach), + DEVMETHOD_END +}; + +static driver_t imx_wdog_driver = { + "imx_wdog", + imx_wdog_methods, + sizeof(struct imx_wdog_softc), +}; + +static devclass_t imx_wdog_devclass; + +DRIVER_MODULE(imx_wdog, simplebus, imx_wdog_driver, imx_wdog_devclass, 0, 0); Modified: stable/11/sys/arm/freescale/imx/imx_wdogreg.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_wdogreg.h Sat Mar 24 21:22:28 2018 (r331497) +++ stable/11/sys/arm/freescale/imx/imx_wdogreg.h Sat Mar 24 21:27:10 2018 (r331498) @@ -34,31 +34,31 @@ #define WDOG_CLK_FREQ 32768 #define WDOG_CR_REG 0x00 /* Control Register */ -#define WDOG_CR_WT_MASK 0xff00 /* Count of 0.5 sec */ -#define WDOG_CR_WT_SHIFT 8 -#define WDOG_CR_WDW (1 << 7) /* Suspend WDog */ -#define WDOG_CR_WDA (1 << 5) /* Don't touch ipp_wdog */ -#define WDOG_CR_SRS (1 << 4) /* Don't touch sys_reset */ -#define WDOG_CR_WDT (1 << 3) /* Assert ipp_wdog on tout */ -#define WDOG_CR_WDE (1 << 2) /* WDog Enable */ -#define WDOG_CR_WDBG (1 << 1) /* Suspend when DBG mode */ -#define WDOG_CR_WDZST (1 << 0) /* Suspend when LP mode */ +#define WDOG_CR_WT_MASK 0xff00 /* Count; 0.5 sec units */ +#define WDOG_CR_WT_SHIFT 8 +#define WDOG_CR_WDW (1u << 7) /* Suspend when in WAIT mode */ +#define WDOG_CR_WDA (1u << 5) /* Don't assert ext reset */ +#define WDOG_CR_SRS (1u << 4) /* Don't assert soft reset */ +#define WDOG_CR_WDT (1u << 3) /* Assert ext reset on timeout */ +#define WDOG_CR_WDE (1u << 2) /* Watchdog Enable */ +#define WDOG_CR_WDBG (1u << 1) /* Suspend when DBG mode */ +#define WDOG_CR_WDZST (1u << 0) /* Suspend when LP mode */ #define WDOG_SR_REG 0x02 /* Service Register */ -#define WDOG_SR_STEP1 0x5555 -#define WDOG_SR_STEP2 0xaaaa +#define WDOG_SR_STEP1 0x5555 +#define WDOG_SR_STEP2 0xaaaa #define WDOG_RSR_REG 0x04 /* Reset Status Register */ -#define WDOG_RSR_POR (1 << 4) /* Due to Power-On Reset */ -#define WDOG_RSR_TOUT (1 << 1) /* Due WDog timeout reset */ -#define WDOG_RSR_SFTW (1 << 0) /* Due Soft reset */ +#define WDOG_RSR_POR (1u << 4) /* Due to Power-On Reset */ +#define WDOG_RSR_TOUT (1u << 1) /* Due WDog timeout reset */ +#define WDOG_RSR_SFTW (1u << 0) /* Due Soft reset */ #define WDOG_ICR_REG 0x06 /* Interrupt Control Register */ -#define WDOG_ICR_WIE (1 << 15) /* Enable Interrupt */ -#define WDOG_ICR_WTIS (1 << 14) /* Interrupt has occurred */ -#define WDOG_ICR_WTCT_MASK 0x00ff -#define WDOG_ICR_WTCT_SHIFT 0 /* Interrupt hold time */ +#define WDOG_ICR_WIE (1u << 15) /* Enable Interrupt */ +#define WDOG_ICR_WTIS (1u << 14) /* Interrupt has occurred */ +#define WDOG_ICR_WTCT_MASK 0x00ff /* Interrupt lead time in 0.5s */ +#define WDOG_ICR_WTCT_SHIFT 0 /* units before reset occurs */ #define WDOG_MCR_REG 0x08 /* Miscellaneous Control Register */ -#define WDOG_MCR_PDE (1 << 0) +#define WDOG_MCR_PDE (1u << 0) /* Power-down enable */ From owner-svn-src-stable@freebsd.org Sat Mar 24 21:53:02 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 932D1F4E128; Sat, 24 Mar 2018 21:53:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 311FC81A3D; Sat, 24 Mar 2018 21:53:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BAA91512E; Sat, 24 Mar 2018 21:53:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OLr1ak090973; Sat, 24 Mar 2018 21:53:01 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OLr1NV090970; Sat, 24 Mar 2018 21:53:01 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242153.w2OLr1NV090970@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 21:53: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: r331500 - in stable/11: etc/devd sys/dev/usb sys/dev/usb/serial X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11: etc/devd sys/dev/usb sys/dev/usb/serial X-SVN-Commit-Revision: 331500 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, 24 Mar 2018 21:53:02 -0000 Author: ian Date: Sat Mar 24 21:53:01 2018 New Revision: 331500 URL: https://svnweb.freebsd.org/changeset/base/331500 Log: MFC r329125-r329126 r329125: Add a device ID to uftdi for TIAO USB Multi Protocol Adapter (TUMPA). PR: 225810 r329126: Regenerate devd/usb.conf after the recent addition of several new device IDs. Modified: stable/11/etc/devd/usb.conf stable/11/sys/dev/usb/serial/uftdi.c stable/11/sys/dev/usb/usbdevs Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/devd/usb.conf ============================================================================== --- stable/11/etc/devd/usb.conf Sat Mar 24 21:30:24 2018 (r331499) +++ stable/11/etc/devd/usb.conf Sat Mar 24 21:53:01 2018 (r331500) @@ -145,7 +145,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0403"; - match "product" "(0x5259|0x6001|0x6004|0x6006|0x6006|0x6010|0x6011|0x6014|0x6015|0x8372|0x9378|0x9379|0x937a|0x937c|0x9868|0x9e90|0x9f80|0xa6d0|0xa6d1|0xabb8|0xb810|0xb811|0xb812|0xbaf8|0xbbe2|0xbca0|0xbca1|0xbca2|0xbca4|0xbcd8|0xbcd9|0xbcda|0xbdc8|0xbfd8|0xbfd9|0xbfda|0xbfdb|0xbfdc|0xc7d0|0xc850|0xc991|0xcaa0|0xcc48|0xcc49|0xcc4a|0xd010|0xd011|0xd012|0xd013|0xd014|0xd015|0xd016|0xd017|0xd070|0xd071|0xd388|0xd389|0xd38a|0xd38b|0xd38c|0xd38d|0xd38e|0xd38f|0xd578|0xd678|0xd738|0xd780|0xdaf8|0xdaf9|0xdafa|0xdafb|0xdafc|0xdafd|0xdafe|0xdaff|0xdc00|0xdc01|0xdd20|0xdf28|0xdf30|0xdf31|0xdf32|0xdf33|0xdf35|0xe000|0xe001|0xe002|0xe004|0xe006|0xe008|0xe009|0xe00a|0xe050|0xe0e8|0xe0e9|0xe0ea|0xe0eb|0xe0ec|0xe0ed|0xe0ee|0xe0ef|0xe0f0|0xe0f1|0xe0f2|0xe0f3|0xe0f4|0xe0f5|0xe0f6|0xe0f7|0xe40b|0xe520|0xe548|0xe6c8|0xe700|0xe729|0xe808|0xe809|0xe80a|0xe80b|0xe80c|0xe80d|0xe80e|0xe80f|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xe88d|0xe88e|0xe88f|0xea90|0xebe0|0xec88|0xec89|0xed22|0xed71|0xed72|0xed73|0xed7 4|0xee18|0xeee8|0xeee9|0xeeea|0xeeeb|0xeeec|0xeeed|0xeeee|0xeeef|0xef50|0xef51|0xf068|0xf069|0xf06a|0xf06b|0xf06c|0xf06d|0xf06e|0xf06f|0xf070|0xf0c0|0xf0c8|0xf208|0xf2d0|0xf3c0|0xf3c1|0xf3c2|0xf448|0xf449|0xf44a|0xf44b|0xf44c|0xf460|0xf608|0xf60b|0xf680|0xf850|0xf857|0xf9d0|0xf9d1|0xf9d2|0xf9d3|0xf9d4|0xf9d5|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfa05|0xfa06|0xfa10|0xfa33|0xfa88|0xfad0|0xfaf0|0xfb58|0xfb59|0xfb5a|0xfb5b|0xfb5c|0xfb5d|0xfb5e|0xfb5f|0xfb80|0xfb99|0xfbfa|0xfc08|0xfc09|0xfc0a|0xfc0b|0xfc0c|0xfc0d|0xfc0e|0xfc0f|0xfc60|0xfc70|0xfc71|0xfc72|0xfc73|0xfc82|0xfd60|0xfe38|0xff00|0xff18|0xff1c|0xff1d|0xff20|0xff38|0xff39|0xff3a|0xff3b|0xff3c|0xff3d|0xff3e|0xff3f|0xffa8)"; + match "product" "(0x5259|0x6001|0x6004|0x6006|0x6006|0x6010|0x6011|0x6014|0x6015|0x8372|0x8a98|0x9378|0x9379|0x937a|0x937c|0x9868|0x9e90|0x9f80|0xa6d0|0xa6d1|0xabb8|0xb810|0xb811|0xb812|0xbaf8|0xbbe2|0xbca0|0xbca1|0xbca2|0xbca4|0xbcd8|0xbcd9|0xbcda|0xbdc8|0xbfd8|0xbfd9|0xbfda|0xbfdb|0xbfdc|0xc7d0|0xc850|0xc991|0xcaa0|0xcc48|0xcc49|0xcc4a|0xd010|0xd011|0xd012|0xd013|0xd014|0xd015|0xd016|0xd017|0xd070|0xd071|0xd388|0xd389|0xd38a|0xd38b|0xd38c|0xd38d|0xd38e|0xd38f|0xd578|0xd678|0xd738|0xd780|0xdaf8|0xdaf9|0xdafa|0xdafb|0xdafc|0xdafd|0xdafe|0xdaff|0xdc00|0xdc01|0xdd20|0xdf28|0xdf30|0xdf31|0xdf32|0xdf33|0xdf35|0xe000|0xe001|0xe002|0xe004|0xe006|0xe008|0xe009|0xe00a|0xe050|0xe0e8|0xe0e9|0xe0ea|0xe0eb|0xe0ec|0xe0ed|0xe0ee|0xe0ef|0xe0f0|0xe0f1|0xe0f2|0xe0f3|0xe0f4|0xe0f5|0xe0f6|0xe0f7|0xe40b|0xe520|0xe548|0xe6c8|0xe700|0xe729|0xe808|0xe809|0xe80a|0xe80b|0xe80c|0xe80d|0xe80e|0xe80f|0xe888|0xe889|0xe88a|0xe88b|0xe88c|0xe88d|0xe88e|0xe88f|0xea90|0xebe0|0xec88|0xec89|0xed22|0xed71|0xed72|0xed7 3|0xed74|0xee18|0xeee8|0xeee9|0xeeea|0xeeeb|0xeeec|0xeeed|0xeeee|0xeeef|0xef50|0xef51|0xf068|0xf069|0xf06a|0xf06b|0xf06c|0xf06d|0xf06e|0xf06f|0xf070|0xf0c0|0xf0c8|0xf208|0xf2d0|0xf3c0|0xf3c1|0xf3c2|0xf448|0xf449|0xf44a|0xf44b|0xf44c|0xf460|0xf608|0xf60b|0xf680|0xf850|0xf857|0xf9d0|0xf9d1|0xf9d2|0xf9d3|0xf9d4|0xf9d5|0xfa00|0xfa01|0xfa02|0xfa03|0xfa04|0xfa05|0xfa06|0xfa10|0xfa33|0xfa88|0xfad0|0xfaf0|0xfb58|0xfb59|0xfb5a|0xfb5b|0xfb5c|0xfb5d|0xfb5e|0xfb5f|0xfb80|0xfb99|0xfbfa|0xfc08|0xfc09|0xfc0a|0xfc0b|0xfc0c|0xfc0d|0xfc0e|0xfc0f|0xfc60|0xfc70|0xfc71|0xfc72|0xfc73|0xfc82|0xfd60|0xfe38|0xff00|0xff18|0xff1c|0xff1d|0xff20|0xff38|0xff39|0xff3a|0xff3b|0xff3c|0xff3d|0xff3e|0xff3f|0xffa8)"; action "kldload -n uftdi"; }; @@ -1361,6 +1361,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x067b"; + match "product" "0x27a1"; + action "kldload -n udbp"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x067b"; match "product" "(0x331a|0xaaa0|0xaaa2)"; action "kldload -n uplcom"; }; @@ -3617,7 +3625,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x10c4"; - match "product" "(0x8066|0x806f|0x807a|0x80c4|0x80ca|0x80dd|0x80ed|0x80f6|0x8115|0x813d|0x813f|0x814a|0x814a|0x814b|0x8156|0x815e|0x815f|0x818b|0x819f|0x81a6|0x81a9|0x81ac|0x81ad|0x81c8|0x81e2|0x81e7|0x81e8|0x81f2|0x8218|0x822b|0x826b|0x8293|0x82f9|0x8341|0x8382|0x83a8|0x83d8|0x8411|0x8418|0x846e|0x8477|0x85ea|0x85eb|0x85f8|0x8664|0x8665|0x88a4|0x88a5|0xea60|0xea61|0xea70|0xea71|0xea80|0xf001|0xf002|0xf003|0xf004)"; + match "product" "(0x8066|0x806f|0x807a|0x80c4|0x80ca|0x80dd|0x80ed|0x80f6|0x8115|0x813d|0x813f|0x814a|0x814a|0x814b|0x8156|0x815e|0x815f|0x818b|0x819f|0x81a6|0x81a9|0x81ac|0x81ad|0x81c8|0x81e2|0x81e7|0x81e8|0x81f2|0x8218|0x822b|0x826b|0x8293|0x82f9|0x8341|0x8382|0x83a8|0x83d8|0x8411|0x8418|0x846e|0x8477|0x85ea|0x85eb|0x85f8|0x8664|0x8665|0x88a4|0x88a5|0x8a2a|0xea60|0xea61|0xea70|0xea71|0xea80|0xf001|0xf002|0xf003|0xf004)"; action "kldload -n uslcom"; }; @@ -3745,7 +3753,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x1199"; - match "product" "(0x68aa|0x68c0|0x9041)"; + match "product" "(0x68aa|0x68c0|0x9041|0x9071)"; action "kldload -n u3g"; }; @@ -3857,7 +3865,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x12d1"; - match "product" "(0x1573|0x1803|0x1c05|0x1c0b)"; + match "product" "(0x155b|0x1573|0x15c1|0x1803|0x1c05|0x1c0b|0x1c1e)"; action "kldload -n u3g"; }; @@ -4360,6 +4368,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x15eb"; + match "product" "0x7d0e"; + action "kldload -n u3g"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x1614"; match "product" "(0x0800|0x0802|0x7002)"; action "kldload -n u3g"; @@ -5248,6 +5264,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x2c7c"; + match "product" "0x0125"; + action "kldload -n u3g"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x3195"; match "product" "(0xf190|0xf280|0xf281)"; action "kldload -n uslcom"; @@ -5623,6 +5647,46 @@ nomatch 32 { match "vendor" "0x12d1"; match "intclass" "0xff"; match "intsubclass" "0x02"; + match "intprotocol" "0x01"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x02"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x10"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x12"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; match "intprotocol" "0x16"; action "kldload -n if_cdce"; }; @@ -5643,12 +5707,42 @@ nomatch 32 { match "vendor" "0x12d1"; match "intclass" "0xff"; match "intsubclass" "0x02"; + match "intprotocol" "0x61"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; + match "intprotocol" "0x62"; + action "kldload -n umodem"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x02"; match "intprotocol" "0x76"; action "kldload -n if_cdce"; }; nomatch 32 { match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x12d1"; + match "intclass" "0xff"; + match "intsubclass" "0x03"; + match "intprotocol" "0x16"; + action "kldload -n if_cdce"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; match "mode" "(host|device)"; match "intclass" "0x02"; match "intsubclass" "0x02"; @@ -5817,5 +5911,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 2722 USB entries processed +# 2738 USB entries processed Modified: stable/11/sys/dev/usb/serial/uftdi.c ============================================================================== --- stable/11/sys/dev/usb/serial/uftdi.c Sat Mar 24 21:30:24 2018 (r331499) +++ stable/11/sys/dev/usb/serial/uftdi.c Sat Mar 24 21:53:01 2018 (r331500) @@ -522,6 +522,7 @@ static const STRUCT_USB_HOST_ID uftdi_devs[] = { UFTDI_DEV(FTDI, TERATRONIK_D2XX, 0), UFTDI_DEV(FTDI, TERATRONIK_VCP, 0), UFTDI_DEV(FTDI, THORLABS, 0), + UFTDI_DEV(FTDI, TIAO, 0), UFTDI_DEV(FTDI, TNC_X, 0), UFTDI_DEV(FTDI, TTUSB, 0), UFTDI_DEV(FTDI, TURTELIZER2, UFTDI_JTAG_IFACE(0)), Modified: stable/11/sys/dev/usb/usbdevs ============================================================================== --- stable/11/sys/dev/usb/usbdevs Sat Mar 24 21:30:24 2018 (r331499) +++ stable/11/sys/dev/usb/usbdevs Sat Mar 24 21:53:01 2018 (r331500) @@ -2136,6 +2136,7 @@ product FTDI TAVIR_STK500 0xfa33 FTDI compatible adapt product FTDI TERATRONIK_D2XX 0xec89 FTDI compatible adapter product FTDI TERATRONIK_VCP 0xec88 FTDI compatible adapter product FTDI THORLABS 0xfaf0 FTDI compatible adapter +product FTDI TIAO 0x8a98 FTDI compatible adapter product FTDI TNC_X 0xebe0 FTDI compatible adapter product FTDI TTUSB 0xff20 FTDI compatible adapter product FTDI USBX_707 0xf857 FTDI compatible adapter From owner-svn-src-stable@freebsd.org Sat Mar 24 22:39:40 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0345DF51E7D; Sat, 24 Mar 2018 22:39:40 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 93E2E838A3; Sat, 24 Mar 2018 22:39:39 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88F56157C8; Sat, 24 Mar 2018 22:39:39 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OMddMd011851; Sat, 24 Mar 2018 22:39:39 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OMdct9011839; Sat, 24 Mar 2018 22:39:38 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242239.w2OMdct9011839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 22:39:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331501 - in stable/11/sys: arm/conf arm/freescale/imx dev/iicbus dev/sdhci dev/usb/controller modules modules/i2c/iicbus modules/imx modules/imx/imx_i2c X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: arm/conf arm/freescale/imx dev/iicbus dev/sdhci dev/usb/controller modules modules/i2c/iicbus modules/imx modules/imx/imx_i2c X-SVN-Commit-Revision: 331501 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, 24 Mar 2018 22:39:40 -0000 Author: ian Date: Sat Mar 24 22:39:38 2018 New Revision: 331501 URL: https://svnweb.freebsd.org/changeset/base/331501 Log: MFC r329479-r329480, r329483, r329506-r329507, r329526, r329529, r329536, r329541, r329730, r329841, r329988, r330397 r329479: Do not try to deallocate memory that wasn't allocated (you'd think that would be safe, but the function also tries to destroy mutexes that never got created). I guess this can only happen when imx_ehci_detach() is called on the error-exit path from imx_ehci_attach(), and that path never got exercised before today. r329480: Don't call sdhci_cleanup_slot() if sdhci_init_slot() never got called. Also, do callout_init() very early in attach, so that callout_drain() can be called in detach without worrying about whether it ever got init'd. r329483: Fix fallout from the import of fresh dts source files from linux 4.15. It appears that node names no longer include leading zeroes in the @address qualifiers, so we have to search for the nodes involved in interrupt fixup using both flavors of name to be compatible with old and new .dtb files. (You know you're in a bad place when you're applying a workaround to code that exists only as a workaround for another problem.) r329506: Add a detach method so that this can be a kldunload-friendly module. r329507: Build modules specific to imx5/imx6 only when building those kernels. This adds sys/modules/imx with a SUBDIR makefile to make the whole collection of modules that are specific to these SoCs. Initially, that "whole collection" consists of the if_ffec and imx_i2c drivers. The if_ffec driver is referenced in its existing home in ../ffec rather than moving it into the imx directory, because it's used by powerpc too, but it is no longer built for all armv6/7 systems. The imx_i2c driver is newly added as a module. r329526: Allow i2c hardware drivers to declare their own relationships to ofw_iicbus rather than relying on a set of canned EARLY_DRIVER_MODULE() statements in the ofw_iicbus source. This means hw drivers will no longer be required to use one of a few predefined driver names. They will also now be able to decide themselves if they want to use DRIVER_MODULE or EARLY_DRIVER_MODULE and to set which pass to attach on for early modules. Mainly, this adds extern declarations for the driver and devclass variables. It also renames ofwiicbus_devclass to ofw_iicbus_devclass to be consistant with the way we use ofw_ prefixes on this stuff. r329529: Give the imx_i2c driver its own name, set up its relationship to ofw_iicbus. Previously it called itself 'iichb' to link up with the EARLY_DRIVER_MODULE declaration in ofw_iicbus.c. r329536: Add the MODULE_DEPEND()s needed so that the kernel linker can resolve all the symbols at load time when iicbus is not compiled into the kernel. r329541: Build ofw_iicbus as a module if OPT_FDT is defined. r329730: Add required header files. Reported by: andreast@ r329841: Add a missing line continuation. How many commits does it take to get a simple module makefile working? Apparently at least three. Pointy hat to: ian r329988: Instead of building ofw_iicbus as a separate module, just compile it in to the iicbus module for FDT-based systems. The primary motivation for this is that host controller drivers which declare DRIVER_MODULE(ofw_iicbus, thisdriver, etc, etc) now only need a single MODULE_DEPEND(thisdriver, ofw_iicbus) for runtime linking to resolve all the symbols. With ofw_iicbus and iicbus in separate modules, drivers would need to declare a MODULE_DEPEND() on both, because symbol lookup is non-recursive through the dependency chain. Requiring a driver to have MODULE_DEPENDS() on both amounts to requiring the drivers to understand the kobj inheritence details of how ofw_iicbus is implemented, which seems like something they shouldn't have to know (and could even change some day). Also, this is somewhat analogous to how the drivers get built when compiled into the kernel. You don't have to ask for ofw_iicbus separately, it just gets built in along with iicbus when option FDT is in effect. r330397: Fix a paste-o: use the IICBUS version constants, not IICBB bitbang driver's. Added: stable/11/sys/modules/imx/ - copied from r329507, head/sys/modules/imx/ Modified: stable/11/sys/arm/conf/IMX53 stable/11/sys/arm/conf/IMX6 stable/11/sys/arm/freescale/imx/imx6_machdep.c stable/11/sys/arm/freescale/imx/imx_i2c.c stable/11/sys/dev/iicbus/iicbus.h stable/11/sys/dev/iicbus/nxprtc.c stable/11/sys/dev/iicbus/ofw_iicbus.c stable/11/sys/dev/sdhci/fsl_sdhci.c stable/11/sys/dev/usb/controller/ehci_imx.c stable/11/sys/modules/Makefile stable/11/sys/modules/i2c/iicbus/Makefile stable/11/sys/modules/imx/imx_i2c/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/conf/IMX53 ============================================================================== --- stable/11/sys/arm/conf/IMX53 Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/arm/conf/IMX53 Sat Mar 24 22:39:38 2018 (r331501) @@ -117,6 +117,6 @@ device wlan_amrr # AMRR transmit rate control algori # Flattened Device Tree options FDT # Configure using FDT/DTB data -makeoptions MODULES_EXTRA=dtb/imx5 +makeoptions MODULES_EXTRA="dtb/imx5 imx" options INTRNG Modified: stable/11/sys/arm/conf/IMX6 ============================================================================== --- stable/11/sys/arm/conf/IMX6 Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/arm/conf/IMX6 Sat Mar 24 22:39:38 2018 (r331501) @@ -117,7 +117,7 @@ device hdmi # Flattened Device Tree options FDT # Configure using FDT/DTB data -makeoptions MODULES_EXTRA=dtb/imx6 +makeoptions MODULES_EXTRA="dtb/imx6 imx" # SoC-specific devices device ffec # Freescale Fast Ethernet Controller Modified: stable/11/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_machdep.c Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/arm/freescale/imx/imx6_machdep.c Sat Mar 24 22:39:38 2018 (r331501) @@ -80,6 +80,12 @@ __FBSDID("$FreeBSD$"); * per-soc logic. We handle this at platform attach time rather than via the * fdt_fixup_table, because the latter requires matching on the FDT "model" * property, and this applies to all boards including those not yet invented. + * + * This just in: as of the import of dts files from linux 4.15 on 2018-02-10, + * they appear to have applied a new style rule to the dts which forbids leading + * zeroes in the @address qualifiers on node names. Since we have to find those + * nodes by string matching we now have to search for both flavors of each node + * name involved. */ static void fix_fdt_interrupt_data(void) @@ -99,9 +105,13 @@ fix_fdt_interrupt_data(void) /* GIC node may be child of soc node, or appear directly at root. */ gicnode = OF_finddevice("/soc/interrupt-controller@00a01000"); + if (gicnode == -1) + gicnode = OF_finddevice("/soc/interrupt-controller@a01000"); if (gicnode == -1) { gicnode = OF_finddevice("/interrupt-controller@00a01000"); if (gicnode == -1) + gicnode = OF_finddevice("/interrupt-controller@a01000"); + if (gicnode == -1) return; } gicxref = OF_xref_from_node(gicnode); @@ -113,6 +123,8 @@ fix_fdt_interrupt_data(void) gicipar = gicxref; gpcnode = OF_finddevice("/soc/aips-bus@02000000/gpc@020dc000"); + if (gpcnode == -1) + gpcnode = OF_finddevice("/soc/aips-bus@2000000/gpc@20dc000"); if (gpcnode == -1) return; result = OF_getencprop(gpcnode, "interrupt-parent", &gpcipar, Modified: stable/11/sys/arm/freescale/imx/imx_i2c.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_i2c.c Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/arm/freescale/imx/imx_i2c.c Sat Mar 24 22:39:38 2018 (r331501) @@ -155,6 +155,7 @@ struct i2c_softc { static phandle_t i2c_get_node(device_t, device_t); static int i2c_probe(device_t); static int i2c_attach(device_t); +static int i2c_detach(device_t); static int i2c_repeated_start(device_t, u_char, int); static int i2c_start(device_t, u_char, int); @@ -166,6 +167,7 @@ static int i2c_write(device_t, const char *, int, int static device_method_t i2c_methods[] = { DEVMETHOD(device_probe, i2c_probe), DEVMETHOD(device_attach, i2c_attach), + DEVMETHOD(device_detach, i2c_detach), /* OFW methods */ DEVMETHOD(ofw_bus_get_node, i2c_get_node), @@ -183,14 +185,16 @@ static device_method_t i2c_methods[] = { }; static driver_t i2c_driver = { - "iichb", + "imx_i2c", i2c_methods, sizeof(struct i2c_softc), }; static devclass_t i2c_devclass; -DRIVER_MODULE(i2c, simplebus, i2c_driver, i2c_devclass, 0, 0); -DRIVER_MODULE(iicbus, i2c, iicbus_driver, iicbus_devclass, 0, 0); +DRIVER_MODULE(imx_i2c, simplebus, i2c_driver, i2c_devclass, 0, 0); +DRIVER_MODULE(ofw_iicbus, imx_i2c, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); +MODULE_DEPEND(imx_i2c, iicbus, 1, 1, 1); +MODULE_DEPEND(imx_i2c, ofw_iicbus, 1, 1, 1); static phandle_t i2c_get_node(device_t bus, device_t dev) @@ -446,6 +450,28 @@ no_recovery: /* Probe and attach the iicbus when interrupts are available. */ config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev); + return (0); +} + +static int +i2c_detach(device_t dev) +{ + struct i2c_softc *sc; + int error; + + sc = device_get_softc(dev); + + if ((error = bus_generic_detach(sc->dev)) != 0) { + device_printf(sc->dev, "cannot detach child devices\n"); + return (error); + } + + if (sc->iicbus != NULL) + device_delete_child(dev, sc->iicbus); + + if (sc->res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->res); + return (0); } Modified: stable/11/sys/dev/iicbus/iicbus.h ============================================================================== --- stable/11/sys/dev/iicbus/iicbus.h Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/dev/iicbus/iicbus.h Sat Mar 24 22:39:38 2018 (r331501) @@ -77,5 +77,7 @@ void iicbus_init_frequency(device_t dev, u_int bus_fre extern driver_t iicbus_driver; extern devclass_t iicbus_devclass; +extern driver_t ofw_iicbus_driver; +extern devclass_t ofw_iicbus_devclass; #endif Modified: stable/11/sys/dev/iicbus/nxprtc.c ============================================================================== --- stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 22:39:38 2018 (r331501) @@ -823,4 +823,4 @@ static devclass_t nxprtc_devclass; DRIVER_MODULE(nxprtc, iicbus, nxprtc_driver, nxprtc_devclass, NULL, NULL); MODULE_VERSION(nxprtc, 1); -MODULE_DEPEND(nxprtc, iicbus, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER); +MODULE_DEPEND(nxprtc, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); Modified: stable/11/sys/dev/iicbus/ofw_iicbus.c ============================================================================== --- stable/11/sys/dev/iicbus/ofw_iicbus.c Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/dev/iicbus/ofw_iicbus.c Sat Mar 24 22:39:38 2018 (r331501) @@ -76,13 +76,15 @@ struct ofw_iicbus_devinfo { struct ofw_bus_devinfo opd_obdinfo; }; -devclass_t ofwiicbus_devclass; +devclass_t ofw_iicbus_devclass; DEFINE_CLASS_1(iicbus, ofw_iicbus_driver, ofw_iicbus_methods, sizeof(struct iicbus_softc), iicbus_driver); -EARLY_DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driver, ofwiicbus_devclass, +EARLY_DRIVER_MODULE(ofw_iicbus, iicbb, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0, BUS_PASS_BUS); -EARLY_DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofwiicbus_devclass, +EARLY_DRIVER_MODULE(ofw_iicbus, iichb, ofw_iicbus_driver, ofw_iicbus_devclass, + 0, 0, BUS_PASS_BUS); +EARLY_DRIVER_MODULE(ofw_iicbus, twsi, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0, BUS_PASS_BUS); MODULE_VERSION(ofw_iicbus, 1); MODULE_DEPEND(ofw_iicbus, iicbus, 1, 1, 1); Modified: stable/11/sys/dev/sdhci/fsl_sdhci.c ============================================================================== --- stable/11/sys/dev/sdhci/fsl_sdhci.c Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/dev/sdhci/fsl_sdhci.c Sat Mar 24 22:39:38 2018 (r331501) @@ -86,6 +86,7 @@ struct fsl_sdhci_softc { uint16_t sdclockreg_freq_bits; uint8_t r1bfix_type; uint8_t hwtype; + bool slot_init_done; }; #define R1BFIX_NONE 0 /* No fix needed at next interrupt. */ @@ -814,6 +815,9 @@ fsl_sdhci_detach(device_t dev) callout_drain(&sc->r1bfix_callout); + if (sc->slot_init_done) + sdhci_cleanup_slot(&sc->slot); + if (sc->intr_cookie != NULL) bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie); if (sc->irq_res != NULL) @@ -821,7 +825,6 @@ fsl_sdhci_detach(device_t dev) rman_get_rid(sc->irq_res), sc->irq_res); if (sc->mem_res != NULL) { - sdhci_cleanup_slot(&sc->slot); bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(sc->mem_res), sc->mem_res); } @@ -841,6 +844,8 @@ fsl_sdhci_attach(device_t dev) sc->dev = dev; + callout_init(&sc->r1bfix_callout, 1); + sc->hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; if (sc->hwtype == HWTYPE_NONE) panic("Impossible: not compatible in fsl_sdhci_attach()"); @@ -928,8 +933,8 @@ fsl_sdhci_attach(device_t dev) WR4(sc, SDHC_PROT_CTRL, protctl); #endif - callout_init(&sc->r1bfix_callout, 1); sdhci_init_slot(dev, &sc->slot, 0); + sc->slot_init_done = true; bus_generic_probe(dev); bus_generic_attach(dev); Modified: stable/11/sys/dev/usb/controller/ehci_imx.c ============================================================================== --- stable/11/sys/dev/usb/controller/ehci_imx.c Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/dev/usb/controller/ehci_imx.c Sat Mar 24 22:39:38 2018 (r331501) @@ -268,6 +268,7 @@ struct imx_ehci_softc { device_t dev; struct resource *ehci_mem_res; /* EHCI core regs. */ struct resource *ehci_irq_res; /* EHCI core IRQ. */ + bool usb_mem_allocated; }; static struct ofw_compat_data compat_data[] = { @@ -331,7 +332,8 @@ imx_ehci_detach(device_t dev) bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->ehci_mem_res); - usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc); + if (sc->usb_mem_allocated) + usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc); /* During module unload there are lots of children leftover */ device_delete_children(dev); @@ -413,6 +415,7 @@ imx_ehci_attach(device_t dev) err = ENOMEM; goto out; } + sc->usb_mem_allocated = true; /* * Set handle to USB related registers subregion used by Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/modules/Makefile Sat Mar 24 22:39:38 2018 (r331501) @@ -824,8 +824,9 @@ _cloudabi64= cloudabi64 .endif -.if ${MACHINE_ARCH} == "armv6" -_ffec= ffec +.if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64" +_bcm283x_clkman= bcm283x_clkman +_bcm283x_pwm= bcm283x_pwm .endif SUBDIR+=${MODULES_EXTRA} Modified: stable/11/sys/modules/i2c/iicbus/Makefile ============================================================================== --- stable/11/sys/modules/i2c/iicbus/Makefile Sat Mar 24 21:53:01 2018 (r331500) +++ stable/11/sys/modules/i2c/iicbus/Makefile Sat Mar 24 22:39:38 2018 (r331501) @@ -5,4 +5,8 @@ KMOD = iicbus SRCS = device_if.h bus_if.h iicbus_if.h iicbus_if.c \ iiconf.h iiconf.c iicbus.h iicbus.c +.if !empty(OPT_FDT) +SRCS+= ofw_iicbus.c ofw_bus_if.h +.endif + .include Modified: stable/11/sys/modules/imx/imx_i2c/Makefile ============================================================================== --- head/sys/modules/imx/imx_i2c/Makefile Sun Feb 18 02:48:54 2018 (r329507) +++ stable/11/sys/modules/imx/imx_i2c/Makefile Sat Mar 24 22:39:38 2018 (r331501) @@ -8,6 +8,8 @@ SRCS= imx_i2c.c SRCS+= \ bus_if.h \ device_if.h \ + fdt_pinctrl_if.h \ + gpio_if.h \ iicbus_if.h \ ofw_bus_if.h \ opt_platform.h \ From owner-svn-src-stable@freebsd.org Sat Mar 24 22:51:00 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D390F52CF1; Sat, 24 Mar 2018 22:51:00 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF1E383F69; Sat, 24 Mar 2018 22:50:59 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA01715994; Sat, 24 Mar 2018 22:50:59 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2OMoxKX016780; Sat, 24 Mar 2018 22:50:59 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2OMoxNl016779; Sat, 24 Mar 2018 22:50:59 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242250.w2OMoxNl016779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 22:50: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: r331502 - stable/11/sys/modules/i2c/iicbus X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/modules/i2c/iicbus X-SVN-Commit-Revision: 331502 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, 24 Mar 2018 22:51:00 -0000 Author: ian Date: Sat Mar 24 22:50:59 2018 New Revision: 331502 URL: https://svnweb.freebsd.org/changeset/base/331502 Log: MFC r329534-r329535 r329534: Arrange SRCS= as 1 file per line, alphabetical, so it's easier to maintain. Whitespace only, no functional changes. r329535: Add iic_recover_bus.c, now part of iicbus. This should have been added as part of r320463. Modified: stable/11/sys/modules/i2c/iicbus/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/modules/i2c/iicbus/Makefile ============================================================================== --- stable/11/sys/modules/i2c/iicbus/Makefile Sat Mar 24 22:39:38 2018 (r331501) +++ stable/11/sys/modules/i2c/iicbus/Makefile Sat Mar 24 22:50:59 2018 (r331502) @@ -1,9 +1,18 @@ # $FreeBSD$ -.PATH: ${SRCTOP}/sys/dev/iicbus -KMOD = iicbus -SRCS = device_if.h bus_if.h iicbus_if.h iicbus_if.c \ - iiconf.h iiconf.c iicbus.h iicbus.c +.PATH: ${SRCTOP}/sys/dev/iicbus + +KMOD= iicbus +SRCS= \ + bus_if.h \ + device_if.h \ + iic_recover_bus.c \ + iicbus.c \ + iicbus.h \ + iicbus_if.c \ + iicbus_if.h \ + iiconf.c \ + iiconf.h \ .if !empty(OPT_FDT) SRCS+= ofw_iicbus.c ofw_bus_if.h From owner-svn-src-stable@freebsd.org Sat Mar 24 23:01:12 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A228F539F9; Sat, 24 Mar 2018 23:01:12 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 27277846CB; Sat, 24 Mar 2018 23:01:12 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21DF515B55; Sat, 24 Mar 2018 23:01:12 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2ON1CSf023487; Sat, 24 Mar 2018 23:01:12 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ON1AiX023472; Sat, 24 Mar 2018 23:01:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242301.w2ON1AiX023472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 23:01: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: r331503 - in stable/11/sys: conf dev/iicbus kern modules/i2c modules/i2c/ds1672 modules/i2c/rtc8583 sys x86/isa X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: conf dev/iicbus kern modules/i2c modules/i2c/ds1672 modules/i2c/rtc8583 sys x86/isa X-SVN-Commit-Revision: 331503 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, 24 Mar 2018 23:01:12 -0000 Author: ian Date: Sat Mar 24 23:01:10 2018 New Revision: 331503 URL: https://svnweb.freebsd.org/changeset/base/331503 Log: MFC r325233, r328956, r329170, r329172-r329173, r329224, r330403-r330407, r330411-r330412, r330416, r330430-r330431, r330433, r330528-r330529, r330767 r325233: [i2c/clock] add support for EPSON RTC-8583 RTC-8583 is time-of-day clock used in some SOHO routers. This clock has only 2 bits for year values, but thanks to user SRAM it's possible to save year value and keep it up to date via driver code. Tested on Planex_MZK-W300NAG (SoC is RT2880) Submitted by: Hiroki Mori Differential Revision: https://reviews.freebsd.org/D12833 r328956: Use const pointers for input data not modified by clock utility functions. r329170: Replace the existing print_ct() private debugging function with a set of three public functions to format and print the three major data structures used by realtime clock drivers (clocktime, bcd_clocktime, and timespec). r329172: Add a set of convenience routines for RTC drivers to use for debug output, and a debug.clock_show_io sysctl to control debugging output. r329173: Add a new sysctl, debug.clock_do_io, to allow manully triggering a one-shot read or write of all registered realtime clocks. In the read case, the values read are simply discarded. For writes, there's no alternative but to actually write the current system time to the device. r329224: Fix bad indentation. Whitespace only, no functional changes. Reported by: bde@ r330403: Add calls to the new clock_dbgprint_xxx() functions. r330404: Add calls to the new clock_dbgprint_xxx() functions. r330405: Oops, fix a paste-o. r330406: Add calls to the new clock_dbgprint_xxx() functions. r330407: Add calls to the new clock_dbgprint_xxx() functions. Also, stop applying a local .5 second adjustment to the time, since that is now done by the code in subr_rtc.c. r330411: Convert to the new(ish) bcd_clocktime conversion functions, add calls to the new debug output functions, and when setting the clock, propagate the timespec nsecs to the 1/100ths register. r330412: Build iicbus/rtc8583 as a module. r330416: The year is stored in a single byte in sram, in binary format, as a count of years since the century, so strip the century out when converting to or from bcd_clocktime format (the conversion routines will infer century by pivoting on 70). r330430: Switch to the new bcd_clocktime conversion routines, and add calls to the new clock_dbgprint_xxx() functions. r330431: Switch to the new bcd_clocktime conversion routines, and add calls to the new clock_dbgprint_xxx() functions. r330433: Switch to the new bcd_clocktime conversion routines, and add calls to the new clock_dbgprint_xxx() functions. r330528: Fix a paste-o that broke the build. There is no softc pointer here, just use the dev arg. Reported by: Jonathan Looney Pointy hat: ian@ r330529: Build the ds1672 driver as a module. Add a detach() to unregister the rtc. r330767: Convert atrtc the new style rtc debugging output. Remove the db show command handler which provided much the same information. Removing the possibility of accessing the hardware regs from the debugger context paves the way for simplifying the locking code in the driver. Added: stable/11/sys/dev/iicbus/rtc8583.c - copied, changed from r325233, head/sys/dev/iicbus/rtc8583.c stable/11/sys/modules/i2c/ds1672/ - copied from r330529, head/sys/modules/i2c/ds1672/ stable/11/sys/modules/i2c/rtc8583/ - copied from r330412, head/sys/modules/i2c/rtc8583/ Modified: stable/11/sys/conf/files stable/11/sys/dev/iicbus/ds1307.c stable/11/sys/dev/iicbus/ds13rtc.c stable/11/sys/dev/iicbus/ds1672.c stable/11/sys/dev/iicbus/ds3231.c stable/11/sys/dev/iicbus/isl12xx.c stable/11/sys/dev/iicbus/nxprtc.c stable/11/sys/dev/iicbus/s35390a.c stable/11/sys/kern/subr_clock.c stable/11/sys/kern/subr_fattime.c stable/11/sys/kern/subr_rtc.c stable/11/sys/modules/i2c/Makefile stable/11/sys/sys/clock.h stable/11/sys/x86/isa/atrtc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/conf/files Sat Mar 24 23:01:10 2018 (r331503) @@ -1768,6 +1768,7 @@ dev/iicbus/ds1307.c optional ds1307 dev/iicbus/ds13rtc.c optional ds13rtc | ds133x | ds1374 dev/iicbus/ds1672.c optional ds1672 dev/iicbus/ds3231.c optional ds3231 +dev/iicbus/rtc8583.c optional rtc8583 dev/iicbus/icee.c optional icee dev/iicbus/if_ic.c optional ic dev/iicbus/iic.c optional iic Modified: stable/11/sys/dev/iicbus/ds1307.c ============================================================================== --- stable/11/sys/dev/iicbus/ds1307.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/ds1307.c Sat Mar 24 23:01:10 2018 (r331503) @@ -359,6 +359,7 @@ ds1307_gettime(device_t dev, struct timespec *ts) bct.mon = data[DS1307_MONTH] & DS1307_MONTH_MASK; bct.year = data[DS1307_YEAR] & DS1307_YEAR_MASK; + clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_READ, &bct); return (clock_bcd_to_ts(&bct, ts, sc->sc_use_ampm)); } @@ -379,6 +380,7 @@ ds1307_settime(device_t dev, struct timespec *ts) */ ts->tv_sec -= utc_offset(); clock_ts_to_bcd(ts, &bct, sc->sc_use_ampm); + clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_WRITE, &bct); /* If the chip is in AM/PM mode, adjust hour and set flags as needed. */ if (sc->sc_use_ampm) { Modified: stable/11/sys/dev/iicbus/ds13rtc.c ============================================================================== --- stable/11/sys/dev/iicbus/ds13rtc.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/ds13rtc.c Sat Mar 24 23:01:10 2018 (r331503) @@ -395,6 +395,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts) if (sc->use_century) bct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 0x100 : 0; + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); err = clock_bcd_to_ts(&bct, ts, sc->use_ampm); return (err); @@ -422,6 +423,7 @@ ds13rtc_settime(device_t dev, struct timespec *ts) return (write_timeword(sc, ts->tv_sec)); clock_ts_to_bcd(ts, &bct, sc->use_ampm); + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); /* If the chip is in AMPM mode deal with the PM flag. */ pmflags = 0; Modified: stable/11/sys/dev/iicbus/ds1672.c ============================================================================== --- stable/11/sys/dev/iicbus/ds1672.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/ds1672.c Sat Mar 24 23:01:10 2018 (r331503) @@ -54,8 +54,6 @@ __FBSDID("$FreeBSD$"); #define DS1672_CTRL_EOSC (1 << 7) /* Stop/start flag. */ -#define NANOSEC 1000000000 - #define MAX_IIC_DATA_SIZE 4 struct ds1672_softc { @@ -120,6 +118,14 @@ ds1672_init(device_t dev) } static int +ds1672_detach(device_t dev) +{ + + clock_unregister(dev); + return (0); +} + +static int ds1672_attach(device_t dev) { struct ds1672_softc *sc = device_get_softc(dev); @@ -144,8 +150,9 @@ ds1672_gettime(device_t dev, struct timespec *ts) /* counter has seconds since epoch */ ts->tv_sec = (secs[3] << 24) | (secs[2] << 16) | (secs[1] << 8) | (secs[0] << 0); - ts->tv_nsec = NANOSEC / 2; + ts->tv_nsec = 0; } + clock_dbgprint_ts(dev, CLOCK_DBG_READ, ts); return (error); } @@ -159,12 +166,15 @@ ds1672_settime(device_t dev, struct timespec *ts) data[2] = (ts->tv_sec >> 16) & 0xff; data[3] = (ts->tv_sec >> 24) & 0xff; + ts->tv_nsec = 0; + clock_dbgprint_ts(dev, CLOCK_DBG_WRITE, ts); return (ds1672_write(dev, DS1672_COUNTER, data, 4)); } static device_method_t ds1672_methods[] = { DEVMETHOD(device_probe, ds1672_probe), DEVMETHOD(device_attach, ds1672_attach), + DEVMETHOD(device_detach, ds1672_detach), DEVMETHOD(clock_gettime, ds1672_gettime), DEVMETHOD(clock_settime, ds1672_settime), Modified: stable/11/sys/dev/iicbus/ds3231.c ============================================================================== --- stable/11/sys/dev/iicbus/ds3231.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/ds3231.c Sat Mar 24 23:01:10 2018 (r331503) @@ -377,7 +377,7 @@ ds3231_attach(device_t dev) sc->sc_dev = dev; sc->sc_addr = iicbus_get_addr(dev); sc->sc_last_c = -1; - sc->sc_year0 = 1900; + sc->sc_year0 = 0; sc->enum_hook.ich_func = ds3231_start; sc->enum_hook.ich_arg = dev; @@ -477,7 +477,7 @@ static int ds3231_gettime(device_t dev, struct timespec *ts) { int c, error; - struct clocktime ct; + struct bcd_clocktime bct; struct ds3231_softc *sc; uint8_t data[7], hourmask; @@ -505,13 +505,14 @@ ds3231_gettime(device_t dev, struct timespec *ts) } else hourmask = DS3231_HOUR_MASK_24HR; - ct.nsec = 0; - ct.sec = FROMBCD(data[DS3231_SECS] & DS3231_SECS_MASK); - ct.min = FROMBCD(data[DS3231_MINS] & DS3231_MINS_MASK); - ct.hour = FROMBCD(data[DS3231_HOUR] & hourmask); - ct.day = FROMBCD(data[DS3231_DATE] & DS3231_DATE_MASK); - ct.mon = FROMBCD(data[DS3231_MONTH] & DS3231_MONTH_MASK); - ct.year = FROMBCD(data[DS3231_YEAR] & DS3231_YEAR_MASK); + bct.nsec = 0; + bct.sec = data[DS3231_SECS] & DS3231_SECS_MASK; + bct.min = data[DS3231_MINS] & DS3231_MINS_MASK; + bct.hour = data[DS3231_HOUR] & hourmask; + bct.day = data[DS3231_DATE] & DS3231_DATE_MASK; + bct.mon = data[DS3231_MONTH] & DS3231_MONTH_MASK; + bct.year = data[DS3231_YEAR] & DS3231_YEAR_MASK; + bct.ispm = data[DS3231_HOUR] & DS3231_HOUR_IS_PM; /* * If the century flag has toggled since we last saw it, there has been @@ -522,29 +523,20 @@ ds3231_gettime(device_t dev, struct timespec *ts) if (sc->sc_last_c == -1) sc->sc_last_c = c; else if (c != sc->sc_last_c) { - sc->sc_year0 += 100; + sc->sc_year0 += 0x100; sc->sc_last_c = c; } - ct.year += sc->sc_year0; - if (ct.year < POSIX_BASE_YEAR) - ct.year += 100; /* assume [1970, 2069] */ + bct.year |= sc->sc_year0; - /* If running in AM/PM mode, deal with it. */ - if (sc->sc_use_ampm) { - if (ct.hour == 12) - ct.hour = 0; - if (data[DS3231_HOUR] & DS3231_HOUR_IS_PM) - ct.hour += 12; - } - - return (clock_ct_to_ts(&ct, ts)); + clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_READ, &bct); + return (clock_bcd_to_ts(&bct, ts, sc->sc_use_ampm)); } static int ds3231_settime(device_t dev, struct timespec *ts) { int error; - struct clocktime ct; + struct bcd_clocktime bct; struct ds3231_softc *sc; uint8_t data[7]; uint8_t pmflags; @@ -556,27 +548,24 @@ ds3231_settime(device_t dev, struct timespec *ts) * disables utc adjustment, so apply that ourselves. */ ts->tv_sec -= utc_offset(); - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, sc->sc_use_ampm); + clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_WRITE, &bct); /* If the chip is in AM/PM mode, adjust hour and set flags as needed. */ if (sc->sc_use_ampm) { pmflags = DS3231_HOUR_USE_AMPM; - if (ct.hour >= 12) { - ct.hour -= 12; + if (bct.ispm) pmflags |= DS3231_HOUR_IS_PM; - } - if (ct.hour == 0) - ct.hour = 12; } else pmflags = 0; - data[DS3231_SECS] = TOBCD(ct.sec); - data[DS3231_MINS] = TOBCD(ct.min); - data[DS3231_HOUR] = TOBCD(ct.hour) | pmflags; - data[DS3231_DATE] = TOBCD(ct.day); - data[DS3231_WEEKDAY] = ct.dow + 1; - data[DS3231_MONTH] = TOBCD(ct.mon); - data[DS3231_YEAR] = TOBCD(ct.year % 100); + data[DS3231_SECS] = bct.sec; + data[DS3231_MINS] = bct.min; + data[DS3231_HOUR] = bct.hour | pmflags; + data[DS3231_DATE] = bct.day; + data[DS3231_WEEKDAY] = bct.dow + 1; + data[DS3231_MONTH] = bct.mon; + data[DS3231_YEAR] = bct.year & 0xff; if (sc->sc_last_c) data[DS3231_MONTH] |= DS3231_C_MASK; Modified: stable/11/sys/dev/iicbus/isl12xx.c ============================================================================== --- stable/11/sys/dev/iicbus/isl12xx.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/isl12xx.c Sat Mar 24 23:01:10 2018 (r331503) @@ -233,7 +233,7 @@ static int isl12xx_gettime(device_t dev, struct timespec *ts) { struct isl12xx_softc *sc = device_get_softc(dev); - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; int err; uint8_t hourmask, sreg; @@ -263,29 +263,24 @@ isl12xx_gettime(device_t dev, struct timespec *ts) hourmask = ISL12xx_12HR_MASK; } - ct.nsec = 0; - ct.sec = FROMBCD(tregs.sec); - ct.min = FROMBCD(tregs.min); - ct.hour = FROMBCD(tregs.hour & hourmask); - ct.day = FROMBCD(tregs.day); - ct.mon = FROMBCD(tregs.month); - ct.year = FROMBCD(tregs.year); + bct.nsec = 0; + bct.sec = tregs.sec; + bct.min = tregs.min; + bct.hour = tregs.hour & hourmask; + bct.day = tregs.day; + bct.mon = tregs.month; + bct.year = tregs.year; + bct.ispm = tregs.hour & ISL12XX_PM_FLAG; - if (sc->use_ampm) { - if (ct.hour == 12) - ct.hour = 0; - if (tregs.hour & ISL12XX_PM_FLAG) - ct.hour += 12; - } - - return (clock_ct_to_ts(&ct, ts)); + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); + return (clock_bcd_to_ts(&bct, ts, sc->use_ampm)); } static int isl12xx_settime(device_t dev, struct timespec *ts) { struct isl12xx_softc *sc = device_get_softc(dev); - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; int err; uint8_t ampmflags, sreg; @@ -296,27 +291,21 @@ isl12xx_settime(device_t dev, struct timespec *ts) */ ts->tv_sec -= utc_offset(); ts->tv_nsec = 0; - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, sc->use_ampm); + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); - /* If the chip is in AM/PM mode, adjust hour and set flags as needed. */ - if (!sc->use_ampm) { + /* If the chip is in AM/PM mode, set flags as needed. */ + if (!sc->use_ampm) ampmflags = ISL12XX_24HR_FLAG; - } else { - ampmflags = 0; - if (ct.hour >= 12) { - ct.hour -= 12; - ampmflags |= ISL12XX_PM_FLAG; - } - if (ct.hour == 0) - ct.hour = 12; - } + else + ampmflags = bct.ispm ? ISL12XX_PM_FLAG : 0; - tregs.sec = TOBCD(ct.sec); - tregs.min = TOBCD(ct.min); - tregs.hour = TOBCD(ct.hour) | ampmflags; - tregs.day = TOBCD(ct.day); - tregs.month = TOBCD(ct.mon); - tregs.year = TOBCD(ct.year % 100); + tregs.sec = bct.sec; + tregs.min = bct.min; + tregs.hour = bct.hour | ampmflags; + tregs.day = bct.day; + tregs.month = bct.mon; + tregs.year = bct.year % 100; /* * To set the time we have to set the WRTC enable bit in the control Modified: stable/11/sys/dev/iicbus/nxprtc.c ============================================================================== --- stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/nxprtc.c Sat Mar 24 23:01:10 2018 (r331503) @@ -608,6 +608,7 @@ nxprtc_gettime(device_t dev, struct timespec *ts) sc->flags |= SC_F_CPOL; } + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); err = clock_bcd_to_ts(&bct, ts, sc->use_ampm); ts->tv_sec += utc_offset(); @@ -648,6 +649,7 @@ nxprtc_settime(device_t dev, struct timespec *ts) ts->tv_sec -= utc_offset(); ts->tv_nsec = 0; clock_ts_to_bcd(ts, &bct, sc->use_ampm); + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); /* On 8563 set the century based on the polarity seen when reading. */ cflag = 0; Copied and modified: stable/11/sys/dev/iicbus/rtc8583.c (from r325233, head/sys/dev/iicbus/rtc8583.c) ============================================================================== --- head/sys/dev/iicbus/rtc8583.c Tue Oct 31 12:15:00 2017 (r325233, copy source) +++ stable/11/sys/dev/iicbus/rtc8583.c Sat Mar 24 23:01:10 2018 (r331503) @@ -190,7 +190,7 @@ static int rtc8583_gettime(device_t dev, struct timespec *ts) { struct rtc8583_softc *sc; - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; uint8_t y, ytmp, sreg; int err; @@ -227,42 +227,49 @@ rtc8583_gettime(device_t dev, struct timespec *ts) iicbus_release_bus(sc->busdev, sc->dev); } - ct.nsec = FROMBCD(tregs.msec) * 10 * 1000 * 1000; - ct.sec = FROMBCD(tregs.sec); - ct.min = FROMBCD(tregs.min); - ct.hour = FROMBCD(tregs.hour & 0x3f); - ct.day = FROMBCD(tregs.day & 0x3f); - ct.mon = FROMBCD(tregs.month & 0x1f); - ct.year = 2000 + sreg; + if (!validbcd(tregs.msec)) + return (EINVAL); - return (clock_ct_to_ts(&ct, ts)); + /* The 'msec' reg is actually 1/100ths, in bcd. */ + bct.nsec = bcd2bin(tregs.msec) * 10 * 1000 * 1000; + bct.sec = tregs.sec; + bct.min = tregs.min; + bct.hour = tregs.hour & 0x3f; + bct.day = tregs.day & 0x3f; + bct.mon = tregs.month & 0x1f; + bct.year = bin2bcd(sreg % 100); + + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); + return (clock_bcd_to_ts(&bct, ts, false)); } static int rtc8583_settime(device_t dev, struct timespec *ts) { struct rtc8583_softc *sc; - struct clocktime ct; + struct bcd_clocktime bct; struct time_regs tregs; uint8_t sreg; int err; sc = device_get_softc(dev); ts->tv_sec -= utc_offset(); - ts->tv_nsec = 0; - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, false); + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); - tregs.sec = TOBCD(ct.sec); - tregs.min = TOBCD(ct.min); - tregs.hour = TOBCD(ct.hour); - tregs.day = TOBCD(ct.day) | ((ct.year & 0x03) << 6); - tregs.month = TOBCD(ct.mon); + /* The 'msec' reg is actually 1/100ths, in bcd. */ + tregs.msec = bin2bcd(ts->tv_nsec / (10 * 1000 * 1000)); + tregs.sec = bct.sec; + tregs.min = bct.min; + tregs.hour = bct.hour; + tregs.day = bct.day | (bct.year & 0x03 << 6); + tregs.month = bct.mon; if ((err = iicbus_request_bus(sc->busdev, sc->dev, IIC_WAIT)) != 0) return (err); err = rtc8583_writeto(sc->dev, RTC8583_SC_REG, &tregs, sizeof(tregs), IIC_WAIT); - sreg = ct.year - 2000; + sreg = bcd2bin(bct.year & 0xff); /* save to year to sram */ rtc8583_write1(sc, RTC8583_USERSRAM_REG, sreg); iicbus_release_bus(sc->busdev, sc->dev); Modified: stable/11/sys/dev/iicbus/s35390a.c ============================================================================== --- stable/11/sys/dev/iicbus/s35390a.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/dev/iicbus/s35390a.c Sat Mar 24 23:01:10 2018 (r331503) @@ -297,7 +297,7 @@ static int s390rtc_gettime(device_t dev, struct timespec *ts) { uint8_t bcd[S390_RT1_NBYTES]; - struct clocktime ct; + struct bcd_clocktime bct; int error; error = s390rtc_read(dev, S390_REALTIME1, bcd, S390_RT1_NBYTES); @@ -310,37 +310,39 @@ s390rtc_gettime(device_t dev, struct timespec *ts) /* * Convert the register values into something useable. */ - ct.nsec = 0; - ct.sec = FROMBCD(bcd[S390_RT1_SECOND]); - ct.min = FROMBCD(bcd[S390_RT1_MINUTE]); - ct.hour = FROMBCD(bcd[S390_RT1_HOUR] & 0x3f); - ct.day = FROMBCD(bcd[S390_RT1_DAY]); - ct.dow = bcd[S390_RT1_WDAY] & 0x07; - ct.mon = FROMBCD(bcd[S390_RT1_MONTH]); - ct.year = FROMBCD(bcd[S390_RT1_YEAR]) + 2000; + bct.nsec = 0; + bct.sec = bcd[S390_RT1_SECOND]; + bct.min = bcd[S390_RT1_MINUTE]; + bct.hour = bcd[S390_RT1_HOUR] & 0x3f; + bct.day = bcd[S390_RT1_DAY]; + bct.dow = bcd[S390_RT1_WDAY] & 0x07; + bct.mon = bcd[S390_RT1_MONTH]; + bct.year = bcd[S390_RT1_YEAR]; - return (clock_ct_to_ts(&ct, ts)); + clock_dbgprint_bcd(dev, CLOCK_DBG_READ, &bct); + return (clock_bcd_to_ts(&bct, ts, false)); } static int s390rtc_settime(device_t dev, struct timespec *ts) { uint8_t bcd[S390_RT1_NBYTES]; - struct clocktime ct; + struct bcd_clocktime bct; - clock_ts_to_ct(ts, &ct); + clock_ts_to_bcd(ts, &bct, false); + clock_dbgprint_bcd(dev, CLOCK_DBG_WRITE, &bct); /* * Convert our time representation into something the S-xx390 * can understand. */ - bcd[S390_RT1_SECOND] = TOBCD(ct.sec); - bcd[S390_RT1_MINUTE] = TOBCD(ct.min); - bcd[S390_RT1_HOUR] = TOBCD(ct.hour); - bcd[S390_RT1_DAY] = TOBCD(ct.day); - bcd[S390_RT1_WDAY] = ct.dow; - bcd[S390_RT1_MONTH] = TOBCD(ct.mon); - bcd[S390_RT1_YEAR] = TOBCD(ct.year % 100); + bcd[S390_RT1_SECOND] = bct.sec; + bcd[S390_RT1_MINUTE] = bct.min; + bcd[S390_RT1_HOUR] = bct.hour; + bcd[S390_RT1_DAY] = bct.day; + bcd[S390_RT1_WDAY] = bct.dow; + bcd[S390_RT1_MONTH] = bct.mon; + bcd[S390_RT1_YEAR] = bct.year & 0xff; return (s390rtc_write(dev, S390_REALTIME1, bcd, S390_RT1_NBYTES)); } Modified: stable/11/sys/kern/subr_clock.c ============================================================================== --- stable/11/sys/kern/subr_clock.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/kern/subr_clock.c Sat Mar 24 23:01:10 2018 (r331503) @@ -108,6 +108,14 @@ static const int recent_base_year = 2017; static const int recent_base_days = 17167; /* + * Table to 'calculate' pow(10, 9 - nsdigits) via lookup of nsdigits. + * Before doing the lookup, the code asserts 0 <= nsdigits <= 9. + */ +static u_int nsdivisors[] = { + 1000000000, 100000000, 10000000, 1000000, 100000, 10000, 1000, 100, 10, 1 +}; + +/* * This inline avoids some unnecessary modulo operations * as compared with the usual macro: * ( ((year % 4) == 0 && @@ -131,23 +139,15 @@ leapyear(int year) return (rv); } -static void -print_ct(struct clocktime *ct) -{ - printf("[%04d-%02d-%02d %02d:%02d:%02d]", - ct->year, ct->mon, ct->day, - ct->hour, ct->min, ct->sec); -} - int -clock_ct_to_ts(struct clocktime *ct, struct timespec *ts) +clock_ct_to_ts(const struct clocktime *ct, struct timespec *ts) { int i, year, days; if (ct_debug) { - printf("ct_to_ts("); - print_ct(ct); - printf(")"); + printf("ct_to_ts(["); + clock_print_ct(ct, 9); + printf("])"); } /* @@ -200,7 +200,7 @@ clock_ct_to_ts(struct clocktime *ct, struct timespec * } int -clock_bcd_to_ts(struct bcd_clocktime *bct, struct timespec *ts, bool ampm) +clock_bcd_to_ts(const struct bcd_clocktime *bct, struct timespec *ts, bool ampm) { struct clocktime ct; int bcent, byear; @@ -249,7 +249,7 @@ clock_bcd_to_ts(struct bcd_clocktime *bct, struct time } void -clock_ts_to_ct(struct timespec *ts, struct clocktime *ct) +clock_ts_to_ct(const struct timespec *ts, struct clocktime *ct) { int i, year, days; time_t rsec; /* remainder seconds */ @@ -288,15 +288,15 @@ clock_ts_to_ct(struct timespec *ts, struct clocktime * ct->sec = rsec; ct->nsec = ts->tv_nsec; if (ct_debug) { - printf("ts_to_ct(%jd.%09ld) = ", + printf("ts_to_ct(%jd.%09ld) = [", (intmax_t)ts->tv_sec, ts->tv_nsec); - print_ct(ct); - printf("\n"); + clock_print_ct(ct, 9); + printf("]\n"); } } void -clock_ts_to_bcd(struct timespec *ts, struct bcd_clocktime *bct, bool ampm) +clock_ts_to_bcd(const struct timespec *ts, struct bcd_clocktime *bct, bool ampm) { struct clocktime ct; @@ -321,6 +321,51 @@ clock_ts_to_bcd(struct timespec *ts, struct bcd_clockt bct->sec = TOBCD(ct.sec); bct->dow = ct.dow; bct->nsec = ct.nsec; +} + +void +clock_print_bcd(const struct bcd_clocktime *bct, int nsdigits) +{ + + KASSERT(nsdigits >= 0 && nsdigits <= 9, ("bad nsdigits %d", nsdigits)); + + if (nsdigits > 0) { + printf("%4.4x-%2.2x-%2.2x %2.2x:%2.2x:%2.2x.%*.*ld", + bct->year, bct->mon, bct->day, + bct->hour, bct->min, bct->sec, + nsdigits, nsdigits, bct->nsec / nsdivisors[nsdigits]); + } else { + printf("%4.4x-%2.2x-%2.2x %2.2x:%2.2x:%2.2x", + bct->year, bct->mon, bct->day, + bct->hour, bct->min, bct->sec); + } +} + +void +clock_print_ct(const struct clocktime *ct, int nsdigits) +{ + + KASSERT(nsdigits >= 0 && nsdigits <= 9, ("bad nsdigits %d", nsdigits)); + + if (nsdigits > 0) { + printf("%04d-%02d-%02d %02d:%02d:%02d.%*.*ld", + ct->year, ct->mon, ct->day, + ct->hour, ct->min, ct->sec, + nsdigits, nsdigits, ct->nsec / nsdivisors[nsdigits]); + } else { + printf("%04d-%02d-%02d %02d:%02d:%02d", + ct->year, ct->mon, ct->day, + ct->hour, ct->min, ct->sec); + } +} + +void +clock_print_ts(const struct timespec *ts, int nsdigits) +{ + struct clocktime ct; + + clock_ts_to_ct(ts, &ct); + clock_print_ct(&ct, nsdigits); } int Modified: stable/11/sys/kern/subr_fattime.c ============================================================================== --- stable/11/sys/kern/subr_fattime.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/kern/subr_fattime.c Sat Mar 24 23:01:10 2018 (r331503) @@ -135,7 +135,8 @@ static const struct { void -timespec2fattime(struct timespec *tsp, int utc, uint16_t *ddp, uint16_t *dtp, uint8_t *dhp) +timespec2fattime(const struct timespec *tsp, int utc, uint16_t *ddp, + uint16_t *dtp, uint8_t *dhp) { time_t t1; unsigned t2, l, m; @@ -215,7 +216,8 @@ static const uint16_t daytab[64] = { }; void -fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc, struct timespec *tsp) +fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc, + struct timespec *tsp) { unsigned day; Modified: stable/11/sys/kern/subr_rtc.c ============================================================================== --- stable/11/sys/kern/subr_rtc.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/kern/subr_rtc.c Sat Mar 24 23:01:10 2018 (r331503) @@ -76,6 +76,15 @@ __FBSDID("$FreeBSD$"); #include "clock_if.h" +static int show_io; +SYSCTL_INT(_debug, OID_AUTO, clock_show_io, CTLFLAG_RWTUN, &show_io, 0, + "Enable debug printing of RTC clock I/O; 1=reads, 2=writes, 3=both."); + +static int sysctl_clock_do_io(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_debug, OID_AUTO, clock_do_io, CTLTYPE_INT | CTLFLAG_RW, + 0, 0, sysctl_clock_do_io, "I", + "Trigger one-time IO on RTC clocks; 1=read (and discard), 2=write"); + /* XXX: should be kern. now, it's no longer machdep. */ static int disable_rtc_set; SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set, CTLFLAG_RW, &disable_rtc_set, @@ -144,7 +153,61 @@ settime_task_func(void *arg, int pending) CLOCK_SETTIME(rtc->clockdev, &ts); } +static void +clock_dbgprint_hdr(device_t dev, int rw) +{ + struct timespec now; + + getnanotime(&now); + device_printf(dev, "%s at ", (rw & CLOCK_DBG_READ) ? "read " : "write"); + clock_print_ts(&now, 9); + printf(": "); +} + void +clock_dbgprint_bcd(device_t dev, int rw, const struct bcd_clocktime *bct) +{ + + if (show_io & rw) { + clock_dbgprint_hdr(dev, rw); + clock_print_bcd(bct, 9); + printf("\n"); + } +} + +void +clock_dbgprint_ct(device_t dev, int rw, const struct clocktime *ct) +{ + + if (show_io & rw) { + clock_dbgprint_hdr(dev, rw); + clock_print_ct(ct, 9); + printf("\n"); + } +} + +void +clock_dbgprint_err(device_t dev, int rw, int err) +{ + + if (show_io & rw) { + clock_dbgprint_hdr(dev, rw); + printf("error = %d\n", err); + } +} + +void +clock_dbgprint_ts(device_t dev, int rw, const struct timespec *ts) +{ + + if (show_io & rw) { + clock_dbgprint_hdr(dev, rw); + clock_print_ts(ts, 9); + printf("\n"); + } +} + +void clock_register_flags(device_t clockdev, long resolution, int flags) { struct rtc_instance *rtc, *newrtc; @@ -203,7 +266,7 @@ clock_unregister(device_t clockdev) if (rtc != NULL) { taskqueue_cancel_timeout(taskqueue_thread, &rtc->stask, NULL); taskqueue_drain_timeout(taskqueue_thread, &rtc->stask); - free(rtc, M_DEVBUF); + free(rtc, M_DEVBUF); } } @@ -222,6 +285,36 @@ clock_schedule(device_t clockdev, u_int offsetns) sx_xunlock(&rtc_list_lock); } +static int +read_clocks(struct timespec *ts, bool debug_read) +{ + struct rtc_instance *rtc; + int error; + + error = ENXIO; + sx_xlock(&rtc_list_lock); + LIST_FOREACH(rtc, &rtc_list, rtc_entries) { + if ((error = CLOCK_GETTIME(rtc->clockdev, ts)) != 0) + continue; + if (ts->tv_sec < 0 || ts->tv_nsec < 0) { + error = EINVAL; + continue; + } + if (!(rtc->flags & CLOCKF_GETTIME_NO_ADJ)) { + timespecadd(ts, &rtc->resadj); + ts->tv_sec += utc_offset(); + } + if (!debug_read) { + if (bootverbose) + device_printf(rtc->clockdev, + "providing initial system time\n"); + break; + } + } + sx_xunlock(&rtc_list_lock); + return (error); +} + /* * Initialize the system time. Must be called from a context which does not * restrict any locking or sleeping that clock drivers may need to do. @@ -238,28 +331,9 @@ void inittodr(time_t base) { struct timespec ts; - struct rtc_instance *rtc; int error; - error = ENXIO; - sx_xlock(&rtc_list_lock); - LIST_FOREACH(rtc, &rtc_list, rtc_entries) { - if ((error = CLOCK_GETTIME(rtc->clockdev, &ts)) != 0) - continue; - if (ts.tv_sec < 0 || ts.tv_nsec < 0) { - error = EINVAL; - continue; - } - if (!(rtc->flags & CLOCKF_GETTIME_NO_ADJ)) { - timespecadd(&ts, &rtc->resadj); - ts.tv_sec += utc_offset(); - } - if (bootverbose) - device_printf(rtc->clockdev, - "providing initial system time\n"); - break; - } - sx_xunlock(&rtc_list_lock); + error = read_clocks(&ts, false); /* * Do not report errors from each clock; it is expected that some clocks @@ -321,4 +395,30 @@ resettodr(void) &rtc->stask, -sbt, 0, C_PREL(31)); } sx_xunlock(&rtc_list_lock); +} + +static int +sysctl_clock_do_io(SYSCTL_HANDLER_ARGS) +{ + struct timespec ts_discard; + int error, value; + + value = 0; + error = sysctl_handle_int(oidp, &value, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + + switch (value) { + case CLOCK_DBG_READ: + if (read_clocks(&ts_discard, true) == ENXIO) + printf("No registered RTC clocks\n"); + break; + case CLOCK_DBG_WRITE: + resettodr(); + break; + default: + return (EINVAL); + } + + return (0); } Modified: stable/11/sys/modules/i2c/Makefile ============================================================================== --- stable/11/sys/modules/i2c/Makefile Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/modules/i2c/Makefile Sat Mar 24 23:01:10 2018 (r331503) @@ -5,6 +5,7 @@ SUBDIR = \ cyapa \ ds1307 \ ds13rtc \ + ds1672 \ ds3231 \ icee \ if_ic \ @@ -17,6 +18,7 @@ SUBDIR = \ jedec_dimm \ jedec_ts \ nxprtc \ + rtc8583 \ s35390a \ smb \ smbus \ Modified: stable/11/sys/sys/clock.h ============================================================================== --- stable/11/sys/sys/clock.h Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/sys/clock.h Sat Mar 24 23:01:10 2018 (r331503) @@ -88,8 +88,8 @@ struct clocktime { long nsec; /* nano seconds */ }; -int clock_ct_to_ts(struct clocktime *, struct timespec *); -void clock_ts_to_ct(struct timespec *, struct clocktime *); +int clock_ct_to_ts(const struct clocktime *, struct timespec *); +void clock_ts_to_ct(const struct timespec *, struct clocktime *); /* * Structure to hold the values typically reported by time-of-day clocks, @@ -125,8 +125,8 @@ struct bcd_clocktime { bool ispm; /* true if hour represents pm time */ }; -int clock_bcd_to_ts(struct bcd_clocktime *, struct timespec *, bool ampm); -void clock_ts_to_bcd(struct timespec *, struct bcd_clocktime *, bool ampm); +int clock_bcd_to_ts(const struct bcd_clocktime *, struct timespec *, bool ampm); +void clock_ts_to_bcd(const struct timespec *, struct bcd_clocktime *, bool ampm); /* * Time-of-day clock functions and flags. These functions might sleep. @@ -177,8 +177,31 @@ void clock_unregister(device_t _clockdev); /* Traditional POSIX base year */ #define POSIX_BASE_YEAR 1970 -void timespec2fattime(struct timespec *tsp, int utc, u_int16_t *ddp, u_int16_t *dtp, u_int8_t *dhp); -void fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc, struct timespec *tsp); +void timespec2fattime(const struct timespec *tsp, int utc, u_int16_t *ddp, + u_int16_t *dtp, u_int8_t *dhp); +void fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc, + struct timespec *tsp); + +/* + * Print a [bcd_]clocktime or timespec, optionally with fractional seconds. The + * nsdig argument can range from 0-9, and specifies how many decimal digits to + * display for fractional seconds. + */ +void clock_print_bcd(const struct bcd_clocktime *bct, int nsdig); +void clock_print_ct(const struct clocktime *ct, int nsdig); +void clock_print_ts(const struct timespec *ts, int nsdig); + +/* + * Debugging helpers for RTC clock drivers. Print a [bcd_]clocktime or + * timespec, only if rtc clock debugging has been enabled. The rw argument is + * one of CLOCK_DBG_READ or CLOCK_DBG_WRITE. + */ +#define CLOCK_DBG_READ 0x01 +#define CLOCK_DBG_WRITE 0x02 +void clock_dbgprint_bcd(device_t dev, int rw, const struct bcd_clocktime *bct); +void clock_dbgprint_ct(device_t dev, int rw, const struct clocktime *ct); +void clock_dbgprint_err(device_t dev, int rw, int err); +void clock_dbgprint_ts(device_t dev, int rw, const struct timespec *ts); #endif /* _KERNEL */ Modified: stable/11/sys/x86/isa/atrtc.c ============================================================================== --- stable/11/sys/x86/isa/atrtc.c Sat Mar 24 22:50:59 2018 (r331502) +++ stable/11/sys/x86/isa/atrtc.c Sat Mar 24 23:01:10 2018 (r331503) @@ -316,6 +316,7 @@ atrtc_settime(device_t dev __unused, struct timespec * struct bcd_clocktime bct; clock_ts_to_bcd(ts, &bct, false); + clock_dbgprint_bcd(dev, CLOCK_DBG_WRITE, &bct); mtx_lock(&atrtc_time_lock); RTC_LOCK; @@ -383,6 +384,7 @@ atrtc_gettime(device_t dev, struct timespec *ts) /* dow is unused in timespec conversion and we have no nsec info. */ bct.dow = 0; bct.nsec = 0; + clock_dbgprint_bcd(dev, CLOCK_DBG_READ, &bct); return (clock_bcd_to_ts(&bct, ts, false)); } @@ -413,16 +415,3 @@ static devclass_t atrtc_devclass; DRIVER_MODULE(atrtc, isa, atrtc_driver, atrtc_devclass, 0, 0); DRIVER_MODULE(atrtc, acpi, atrtc_driver, atrtc_devclass, 0, 0); - -#include "opt_ddb.h" -#ifdef DDB -#include - -DB_SHOW_COMMAND(rtc, rtc) -{ - printf("%02x/%02x/%02x %02x:%02x:%02x, A = %02x, B = %02x, C = %02x\n", - rtcin(RTC_YEAR), rtcin(RTC_MONTH), rtcin(RTC_DAY), - rtcin(RTC_HRS), rtcin(RTC_MIN), rtcin(RTC_SEC), - rtcin(RTC_STATUSA), rtcin(RTC_STATUSB), rtcin(RTC_INTR)); -} -#endif /* DDB */ From owner-svn-src-stable@freebsd.org Sat Mar 24 23:04:00 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3437F53D7F; Sat, 24 Mar 2018 23:03:59 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A69DE8499A; Sat, 24 Mar 2018 23:03:59 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A179415CB2; Sat, 24 Mar 2018 23:03:59 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2ON3xOB026663; Sat, 24 Mar 2018 23:03:59 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ON3x5t026661; Sat, 24 Mar 2018 23:03:59 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242303.w2ON3x5t026661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 23:03: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: r331504 - stable/11/sys/dev/gpio X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/dev/gpio X-SVN-Commit-Revision: 331504 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, 24 Mar 2018 23:04:00 -0000 Author: ian Date: Sat Mar 24 23:03:59 2018 New Revision: 331504 URL: https://svnweb.freebsd.org/changeset/base/331504 Log: MFC r329537: Provide a public function to acquire a gpio pin by giving the property name and index. A private function to do exactly that already existed, so this renames gpio_pin_get_by_ofw_impl() to gpio_pin_get_by_ofw_propidx() and provides a declaration for it in a public header. Previously there were functions to get a pin by property name (assuming there would only be one pin defined for the name), or by index (asuming the property has the standard name "gpios"). It turns out there are devicetree bindings that describe properties with names other than "gpios" which can describe multiple pins. Hence the need to retrieve the Nth item from a named property. Modified: stable/11/sys/dev/gpio/gpiobusvar.h stable/11/sys/dev/gpio/ofw_gpiobus.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/gpio/gpiobusvar.h ============================================================================== --- stable/11/sys/dev/gpio/gpiobusvar.h Sat Mar 24 23:01:10 2018 (r331503) +++ stable/11/sys/dev/gpio/gpiobusvar.h Sat Mar 24 23:03:59 2018 (r331504) @@ -133,6 +133,8 @@ int gpio_pin_get_by_ofw_idx(device_t consumer, phandle int idx, gpio_pin_t *gpio); int gpio_pin_get_by_ofw_property(device_t consumer, phandle_t node, char *name, gpio_pin_t *gpio); +int gpio_pin_get_by_ofw_propidx(device_t consumer, phandle_t node, + char *name, int idx, gpio_pin_t *gpio); void gpio_pin_release(gpio_pin_t gpio); int gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps); int gpio_pin_is_active(gpio_pin_t pin, bool *active); Modified: stable/11/sys/dev/gpio/ofw_gpiobus.c ============================================================================== --- stable/11/sys/dev/gpio/ofw_gpiobus.c Sat Mar 24 23:01:10 2018 (r331503) +++ stable/11/sys/dev/gpio/ofw_gpiobus.c Sat Mar 24 23:03:59 2018 (r331504) @@ -57,8 +57,8 @@ static int ofw_gpiobus_parse_gpios_impl(device_t, phan * tree consumers. * */ -static int -gpio_pin_get_by_ofw_impl(device_t consumer, phandle_t cnode, +int +gpio_pin_get_by_ofw_propidx(device_t consumer, phandle_t cnode, char *prop_name, int idx, gpio_pin_t *out_pin) { phandle_t xref; @@ -112,7 +112,7 @@ gpio_pin_get_by_ofw_idx(device_t consumer, phandle_t n int idx, gpio_pin_t *pin) { - return (gpio_pin_get_by_ofw_impl(consumer, node, "gpios", idx, pin)); + return (gpio_pin_get_by_ofw_propidx(consumer, node, "gpios", idx, pin)); } int @@ -120,7 +120,7 @@ gpio_pin_get_by_ofw_property(device_t consumer, phandl char *name, gpio_pin_t *pin) { - return (gpio_pin_get_by_ofw_impl(consumer, node, name, 0, pin)); + return (gpio_pin_get_by_ofw_propidx(consumer, node, name, 0, pin)); } int From owner-svn-src-stable@freebsd.org Sat Mar 24 23:07:10 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0A27F541D7; Sat, 24 Mar 2018 23:07:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 85BA784BD2; Sat, 24 Mar 2018 23:07:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C69915CB4; Sat, 24 Mar 2018 23:07:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2ON7AdH026813; Sat, 24 Mar 2018 23:07:10 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ON7AT4026812; Sat, 24 Mar 2018 23:07:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242307.w2ON7AT4026812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 23:07: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: r331505 - stable/11/sys/arm/freescale/imx X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/arm/freescale/imx X-SVN-Commit-Revision: 331505 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, 24 Mar 2018 23:07:11 -0000 Author: ian Date: Sat Mar 24 23:07:10 2018 New Revision: 331505 URL: https://svnweb.freebsd.org/changeset/base/331505 Log: MFC r329642: Adjust whitespace of things added in the past couple years to match the original style of the file. No functional changes. Modified: stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/freescale/imx/imx6_ccmreg.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Sat Mar 24 23:03:59 2018 (r331504) +++ stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Sat Mar 24 23:07:10 2018 (r331505) @@ -31,113 +31,113 @@ #ifndef IMX6_CCMREG_H #define IMX6_CCMREG_H -#define CCM_CACCR 0x010 -#define CCM_CBCDR 0x014 -#define CBCDR_MMDC_CH1_AXI_PODF_SHIFT 3 -#define CBCDR_MMDC_CH1_AXI_PODF_MASK (7 << 3) -#define CCM_CSCMR1 0x01C -#define SSI1_CLK_SEL_S 10 -#define SSI2_CLK_SEL_S 12 -#define SSI3_CLK_SEL_S 14 -#define SSI_CLK_SEL_M 0x3 -#define SSI_CLK_SEL_508_PFD 0 -#define SSI_CLK_SEL_454_PFD 1 -#define SSI_CLK_SEL_PLL4 2 -#define CCM_CSCMR2 0x020 -#define CSCMR2_LDB_DI0_IPU_DIV_SHIFT 10 -#define CCM_CS1CDR 0x028 -#define SSI1_CLK_PODF_SHIFT 0 -#define SSI1_CLK_PRED_SHIFT 6 -#define SSI3_CLK_PODF_SHIFT 16 -#define SSI3_CLK_PRED_SHIFT 22 -#define SSI_CLK_PODF_MASK 0x3f -#define SSI_CLK_PRED_MASK 0x7 -#define CCM_CS2CDR 0x02C -#define SSI2_CLK_PODF_SHIFT 0 -#define SSI2_CLK_PRED_SHIFT 6 -#define LDB_DI0_CLK_SEL_SHIFT 9 -#define LDB_DI0_CLK_SEL_MASK (3 << LDB_DI0_CLK_SEL_SHIFT) -#define CCM_CHSCCDR 0x034 -#define CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK (0x7 << 6) -#define CHSCCDR_IPU1_DI0_PRE_CLK_SEL_SHIFT 6 -#define CHSCCDR_IPU1_DI0_PODF_MASK (0x7 << 3) -#define CHSCCDR_IPU1_DI0_PODF_SHIFT 3 -#define CHSCCDR_IPU1_DI0_CLK_SEL_MASK (0x7) -#define CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT 0 -#define CHSCCDR_CLK_SEL_LDB_DI0 3 -#define CHSCCDR_PODF_DIVIDE_BY_3 2 -#define CHSCCDR_IPU_PRE_CLK_540M_PFD 5 -#define CCM_CSCDR2 0x038 -#define CCM_CLPCR 0x054 -#define CCM_CLPCR_LPM_MASK 0x03 -#define CCM_CLPCR_LPM_RUN 0x00 -#define CCM_CLPCR_LPM_WAIT 0x01 -#define CCM_CLPCR_LPM_STOP 0x02 -#define CCM_CGPR 0x064 -#define CCM_CGPR_INT_MEM_CLK_LPM (1 << 17) -#define CCM_CCGR0 0x068 -#define CCGR0_AIPS_TZ1 (0x3 << 0) -#define CCGR0_AIPS_TZ2 (0x3 << 2) -#define CCGR0_ABPHDMA (0x3 << 4) -#define CCM_CCGR1 0x06C -#define CCGR1_ENET (0x3 << 10) -#define CCGR1_EPIT1 (0x3 << 12) -#define CCGR1_EPIT2 (0x3 << 14) -#define CCGR1_GPT (0x3 << 20) -#define CCGR1_GPT_SERIAL (0x3 << 22) -#define CCM_CCGR2 0x070 -#define CCGR2_HDMI_TX (0x3 << 0) -#define CCGR2_HDMI_TX_ISFR (0x3 << 4) -#define CCGR2_I2C1 (0x3 << 6) -#define CCGR2_I2C2 (0x3 << 8) -#define CCGR2_I2C3 (0x3 << 10) -#define CCGR2_IIM (0x3 << 12) -#define CCGR2_IOMUX_IPT (0x3 << 14) -#define CCGR2_IPMUX1 (0x3 << 16) -#define CCGR2_IPMUX2 (0x3 << 18) -#define CCGR2_IPMUX3 (0x3 << 20) -#define CCGR2_IPSYNC_IP2APB_TZASC1 (0x3 << 22) -#define CCGR2_IPSYNC_IP2APB_TZASC2 (0x3 << 24) -#define CCGR2_IPSYNC_VDOA (0x3 << 26) -#define CCM_CCGR3 0x074 -#define CCGR3_IPU1_IPU (0x3 << 0) -#define CCGR3_IPU1_DI0 (0x3 << 2) -#define CCGR3_IPU1_DI1 (0x3 << 4) -#define CCGR3_IPU2_IPU (0x3 << 6) -#define CCGR3_IPU2_DI0 (0x3 << 8) -#define CCGR3_IPU2_DI1 (0x3 << 10) -#define CCGR3_LDB_DI0 (0x3 << 12) -#define CCGR3_LDB_DI1 (0x3 << 14) -#define CCGR3_MMDC_CORE_ACLK_FAST (0x3 << 20) -#define CCGR3_CG11 (0x3 << 22) -#define CCGR3_MMDC_CORE_IPG (0x3 << 24) -#define CCGR3_CG13 (0x3 << 26) -#define CCGR3_OCRAM (0x3 << 28) -#define CCM_CCGR4 0x078 -#define CCGR4_PL301_MX6QFAST1_S133 (0x3 << 8) -#define CCGR4_PL301_MX6QPER1_BCH (0x3 << 12) -#define CCGR4_PL301_MX6QPER2_MAIN (0x3 << 14) -#define CCM_CCGR5 0x07C -#define CCGR5_SATA (0x3 << 4) -#define CCGR5_SDMA (0x3 << 6) -#define CCGR5_SSI1 (0x3 << 18) -#define CCGR5_SSI2 (0x3 << 20) -#define CCGR5_SSI3 (0x3 << 22) -#define CCGR5_UART (0x3 << 24) -#define CCGR5_UART_SERIAL (0x3 << 26) -#define CCM_CCGR6 0x080 -#define CCGR6_USBOH3 (0x3 << 0) -#define CCGR6_USDHC1 (0x3 << 2) -#define CCGR6_USDHC2 (0x3 << 4) -#define CCGR6_USDHC3 (0x3 << 6) -#define CCGR6_USDHC4 (0x3 << 8) -#define CCM_CMEOR 0x088 - -#define CCM_ANALOG_PLL_ENET 0x000040e0 -#define CCM_ANALOG_PLL_ENET_LOCK (1u << 31) -#define CCM_ANALOG_PLL_ENET_ENABLE_100M (1u << 20) /* SATA */ -#define CCM_ANALOG_PLL_ENET_BYPASS (1u << 16) -#define CCM_ANALOG_PLL_ENET_ENABLE (1u << 13) /* Ether */ -#define CCM_ANALOG_PLL_ENET_POWERDOWN (1u << 12) +#define CCM_CACCR 0x010 +#define CCM_CBCDR 0x014 +#define CBCDR_MMDC_CH1_AXI_PODF_SHIFT 3 +#define CBCDR_MMDC_CH1_AXI_PODF_MASK (7 << 3) +#define CCM_CSCMR1 0x01C +#define SSI1_CLK_SEL_S 10 +#define SSI2_CLK_SEL_S 12 +#define SSI3_CLK_SEL_S 14 +#define SSI_CLK_SEL_M 0x3 +#define SSI_CLK_SEL_508_PFD 0 +#define SSI_CLK_SEL_454_PFD 1 +#define SSI_CLK_SEL_PLL4 2 +#define CCM_CSCMR2 0x020 +#define CSCMR2_LDB_DI0_IPU_DIV_SHIFT 10 +#define CCM_CS1CDR 0x028 +#define SSI1_CLK_PODF_SHIFT 0 +#define SSI1_CLK_PRED_SHIFT 6 +#define SSI3_CLK_PODF_SHIFT 16 +#define SSI3_CLK_PRED_SHIFT 22 +#define SSI_CLK_PODF_MASK 0x3f +#define SSI_CLK_PRED_MASK 0x7 +#define CCM_CS2CDR 0x02C +#define SSI2_CLK_PODF_SHIFT 0 +#define SSI2_CLK_PRED_SHIFT 6 +#define LDB_DI0_CLK_SEL_SHIFT 9 +#define LDB_DI0_CLK_SEL_MASK (3 << LDB_DI0_CLK_SEL_SHIFT) +#define CCM_CHSCCDR 0x034 +#define CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK (0x7 << 6) +#define CHSCCDR_IPU1_DI0_PRE_CLK_SEL_SHIFT 6 +#define CHSCCDR_IPU1_DI0_PODF_MASK (0x7 << 3) +#define CHSCCDR_IPU1_DI0_PODF_SHIFT 3 +#define CHSCCDR_IPU1_DI0_CLK_SEL_MASK (0x7) +#define CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT 0 +#define CHSCCDR_CLK_SEL_LDB_DI0 3 +#define CHSCCDR_PODF_DIVIDE_BY_3 2 +#define CHSCCDR_IPU_PRE_CLK_540M_PFD 5 +#define CCM_CSCDR2 0x038 +#define CCM_CLPCR 0x054 +#define CCM_CLPCR_LPM_MASK 0x03 +#define CCM_CLPCR_LPM_RUN 0x00 +#define CCM_CLPCR_LPM_WAIT 0x01 +#define CCM_CLPCR_LPM_STOP 0x02 +#define CCM_CGPR 0x064 +#define CCM_CGPR_INT_MEM_CLK_LPM (1 << 17) +#define CCM_CCGR0 0x068 +#define CCGR0_AIPS_TZ1 (0x3 << 0) +#define CCGR0_AIPS_TZ2 (0x3 << 2) +#define CCGR0_ABPHDMA (0x3 << 4) +#define CCM_CCGR1 0x06C +#define CCGR1_ENET (0x3 << 10) +#define CCGR1_EPIT1 (0x3 << 12) +#define CCGR1_EPIT2 (0x3 << 14) +#define CCGR1_GPT (0x3 << 20) +#define CCGR1_GPT_SERIAL (0x3 << 22) +#define CCM_CCGR2 0x070 +#define CCGR2_HDMI_TX (0x3 << 0) +#define CCGR2_HDMI_TX_ISFR (0x3 << 4) +#define CCGR2_I2C1 (0x3 << 6) +#define CCGR2_I2C2 (0x3 << 8) +#define CCGR2_I2C3 (0x3 << 10) +#define CCGR2_IIM (0x3 << 12) +#define CCGR2_IOMUX_IPT (0x3 << 14) +#define CCGR2_IPMUX1 (0x3 << 16) +#define CCGR2_IPMUX2 (0x3 << 18) +#define CCGR2_IPMUX3 (0x3 << 20) +#define CCGR2_IPSYNC_IP2APB_TZASC1 (0x3 << 22) +#define CCGR2_IPSYNC_IP2APB_TZASC2 (0x3 << 24) +#define CCGR2_IPSYNC_VDOA (0x3 << 26) +#define CCM_CCGR3 0x074 +#define CCGR3_IPU1_IPU (0x3 << 0) +#define CCGR3_IPU1_DI0 (0x3 << 2) +#define CCGR3_IPU1_DI1 (0x3 << 4) +#define CCGR3_IPU2_IPU (0x3 << 6) +#define CCGR3_IPU2_DI0 (0x3 << 8) +#define CCGR3_IPU2_DI1 (0x3 << 10) +#define CCGR3_LDB_DI0 (0x3 << 12) +#define CCGR3_LDB_DI1 (0x3 << 14) +#define CCGR3_MMDC_CORE_ACLK_FAST (0x3 << 20) +#define CCGR3_CG11 (0x3 << 22) +#define CCGR3_MMDC_CORE_IPG (0x3 << 24) +#define CCGR3_CG13 (0x3 << 26) +#define CCGR3_OCRAM (0x3 << 28) +#define CCM_CCGR4 0x078 +#define CCGR4_PL301_MX6QFAST1_S133 (0x3 << 8) +#define CCGR4_PL301_MX6QPER1_BCH (0x3 << 12) +#define CCGR4_PL301_MX6QPER2_MAIN (0x3 << 14) +#define CCM_CCGR5 0x07C +#define CCGR5_SATA (0x3 << 4) +#define CCGR5_SDMA (0x3 << 6) +#define CCGR5_SSI1 (0x3 << 18) +#define CCGR5_SSI2 (0x3 << 20) +#define CCGR5_SSI3 (0x3 << 22) +#define CCGR5_UART (0x3 << 24) +#define CCGR5_UART_SERIAL (0x3 << 26) +#define CCM_CCGR6 0x080 +#define CCGR6_USBOH3 (0x3 << 0) +#define CCGR6_USDHC1 (0x3 << 2) +#define CCGR6_USDHC2 (0x3 << 4) +#define CCGR6_USDHC3 (0x3 << 6) +#define CCGR6_USDHC4 (0x3 << 8) +#define CCM_CMEOR 0x088 + +#define CCM_ANALOG_PLL_ENET 0x000040e0 +#define CCM_ANALOG_PLL_ENET_LOCK (1u << 31) +#define CCM_ANALOG_PLL_ENET_ENABLE_100M (1u << 20) /* SATA */ +#define CCM_ANALOG_PLL_ENET_BYPASS (1u << 16) +#define CCM_ANALOG_PLL_ENET_ENABLE (1u << 13) /* Ether */ +#define CCM_ANALOG_PLL_ENET_POWERDOWN (1u << 12) #endif From owner-svn-src-stable@freebsd.org Sat Mar 24 23:23:34 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22024F5575C; Sat, 24 Mar 2018 23:23:34 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3F15858E9; Sat, 24 Mar 2018 23:23:33 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD19F15FEC; Sat, 24 Mar 2018 23:23:33 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2ONNXnd036281; Sat, 24 Mar 2018 23:23:33 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ONNVMg036256; Sat, 24 Mar 2018 23:23:31 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242323.w2ONNVMg036256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 23:23:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331506 - in stable/11/sys: arm/at91 arm/broadcom/bcm2835 arm/freescale/imx arm/freescale/vybrid arm/lpc arm/samsung/exynos arm/ti dev/flash dev/spibus dev/xilinx mips/atheros mips/medi... X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys: arm/at91 arm/broadcom/bcm2835 arm/freescale/imx arm/freescale/vybrid arm/lpc arm/samsung/exynos arm/ti dev/flash dev/spibus dev/xilinx mips/atheros mips/mediatek mips/rt305x modules ... X-SVN-Commit-Revision: 331506 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, 24 Mar 2018 23:23:34 -0000 Author: ian Date: Sat Mar 24 23:23:31 2018 New Revision: 331506 URL: https://svnweb.freebsd.org/changeset/base/331506 Log: MFC r310017, r310229, r312289, r327260, r329539, r329544-r329546, r329620, r329729, r329911, r329999 r310017: [spi] reformat message This commit corrects print of nomatch (newline was too early) Submitted by: Hiroki Mori Reviewed by: ray, loos, mizhka Differential Revision: https://reviews.freebsd.org/D8749 r310229: ofw_spi: Parse property for the SPI mode and CS polarity. As cs is stored in a uint32_t, use the last bit to store the active high flag as it's unlikely that we will have that much CS. Reviewed by: loos Differential Revision: https://reviews.freebsd.org/D8614 r312289: [spibus] small code refactoring Merge 3 sequential printf calls into one. Reported by: rpokala Reviewed by: rpokala, adrian Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8795 r327260: SPDX: fix wrong license ID tag in dev/spibus. r329539: Provide public declarations for ofw_spibus_driver and ofw_spibus_devclass so other drivers can refer to them in DRIVER_MODULE() decls. r329544: Add modules/spi as a gathering point for SPI-related modules, analagous to modules/i2c for i2c/iicbus modules. Build spibus as a module. r329545: Add ofw_bus_if.h to SRCS. r329546: Build at45d and mx25l SPI flash drivers as modules. r329620: Add missing MODULE_DEPENDS(). r329729: Remove some files that snuck in via cut and paste. Having these compiled into the module causes the kobj method descriptors to be resolved incorrectly (by the compile-time linker instead of the kernel linker), which then leads to hours of frustrating debugging. r329911: Add a functional detach() routine, to make things kldunload-friendly. r329999: Add a SPI driver for imx5 and imx6. It can be compiled into the kernel with "device imx_spi" or loaded as a module, which is also named "imx_spi". Added: stable/11/sys/arm/freescale/imx/imx_spi.c - copied unchanged from r329999, head/sys/arm/freescale/imx/imx_spi.c stable/11/sys/modules/imx/imx_spi/ - copied from r329999, head/sys/modules/imx/imx_spi/ stable/11/sys/modules/spi/ - copied from r329546, head/sys/modules/spi/ Modified: stable/11/sys/arm/at91/at91_spi.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c stable/11/sys/arm/freescale/imx/files.imx5 stable/11/sys/arm/freescale/imx/files.imx6 stable/11/sys/arm/freescale/imx/imx51_ccm.c stable/11/sys/arm/freescale/imx/imx6_ccm.c stable/11/sys/arm/freescale/imx/imx6_ccmreg.h stable/11/sys/arm/freescale/imx/imx_ccmvar.h stable/11/sys/arm/freescale/vybrid/vf_spi.c stable/11/sys/arm/lpc/lpc_spi.c stable/11/sys/arm/samsung/exynos/exynos5_spi.c stable/11/sys/arm/ti/ti_spi.c stable/11/sys/dev/flash/at45d.c stable/11/sys/dev/flash/mx25l.c stable/11/sys/dev/spibus/ofw_spibus.c stable/11/sys/dev/spibus/spibusvar.h stable/11/sys/dev/xilinx/axi_quad_spi.c stable/11/sys/mips/atheros/ar71xx_spi.c stable/11/sys/mips/mediatek/mtk_spi_v1.c stable/11/sys/mips/mediatek/mtk_spi_v2.c stable/11/sys/mips/rt305x/rt305x_spi.c stable/11/sys/modules/Makefile stable/11/sys/modules/imx/Makefile stable/11/sys/modules/spi/at45d/Makefile stable/11/sys/modules/spi/mx25l/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/at91/at91_spi.c ============================================================================== --- stable/11/sys/arm/at91/at91_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/at91/at91_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -304,6 +304,8 @@ at91_spi_transfer(device_t dev, device_t child, struct /* get the proper chip select */ spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + sc = device_get_softc(dev); i = 0; Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -436,6 +436,9 @@ bcm_spi_transfer(device_t dev, device_t child, struct /* Get the proper chip select for this child. */ spibus_get_cs(child, &cs); + + cs &= ~SPIBUS_CS_HIGH; + if (cs > 2) { device_printf(dev, "Invalid chip select %d requested by %s\n", cs, Modified: stable/11/sys/arm/freescale/imx/files.imx5 ============================================================================== --- stable/11/sys/arm/freescale/imx/files.imx5 Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/imx/files.imx5 Sat Mar 24 23:23:31 2018 (r331506) @@ -52,3 +52,6 @@ dev/vt/hw/fb/vt_early_fb.c optional vt # Fast Ethernet Controller dev/ffec/if_ffec.c optional ffec +# SPI +arm/freescale/imx/imx_spi.c optional imx_spi + Modified: stable/11/sys/arm/freescale/imx/files.imx6 ============================================================================== --- stable/11/sys/arm/freescale/imx/files.imx6 Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/imx/files.imx6 Sat Mar 24 23:23:31 2018 (r331506) @@ -22,6 +22,7 @@ arm/freescale/imx/imx_machdep.c standard arm/freescale/imx/imx_gpt.c optional imx_gpt arm/freescale/imx/imx_gpio.c optional gpio arm/freescale/imx/imx_i2c.c optional fsliic +arm/freescale/imx/imx_spi.c optional imx_spi arm/freescale/imx/imx6_sdma.c optional sdma arm/freescale/imx/imx6_audmux.c optional sound arm/freescale/imx/imx6_ssi.c optional sound Modified: stable/11/sys/arm/freescale/imx/imx51_ccm.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx51_ccm.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/imx/imx51_ccm.c Sat Mar 24 23:23:31 2018 (r331506) @@ -622,6 +622,13 @@ imx_ccm_usbphy_enable(device_t dev) } uint32_t +imx_ccm_ecspi_hz(void) +{ + + return (imx51_get_clock(IMX51CLK_CSPI_CLK_ROOT)); +} + +uint32_t imx_ccm_ipg_hz(void) { @@ -655,3 +662,4 @@ imx_ccm_ahb_hz(void) return (imx51_get_clock(IMX51CLK_AHB_CLK_ROOT)); } + Modified: stable/11/sys/arm/freescale/imx/imx6_ccm.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_ccm.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/imx/imx6_ccm.c Sat Mar 24 23:23:31 2018 (r331506) @@ -96,8 +96,9 @@ ccm_init_gates(struct ccm_softc *sc) reg = CCGR0_AIPS_TZ1 | CCGR0_AIPS_TZ2 | CCGR0_ABPHDMA; WR4(sc, CCM_CCGR0, reg); - /* enet, epit, gpt */ - reg = CCGR1_ENET | CCGR1_EPIT1 | CCGR1_GPT; + /* enet, epit, gpt, spi */ + reg = CCGR1_ENET | CCGR1_EPIT1 | CCGR1_GPT | CCGR1_ECSPI1 | + CCGR1_ECSPI2 | CCGR1_ECSPI3 | CCGR1_ECSPI4 | CCGR1_ECSPI5; WR4(sc, CCM_CCGR1, reg); /* ipmux & ipsync (bridges), iomux, i2c */ @@ -349,6 +350,13 @@ imx6_ccm_sata_enable(void) WR4(ccm_sc, CCM_ANALOG_PLL_ENET, v); return 0; +} + +uint32_t +imx_ccm_ecspi_hz(void) +{ + + return (60000000); } uint32_t Modified: stable/11/sys/arm/freescale/imx/imx6_ccmreg.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/imx/imx6_ccmreg.h Sat Mar 24 23:23:31 2018 (r331506) @@ -80,9 +80,15 @@ #define CCGR0_AIPS_TZ2 (0x3 << 2) #define CCGR0_ABPHDMA (0x3 << 4) #define CCM_CCGR1 0x06C +#define CCGR1_ECSPI1 (0x3 << 0) +#define CCGR1_ECSPI2 (0x3 << 2) +#define CCGR1_ECSPI3 (0x3 << 4) +#define CCGR1_ECSPI4 (0x3 << 6) +#define CCGR1_ECSPI5 (0x3 << 8) #define CCGR1_ENET (0x3 << 10) #define CCGR1_EPIT1 (0x3 << 12) #define CCGR1_EPIT2 (0x3 << 14) +#define CCGR1_ESAI (0x3 << 16) #define CCGR1_GPT (0x3 << 20) #define CCGR1_GPT_SERIAL (0x3 << 22) #define CCM_CCGR2 0x070 Modified: stable/11/sys/arm/freescale/imx/imx_ccmvar.h ============================================================================== --- stable/11/sys/arm/freescale/imx/imx_ccmvar.h Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/imx/imx_ccmvar.h Sat Mar 24 23:23:31 2018 (r331506) @@ -43,6 +43,7 @@ * board setup code has to handle those things. */ +uint32_t imx_ccm_ecspi_hz(void); uint32_t imx_ccm_ipg_hz(void); uint32_t imx_ccm_perclk_hz(void); uint32_t imx_ccm_sdhci_hz(void); Copied: stable/11/sys/arm/freescale/imx/imx_spi.c (from r329999, head/sys/arm/freescale/imx/imx_spi.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/arm/freescale/imx/imx_spi.c Sat Mar 24 23:23:31 2018 (r331506, copy of r329999, head/sys/arm/freescale/imx/imx_spi.c) @@ -0,0 +1,604 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Ian Lepore + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for imx Enhanced Configurable SPI; master-mode only. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include "spibus_if.h" + +#define ECSPI_RXDATA 0x00 +#define ECSPI_TXDATA 0x04 +#define ECSPI_CTLREG 0x08 +#define CTLREG_BLEN_SHIFT 20 +#define CTLREG_BLEN_MASK 0x0fff +#define CTLREG_CSEL_SHIFT 18 +#define CTLREG_CSEL_MASK 0x03 +#define CTLREG_DRCTL_SHIFT 16 +#define CTLREG_DRCTL_MASK 0x03 +#define CTLREG_PREDIV_SHIFT 12 +#define CTLREG_PREDIV_MASK 0x0f +#define CTLREG_POSTDIV_SHIFT 8 +#define CTLREG_POSTDIV_MASK 0x0f +#define CTLREG_CMODE_SHIFT 4 +#define CTLREG_CMODE_MASK 0x0f +#define CTLREG_CMODES_MASTER (CTLREG_CMODE_MASK << CTLREG_CMODE_SHIFT) +#define CTLREG_SMC (1u << 3) +#define CTLREG_XCH (1u << 2) +#define CTLREG_HT (1u << 1) +#define CTLREG_EN (1u << 0) +#define ECSPI_CFGREG 0x0c +#define CFGREG_HTLEN_SHIFT 24 +#define CFGREG_SCLKCTL_SHIFT 20 +#define CFGREG_DATACTL_SHIFT 16 +#define CFGREG_SSPOL_SHIFT 12 +#define CFGREG_SSCTL_SHIFT 8 +#define CFGREG_SCLKPOL_SHIFT 4 +#define CFGREG_SCLKPHA_SHIFT 0 +#define CFGREG_MASK 0x0f /* all CFGREG fields are 4 bits */ +#define ECSPI_INTREG 0x10 +#define INTREG_TCEN (1u << 7) +#define INTREG_ROEN (1u << 6) +#define INTREG_RFEN (1u << 5) +#define INTREG_RDREN (1u << 4) +#define INTREG_RREN (1u << 3) +#define INTREG_TFEN (1u << 2) +#define INTREG_TDREN (1u << 1) +#define INTREG_TEEN (1u << 0) +#define ECSPI_DMAREG 0x14 +#define DMA_RX_THRESH_SHIFT 16 +#define DMA_RX_THRESH_MASK 0x3f +#define DMA_TX_THRESH_SHIFT 0 +#define DMA_TX_THRESH_MASK 0x3f +#define ECSPI_STATREG 0x18 +#define SREG_TC (1u << 7) +#define SREG_RO (1u << 6) +#define SREG_RF (1u << 5) +#define SREG_RDR (1u << 4) +#define SREG_RR (1u << 3) +#define SREG_TF (1u << 2) +#define SREG_TDR (1u << 1) +#define SREG_TE (1u << 0) +#define ECSPI_PERIODREG 0x1c +#define ECSPI_TESTREG 0x20 + +#define CS_MAX 4 /* Max number of chip selects. */ +#define CS_MASK 0x03 /* Mask flag bits out of chipsel. */ + +#define FIFO_SIZE 64 +#define FIFO_RXTHRESH 32 +#define FIFO_TXTHRESH 32 + +struct spi_softc { + device_t dev; + device_t spibus; + struct mtx mtx; + struct resource *memres; + struct resource *intres; + void *inthandle; + gpio_pin_t cspins[CS_MAX]; + u_int debug; + u_int basefreq; + uint32_t ctlreg; + uint32_t intreg; + uint32_t fifocnt; + uint8_t *rxbuf; + uint32_t rxidx; + uint32_t rxlen; + uint8_t *txbuf; + uint32_t txidx; + uint32_t txlen; +}; + +static struct ofw_compat_data compat_data[] = { + {"fsl,imx51-ecspi", true}, + {"fsl,imx53-ecspi", true}, + {"fsl,imx6dl-ecspi", true}, + {"fsl,imx6q-ecspi", true}, + {"fsl,imx6sx-ecspi", true}, + {"fsl,imx6ul-ecspi", true}, + {NULL, false} +}; + +static inline uint32_t +RD4(struct spi_softc *sc, bus_size_t offset) +{ + + return (bus_read_4(sc->memres, offset)); +} + +static inline void +WR4(struct spi_softc *sc, bus_size_t offset, uint32_t value) +{ + + bus_write_4(sc->memres, offset, value); +} + +static u_int +spi_calc_clockdiv(struct spi_softc *sc, u_int busfreq) +{ + u_int post, pre; + + /* Returning 0 effectively sets both dividers to 1. */ + if (sc->basefreq <= busfreq) + return (0); + + /* + * Brute-force this; all real-world bus speeds are going to be found on + * the 1st or 2nd time through this loop. + */ + for (post = 0; post < 16; ++post) { + pre = ((sc->basefreq >> post) / busfreq) - 1; + if (pre < 16) + break; + } + if (post == 16) { + /* The lowest we can go is ~115 Hz. */ + pre = 15; + post = 15; + } + + if (sc->debug >= 2) { + device_printf(sc->dev, + "base %u bus %u; pre %u, post %u; actual busfreq %u\n", + sc->basefreq, busfreq, pre, post, + (sc->basefreq / (pre + 1)) / (1 << post)); + } + + return (pre << CTLREG_PREDIV_SHIFT) | (post << CTLREG_POSTDIV_SHIFT); +} + +static void +spi_set_chipsel(struct spi_softc *sc, u_int cs, bool active) +{ + bool pinactive; + + /* + * This is kinda crazy... the gpio pins for chipsel are defined as + * active-high in the dts, but are supposed to be treated as active-low + * by this driver. So to turn on chipsel we have to invert the value + * passed to gpio_pin_set_active(). Then, to make it more fun, any + * slave can say its chipsel is active-high, so if that option is + * on, we have to invert the value again. + */ + pinactive = !active ^ (bool)(cs & SPIBUS_CS_HIGH); + + if (sc->debug >= 2) { + device_printf(sc->dev, "chipsel %u changed to %u\n", + (cs & ~SPIBUS_CS_HIGH), pinactive); + } + + /* + * Change the pin, then do a dummy read of its current state to ensure + * that the state change reaches the hardware before proceeding. + */ + gpio_pin_set_active(sc->cspins[cs & ~SPIBUS_CS_HIGH], pinactive); + gpio_pin_is_active(sc->cspins[cs & ~SPIBUS_CS_HIGH], &pinactive); +} + +static void +spi_hw_setup(struct spi_softc *sc, u_int cs, u_int mode, u_int freq) +{ + uint32_t reg; + + /* + * Set up control register, and write it first to bring the device out + * of reset. + */ + sc->ctlreg = CTLREG_EN | CTLREG_CMODES_MASTER | CTLREG_SMC; + sc->ctlreg |= spi_calc_clockdiv(sc, freq); + sc->ctlreg |= 7 << CTLREG_BLEN_SHIFT; /* XXX byte at a time */ + WR4(sc, ECSPI_CTLREG, sc->ctlreg); + + /* + * Set up the config register. Note that we do all transfers with the + * SPI hardware's chip-select set to zero. The actual chip select is + * handled with a gpio pin. + */ + reg = 0; + if (cs & SPIBUS_CS_HIGH) + reg |= 1u << CFGREG_SSPOL_SHIFT; + if (mode & SPIBUS_MODE_CPHA) + reg |= 1u << CFGREG_SCLKPHA_SHIFT; + if (mode & SPIBUS_MODE_CPOL) { + reg |= 1u << CFGREG_SCLKPOL_SHIFT; + reg |= 1u << CFGREG_SCLKCTL_SHIFT; + } + WR4(sc, ECSPI_CFGREG, reg); + + /* + * Set up the rx/tx FIFO interrupt thresholds. + */ + reg = (FIFO_RXTHRESH << DMA_RX_THRESH_SHIFT); + reg |= (FIFO_TXTHRESH << DMA_TX_THRESH_SHIFT); + WR4(sc, ECSPI_DMAREG, reg); + + /* + * Do a dummy read, to make sure the preceding writes reach the spi + * hardware before we assert any gpio chip select. + */ + (void)RD4(sc, ECSPI_CFGREG); +} + +static void +spi_empty_rxfifo(struct spi_softc *sc) +{ + + while (sc->rxidx < sc->rxlen && (RD4(sc, ECSPI_STATREG) & SREG_RR)) { + sc->rxbuf[sc->rxidx++] = (uint8_t)RD4(sc, ECSPI_RXDATA); + --sc->fifocnt; + } +} + +static void +spi_fill_txfifo(struct spi_softc *sc) +{ + + while (sc->txidx < sc->txlen && sc->fifocnt < FIFO_SIZE) { + WR4(sc, ECSPI_TXDATA, sc->txbuf[sc->txidx++]); + ++sc->fifocnt; + } + + /* + * If we're out of data, disable tx data ready (threshold) interrupts, + * and enable tx fifo empty interrupts. + */ + if (sc->txidx == sc->txlen) + sc->intreg = (sc->intreg & ~INTREG_TDREN) | INTREG_TEEN; +} + +static void +spi_intr(void *arg) +{ + struct spi_softc *sc = arg; + uint32_t intreg, status; + + mtx_lock(&sc->mtx); + + sc = arg; + intreg = sc->intreg; + status = RD4(sc, ECSPI_STATREG); + WR4(sc, ECSPI_STATREG, status); /* Clear w1c bits. */ + + /* + * If we get an overflow error, just signal that the transfer is done + * and wakeup the waiting thread, which will see that txidx != txlen and + * return an IO error to the caller. + */ + if (__predict_false(status & SREG_RO)) { + if (sc->debug || bootverbose) { + device_printf(sc->dev, "rxoverflow rxidx %u txidx %u\n", + sc->rxidx, sc->txidx); + } + sc->intreg = 0; + wakeup(sc); + mtx_unlock(&sc->mtx); + return; + } + + if (status & SREG_RR) + spi_empty_rxfifo(sc); + + if (status & SREG_TDR) + spi_fill_txfifo(sc); + + /* + * If we're out of bytes to send... + * - If Transfer Complete is set (shift register is empty) and we've + * received everything we expect, we're all done. + * - Else if Tx Fifo Empty is set, we need to stop waiting for that and + * switch to waiting for Transfer Complete (wait for shift register + * to empty out), and also for Receive Ready (last of incoming data). + */ + if (sc->txidx == sc->txlen) { + if ((status & SREG_TC) && sc->fifocnt == 0) { + sc->intreg = 0; + wakeup(sc); + } else if (status & SREG_TE) { + sc->intreg &= ~(sc->intreg & ~INTREG_TEEN); + sc->intreg |= INTREG_TCEN | INTREG_RREN; + } + } + + /* + * If interrupt flags changed, write the new flags to the hardware and + * do a dummy readback to ensure the changes reach the hardware before + * we exit the isr. + */ + if (sc->intreg != intreg) { + WR4(sc, ECSPI_INTREG, sc->intreg); + (void)RD4(sc, ECSPI_INTREG); + } + + if (sc->debug >= 3) { + device_printf(sc->dev, + "spi_intr, sreg 0x%08x intreg was 0x%08x now 0x%08x\n", + status, intreg, sc->intreg); + } + + mtx_unlock(&sc->mtx); +} + +static int +spi_xfer_buf(struct spi_softc *sc, void *rxbuf, void *txbuf, uint32_t len) +{ + int err; + + if (sc->debug >= 1) { + device_printf(sc->dev, + "spi_xfer_buf, rxbuf %p txbuf %p len %u\n", + rxbuf, txbuf, len); + } + + if (len == 0) + return (0); + + sc->rxbuf = rxbuf; + sc->rxlen = len; + sc->rxidx = 0; + sc->txbuf = txbuf; + sc->txlen = len; + sc->txidx = 0; + sc->intreg = INTREG_RDREN | INTREG_TDREN; + spi_fill_txfifo(sc); + + /* Enable interrupts last; spi_fill_txfifo() can change sc->intreg */ + WR4(sc, ECSPI_INTREG, sc->intreg); + + err = 0; + while (err == 0 && sc->intreg != 0) + err = msleep(sc, &sc->mtx, 0, "imxspi", 10 * hz); + + if (sc->rxidx != sc->rxlen || sc->txidx != sc->txlen) + err = EIO; + + return (err); +} + +static int +spi_transfer(device_t dev, device_t child, struct spi_command *cmd) +{ + struct spi_softc *sc = device_get_softc(dev); + uint32_t cs, mode, clock; + int err; + + spibus_get_cs(child, &cs); + spibus_get_clock(child, &clock); + spibus_get_mode(child, &mode); + + if (cs > CS_MAX || sc->cspins[cs] == NULL) { + if (sc->debug || bootverbose) + device_printf(sc->dev, "Invalid chip select %u\n", cs); + return (EINVAL); + } + + mtx_lock(&sc->mtx); + + if (sc->debug >= 1) { + device_printf(sc->dev, + "spi_transfer, cs 0x%x clock %u mode %u\n", + cs, clock, mode); + } + + /* Set up the hardware and select the device. */ + spi_hw_setup(sc, cs, mode, clock); + spi_set_chipsel(sc, cs, true); + + /* Transfer command then data bytes. */ + err = 0; + if (cmd->tx_cmd_sz > 0) + err = spi_xfer_buf(sc, cmd->rx_cmd, cmd->tx_cmd, + cmd->tx_cmd_sz); + if (cmd->tx_data_sz > 0 && err == 0) + err = spi_xfer_buf(sc, cmd->rx_data, cmd->tx_data, + cmd->tx_data_sz); + + /* Deselect the device, turn off (and reset) hardware. */ + spi_set_chipsel(sc, cs, false); + WR4(sc, ECSPI_CTLREG, 0); + + mtx_unlock(&sc->mtx); + + return (err); +} + +static phandle_t +spi_get_node(device_t bus, device_t dev) +{ + + /* + * Share our controller node with our spibus child; it instantiates + * devices by walking the children contained within our node. + */ + return ofw_bus_get_node(bus); +} + +static int +spi_detach(device_t dev) +{ + struct spi_softc *sc = device_get_softc(dev); + int idx; + + mtx_lock(&sc->mtx); + + bus_generic_detach(sc->dev); + if (sc->spibus != NULL) + device_delete_child(dev, sc->spibus); + + for (idx = 0; idx < nitems(sc->cspins); ++idx) { + if (sc->cspins[idx] != NULL) + gpio_pin_release(sc->cspins[idx]); + } + + if (sc->inthandle != NULL) + bus_teardown_intr(sc->dev, sc->intres, sc->inthandle); + if (sc->intres != NULL) + bus_release_resource(sc->dev, SYS_RES_IRQ, 0, sc->intres); + if (sc->memres != NULL) + bus_release_resource(sc->dev, SYS_RES_MEMORY, 0, sc->memres); + + mtx_unlock(&sc->mtx); + mtx_destroy(&sc->mtx); + + return (0); +} + +static int +spi_attach(device_t dev) +{ + struct spi_softc *sc = device_get_softc(dev); + phandle_t node; + int err, idx, rid; + + sc->dev = dev; + sc->basefreq = imx_ccm_ecspi_hz(); + + mtx_init(&sc->mtx, device_get_nameunit(dev), NULL, MTX_DEF); + + /* Set up debug-enable sysctl. */ + SYSCTL_ADD_INT(device_get_sysctl_ctx(sc->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), + OID_AUTO, "debug", CTLFLAG_RWTUN, &sc->debug, 0, + "Enable debug, higher values = more info"); + + /* Allocate mmio register access resources. */ + rid = 0; + sc->memres = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->memres == NULL) { + device_printf(sc->dev, "could not allocate registers\n"); + spi_detach(sc->dev); + return (ENXIO); + } + + /* Allocate interrupt resources and set up handler. */ + rid = 0; + sc->intres = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->intres == NULL) { + device_printf(sc->dev, "could not allocate interrupt\n"); + device_detach(sc->dev); + return (ENXIO); + } + err = bus_setup_intr(sc->dev, sc->intres, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, spi_intr, sc, &sc->inthandle); + if (err != 0) { + device_printf(sc->dev, "could not setup interrupt handler"); + device_detach(sc->dev); + return (ENXIO); + } + + /* Allocate gpio pins for configured chip selects. */ + node = ofw_bus_get_node(sc->dev); + for (err = 0, idx = 0; err == 0 && idx < nitems(sc->cspins); ++idx) { + err = gpio_pin_get_by_ofw_propidx(sc->dev, node, "cs-gpios", + idx, &sc->cspins[idx]); + if (err == 0) { + gpio_pin_setflags(sc->cspins[idx], GPIO_PIN_OUTPUT); + } else if (sc->debug >= 2) { + device_printf(sc->dev, + "cannot configure gpio for chip select %u\n", idx); + } + } + + /* + * Hardware init: put all channels into Master mode, turn off the enable + * bit (gates off clocks); we only enable the hardware while xfers run. + */ + WR4(sc, ECSPI_CTLREG, CTLREG_CMODES_MASTER); + + /* Attach the bus driver. */ + sc->spibus = device_add_child(dev, "spibus", -1); + return (bus_generic_attach(sc->dev)); +} + +static int +spi_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + + device_set_desc(dev, "i.MX ECSPI Master"); + return (BUS_PROBE_DEFAULT); +} + +static device_method_t spi_methods[] = { + DEVMETHOD(device_probe, spi_probe), + DEVMETHOD(device_attach, spi_attach), + DEVMETHOD(device_detach, spi_detach), + + /* spibus_if */ + DEVMETHOD(spibus_transfer, spi_transfer), + + /* ofw_bus_if */ + DEVMETHOD(ofw_bus_get_node, spi_get_node), + + DEVMETHOD_END +}; + +static driver_t spi_driver = { + "imx_spi", + spi_methods, + sizeof(struct spi_softc), +}; + +static devclass_t spi_devclass; + +DRIVER_MODULE(imx_spi, simplebus, spi_driver, spi_devclass, 0, 0); +DRIVER_MODULE(ofw_spibus, imx_spi, ofw_spibus_driver, ofw_spibus_devclass, 0, 0); +MODULE_DEPEND(imx_spi, ofw_spibus, 1, 1, 1); Modified: stable/11/sys/arm/freescale/vybrid/vf_spi.c ============================================================================== --- stable/11/sys/arm/freescale/vybrid/vf_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/freescale/vybrid/vf_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -263,6 +263,8 @@ spi_transfer(device_t dev, device_t child, struct spi_ /* get the proper chip select */ spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + /* Command */ spi_txrx(sc, cmd->tx_cmd, cmd->rx_cmd, cmd->tx_cmd_sz, cs); Modified: stable/11/sys/arm/lpc/lpc_spi.c ============================================================================== --- stable/11/sys/arm/lpc/lpc_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/lpc/lpc_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -149,6 +149,8 @@ lpc_spi_transfer(device_t dev, device_t child, struct spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + /* Set CS active */ lpc_gpio_set_state(child, cs, 0); Modified: stable/11/sys/arm/samsung/exynos/exynos5_spi.c ============================================================================== --- stable/11/sys/arm/samsung/exynos/exynos5_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/samsung/exynos/exynos5_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -204,6 +204,8 @@ spi_transfer(device_t dev, device_t child, struct spi_ /* get the proper chip select */ spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + /* Command */ spi_txrx(sc, cmd->tx_cmd, cmd->rx_cmd, cmd->tx_cmd_sz, cs); Modified: stable/11/sys/arm/ti/ti_spi.c ============================================================================== --- stable/11/sys/arm/ti/ti_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/arm/ti/ti_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -458,6 +458,9 @@ ti_spi_transfer(device_t dev, device_t child, struct s /* Get the proper chip select for this child. */ spibus_get_cs(child, &cs); + + cs &= ~SPIBUS_CS_HIGH; + if (cs > sc->sc_numcs) { device_printf(dev, "Invalid chip select %d requested by %s\n", cs, device_get_nameunit(child)); Modified: stable/11/sys/dev/flash/at45d.c ============================================================================== --- stable/11/sys/dev/flash/at45d.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/dev/flash/at45d.c Sat Mar 24 23:23:31 2018 (r331506) @@ -450,3 +450,4 @@ static driver_t at45d_driver = { }; DRIVER_MODULE(at45d, spibus, at45d_driver, at45d_devclass, NULL, NULL); +MODULE_DEPEND(at45d, spibus, 1, 1, 1); Modified: stable/11/sys/dev/flash/mx25l.c ============================================================================== --- stable/11/sys/dev/flash/mx25l.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/dev/flash/mx25l.c Sat Mar 24 23:23:31 2018 (r331506) @@ -89,8 +89,13 @@ struct mx25l_softc struct proc *sc_p; struct bio_queue_head sc_bio_queue; unsigned int sc_flags; + unsigned int sc_taskstate; }; +#define TSTATE_STOPPED 0 +#define TSTATE_STOPPING 1 +#define TSTATE_RUNNING 2 + #define M25PXX_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define M25PXX_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define M25PXX_LOCK_INIT(_sc) \ @@ -527,6 +532,8 @@ mx25l_attach(device_t dev) bioq_init(&sc->sc_bio_queue); kproc_create(&mx25l_task, sc, &sc->sc_p, 0, 0, "task: mx25l flash"); + sc->sc_taskstate = TSTATE_RUNNING; + device_printf(sc->sc_dev, "%s, sector %d bytes, %d sectors\n", ident->name, ident->sectorsize, ident->sectorcount); @@ -536,8 +543,33 @@ mx25l_attach(device_t dev) static int mx25l_detach(device_t dev) { + struct mx25l_softc *sc; + int err; - return (EIO); + sc = device_get_softc(dev); + err = 0; + + M25PXX_LOCK(sc); + if (sc->sc_taskstate == TSTATE_RUNNING) { + sc->sc_taskstate = TSTATE_STOPPING; + wakeup(sc); + while (err == 0 && sc->sc_taskstate != TSTATE_STOPPED) { + err = msleep(sc, &sc->sc_mtx, 0, "mx25dt", hz * 3); + if (err != 0) { + sc->sc_taskstate = TSTATE_RUNNING; + device_printf(dev, + "Failed to stop queue task\n"); + } + } + } + M25PXX_UNLOCK(sc); + + if (err == 0 && sc->sc_taskstate == TSTATE_STOPPED) { + disk_destroy(sc->sc_disk); + bioq_flush(&sc->sc_bio_queue, NULL, ENXIO); + M25PXX_LOCK_DESTROY(sc); + } + return (err); } static int @@ -605,9 +637,15 @@ mx25l_task(void *arg) dev = sc->sc_dev; M25PXX_LOCK(sc); do { + if (sc->sc_taskstate == TSTATE_STOPPING) { + sc->sc_taskstate = TSTATE_STOPPED; + M25PXX_UNLOCK(sc); + wakeup(sc); + kproc_exit(0); + } bp = bioq_first(&sc->sc_bio_queue); if (bp == NULL) - msleep(sc, &sc->sc_mtx, PRIBIO, "jobqueue", 0); + msleep(sc, &sc->sc_mtx, PRIBIO, "mx25jq", 0); } while (bp == NULL); bioq_remove(&sc->sc_bio_queue, bp); M25PXX_UNLOCK(sc); @@ -648,3 +686,4 @@ static driver_t mx25l_driver = { }; DRIVER_MODULE(mx25l, spibus, mx25l_driver, mx25l_devclass, 0, 0); +MODULE_DEPEND(mx25l, spibus, 1, 1, 1); Modified: stable/11/sys/dev/spibus/ofw_spibus.c ============================================================================== --- stable/11/sys/dev/spibus/ofw_spibus.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/dev/spibus/ofw_spibus.c Sat Mar 24 23:23:31 2018 (r331506) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-4-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2009, Nathan Whitehorn * Copyright (c) 2013 The FreeBSD Foundation @@ -82,6 +82,7 @@ ofw_spibus_attach(device_t dev) phandle_t child; pcell_t clock, paddr; device_t childdev; + uint32_t mode = SPIBUS_MODE_NONE; sc->dev = dev; @@ -105,6 +106,24 @@ ofw_spibus_attach(device_t dev) } /* + * Try to get the cpol/cpha mode + */ + if (OF_hasprop(child, "spi-cpol")) + mode = SPIBUS_MODE_CPOL; + if (OF_hasprop(child, "spi-cpha")) { + if (mode == SPIBUS_MODE_CPOL) + mode = SPIBUS_MODE_CPOL_CPHA; + else + mode = SPIBUS_MODE_CPHA; + } + + /* + * Try to get the CS polarity + */ + if (OF_hasprop(child, "spi-cs-high")) + paddr |= SPIBUS_CS_HIGH; + + /* * Get the maximum clock frequency for device, zero means * use the default bus speed. */ @@ -122,6 +141,7 @@ ofw_spibus_attach(device_t dev) continue; dinfo->opd_dinfo.cs = paddr; dinfo->opd_dinfo.clock = clock; + dinfo->opd_dinfo.mode = mode; if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != 0) { free(dinfo, M_DEVBUF); @@ -194,10 +214,10 @@ static device_method_t ofw_spibus_methods[] = { DEVMETHOD_END }; -static devclass_t ofwspibus_devclass; +devclass_t ofw_spibus_devclass; DEFINE_CLASS_1(spibus, ofw_spibus_driver, ofw_spibus_methods, sizeof(struct spibus_softc), spibus_driver); -DRIVER_MODULE(ofw_spibus, spi, ofw_spibus_driver, ofwspibus_devclass, 0, 0); +DRIVER_MODULE(ofw_spibus, spi, ofw_spibus_driver, ofw_spibus_devclass, 0, 0); MODULE_VERSION(ofw_spibus, 1); MODULE_DEPEND(ofw_spibus, spibus, 1, 1, 1); Modified: stable/11/sys/dev/spibus/spibusvar.h ============================================================================== --- stable/11/sys/dev/spibus/spibusvar.h Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/dev/spibus/spibusvar.h Sat Mar 24 23:23:31 2018 (r331506) @@ -46,6 +46,8 @@ struct spibus_ivar uint32_t clock; }; +#define SPIBUS_CS_HIGH (1U << 31) + enum { SPIBUS_IVAR_CS, /* chip select that we're on */ SPIBUS_IVAR_MODE, /* SPI mode (0-3) */ @@ -66,3 +68,5 @@ SPIBUS_ACCESSOR(clock, CLOCK, uint32_t) extern driver_t spibus_driver; extern devclass_t spibus_devclass; +extern driver_t ofw_spibus_driver; +extern devclass_t ofw_spibus_devclass; Modified: stable/11/sys/dev/xilinx/axi_quad_spi.c ============================================================================== --- stable/11/sys/dev/xilinx/axi_quad_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/dev/xilinx/axi_quad_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -193,6 +193,8 @@ spi_transfer(device_t dev, device_t child, struct spi_ /* get the proper chip select */ spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + /* Assert CS */ reg = READ4(sc, SPI_SSR); reg &= ~(1 << cs); Modified: stable/11/sys/mips/atheros/ar71xx_spi.c ============================================================================== --- stable/11/sys/mips/atheros/ar71xx_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/mips/atheros/ar71xx_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -214,6 +214,8 @@ ar71xx_spi_transfer(device_t dev, device_t child, stru spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + ar71xx_spi_chip_activate(sc, cs); KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz, Modified: stable/11/sys/mips/mediatek/mtk_spi_v1.c ============================================================================== --- stable/11/sys/mips/mediatek/mtk_spi_v1.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/mips/mediatek/mtk_spi_v1.c Sat Mar 24 23:23:31 2018 (r331506) @@ -231,6 +231,8 @@ mtk_spi_transfer(device_t dev, device_t child, struct spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + if (cs != 0) /* Only 1 CS */ return (ENXIO); Modified: stable/11/sys/mips/mediatek/mtk_spi_v2.c ============================================================================== --- stable/11/sys/mips/mediatek/mtk_spi_v2.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/mips/mediatek/mtk_spi_v2.c Sat Mar 24 23:23:31 2018 (r331506) @@ -236,6 +236,8 @@ mtk_spi_transfer(device_t dev, device_t child, struct spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + if (cs != 0) /* Only 1 CS */ return (ENXIO); Modified: stable/11/sys/mips/rt305x/rt305x_spi.c ============================================================================== --- stable/11/sys/mips/rt305x/rt305x_spi.c Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/mips/rt305x/rt305x_spi.c Sat Mar 24 23:23:31 2018 (r331506) @@ -226,6 +226,8 @@ rt305x_spi_transfer(device_t dev, device_t child, stru spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + if (cs != 0) /* Only 1 CS */ return (ENXIO); Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Sat Mar 24 23:07:10 2018 (r331505) +++ stable/11/sys/modules/Makefile Sat Mar 24 23:23:31 2018 (r331506) @@ -360,7 +360,7 @@ SUBDIR= \ snp \ sound \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Sat Mar 24 23:26:55 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37F8DF55BC1; Sat, 24 Mar 2018 23:26:55 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE67A85BD2; Sat, 24 Mar 2018 23:26:54 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8BB615FF1; Sat, 24 Mar 2018 23:26:54 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2ONQsGT036431; Sat, 24 Mar 2018 23:26:54 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2ONQsC1036430; Sat, 24 Mar 2018 23:26:54 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803242326.w2ONQsC1036430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 24 Mar 2018 23:26:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331507 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 331507 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, 24 Mar 2018 23:26:55 -0000 Author: ian Date: Sat Mar 24 23:26:54 2018 New Revision: 331507 URL: https://svnweb.freebsd.org/changeset/base/331507 Log: MFC r330361: Correct a misplaced closing paren. Does not affect the result, but does clarify (at least for me) that the multiplication happens before the shift. Modified: stable/11/sys/sys/time.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/time.h ============================================================================== --- stable/11/sys/sys/time.h Sat Mar 24 23:23:31 2018 (r331506) +++ stable/11/sys/sys/time.h Sat Mar 24 23:26:54 2018 (r331507) @@ -173,7 +173,7 @@ static __inline sbintime_t nstosbt(int64_t _ns) { - return ((_ns * (((uint64_t)1 << 63) / 500000000) >> 32)); + return ((_ns * (((uint64_t)1 << 63) / 500000000)) >> 32); } static __inline int64_t @@ -187,7 +187,7 @@ static __inline sbintime_t ustosbt(int64_t _us) { - return ((_us * (((uint64_t)1 << 63) / 500000) >> 32)); + return ((_us * (((uint64_t)1 << 63) / 500000)) >> 32); } static __inline int64_t @@ -201,7 +201,7 @@ static __inline sbintime_t mstosbt(int64_t _ms) { - return ((_ms * (((uint64_t)1 << 63) / 500) >> 32)); + return ((_ms * (((uint64_t)1 << 63) / 500)) >> 32); } /*-