From owner-svn-src-stable@freebsd.org Sun Jan 21 10:35:18 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55513EC5200; Sun, 21 Jan 2018 10:35:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2FCD920FF; Sun, 21 Jan 2018 10:35:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65FEC24CC; Sun, 21 Jan 2018 10:35:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0LAZHJD054712; Sun, 21 Jan 2018 10:35:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LAZHo8054711; Sun, 21 Jan 2018 10:35:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801211035.w0LAZHo8054711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 21 Jan 2018 10:35:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328213 - stable/11/sys/dev/cpuctl X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/dev/cpuctl X-SVN-Commit-Revision: 328213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 21 Jan 2018 10:35:18 -0000 Author: kib Date: Sun Jan 21 10:35:17 2018 New Revision: 328213 URL: https://svnweb.freebsd.org/changeset/base/328213 Log: MFC r327963: When re-evaluating cpu_features, also re-print CPU identification. Modified: stable/11/sys/dev/cpuctl/cpuctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/11/sys/dev/cpuctl/cpuctl.c Sun Jan 21 08:48:26 2018 (r328212) +++ stable/11/sys/dev/cpuctl/cpuctl.c Sun Jan 21 10:35:17 2018 (r328213) @@ -526,6 +526,7 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td identify_cpu1(); identify_cpu2(); restore_cpu(oldcpu, is_bound, td); + printcpuinfo(); return (0); } From owner-svn-src-stable@freebsd.org Sun Jan 21 10:38:40 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E7E2EC529C; Sun, 21 Jan 2018 10:38:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA3F1222D; Sun, 21 Jan 2018 10:38:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11EC124CE; Sun, 21 Jan 2018 10:38:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0LAccHC054881; Sun, 21 Jan 2018 10:38:38 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LAcce9054878; Sun, 21 Jan 2018 10:38:38 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801211038.w0LAcce9054878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 21 Jan 2018 10:38:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328214 - in stable/11/sys/x86: include x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys/x86: include x86 X-SVN-Commit-Revision: 328214 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 21 Jan 2018 10:38:40 -0000 Author: kib Date: Sun Jan 21 10:38:38 2018 New Revision: 328214 URL: https://svnweb.freebsd.org/changeset/base/328214 Log: MFC r323822 (by cem): x86: Decode AMD "Extended Feature Extensions ID EBX" bits. Modified: stable/11/sys/x86/include/specialreg.h stable/11/sys/x86/include/x86_var.h stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/include/specialreg.h ============================================================================== --- stable/11/sys/x86/include/specialreg.h Sun Jan 21 10:35:17 2018 (r328213) +++ stable/11/sys/x86/include/specialreg.h Sun Jan 21 10:38:38 2018 (r328214) @@ -323,6 +323,13 @@ #define AMDPM_CPB 0x00000200 /* + * AMD extended function 8000_0008h ebx info (amd_extended_feature_extensions) + */ +#define AMDFEID_CLZERO 0x00000001 +#define AMDFEID_IRPERF 0x00000002 +#define AMDFEID_XSAVEERPTR 0x00000004 + +/* * AMD extended function 8000_0008h ecx info */ #define AMDID_CMP_CORES 0x000000ff Modified: stable/11/sys/x86/include/x86_var.h ============================================================================== --- stable/11/sys/x86/include/x86_var.h Sun Jan 21 10:35:17 2018 (r328213) +++ stable/11/sys/x86/include/x86_var.h Sun Jan 21 10:38:38 2018 (r328214) @@ -45,6 +45,7 @@ extern u_int cpu_feature2; extern u_int amd_feature; extern u_int amd_feature2; extern u_int amd_pminfo; +extern u_int amd_extended_feature_extensions; extern u_int via_feature_rng; extern u_int via_feature_xcrypt; extern u_int cpu_clflush_line_size; Modified: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Sun Jan 21 10:35:17 2018 (r328213) +++ stable/11/sys/x86/x86/identcpu.c Sun Jan 21 10:38:38 2018 (r328214) @@ -92,6 +92,7 @@ u_int cpu_feature2; /* Feature flags */ u_int amd_feature; /* AMD feature flags */ u_int amd_feature2; /* AMD feature flags */ u_int amd_pminfo; /* AMD advanced power management info */ +u_int amd_extended_feature_extensions; u_int via_feature_rng; /* VIA RNG features */ u_int via_feature_xcrypt; /* VIA ACE features */ u_int cpu_high; /* Highest arg to CPUID */ @@ -992,6 +993,16 @@ printcpuinfo(void) } } + if (amd_extended_feature_extensions != 0) { + printf("\n " + "AMD Extended Feature Extensions ID EBX=" + "0x%b", amd_extended_feature_extensions, + "\020" + "\001CLZERO" + "\002IRPerf" + "\003XSaveErPtr"); + } + if (via_feature_rng != 0 || via_feature_xcrypt != 0) print_via_padlock_info(); @@ -1473,6 +1484,7 @@ finishidentcpu(void) if (cpu_exthigh >= 0x80000008) { do_cpuid(0x80000008, regs); cpu_maxphyaddr = regs[0] & 0xff; + amd_extended_feature_extensions = regs[1]; cpu_procinfo2 = regs[2]; } else { cpu_maxphyaddr = (cpu_feature & CPUID_PAE) != 0 ? 36 : 32; From owner-svn-src-stable@freebsd.org Sun Jan 21 10:43:02 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8855EC5500; Sun, 21 Jan 2018 10:43:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 836A127F5; Sun, 21 Jan 2018 10:43:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C49D82661; Sun, 21 Jan 2018 10:43:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0LAh1rT058760; Sun, 21 Jan 2018 10:43:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LAh12u058759; Sun, 21 Jan 2018 10:43:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801211043.w0LAh12u058759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 21 Jan 2018 10:43:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328216 - stable/11/sys/amd64/include X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/include X-SVN-Commit-Revision: 328216 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 21 Jan 2018 10:43:02 -0000 Author: kib Date: Sun Jan 21 10:43:01 2018 New Revision: 328216 URL: https://svnweb.freebsd.org/changeset/base/328216 Log: MFC r327965: Add STAC and CLAC instructions wrappers. Modified: stable/11/sys/amd64/include/cpufunc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/include/cpufunc.h ============================================================================== --- stable/11/sys/amd64/include/cpufunc.h Sun Jan 21 10:39:57 2018 (r328215) +++ stable/11/sys/amd64/include/cpufunc.h Sun Jan 21 10:43:01 2018 (r328216) @@ -862,6 +862,20 @@ intr_restore(register_t rflags) write_rflags(rflags); } +static __inline void +stac(void) +{ + + __asm __volatile("stac" : : : "cc"); +} + +static __inline void +clac(void) +{ + + __asm __volatile("clac" : : : "cc"); +} + #else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ int breakpoint(void); From owner-svn-src-stable@freebsd.org Sun Jan 21 10:39:58 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6718DEC5317; Sun, 21 Jan 2018 10:39:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 41D072475; Sun, 21 Jan 2018 10:39:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9609F24CF; Sun, 21 Jan 2018 10:39:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0LAdvM6054978; Sun, 21 Jan 2018 10:39:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0LAdvhc054975; Sun, 21 Jan 2018 10:39:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801211039.w0LAdvhc054975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 21 Jan 2018 10:39:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328215 - in stable/11/sys/x86: include x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys/x86: include x86 X-SVN-Commit-Revision: 328215 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 21 Jan 2018 10:39:58 -0000 Author: kib Date: Sun Jan 21 10:39:57 2018 New Revision: 328215 URL: https://svnweb.freebsd.org/changeset/base/328215 Log: MFC r327964: Enumerate and print Intel CPU features for Speculative Execution Side Channel Mitigations. Modified: stable/11/sys/x86/include/specialreg.h stable/11/sys/x86/include/x86_var.h stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/include/specialreg.h ============================================================================== --- stable/11/sys/x86/include/specialreg.h Sun Jan 21 10:38:38 2018 (r328214) +++ stable/11/sys/x86/include/specialreg.h Sun Jan 21 10:39:57 2018 (r328215) @@ -383,6 +383,17 @@ #define CPUID_STDEXT2_SGXLC 0x40000000 /* + * CPUID instruction 7 Structured Extended Features, leaf 0 edx info + */ +#define CPUID_STDEXT3_IBPB 0x04000000 +#define CPUID_STDEXT3_STIBP 0x08000000 +#define CPUID_STDEXT3_ARCH_CAP 0x20000000 + +/* MSR IA32_ARCH_CAP(ABILITIES) bits */ +#define IA32_ARCH_CAP_RDCL_NO 0x00000001 +#define IA32_ARCH_CAP_IBRS_ALL 0x00000002 + +/* * CPUID manufacturers identifiers */ #define AMD_VENDOR_ID "AuthenticAMD" @@ -410,6 +421,8 @@ #define MSR_EBL_CR_POWERON 0x02a #define MSR_TEST_CTL 0x033 #define MSR_IA32_FEATURE_CONTROL 0x03a +#define MSR_IA32_SPEC_CTRL 0x048 +#define MSR_IA32_PRED_CMD 0x049 #define MSR_BIOS_UPDT_TRIG 0x079 #define MSR_BBL_CR_D0 0x088 #define MSR_BBL_CR_D1 0x089 @@ -422,6 +435,7 @@ #define MSR_APERF 0x0e8 #define MSR_IA32_EXT_CONFIG 0x0ee /* Undocumented. Core Solo/Duo only */ #define MSR_MTRRcap 0x0fe +#define MSR_IA32_ARCH_CAP 0x10a #define MSR_BBL_CR_ADDR 0x116 #define MSR_BBL_CR_DECC 0x118 #define MSR_BBL_CR_CTL 0x119 @@ -563,6 +577,13 @@ #define IA32_MISC_EN_LIMCPUID 0x0000000000400000ULL #define IA32_MISC_EN_xTPRD 0x0000000000800000ULL #define IA32_MISC_EN_XDD 0x0000000400000000ULL + +/* MSR IA32_SPEC_CTRL */ +#define IA32_SPEC_CTRL_IBRS 0x0000000000000001ULL +#define IA32_SPEC_CTRL_STIBP 0x0000000000000002ULL + +/* MSR IA32_PRED_CMD */ +#define IA32_PRED_CMD_IBPB_BARRIER 0x0000000000000001ULL /* * PAT modes. Modified: stable/11/sys/x86/include/x86_var.h ============================================================================== --- stable/11/sys/x86/include/x86_var.h Sun Jan 21 10:38:38 2018 (r328214) +++ stable/11/sys/x86/include/x86_var.h Sun Jan 21 10:39:57 2018 (r328215) @@ -51,6 +51,8 @@ extern u_int via_feature_xcrypt; extern u_int cpu_clflush_line_size; extern u_int cpu_stdext_feature; extern u_int cpu_stdext_feature2; +extern u_int cpu_stdext_feature3; +extern uint64_t cpu_ia32_arch_caps; extern u_int cpu_fxsr; extern u_int cpu_high; extern u_int cpu_id; Modified: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Sun Jan 21 10:38:38 2018 (r328214) +++ stable/11/sys/x86/x86/identcpu.c Sun Jan 21 10:39:57 2018 (r328215) @@ -105,8 +105,10 @@ u_int cpu_vendor_id; /* CPU vendor ID */ u_int cpu_fxsr; /* SSE enabled */ u_int cpu_mxcsr_mask; /* Valid bits in mxcsr */ u_int cpu_clflush_line_size = 32; -u_int cpu_stdext_feature; -u_int cpu_stdext_feature2; +u_int cpu_stdext_feature; /* %ebx */ +u_int cpu_stdext_feature2; /* %ecx */ +u_int cpu_stdext_feature3; /* %edx */ +uint64_t cpu_ia32_arch_caps; u_int cpu_max_ext_state_size; u_int cpu_mon_mwait_flags; /* MONITOR/MWAIT flags (CPUID.05H.ECX) */ u_int cpu_mon_min_size; /* MONITOR minimum range size, bytes */ @@ -980,6 +982,16 @@ printcpuinfo(void) ); } + if (cpu_stdext_feature3 != 0) { + printf("\n Structured Extended Features3=0x%b", + cpu_stdext_feature3, + "\020" + "\033IBPB" + "\034STIBP" + "\036ARCH_CAP" + ); + } + if ((cpu_feature2 & CPUID2_XSAVE) != 0) { cpuid_count(0xd, 0x1, regs); if (regs[0] != 0) { @@ -993,6 +1005,15 @@ printcpuinfo(void) } } + if (cpu_ia32_arch_caps != 0) { + printf("\n IA32_ARCH_CAPS=0x%b", + (u_int)cpu_ia32_arch_caps, + "\020" + "\001RDCL_NO" + "\002IBRS_ALL" + ); + } + if (amd_extended_feature_extensions != 0) { printf("\n " "AMD Extended Feature Extensions ID EBX=" @@ -1423,6 +1444,10 @@ identify_cpu2(void) cpu_stdext_feature &= ~cpu_stdext_disable; cpu_stdext_feature2 = regs[2]; + cpu_stdext_feature3 = regs[3]; + + if ((cpu_stdext_feature3 & CPUID_STDEXT3_ARCH_CAP) != 0) + cpu_ia32_arch_caps = rdmsr(MSR_IA32_ARCH_CAP); } } From owner-svn-src-stable@freebsd.org Mon Jan 22 00:19:51 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFE85EC3D38; Mon, 22 Jan 2018 00:19:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A3D182FAC; Mon, 22 Jan 2018 00:19:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B78D012CFF; Mon, 22 Jan 2018 00:19:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0M0Jolw020828; Mon, 22 Jan 2018 00:19:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M0JoaO020827; Mon, 22 Jan 2018 00:19:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801220019.w0M0JoaO020827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Jan 2018 00:19:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328235 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 328235 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 22 Jan 2018 00:19:51 -0000 Author: mav Date: Mon Jan 22 00:19:50 2018 New Revision: 328235 URL: https://svnweb.freebsd.org/changeset/base/328235 Log: MFC r322245: MFV r322242: 8373 TXG_WAIT in ZIL commit path illumos/illumos-gate@d28671a3b094af696bea87f52272d4c4d89321c7 https://github.com/illumos/illumos-gate/commit/d28671a3b094af696bea87f52272d4c4d89321c7 https://www.illumos.org/issues/8373 The code that writes ZIL blocks uses dmu_tx_assign(TXG_WAIT) to assign a transaction to a transaction group. That seems to be logically incorrect as writing of the ZIL block does not introduce any new dirty data. Also, when there is a lot of dirty data, the call can introduce significant delays into the ZIL commit path, thus affecting all synchronous writes. Additionally, ARC throttling may affect the ZIL writing. Reviewed by: Matthew Ahrens Reviewed by: Prakash Surya Approved by: Dan McDonald Author: Andriy Gapon Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Mon Jan 22 00:01:36 2018 (r328234) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Mon Jan 22 00:19:50 2018 (r328235) @@ -1227,7 +1227,24 @@ zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) */ tx = dmu_tx_create(zilog->zl_os); - VERIFY(dmu_tx_assign(tx, TXG_WAIT) == 0); + + /* + * Since we are not going to create any new dirty data and we can even + * help with clearing the existing dirty data, we should not be subject + * to the dirty data based delays. + * We (ab)use TXG_WAITED to bypass the delay mechanism. + * One side effect from using TXG_WAITED is that dmu_tx_assign() can + * fail if the pool is suspended. Those are dramatic circumstances, + * so we return NULL to signal that the normal ZIL processing is not + * possible and txg_wait_synced() should be used to ensure that the data + * is on disk. + */ + error = dmu_tx_assign(tx, TXG_WAITED); + if (error != 0) { + ASSERT3S(error, ==, EIO); + dmu_tx_abort(tx); + return (NULL); + } dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx); txg = dmu_tx_get_txg(tx); From owner-svn-src-stable@freebsd.org Mon Jan 22 04:15:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BBCDECCA9C; Mon, 22 Jan 2018 04:15:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DDD969A07; Mon, 22 Jan 2018 04:15:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4397D153CD; Mon, 22 Jan 2018 04:15:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0M4FD68020871; Mon, 22 Jan 2018 04:15:13 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0M4FDg5020870; Mon, 22 Jan 2018 04:15:13 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801220415.w0M4FDg5020870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 22 Jan 2018 04:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328244 - stable/11/usr.bin/units X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/units X-SVN-Commit-Revision: 328244 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 22 Jan 2018 04:15:14 -0000 Author: eadler Date: Mon Jan 22 04:15:12 2018 New Revision: 328244 URL: https://svnweb.freebsd.org/changeset/base/328244 Log: MFC r328008: units(1) free savescr in error condition too CID: 978392 Modified: stable/11/usr.bin/units/units.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/units/units.c ============================================================================== --- stable/11/usr.bin/units/units.c Mon Jan 22 03:38:10 2018 (r328243) +++ stable/11/usr.bin/units/units.c Mon Jan 22 04:15:12 2018 (r328244) @@ -352,6 +352,7 @@ addunit(struct unittype * theunit, const char *toadd, num = atof(item); if (!num) { zeroerror(); + free(savescr); return 1; } if (doingtop ^ flip) { @@ -364,6 +365,7 @@ addunit(struct unittype * theunit, const char *toadd, num = atof(divider + 1); if (!num) { zeroerror(); + free(savescr); return 1; } if (doingtop ^ flip) { @@ -378,6 +380,7 @@ addunit(struct unittype * theunit, const char *toadd, num = atof(item); if (!num) { zeroerror(); + free(savescr); return 1; } if (doingtop ^ flip) { @@ -399,9 +402,12 @@ addunit(struct unittype * theunit, const char *toadd, repeat = item[strlen(item) - 1] - '0'; item[strlen(item) - 1] = 0; } - for (; repeat; repeat--) - if (addsubunit(doingtop ^ flip ? theunit->numerator : theunit->denominator, item)) + for (; repeat; repeat--) { + if (addsubunit(doingtop ^ flip ? theunit->numerator : theunit->denominator, item)) { + free(savescr); return 1; + } + } } item = strtok(NULL, " *\t/\n"); } From owner-svn-src-stable@freebsd.org Tue Jan 23 02:16:07 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D74C2EC3137; Tue, 23 Jan 2018 02:16:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B350B7B8DC; Tue, 23 Jan 2018 02:16:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0851022B76; Tue, 23 Jan 2018 02:16:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0N2G6vH077538; Tue, 23 Jan 2018 02:16:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N2G6Yb077537; Tue, 23 Jan 2018 02:16:06 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801230216.w0N2G6Yb077537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 23 Jan 2018 02:16:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328267 - stable/10/sys/dev/nand X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/dev/nand X-SVN-Commit-Revision: 328267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 23 Jan 2018 02:16:08 -0000 Author: emaste Date: Tue Jan 23 02:16:06 2018 New Revision: 328267 URL: https://svnweb.freebsd.org/changeset/base/328267 Log: MFC r317806 by glebius: The nandsim(4) simulator driver doesn't have any protection against races at least in its ioctl handler, and at the same time it creates device entry with 0666 permissions. To plug possible issues in it: - Mark it as needing Giant. - Switch device mode to 0600. Submitted by: C Turt Reviewed by: imp Security: Possible double free in ioctl handler Modified: stable/10/sys/dev/nand/nandsim.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/nand/nandsim.c ============================================================================== --- stable/10/sys/dev/nand/nandsim.c Mon Jan 22 21:45:54 2018 (r328266) +++ stable/10/sys/dev/nand/nandsim.c Tue Jan 23 02:16:06 2018 (r328267) @@ -71,6 +71,7 @@ static struct nandsim_chip *get_nandsim_chip(uint8_t, static struct cdevsw nandsim_cdevsw = { .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = nandsim_ioctl, .d_name = "nandsim", }; @@ -639,7 +640,7 @@ nandsim_modevent(module_t mod __unused, int type, void switch (type) { case MOD_LOAD: nandsim_dev = make_dev(&nandsim_cdevsw, 0, - UID_ROOT, GID_WHEEL, 0666, "nandsim.ioctl"); + UID_ROOT, GID_WHEEL, 0600, "nandsim.ioctl"); break; case MOD_UNLOAD: for (i = 0; i < MAX_SIM_DEV; i++) { From owner-svn-src-stable@freebsd.org Tue Jan 23 02:29:41 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60A69EC4A4E; Tue, 23 Jan 2018 02:29:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3BAD17C63C; Tue, 23 Jan 2018 02:29:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63CEB22DA0; Tue, 23 Jan 2018 02:29:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0N2Tefe081673; Tue, 23 Jan 2018 02:29:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N2TeGI081670; Tue, 23 Jan 2018 02:29:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801230229.w0N2TeGI081670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 23 Jan 2018 02:29:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328268 - in stable/10/sys/dev: hpt27xx hptnr hptrr X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/10/sys/dev: hpt27xx hptnr hptrr X-SVN-Commit-Revision: 328268 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 23 Jan 2018 02:29:41 -0000 Author: emaste Date: Tue Jan 23 02:29:39 2018 New Revision: 328268 URL: https://svnweb.freebsd.org/changeset/base/328268 Log: MFC r327497, r327498: fix memory disclosure in hpt* ioctls r327497: hpt27xx: plug info leak in hpt_ioctl The hpt27xx ioctl handler allocates a buffer without M_ZERO and calls hpt_do_ioctl(), which might not overwrite the entire buffer. Also zero bytesReturned in case it is not written by hpt_do_ioctl(). The hpt27xx device has permissions only for root so this is not urgent, and the fix can be MFCd and considered for a future EN. Reported by: Ilja van Sprundel Submitted by: Domagoj Stolfa (M_ZERO) r327498: hpt{nr,rr}: plug info leak in hpt_ioctl The hpt{nr,rr} ioctl handler allocates a buffer without M_ZERO and calls hpt_do_ioctl(), which might not overwrite the entire buffer. Also zero bytesReturned in case it is not written by hpt_do_ioctl(). The hpt27{nr,rr} device has permissions only for root so this is not urgent, and the fix can be MFCd and considered for a future EN. The same issue was reported in the hpt27xx driver by Ilja Van Sprundel. Security: memory disclosure in root-only ioctls Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/dev/hpt27xx/hpt27xx_osm_bsd.c stable/10/sys/dev/hptnr/hptnr_osm_bsd.c stable/10/sys/dev/hptrr/hptrr_osm_bsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hpt27xx/hpt27xx_osm_bsd.c ============================================================================== --- stable/10/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Tue Jan 23 02:16:06 2018 (r328267) +++ stable/10/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Tue Jan 23 02:29:39 2018 (r328268) @@ -1402,7 +1402,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad { PHPT_IOCTL_PARAM piop=(PHPT_IOCTL_PARAM)data; IOCTL_ARG ioctl_args; - HPT_U32 bytesReturned; + HPT_U32 bytesReturned = 0; switch (cmd){ case HPT_DO_IOCONTROL: @@ -1432,7 +1432,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad } if (ioctl_args.nOutBufferSize) { - ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK); + ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK | M_ZERO); if (!ioctl_args.lpOutBuffer) goto invalid; } Modified: stable/10/sys/dev/hptnr/hptnr_osm_bsd.c ============================================================================== --- stable/10/sys/dev/hptnr/hptnr_osm_bsd.c Tue Jan 23 02:16:06 2018 (r328267) +++ stable/10/sys/dev/hptnr/hptnr_osm_bsd.c Tue Jan 23 02:29:39 2018 (r328268) @@ -1584,7 +1584,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad { PHPT_IOCTL_PARAM piop=(PHPT_IOCTL_PARAM)data; IOCTL_ARG ioctl_args; - HPT_U32 bytesReturned; + HPT_U32 bytesReturned = 0; switch (cmd){ case HPT_DO_IOCONTROL: @@ -1614,7 +1614,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad } if (ioctl_args.nOutBufferSize) { - ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK); + ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK | M_ZERO); if (!ioctl_args.lpOutBuffer) goto invalid; } Modified: stable/10/sys/dev/hptrr/hptrr_osm_bsd.c ============================================================================== --- stable/10/sys/dev/hptrr/hptrr_osm_bsd.c Tue Jan 23 02:16:06 2018 (r328267) +++ stable/10/sys/dev/hptrr/hptrr_osm_bsd.c Tue Jan 23 02:29:39 2018 (r328268) @@ -1231,7 +1231,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad { PHPT_IOCTL_PARAM piop=(PHPT_IOCTL_PARAM)data; IOCTL_ARG ioctl_args; - HPT_U32 bytesReturned; + HPT_U32 bytesReturned = 0; switch (cmd){ case HPT_DO_IOCONTROL: @@ -1261,7 +1261,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad } if (ioctl_args.nOutBufferSize) { - ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK); + ioctl_args.lpOutBuffer = malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK | M_ZERO); if (!ioctl_args.lpOutBuffer) goto invalid; } From owner-svn-src-stable@freebsd.org Tue Jan 23 07:05:20 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9393EB5C6A; Tue, 23 Jan 2018 07:05:20 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D2D42CA6; Tue, 23 Jan 2018 07:05:20 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E420325E3B; Tue, 23 Jan 2018 04:37:31 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0N4bVxB040508; Tue, 23 Jan 2018 04:37:31 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N4bVr1040504; Tue, 23 Jan 2018 04:37:31 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201801230437.w0N4bVr1040504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 23 Jan 2018 04:37:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328276 - in stable/10: share/man/man9 sys/kern sys/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in stable/10: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 328276 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 23 Jan 2018 07:05:20 -0000 Author: kp Date: Tue Jan 23 04:37:31 2018 New Revision: 328276 URL: https://svnweb.freebsd.org/changeset/base/328276 Log: MFC r327674, r327796 Introduce mallocarray() in the kernel Similar to calloc() the mallocarray() function checks for integer overflows before allocating memory. It does not zero memory, unless the M_ZERO flag is set. Additionally, move the overflow check logic out to WOULD_OVERFLOW() for consumers to have a common means of testing for overflowing allocations. WOULD_OVERFLOW() should be a secondary check -- on 64-bit platforms, just because an allocation won't overflow size_t does not mean it is a sane size to request. Callers should be imposing reasonable allocation limits far, far, below overflow. Obtained from: OpenBSD Modified: stable/10/share/man/man9/malloc.9 stable/10/sys/kern/kern_malloc.c stable/10/sys/sys/malloc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/malloc.9 ============================================================================== --- stable/10/share/man/man9/malloc.9 Tue Jan 23 04:30:46 2018 (r328275) +++ stable/10/share/man/man9/malloc.9 Tue Jan 23 04:37:31 2018 (r328276) @@ -29,7 +29,7 @@ .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $ .\" $FreeBSD$ .\" -.Dd November 15, 2012 +.Dd January 10, 2018 .Dt MALLOC 9 .Os .Sh NAME @@ -45,6 +45,8 @@ .In sys/malloc.h .Ft void * .Fn malloc "unsigned long size" "struct malloc_type *type" "int flags" +.Ft void * +.Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags" .Ft void .Fn free "void *addr" "struct malloc_type *type" .Ft void * @@ -64,6 +66,14 @@ object whose size is specified by .Fa size . .Pp The +.Fn mallocarray +function allocates uninitialized memory in kernel address space for an +array of +.Fa nmemb +entries whose size is specified by +.Fa size . +.Pp +The .Fn free function releases memory at address .Fa addr @@ -144,6 +154,7 @@ If the request cannot be immediately fulfilled, the cu to sleep to wait for resources to be released by other processes. The .Fn malloc , +.Fn mallocarray , .Fn realloc , and .Fn reallocf @@ -152,6 +163,13 @@ functions cannot return if .Dv M_WAITOK is specified. +if the multiplication of +.Fa nmemb +and +.Fa size +would cause an integer overflow, the +.Fn mallocarray +function induces a panic. .It Dv M_USE_RESERVE Indicates that the system can use its reserve of memory to satisfy the request. Modified: stable/10/sys/kern/kern_malloc.c ============================================================================== --- stable/10/sys/kern/kern_malloc.c Tue Jan 23 04:30:46 2018 (r328275) +++ stable/10/sys/kern/kern_malloc.c Tue Jan 23 04:37:31 2018 (r328276) @@ -2,6 +2,7 @@ * Copyright (c) 1987, 1991, 1993 * The Regents of the University of California. * Copyright (c) 2005-2009 Robert N. M. Watson + * Copyright (c) 2008 Otto Moerbeek (mallocarray) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -527,6 +528,16 @@ malloc(unsigned long size, struct malloc_type *mtp, in va = redzone_setup(va, osize); #endif return ((void *) va); +} + +void * +mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) +{ + + if (WOULD_OVERFLOW(nmemb, size)) + panic("mallocarray: %zu * %zu overflowed", nmemb, size); + + return (malloc(size * nmemb, type, flags)); } /* Modified: stable/10/sys/sys/malloc.h ============================================================================== --- stable/10/sys/sys/malloc.h Tue Jan 23 04:30:46 2018 (r328275) +++ stable/10/sys/sys/malloc.h Tue Jan 23 04:37:31 2018 (r328276) @@ -39,6 +39,7 @@ #include #include #include +#include #define MINALLOCSIZE UMA_SMALLEST_UNIT @@ -176,6 +177,8 @@ void *contigmalloc(unsigned long size, struct malloc_t vm_paddr_t boundary) __malloc_like; void free(void *addr, struct malloc_type *type); void *malloc(unsigned long size, struct malloc_type *type, int flags) __malloc_like; +void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, + int flags) __malloc_like __result_use_check; void malloc_init(void *); int malloc_last_fail(void); void malloc_type_allocated(struct malloc_type *type, unsigned long size); @@ -188,6 +191,20 @@ void *reallocf(void *addr, unsigned long size, struct int flags); struct malloc_type *malloc_desc2type(const char *desc); + +/* + * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX + * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW + */ +#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 8 / 2)) +static inline bool +WOULD_OVERFLOW(size_t nmemb, size_t size) +{ + + return ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && + nmemb > 0 && __SIZE_T_MAX / nmemb < size); +} +#undef MUL_NO_OVERFLOW #endif /* _KERNEL */ #endif /* !_SYS_MALLOC_H_ */ From owner-svn-src-stable@freebsd.org Tue Jan 23 07:10:15 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7129EB5FC9; Tue, 23 Jan 2018 07:10:15 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E22B3203; Tue, 23 Jan 2018 07:10:15 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A37D25BFB; Tue, 23 Jan 2018 04:30:46 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0N4Uklf036501; Tue, 23 Jan 2018 04:30:46 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N4Ukku036500; Tue, 23 Jan 2018 04:30:46 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201801230430.w0N4Ukku036500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 23 Jan 2018 04:30:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328275 - stable/11/sys/netpfil/pf X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/11/sys/netpfil/pf X-SVN-Commit-Revision: 328275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 23 Jan 2018 07:10:15 -0000 Author: kp Date: Tue Jan 23 04:30:46 2018 New Revision: 328275 URL: https://svnweb.freebsd.org/changeset/base/328275 Log: MFC r327675 pf: Avoid integer overflow issues by using mallocarray() iso. malloc() pfioctl() handles several ioctl that takes variable length input, these include: - DIOCRADDTABLES - DIOCRDELTABLES - DIOCRGETTABLES - DIOCRGETTSTATS - DIOCRCLRTSTATS - DIOCRSETTFLAGS All of them take a pfioc_table struct as input from userland. One of its elements (pfrio_size) is used in a buffer length calculation. The calculation contains an integer overflow which if triggered can lead to out of bound reads and writes later on. Reported by: Ilja Van Sprundel Modified: stable/11/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/11/sys/netpfil/pf/pf_ioctl.c Tue Jan 23 04:01:48 2018 (r328274) +++ stable/11/sys/netpfil/pf/pf_ioctl.c Tue Jan 23 04:30:46 2018 (r328275) @@ -2524,7 +2524,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2548,7 +2553,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2572,7 +2582,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_tables(&io->pfrio_table, pfrts, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2593,7 +2608,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_tstats); - pfrtstats = malloc(totlen, M_TEMP, M_WAITOK); + pfrtstats = mallocarray(io->pfrio_size, + sizeof(struct pfr_tstats), M_TEMP, M_WAITOK); + if (! pfrtstats) { + error = ENOMEM; + break; + } PF_RULES_WLOCK(); error = pfr_get_tstats(&io->pfrio_table, pfrtstats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2614,7 +2634,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2638,7 +2663,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2677,7 +2707,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2704,7 +2739,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2732,7 +2772,12 @@ DIOCCHANGEADDR_error: } count = max(io->pfrio_size, io->pfrio_size2); totlen = count * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(count, sizeof(struct pfr_addr), M_TEMP, + M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2760,7 +2805,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_addrs(&io->pfrio_table, pfras, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2781,7 +2831,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_astats); - pfrastats = malloc(totlen, M_TEMP, M_WAITOK); + pfrastats = mallocarray(io->pfrio_size, + sizeof(struct pfr_astats), M_TEMP, M_WAITOK); + if (! pfrastats) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_astats(&io->pfrio_table, pfrastats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2802,7 +2857,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2829,7 +2889,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2856,7 +2921,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2898,7 +2968,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -2964,7 +3039,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -3030,7 +3110,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -3231,7 +3316,12 @@ DIOCCHANGEADDR_error: } bufsiz = io->pfiio_size * sizeof(struct pfi_kif); - ifstore = malloc(bufsiz, M_TEMP, M_WAITOK); + ifstore = mallocarray(io->pfiio_size, sizeof(struct pfi_kif), + M_TEMP, M_WAITOK); + if (! ifstore) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); pfi_get_ifaces(io->pfiio_name, ifstore, &io->pfiio_size); PF_RULES_RUNLOCK(); From owner-svn-src-stable@freebsd.org Tue Jan 23 07:30:16 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F34B9EB7295; Tue, 23 Jan 2018 07:30:16 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CDE1968280; Tue, 23 Jan 2018 07:30:16 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 555B226C8E; Tue, 23 Jan 2018 05:03:26 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0N53QrA052842; Tue, 23 Jan 2018 05:03:26 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N53Quc052841; Tue, 23 Jan 2018 05:03:26 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201801230503.w0N53Quc052841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 23 Jan 2018 05:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328277 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/10/sys/netpfil/pf X-SVN-Commit-Revision: 328277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 23 Jan 2018 07:30:17 -0000 Author: kp Date: Tue Jan 23 05:03:26 2018 New Revision: 328277 URL: https://svnweb.freebsd.org/changeset/base/328277 Log: MFC r327675 pf: Avoid integer overflow issues by using mallocarray() iso. malloc() pfioctl() handles several ioctl that takes variable length input, these include: - DIOCRADDTABLES - DIOCRDELTABLES - DIOCRGETTABLES - DIOCRGETTSTATS - DIOCRCLRTSTATS - DIOCRSETTFLAGS All of them take a pfioc_table struct as input from userland. One of its elements (pfrio_size) is used in a buffer length calculation. The calculation contains an integer overflow which if triggered can lead to out of bound reads and writes later on. Reported by: Ilja Van Sprundel Modified: stable/10/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jan 23 04:37:31 2018 (r328276) +++ stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jan 23 05:03:26 2018 (r328277) @@ -2514,7 +2514,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2538,7 +2543,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2562,7 +2572,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_tables(&io->pfrio_table, pfrts, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2583,7 +2598,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_tstats); - pfrtstats = malloc(totlen, M_TEMP, M_WAITOK); + pfrtstats = mallocarray(io->pfrio_size, + sizeof(struct pfr_tstats), M_TEMP, M_WAITOK); + if (! pfrtstats) { + error = ENOMEM; + break; + } PF_RULES_WLOCK(); error = pfr_get_tstats(&io->pfrio_table, pfrtstats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2604,7 +2624,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2628,7 +2653,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_table); - pfrts = malloc(totlen, M_TEMP, M_WAITOK); + pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table), + M_TEMP, M_WAITOK); + if (! pfrts) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfrts, totlen); if (error) { free(pfrts, M_TEMP); @@ -2667,7 +2697,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2694,7 +2729,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2722,7 +2762,12 @@ DIOCCHANGEADDR_error: } count = max(io->pfrio_size, io->pfrio_size2); totlen = count * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(count, sizeof(struct pfr_addr), M_TEMP, + M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2750,7 +2795,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_addrs(&io->pfrio_table, pfras, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2771,7 +2821,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_astats); - pfrastats = malloc(totlen, M_TEMP, M_WAITOK); + pfrastats = mallocarray(io->pfrio_size, + sizeof(struct pfr_astats), M_TEMP, M_WAITOK); + if (! pfrastats) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); error = pfr_get_astats(&io->pfrio_table, pfrastats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); @@ -2792,7 +2847,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2819,7 +2879,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2846,7 +2911,12 @@ DIOCCHANGEADDR_error: break; } totlen = io->pfrio_size * sizeof(struct pfr_addr); - pfras = malloc(totlen, M_TEMP, M_WAITOK); + pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr), + M_TEMP, M_WAITOK); + if (! pfras) { + error = ENOMEM; + break; + } error = copyin(io->pfrio_buffer, pfras, totlen); if (error) { free(pfras, M_TEMP); @@ -2888,7 +2958,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -2954,7 +3029,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -3020,7 +3100,12 @@ DIOCCHANGEADDR_error: break; } totlen = sizeof(struct pfioc_trans_e) * io->size; - ioes = malloc(totlen, M_TEMP, M_WAITOK); + ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e), + M_TEMP, M_WAITOK); + if (! ioes) { + error = ENOMEM; + break; + } error = copyin(io->array, ioes, totlen); if (error) { free(ioes, M_TEMP); @@ -3221,7 +3306,12 @@ DIOCCHANGEADDR_error: } bufsiz = io->pfiio_size * sizeof(struct pfi_kif); - ifstore = malloc(bufsiz, M_TEMP, M_WAITOK); + ifstore = mallocarray(io->pfiio_size, sizeof(struct pfi_kif), + M_TEMP, M_WAITOK); + if (! ifstore) { + error = ENOMEM; + break; + } PF_RULES_RLOCK(); pfi_get_ifaces(io->pfiio_name, ifstore, &io->pfiio_size); PF_RULES_RUNLOCK(); From owner-svn-src-stable@freebsd.org Tue Jan 23 07:40:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E34BEB78B3; Tue, 23 Jan 2018 07:40:14 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 77F9568CC3; Tue, 23 Jan 2018 07:40:14 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A22924DFB; Tue, 23 Jan 2018 04:01:49 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0N41nZR027899; Tue, 23 Jan 2018 04:01:49 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N41nfE027898; Tue, 23 Jan 2018 04:01:49 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201801230401.w0N41nfE027898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 23 Jan 2018 04:01:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328274 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 328274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 23 Jan 2018 07:40:14 -0000 Author: cy Date: Tue Jan 23 04:01:48 2018 New Revision: 328274 URL: https://svnweb.freebsd.org/changeset/base/328274 Log: MFC r327718: When growing the state, also grow the seed array. Otherwise memory that was not allocated will be accessed. This necessitated refactoring state seed allocation from ipf_state_soft_init() into a new common ipf_state_seed_alloc() function as it is now also used by ipf_state_rehash() when changing the size of the state hash table in addition to by ipf_state_soft_init() during initialization. According to Christos Zoulas : The bug was encountered by a NetBSD vendor who's customer machines had large ipfilter states. The bug was reliably triggered by resizing the state variables using "ipf -T". Submitted by: Christos Zoulas Reviewed by: delphij, rgrimes Obtained from: NetBSD ip_state.c CVS revs r1.9 and r1.10 Differential Revision: https://reviews.freebsd.org/D13755 Modified: stable/10/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_state.c Tue Jan 23 03:36:49 2018 (r328273) +++ stable/10/sys/contrib/ipfilter/netinet/ip_state.c Tue Jan 23 04:01:48 2018 (r328274) @@ -301,7 +301,33 @@ ipf_state_soft_destroy(softc, arg) KFREE(softs); } +static void * +ipf_state_seed_alloc(u_int state_size, u_int state_max) +{ + u_int i; + u_long *state_seed; + KMALLOCS(state_seed, u_long *, state_size * sizeof(*state_seed)); + if (state_seed == NULL) + return NULL; + for (i = 0; i < state_size; i++) { + /* + * XXX - ipf_state_seed[X] should be a random number of sorts. + */ +#if FREEBSD_GE_REV(400000) + state_seed[i] = arc4random(); +#else + state_seed[i] = ((u_long)state_seed + i) * state_size; + state_seed[i] ^= 0xa5a55a5a; + state_seed[i] *= (u_long)state_seed; + state_seed[i] ^= 0x5a5aa5a5; + state_seed[i] *= state_max; +#endif + } + return state_seed; +} + + /* ------------------------------------------------------------------------ */ /* Function: ipf_state_soft_init */ /* Returns: int - 0 == success, -1 == failure */ @@ -333,27 +359,11 @@ ipf_state_soft_init(softc, arg) bzero((char *)softs->ipf_state_table, softs->ipf_state_size * sizeof(ipstate_t *)); - KMALLOCS(softs->ipf_state_seed, u_long *, - softs->ipf_state_size * sizeof(*softs->ipf_state_seed)); + softs->ipf_state_seed = ipf_state_seed_alloc(softs->ipf_state_size, + softs->ipf_state_max); if (softs->ipf_state_seed == NULL) return -2; - for (i = 0; i < softs->ipf_state_size; i++) { - /* - * XXX - ipf_state_seed[X] should be a random number of sorts. - */ -#if FREEBSD_GE_REV(400000) - softs->ipf_state_seed[i] = arc4random(); -#else - softs->ipf_state_seed[i] = ((u_long)softs->ipf_state_seed + i) * - softs->ipf_state_size; - softs->ipf_state_seed[i] ^= 0xa5a55a5a; - softs->ipf_state_seed[i] *= (u_long)softs->ipf_state_seed; - softs->ipf_state_seed[i] ^= 0x5a5aa5a5; - softs->ipf_state_seed[i] *= softs->ipf_state_max; -#endif - } - KMALLOCS(softs->ipf_state_stats.iss_bucketlen, u_int *, softs->ipf_state_size * sizeof(u_int)); if (softs->ipf_state_stats.iss_bucketlen == NULL) @@ -5253,6 +5263,7 @@ ipf_state_rehash(softc, t, p) { ipf_state_softc_t *softs = softc->ipf_state_soft; ipstate_t **newtab, *is; + u_long *newseed; u_int *bucketlens; u_int maxbucket; u_int newsize; @@ -5279,6 +5290,14 @@ ipf_state_rehash(softc, t, p) return ENOMEM; } + newseed = ipf_state_seed_alloc(newsize, softs->ipf_state_max); + if (newseed == NULL) { + KFREES(bucketlens, newsize * sizeof(*bucketlens)); + KFREES(newtab, newsize * sizeof(*newtab)); + IPFERROR(100037); + return ENOMEM; + } + for (maxbucket = 0, i = newsize; i > 0; i >>= 1) maxbucket++; maxbucket *= 2; @@ -5293,6 +5312,12 @@ ipf_state_rehash(softc, t, p) softs->ipf_state_size * sizeof(*softs->ipf_state_table)); } softs->ipf_state_table = newtab; + + if (softs->ipf_state_seed != NULL) { + KFREES(softs->ipf_state_seed, + softs->ipf_state_size * sizeof(*softs->ipf_state_seed)); + } + softs->ipf_state_seed = newseed; if (softs->ipf_state_stats.iss_bucketlen != NULL) { KFREES(softs->ipf_state_stats.iss_bucketlen, From owner-svn-src-stable@freebsd.org Tue Jan 23 07:40:36 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 011C8EB7940; Tue, 23 Jan 2018 07:40:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4C6D68FD7; Tue, 23 Jan 2018 07:40:35 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 386BF24DF9; Tue, 23 Jan 2018 04:01:49 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0N41nwb027892; Tue, 23 Jan 2018 04:01:49 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0N41nVe027891; Tue, 23 Jan 2018 04:01:49 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201801230401.w0N41nVe027891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 23 Jan 2018 04:01:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328274 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 328274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 23 Jan 2018 07:40:36 -0000 Author: cy Date: Tue Jan 23 04:01:48 2018 New Revision: 328274 URL: https://svnweb.freebsd.org/changeset/base/328274 Log: MFC r327718: When growing the state, also grow the seed array. Otherwise memory that was not allocated will be accessed. This necessitated refactoring state seed allocation from ipf_state_soft_init() into a new common ipf_state_seed_alloc() function as it is now also used by ipf_state_rehash() when changing the size of the state hash table in addition to by ipf_state_soft_init() during initialization. According to Christos Zoulas : The bug was encountered by a NetBSD vendor who's customer machines had large ipfilter states. The bug was reliably triggered by resizing the state variables using "ipf -T". Submitted by: Christos Zoulas Reviewed by: delphij, rgrimes Obtained from: NetBSD ip_state.c CVS revs r1.9 and r1.10 Differential Revision: https://reviews.freebsd.org/D13755 Modified: stable/11/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_state.c Tue Jan 23 03:36:49 2018 (r328273) +++ stable/11/sys/contrib/ipfilter/netinet/ip_state.c Tue Jan 23 04:01:48 2018 (r328274) @@ -301,7 +301,33 @@ ipf_state_soft_destroy(softc, arg) KFREE(softs); } +static void * +ipf_state_seed_alloc(u_int state_size, u_int state_max) +{ + u_int i; + u_long *state_seed; + KMALLOCS(state_seed, u_long *, state_size * sizeof(*state_seed)); + if (state_seed == NULL) + return NULL; + for (i = 0; i < state_size; i++) { + /* + * XXX - ipf_state_seed[X] should be a random number of sorts. + */ +#if FREEBSD_GE_REV(400000) + state_seed[i] = arc4random(); +#else + state_seed[i] = ((u_long)state_seed + i) * state_size; + state_seed[i] ^= 0xa5a55a5a; + state_seed[i] *= (u_long)state_seed; + state_seed[i] ^= 0x5a5aa5a5; + state_seed[i] *= state_max; +#endif + } + return state_seed; +} + + /* ------------------------------------------------------------------------ */ /* Function: ipf_state_soft_init */ /* Returns: int - 0 == success, -1 == failure */ @@ -333,27 +359,11 @@ ipf_state_soft_init(softc, arg) bzero((char *)softs->ipf_state_table, softs->ipf_state_size * sizeof(ipstate_t *)); - KMALLOCS(softs->ipf_state_seed, u_long *, - softs->ipf_state_size * sizeof(*softs->ipf_state_seed)); + softs->ipf_state_seed = ipf_state_seed_alloc(softs->ipf_state_size, + softs->ipf_state_max); if (softs->ipf_state_seed == NULL) return -2; - for (i = 0; i < softs->ipf_state_size; i++) { - /* - * XXX - ipf_state_seed[X] should be a random number of sorts. - */ -#if FREEBSD_GE_REV(400000) - softs->ipf_state_seed[i] = arc4random(); -#else - softs->ipf_state_seed[i] = ((u_long)softs->ipf_state_seed + i) * - softs->ipf_state_size; - softs->ipf_state_seed[i] ^= 0xa5a55a5a; - softs->ipf_state_seed[i] *= (u_long)softs->ipf_state_seed; - softs->ipf_state_seed[i] ^= 0x5a5aa5a5; - softs->ipf_state_seed[i] *= softs->ipf_state_max; -#endif - } - KMALLOCS(softs->ipf_state_stats.iss_bucketlen, u_int *, softs->ipf_state_size * sizeof(u_int)); if (softs->ipf_state_stats.iss_bucketlen == NULL) @@ -5259,6 +5269,7 @@ ipf_state_rehash(softc, t, p) { ipf_state_softc_t *softs = softc->ipf_state_soft; ipstate_t **newtab, *is; + u_long *newseed; u_int *bucketlens; u_int maxbucket; u_int newsize; @@ -5285,6 +5296,14 @@ ipf_state_rehash(softc, t, p) return ENOMEM; } + newseed = ipf_state_seed_alloc(newsize, softs->ipf_state_max); + if (newseed == NULL) { + KFREES(bucketlens, newsize * sizeof(*bucketlens)); + KFREES(newtab, newsize * sizeof(*newtab)); + IPFERROR(100037); + return ENOMEM; + } + for (maxbucket = 0, i = newsize; i > 0; i >>= 1) maxbucket++; maxbucket *= 2; @@ -5299,6 +5318,12 @@ ipf_state_rehash(softc, t, p) softs->ipf_state_size * sizeof(*softs->ipf_state_table)); } softs->ipf_state_table = newtab; + + if (softs->ipf_state_seed != NULL) { + KFREES(softs->ipf_state_seed, + softs->ipf_state_size * sizeof(*softs->ipf_state_seed)); + } + softs->ipf_state_seed = newseed; if (softs->ipf_state_stats.iss_bucketlen != NULL) { KFREES(softs->ipf_state_stats.iss_bucketlen, From owner-svn-src-stable@freebsd.org Tue Jan 23 18:22:42 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D704EBE88E; Tue, 23 Jan 2018 18:22:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 784AC681E1; Tue, 23 Jan 2018 18:22:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8CC7122A8; Tue, 23 Jan 2018 18:22:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NIMfot092995; Tue, 23 Jan 2018 18:22:41 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NIMfhc092993; Tue, 23 Jan 2018 18:22:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801231822.w0NIMfhc092993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 23 Jan 2018 18:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328294 - in stable: 10/sys/sys 11/sys/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/sys/sys 11/sys/sys X-SVN-Commit-Revision: 328294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 23 Jan 2018 18:22:42 -0000 Author: jhb Date: Tue Jan 23 18:22:41 2018 New Revision: 328294 URL: https://svnweb.freebsd.org/changeset/base/328294 Log: MFC 325835: Use #if instead of #ifdef for __BSD_VISIBLE tests. __BSD_VISIBLE is always defined and it's value instead needs to be tested via #if to determine if FreeBSD-specific APIs should be exposed. PR: 196226 Modified: stable/10/sys/sys/aio.h stable/10/sys/sys/shm.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/sys/aio.h stable/11/sys/sys/shm.h Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/sys/aio.h ============================================================================== --- stable/10/sys/sys/aio.h Tue Jan 23 18:03:13 2018 (r328293) +++ stable/10/sys/sys/aio.h Tue Jan 23 18:22:41 2018 (r328294) @@ -130,7 +130,7 @@ int aio_suspend(const struct aiocb * const[], int, con */ int aio_mlock(struct aiocb *); -#ifdef __BSD_VISIBLE +#if __BSD_VISIBLE int aio_waitcomplete(struct aiocb **, struct timespec *); #endif Modified: stable/10/sys/sys/shm.h ============================================================================== --- stable/10/sys/sys/shm.h Tue Jan 23 18:03:13 2018 (r328293) +++ stable/10/sys/sys/shm.h Tue Jan 23 18:22:41 2018 (r328294) @@ -154,7 +154,7 @@ typedef __size_t size_t; #endif __BEGIN_DECLS -#ifdef __BSD_VISIBLE +#if __BSD_VISIBLE int shmsys(int, ...); #endif void *shmat(int, const void *, int); From owner-svn-src-stable@freebsd.org Tue Jan 23 18:22:42 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4DDDEBE894; Tue, 23 Jan 2018 18:22:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C080A681E4; Tue, 23 Jan 2018 18:22:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1273D122A9; Tue, 23 Jan 2018 18:22:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NIMfdd093003; Tue, 23 Jan 2018 18:22:41 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NIMfcN093001; Tue, 23 Jan 2018 18:22:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801231822.w0NIMfcN093001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 23 Jan 2018 18:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328294 - in stable: 10/sys/sys 11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/sys/sys 11/sys/sys X-SVN-Commit-Revision: 328294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 23 Jan 2018 18:22:43 -0000 Author: jhb Date: Tue Jan 23 18:22:41 2018 New Revision: 328294 URL: https://svnweb.freebsd.org/changeset/base/328294 Log: MFC 325835: Use #if instead of #ifdef for __BSD_VISIBLE tests. __BSD_VISIBLE is always defined and it's value instead needs to be tested via #if to determine if FreeBSD-specific APIs should be exposed. PR: 196226 Modified: stable/11/sys/sys/aio.h stable/11/sys/sys/shm.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/sys/aio.h stable/10/sys/sys/shm.h Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/sys/aio.h ============================================================================== --- stable/11/sys/sys/aio.h Tue Jan 23 18:03:13 2018 (r328293) +++ stable/11/sys/sys/aio.h Tue Jan 23 18:22:41 2018 (r328294) @@ -252,7 +252,7 @@ int aio_suspend(const struct aiocb * const[], int, con */ int aio_mlock(struct aiocb *); -#ifdef __BSD_VISIBLE +#if __BSD_VISIBLE ssize_t aio_waitcomplete(struct aiocb **, struct timespec *); #endif Modified: stable/11/sys/sys/shm.h ============================================================================== --- stable/11/sys/sys/shm.h Tue Jan 23 18:03:13 2018 (r328293) +++ stable/11/sys/sys/shm.h Tue Jan 23 18:22:41 2018 (r328294) @@ -157,7 +157,7 @@ typedef __size_t size_t; #endif __BEGIN_DECLS -#ifdef __BSD_VISIBLE +#if __BSD_VISIBLE int shmsys(int, ...); #endif void *shmat(int, const void *, int); From owner-svn-src-stable@freebsd.org Tue Jan 23 19:00:14 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90548EC0651; Tue, 23 Jan 2018 19:00:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6986069742; Tue, 23 Jan 2018 19:00:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DE311277E; Tue, 23 Jan 2018 19:00:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NJ0DUM005986; Tue, 23 Jan 2018 19:00:13 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NJ0DgR005983; Tue, 23 Jan 2018 19:00:13 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801231900.w0NJ0DgR005983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 23 Jan 2018 19:00:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328295 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/fs/tmpfs X-SVN-Commit-Revision: 328295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 23 Jan 2018 19:00:14 -0000 Author: jhb Date: Tue Jan 23 19:00:13 2018 New Revision: 328295 URL: https://svnweb.freebsd.org/changeset/base/328295 Log: MFC 323993: Use tmpfs_print for tmpfs FIFOs. Modified: stable/11/sys/fs/tmpfs/tmpfs_fifoops.c stable/11/sys/fs/tmpfs/tmpfs_vnops.c stable/11/sys/fs/tmpfs/tmpfs_vnops.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs_fifoops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_fifoops.c Tue Jan 23 18:22:41 2018 (r328294) +++ stable/11/sys/fs/tmpfs/tmpfs_fifoops.c Tue Jan 23 19:00:13 2018 (r328295) @@ -69,5 +69,5 @@ struct vop_vector tmpfs_fifoop_entries = { .vop_access = tmpfs_access, .vop_getattr = tmpfs_getattr, .vop_setattr = tmpfs_setattr, + .vop_print = tmpfs_print, }; - Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.c Tue Jan 23 18:22:41 2018 (r328294) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.c Tue Jan 23 19:00:13 2018 (r328295) @@ -1310,7 +1310,7 @@ tmpfs_reclaim(struct vop_reclaim_args *v) return 0; } -static int +int tmpfs_print(struct vop_print_args *v) { struct vnode *vp = v->a_vp; Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.h Tue Jan 23 18:22:41 2018 (r328294) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.h Tue Jan 23 19:00:13 2018 (r328295) @@ -49,6 +49,7 @@ extern struct vop_vector tmpfs_vnodeop_nonc_entries; vop_access_t tmpfs_access; vop_getattr_t tmpfs_getattr; vop_setattr_t tmpfs_setattr; +vop_print_t tmpfs_print; vop_reclaim_t tmpfs_reclaim; #endif /* _FS_TMPFS_TMPFS_VNOPS_H_ */ From owner-svn-src-stable@freebsd.org Tue Jan 23 20:08:29 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DC7AEC4036; Tue, 23 Jan 2018 20:08:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 265D46C60A; Tue, 23 Jan 2018 20:08:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FAE7132B5; Tue, 23 Jan 2018 20:08:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NK8RNX035225; Tue, 23 Jan 2018 20:08:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0NK8PCY035206; Tue, 23 Jan 2018 20:08:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801232008.w0NK8PCY035206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 23 Jan 2018 20:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328298 - in stable/11/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/cd9660 fs/devfs fs/ext2fs fs/fdescfs fs/fifofs fs/fuse fs/msdosfs fs/nandfs fs/nfsclient fs/smbfs fs/tmpfs fs/u... X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/11/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/cd9660 fs/devfs fs/ext2fs fs/fdescfs fs/fifofs fs/fuse fs/msdosfs fs/nandfs fs/nfsclient fs/smbfs fs/tmpfs fs/udf kern sys ufs/ufs X-SVN-Commit-Revision: 328298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 23 Jan 2018 20:08:29 -0000 Author: jhb Date: Tue Jan 23 20:08:25 2018 New Revision: 328298 URL: https://svnweb.freebsd.org/changeset/base/328298 Log: MFC 320900,323882,324224,324226,324228,326986,326988,326989,326990,326993, 326994,326995,327004: Various fixes for pathconf(2). The original change to use vop_stdpathconf() more widely was motivated by a panic due to recent AIO-related changes. However, bde@ reported that vop_stdpathconf() contained too many settings that were not filesystem-independent. The end result of this set of patches is to fix the AIO-related panic via use of a trimmed-down vop_stdpathconf() while also adding support for missing pathconf variables in various filesystems (and removing a few settings incorrectly reported as supported). 320900: Consistently use vop_stdpathconf() for default pathconf values. Update filesystems not currently using vop_stdpathconf() in pathconf VOPs to use vop_stdpathconf() for any configuration variables that do not have filesystem-specific values. vop_stdpathconf() is used for variables that have system-wide settings as well as providing default values for some values based on system limits. Filesystems can still explicitly override individual settings. 323882: Only handle _PC_MAX_CANON, _PC_MAX_INPUT, and _PC_VDISABLE for TTY devices. Move handling of these three pathconf() variables out of vop_stdpathconf() and into devfs_pathconf() as TTY devices can only be devfs files. In addition, only return settings for these three variables for devfs devices whose device switch has the D_TTY flag set. 324224: Handle _PC_FILESIZEBITS and _PC_SYMLINK_MAX pathconf() requests in cd9660. cd9660 only supports symlinks with Rock Ridge extensions, so _PC_SYMLINK_MAX is conditional on Rock Ridge. 324226: Return 64 for pathconf(_PC_FILESIZEBITS) on tmpfs. 324228: Flesh out pathconf() on UDF. - Return 64 bits for _PC_FILESIZEBITS. - Handle _PC_SYMLINK_MAX. - Defer _PC_PATH_MAX to vop_stdpathconf(). 326986: Add a custom VOP_PATHCONF method for fdescfs. The method handles NAME_MAX and LINK_MAX explicitly. For all other pathconf variables, the method passes the request down to the underlying file descriptor. This requires splitting a kern_fpathconf() syscallsubr routine out of sys_fpathconf(). Also, to avoid lock order reversals with vnode locks, the fdescfs vnode is unlocked around the call to kern_fpathconf(), but with the usecount of the vnode bumped. 326988: Add a custom VOP_PATHCONF method for fuse. This method handles _PC_FILESIZEBITS, _PC_SYMLINK_MAX, and _PC_NO_TRUNC. For other values it defers to vop_stdpathconf(). 326989: Support _PC_FILESIZEBITS in msdosfs' VOP_PATHCONF(). 326990: Handle _PC_FILESIZEBITS and _PC_NO_TRUNC for smbfs' VOP_PATHCONF(). 326993: Move NAME_MAX, LINK_MAX, and CHOWN_RESTRICTED out of vop_stdpathconf(). Having all filesystems fall through to default values isn't always correct and these values can vary for different filesystem implementations. Most of these changes just use the existing default values with a few exceptions: - Don't report CHOWN_RESTRICTED for ZFS since it doesn't do the exact permissions check this claims for chown(). - Use NANDFS_NAME_LEN for NAME_MAX for nandfs. - Don't report a LINK_MAX of 0 on smbfs. Now fail with EINVAL to indicate hard links aren't supported. 326994: Handle _PC_FILESIZEBITS and _PC_SYMLINK_MAX for devfs' VOP_PATHCONF(). 326995: Use FUSE_LINK_MAX for LINK_MAX in fuse' VOP_PATHCONF(). Should have included this in r326993. 327004: Rework pathconf handling for FIFOs. On the one hand, FIFOs should respect other variables not supported by the fifofs vnode operation (such as _PC_NAME_MAX, _PC_LINK_MAX, etc.). These values are fs-specific and must come from a fs-specific method. On the other hand, filesystems that support FIFOs are required to support _PC_PIPE_BUF on directory vnodes that can contain FIFOs. Given this latter requirement, once the fs-specific VOP_PATHCONF method supports _PC_PIPE_BUF for directories, it is also suitable for FIFOs permitting a single VOP_PATHCONF method to be used for both FIFOs and non-FIFOs. To that end, retire all of the FIFO-specific pathconf methods from filesystems and change FIFO-specific vnode operation switches to use the existing fs-specific VOP_PATHCONF method. For fifofs, set it's VOP_PATHCONF to VOP_PANIC since it should no longer be used. While here, move _PC_PIPE_BUF handling out of vop_stdpathconf() so that only filesystems supporting FIFOs will report a value. In addition, only report a valid _PC_PIPE_BUF for directories and FIFOs. PR: 219851 Sponsored by: Chelsio Communications Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/11/sys/fs/cd9660/cd9660_vnops.c stable/11/sys/fs/devfs/devfs_vnops.c stable/11/sys/fs/ext2fs/ext2_vnops.c stable/11/sys/fs/fdescfs/fdesc_vnops.c stable/11/sys/fs/fifofs/fifo_vnops.c stable/11/sys/fs/fuse/fuse_vnops.c stable/11/sys/fs/msdosfs/msdosfs_vnops.c stable/11/sys/fs/nandfs/nandfs_vnops.c stable/11/sys/fs/nfsclient/nfs_clvnops.c stable/11/sys/fs/smbfs/smbfs_vnops.c stable/11/sys/fs/tmpfs/tmpfs_fifoops.c stable/11/sys/fs/tmpfs/tmpfs_vnops.c stable/11/sys/fs/tmpfs/tmpfs_vnops.h stable/11/sys/fs/udf/udf_vnops.c stable/11/sys/kern/kern_descrip.c stable/11/sys/kern/vfs_default.c stable/11/sys/sys/syscallsubr.h stable/11/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -5404,30 +5404,25 @@ zfs_freebsd_pathconf(ap) int error; error = zfs_pathconf(ap->a_vp, ap->a_name, &val, curthread->td_ucred, NULL); - if (error == 0) + if (error == 0) { *ap->a_retval = val; - else if (error == EOPNOTSUPP) - error = vop_stdpathconf(ap); - return (error); -} + return (error); + } + if (error != EOPNOTSUPP) + return (error); -static int -zfs_freebsd_fifo_pathconf(ap) - struct vop_pathconf_args /* { - struct vnode *a_vp; - int a_name; - register_t *a_retval; - } */ *ap; -{ - switch (ap->a_name) { - case _PC_ACL_EXTENDED: - case _PC_ACL_NFS4: - case _PC_ACL_PATH_MAX: - case _PC_MAC_PRESENT: - return (zfs_freebsd_pathconf(ap)); + case _PC_NAME_MAX: + *ap->a_retval = NAME_MAX; + return (0); + case _PC_PIPE_BUF: + if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO) { + *ap->a_retval = PIPE_BUF; + return (0); + } + return (EINVAL); default: - return (fifo_specops.vop_pathconf(ap)); + return (vop_stdpathconf(ap)); } } @@ -6041,7 +6036,7 @@ struct vop_vector zfs_fifoops = { .vop_reclaim = zfs_freebsd_reclaim, .vop_setattr = zfs_freebsd_setattr, .vop_write = VOP_PANIC, - .vop_pathconf = zfs_freebsd_fifo_pathconf, + .vop_pathconf = zfs_freebsd_pathconf, .vop_fid = zfs_freebsd_fid, .vop_getacl = zfs_freebsd_getacl, .vop_setacl = zfs_freebsd_setacl, Modified: stable/11/sys/fs/cd9660/cd9660_vnops.c ============================================================================== --- stable/11/sys/fs/cd9660/cd9660_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/cd9660/cd9660_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -780,6 +780,9 @@ cd9660_pathconf(ap) { switch (ap->a_name) { + case _PC_FILESIZEBITS: + *ap->a_retval = 32; + return (0); case _PC_LINK_MAX: *ap->a_retval = 1; return (0); @@ -789,20 +792,17 @@ cd9660_pathconf(ap) else *ap->a_retval = 37; return (0); - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - return (0); - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - return (0); - case _PC_CHOWN_RESTRICTED: - *ap->a_retval = 1; - return (0); + case _PC_SYMLINK_MAX: + if (VTOI(ap->a_vp)->i_mnt->iso_ftype == ISO_FTYPE_RRIP) { + *ap->a_retval = MAXPATHLEN; + return (0); + } + return (EINVAL); case _PC_NO_TRUNC: *ap->a_retval = 1; return (0); default: - return (EINVAL); + return (vop_stdpathconf(ap)); } /* NOTREACHED */ } Modified: stable/11/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/11/sys/fs/devfs/devfs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/devfs/devfs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -1165,6 +1165,36 @@ devfs_pathconf(struct vop_pathconf_args *ap) { switch (ap->a_name) { + case _PC_FILESIZEBITS: + *ap->a_retval = 64; + return (0); + case _PC_NAME_MAX: + *ap->a_retval = NAME_MAX; + return (0); + case _PC_LINK_MAX: + *ap->a_retval = LINK_MAX; + return (0); + case _PC_SYMLINK_MAX: + *ap->a_retval = MAXPATHLEN; + return (0); + case _PC_MAX_CANON: + if (ap->a_vp->v_vflag & VV_ISTTY) { + *ap->a_retval = MAX_CANON; + return (0); + } + return (EINVAL); + case _PC_MAX_INPUT: + if (ap->a_vp->v_vflag & VV_ISTTY) { + *ap->a_retval = MAX_INPUT; + return (0); + } + return (EINVAL); + case _PC_VDISABLE: + if (ap->a_vp->v_vflag & VV_ISTTY) { + *ap->a_retval = _POSIX_VDISABLE; + return (0); + } + return (EINVAL); case _PC_MAC_PRESENT: #ifdef MAC /* @@ -1175,6 +1205,9 @@ devfs_pathconf(struct vop_pathconf_args *ap) #else *ap->a_retval = 0; #endif + return (0); + case _PC_CHOWN_RESTRICTED: + *ap->a_retval = 1; return (0); default: return (vop_stdpathconf(ap)); Modified: stable/11/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/11/sys/fs/ext2fs/ext2_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/ext2fs/ext2_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -179,6 +179,7 @@ struct vop_vector ext2_fifoops = { .vop_getattr = ext2_getattr, .vop_inactive = ext2_inactive, .vop_kqfilter = ext2fifo_kqfilter, + .vop_pathconf = ext2_pathconf, .vop_print = ext2_print, .vop_read = VOP_PANIC, .vop_reclaim = ext2_reclaim, @@ -1596,11 +1597,11 @@ ext2_pathconf(struct vop_pathconf_args *ap) case _PC_NAME_MAX: *ap->a_retval = NAME_MAX; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; + if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO) + *ap->a_retval = PIPE_BUF; + else + error = EINVAL; break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; @@ -1627,11 +1628,6 @@ ext2_pathconf(struct vop_pathconf_args *ap) case _PC_MIN_HOLE_SIZE: *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; break; - case _PC_ASYNC_IO: - /* _PC_ASYNC_IO should have been handled by upper layers. */ - KASSERT(0, ("_PC_ASYNC_IO should not get here")); - error = EINVAL; - break; case _PC_PRIO_IO: *ap->a_retval = 0; break; @@ -1661,7 +1657,7 @@ ext2_pathconf(struct vop_pathconf_args *ap) break; default: - error = EINVAL; + error = vop_stdpathconf(ap); break; } return (error); Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- stable/11/sys/fs/fdescfs/fdesc_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/fdescfs/fdesc_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -53,6 +53,8 @@ #include #include #include +#include +#include #include #include @@ -68,6 +70,7 @@ struct mtx fdesc_hashmtx; static vop_getattr_t fdesc_getattr; static vop_lookup_t fdesc_lookup; static vop_open_t fdesc_open; +static vop_pathconf_t fdesc_pathconf; static vop_readdir_t fdesc_readdir; static vop_readlink_t fdesc_readlink; static vop_reclaim_t fdesc_reclaim; @@ -80,7 +83,7 @@ static struct vop_vector fdesc_vnodeops = { .vop_getattr = fdesc_getattr, .vop_lookup = fdesc_lookup, .vop_open = fdesc_open, - .vop_pathconf = vop_stdpathconf, + .vop_pathconf = fdesc_pathconf, .vop_readdir = fdesc_readdir, .vop_readlink = fdesc_readlink, .vop_reclaim = fdesc_reclaim, @@ -391,6 +394,33 @@ fdesc_open(struct vop_open_args *ap) */ ap->a_td->td_dupfd = VTOFDESC(vp)->fd_fd; /* XXX */ return (ENODEV); +} + +static int +fdesc_pathconf(struct vop_pathconf_args *ap) +{ + struct vnode *vp = ap->a_vp; + int error; + + switch (ap->a_name) { + case _PC_NAME_MAX: + *ap->a_retval = NAME_MAX; + return (0); + case _PC_LINK_MAX: + if (VTOFDESC(vp)->fd_type == Froot) + *ap->a_retval = 2; + else + *ap->a_retval = 1; + return (0); + default: + vref(vp); + VOP_UNLOCK(vp, 0); + error = kern_fpathconf(curthread, VTOFDESC(vp)->fd_fd, + ap->a_name); + vn_lock(vp, LK_SHARED | LK_RETRY); + vunref(vp); + return (error); + } } static int Modified: stable/11/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- stable/11/sys/fs/fifofs/fifo_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/fifofs/fifo_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -71,7 +71,6 @@ struct fifoinfo { static vop_print_t fifo_print; static vop_open_t fifo_open; static vop_close_t fifo_close; -static vop_pathconf_t fifo_pathconf; static vop_advlock_t fifo_advlock; struct vop_vector fifo_specops = { @@ -87,7 +86,7 @@ struct vop_vector fifo_specops = { .vop_mkdir = VOP_PANIC, .vop_mknod = VOP_PANIC, .vop_open = fifo_open, - .vop_pathconf = fifo_pathconf, + .vop_pathconf = VOP_PANIC, .vop_print = fifo_print, .vop_read = VOP_PANIC, .vop_readdir = VOP_PANIC, @@ -337,34 +336,6 @@ fifo_print(ap) fifo_printinfo(ap->a_vp); printf("\n"); return (0); -} - -/* - * Return POSIX pathconf information applicable to fifo's. - */ -static int -fifo_pathconf(ap) - struct vop_pathconf_args /* { - struct vnode *a_vp; - int a_name; - int *a_retval; - } */ *ap; -{ - - switch (ap->a_name) { - case _PC_LINK_MAX: - *ap->a_retval = LINK_MAX; - return (0); - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - return (0); - case _PC_CHOWN_RESTRICTED: - *ap->a_retval = 1; - return (0); - default: - return (EINVAL); - } - /* NOTREACHED */ } /* Modified: stable/11/sys/fs/fuse/fuse_vnops.c ============================================================================== --- stable/11/sys/fs/fuse/fuse_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/fuse/fuse_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -123,6 +123,7 @@ static vop_lookup_t fuse_vnop_lookup; static vop_mkdir_t fuse_vnop_mkdir; static vop_mknod_t fuse_vnop_mknod; static vop_open_t fuse_vnop_open; +static vop_pathconf_t fuse_vnop_pathconf; static vop_read_t fuse_vnop_read; static vop_readdir_t fuse_vnop_readdir; static vop_readlink_t fuse_vnop_readlink; @@ -155,7 +156,7 @@ struct vop_vector fuse_vnops = { .vop_mkdir = fuse_vnop_mkdir, .vop_mknod = fuse_vnop_mknod, .vop_open = fuse_vnop_open, - .vop_pathconf = vop_stdpathconf, + .vop_pathconf = fuse_vnop_pathconf, .vop_read = fuse_vnop_read, .vop_readdir = fuse_vnop_readdir, .vop_readlink = fuse_vnop_readlink, @@ -1170,6 +1171,31 @@ fuse_vnop_open(struct vop_open_args *ap) error = fuse_filehandle_open(vp, fufh_type, NULL, td, cred); return error; +} + +static int +fuse_vnop_pathconf(struct vop_pathconf_args *ap) +{ + + switch (ap->a_name) { + case _PC_FILESIZEBITS: + *ap->a_retval = 64; + return (0); + case _PC_NAME_MAX: + *ap->a_retval = NAME_MAX; + return (0); + case _PC_LINK_MAX: + *ap->a_retval = FUSE_LINK_MAX; + return (0); + case _PC_SYMLINK_MAX: + *ap->a_retval = MAXPATHLEN; + return (0); + case _PC_NO_TRUNC: + *ap->a_retval = 1; + return (0); + default: + return (vop_stdpathconf(ap)); + } } /* Modified: stable/11/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/msdosfs/msdosfs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -1891,15 +1891,15 @@ msdosfs_pathconf(struct vop_pathconf_args *ap) struct msdosfsmount *pmp = VTODE(ap->a_vp)->de_pmp; switch (ap->a_name) { + case _PC_FILESIZEBITS: + *ap->a_retval = 32; + return (0); case _PC_LINK_MAX: *ap->a_retval = 1; return (0); case _PC_NAME_MAX: *ap->a_retval = pmp->pm_flags & MSDOSFSMNT_LONGNAME ? WIN_MAXLEN : 12; return (0); - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - return (0); case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; return (0); @@ -1907,7 +1907,7 @@ msdosfs_pathconf(struct vop_pathconf_args *ap) *ap->a_retval = 0; return (0); default: - return (EINVAL); + return (vop_stdpathconf(ap)); } /* NOTREACHED */ } Modified: stable/11/sys/fs/nandfs/nandfs_vnops.c ============================================================================== --- stable/11/sys/fs/nandfs/nandfs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/nandfs/nandfs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -2240,13 +2240,13 @@ nandfs_pathconf(struct vop_pathconf_args *ap) *ap->a_retval = LINK_MAX; break; case _PC_NAME_MAX: - *ap->a_retval = NAME_MAX; + *ap->a_retval = NANDFS_NAME_LEN; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; + if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO) + *ap->a_retval = PIPE_BUF; + else + error = EINVAL; break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; @@ -2273,7 +2273,7 @@ nandfs_pathconf(struct vop_pathconf_args *ap) *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; break; default: - error = EINVAL; + error = vop_stdpathconf(ap); break; } return (error); @@ -2418,6 +2418,7 @@ struct vop_vector nandfs_fifoops = { .vop_close = nandfsfifo_close, .vop_getattr = nandfs_getattr, .vop_inactive = nandfs_inactive, + .vop_pathconf = nandfs_pathconf, .vop_print = nandfs_print, .vop_read = VOP_PANIC, .vop_reclaim = nandfs_reclaim, Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/nfsclient/nfs_clvnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -187,6 +187,7 @@ struct vop_vector newnfs_fifoops = { .vop_fsync = nfs_fsync, .vop_getattr = nfs_getattr, .vop_inactive = ncl_inactive, + .vop_pathconf = nfs_pathconf, .vop_print = nfs_print, .vop_read = nfsfifo_read, .vop_reclaim = ncl_reclaim, @@ -3465,11 +3466,11 @@ nfs_pathconf(struct vop_pathconf_args *ap) case _PC_NAME_MAX: *ap->a_retval = pc.pc_namemax; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; + if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO) + *ap->a_retval = PIPE_BUF; + else + error = EINVAL; break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = pc.pc_chownrestricted; @@ -3496,11 +3497,6 @@ nfs_pathconf(struct vop_pathconf_args *ap) case _PC_MAC_PRESENT: *ap->a_retval = 0; break; - case _PC_ASYNC_IO: - /* _PC_ASYNC_IO should have been handled by upper layers. */ - KASSERT(0, ("_PC_ASYNC_IO should not get here")); - error = EINVAL; - break; case _PC_PRIO_IO: *ap->a_retval = 0; break; @@ -3533,7 +3529,7 @@ nfs_pathconf(struct vop_pathconf_args *ap) break; default: - error = EINVAL; + error = vop_stdpathconf(ap); break; } return (error); Modified: stable/11/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- stable/11/sys/fs/smbfs/smbfs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/smbfs/smbfs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -897,8 +897,12 @@ smbfs_pathconf (ap) int error = 0; switch (ap->a_name) { - case _PC_LINK_MAX: - *retval = 0; + case _PC_FILESIZEBITS: + if (vcp->vc_sopt.sv_caps & (SMB_CAP_LARGE_READX | + SMB_CAP_LARGE_WRITEX)) + *retval = 64; + else + *retval = 32; break; case _PC_NAME_MAX: *retval = (vcp->vc_hflags2 & SMB_FLAGS2_KNOWS_LONG_NAMES) ? 255 : 12; @@ -906,8 +910,11 @@ smbfs_pathconf (ap) case _PC_PATH_MAX: *retval = 800; /* XXX: a correct one ? */ break; + case _PC_NO_TRUNC: + *retval = 1; + break; default: - error = EINVAL; + error = vop_stdpathconf(ap); } return error; } Modified: stable/11/sys/fs/tmpfs/tmpfs_fifoops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_fifoops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/tmpfs/tmpfs_fifoops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -69,5 +69,6 @@ struct vop_vector tmpfs_fifoop_entries = { .vop_access = tmpfs_access, .vop_getattr = tmpfs_getattr, .vop_setattr = tmpfs_setattr, + .vop_pathconf = tmpfs_pathconf, .vop_print = tmpfs_print, }; Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -1333,9 +1333,10 @@ tmpfs_print(struct vop_print_args *v) return 0; } -static int +int tmpfs_pathconf(struct vop_pathconf_args *v) { + struct vnode *vp = v->a_vp; int name = v->a_name; register_t *retval = v->a_retval; @@ -1352,12 +1353,11 @@ tmpfs_pathconf(struct vop_pathconf_args *v) *retval = NAME_MAX; break; - case _PC_PATH_MAX: - *retval = PATH_MAX; - break; - case _PC_PIPE_BUF: - *retval = PIPE_BUF; + if (vp->v_type == VDIR || vp->v_type == VFIFO) + *retval = PIPE_BUF; + else + error = EINVAL; break; case _PC_CHOWN_RESTRICTED: @@ -1373,11 +1373,11 @@ tmpfs_pathconf(struct vop_pathconf_args *v) break; case _PC_FILESIZEBITS: - *retval = 0; /* XXX Don't know which value should I return. */ + *retval = 64; break; default: - error = EINVAL; + error = vop_stdpathconf(v); } return error; Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.h ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.h Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.h Tue Jan 23 20:08:25 2018 (r328298) @@ -49,6 +49,7 @@ extern struct vop_vector tmpfs_vnodeop_nonc_entries; vop_access_t tmpfs_access; vop_getattr_t tmpfs_getattr; vop_setattr_t tmpfs_setattr; +vop_pathconf_t tmpfs_pathconf; vop_print_t tmpfs_print; vop_reclaim_t tmpfs_reclaim; Modified: stable/11/sys/fs/udf/udf_vnops.c ============================================================================== --- stable/11/sys/fs/udf/udf_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/fs/udf/udf_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -100,6 +100,7 @@ struct vop_vector udf_fifoops = { .vop_default = &fifo_specops, .vop_access = udf_access, .vop_getattr = udf_getattr, + .vop_pathconf = udf_pathconf, .vop_print = udf_print, .vop_reclaim = udf_reclaim, .vop_setattr = udf_setattr, @@ -383,20 +384,29 @@ udf_pathconf(struct vop_pathconf_args *a) { switch (a->a_name) { + case _PC_FILESIZEBITS: + *a->a_retval = 64; + return (0); case _PC_LINK_MAX: *a->a_retval = 65535; return (0); case _PC_NAME_MAX: *a->a_retval = NAME_MAX; return (0); - case _PC_PATH_MAX: - *a->a_retval = PATH_MAX; + case _PC_SYMLINK_MAX: + *a->a_retval = MAXPATHLEN; return (0); case _PC_NO_TRUNC: *a->a_retval = 1; return (0); - default: + case _PC_PIPE_BUF: + if (a->a_vp->v_type == VDIR || a->a_vp->v_type == VFIFO) { + *a->a_retval = PIPE_BUF; + return (0); + } return (EINVAL); + default: + return (vop_stdpathconf(a)); } } Modified: stable/11/sys/kern/kern_descrip.c ============================================================================== --- stable/11/sys/kern/kern_descrip.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/kern/kern_descrip.c Tue Jan 23 20:08:25 2018 (r328298) @@ -1386,26 +1386,33 @@ struct fpathconf_args { int sys_fpathconf(struct thread *td, struct fpathconf_args *uap) { + + return (kern_fpathconf(td, uap->fd, uap->name)); +} + +int +kern_fpathconf(struct thread *td, int fd, int name) +{ struct file *fp; struct vnode *vp; cap_rights_t rights; int error; - error = fget(td, uap->fd, cap_rights_init(&rights, CAP_FPATHCONF), &fp); + error = fget(td, fd, cap_rights_init(&rights, CAP_FPATHCONF), &fp); if (error != 0) return (error); - if (uap->name == _PC_ASYNC_IO) { + if (name == _PC_ASYNC_IO) { td->td_retval[0] = _POSIX_ASYNCHRONOUS_IO; goto out; } vp = fp->f_vnode; if (vp != NULL) { vn_lock(vp, LK_SHARED | LK_RETRY); - error = VOP_PATHCONF(vp, uap->name, td->td_retval); + error = VOP_PATHCONF(vp, name, td->td_retval); VOP_UNLOCK(vp, 0); } else if (fp->f_type == DTYPE_PIPE || fp->f_type == DTYPE_SOCKET) { - if (uap->name != _PC_PIPE_BUF) { + if (name != _PC_PIPE_BUF) { error = EINVAL; } else { td->td_retval[0] = PIPE_BUF; Modified: stable/11/sys/kern/vfs_default.c ============================================================================== --- stable/11/sys/kern/vfs_default.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/kern/vfs_default.c Tue Jan 23 20:08:25 2018 (r328298) @@ -477,29 +477,8 @@ vop_stdpathconf(ap) case _PC_ASYNC_IO: *ap->a_retval = _POSIX_ASYNCHRONOUS_IO; return (0); - case _PC_NAME_MAX: - *ap->a_retval = NAME_MAX; - return (0); case _PC_PATH_MAX: *ap->a_retval = PATH_MAX; - return (0); - case _PC_LINK_MAX: - *ap->a_retval = LINK_MAX; - return (0); - case _PC_MAX_CANON: - *ap->a_retval = MAX_CANON; - return (0); - case _PC_MAX_INPUT: - *ap->a_retval = MAX_INPUT; - return (0); - case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; - return (0); - case _PC_CHOWN_RESTRICTED: - *ap->a_retval = 1; - return (0); - case _PC_VDISABLE: - *ap->a_retval = _POSIX_VDISABLE; return (0); default: return (EINVAL); Modified: stable/11/sys/sys/syscallsubr.h ============================================================================== --- stable/11/sys/sys/syscallsubr.h Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/sys/syscallsubr.h Tue Jan 23 20:08:25 2018 (r328298) @@ -110,6 +110,7 @@ int kern_fcntl(struct thread *td, int fd, int cmd, int int kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long arg); int kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf); int kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf); +int kern_fpathconf(struct thread *td, int fd, int name); int kern_fstat(struct thread *td, int fd, struct stat *sbp); int kern_fstatfs(struct thread *td, int fd, struct statfs *buf); int kern_fsync(struct thread *td, int fd, bool fullsync); Modified: stable/11/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/11/sys/ufs/ufs/ufs_vnops.c Tue Jan 23 20:07:51 2018 (r328297) +++ stable/11/sys/ufs/ufs/ufs_vnops.c Tue Jan 23 20:08:25 2018 (r328298) @@ -122,7 +122,6 @@ static vop_symlink_t ufs_symlink; static vop_whiteout_t ufs_whiteout; static vop_close_t ufsfifo_close; static vop_kqfilter_t ufsfifo_kqfilter; -static vop_pathconf_t ufsfifo_pathconf; SYSCTL_NODE(_vfs, OID_AUTO, ufs, CTLFLAG_RD, 0, "UFS filesystem"); @@ -2405,30 +2404,6 @@ ufsfifo_kqfilter(ap) } /* - * Return POSIX pathconf information applicable to fifos. - */ -static int -ufsfifo_pathconf(ap) - struct vop_pathconf_args /* { - struct vnode *a_vp; - int a_name; - int *a_retval; - } */ *ap; -{ - - switch (ap->a_name) { - case _PC_ACL_EXTENDED: - case _PC_ACL_NFS4: - case _PC_ACL_PATH_MAX: - case _PC_MAC_PRESENT: - return (ufs_pathconf(ap)); - default: - return (fifo_specops.vop_pathconf(ap)); - } - /* NOTREACHED */ -} - -/* * Return POSIX pathconf information applicable to ufs filesystems. */ static int @@ -2443,17 +2418,14 @@ ufs_pathconf(ap) error = 0; switch (ap->a_name) { - case _PC_LINK_MAX: - *ap->a_retval = LINK_MAX; - break; case _PC_NAME_MAX: *ap->a_retval = NAME_MAX; break; - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - break; case _PC_PIPE_BUF: - *ap->a_retval = PIPE_BUF; + if (ap->a_vp->v_type == VDIR || ap->a_vp->v_type == VFIFO) + *ap->a_retval = PIPE_BUF; + else + error = EINVAL; break; case _PC_CHOWN_RESTRICTED: *ap->a_retval = 1; @@ -2506,11 +2478,6 @@ ufs_pathconf(ap) case _PC_MIN_HOLE_SIZE: *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; break; - case _PC_ASYNC_IO: - /* _PC_ASYNC_IO should have been handled by upper layers. */ - KASSERT(0, ("_PC_ASYNC_IO should not get here")); - error = EINVAL; - break; case _PC_PRIO_IO: *ap->a_retval = 0; break; @@ -2540,7 +2507,7 @@ ufs_pathconf(ap) break; default: - error = EINVAL; + error = vop_stdpathconf(ap); break; } return (error); @@ -2813,7 +2780,7 @@ struct vop_vector ufs_fifoops = { .vop_inactive = ufs_inactive, .vop_kqfilter = ufsfifo_kqfilter, .vop_markatime = ufs_markatime, - .vop_pathconf = ufsfifo_pathconf, + .vop_pathconf = ufs_pathconf, .vop_print = ufs_print, .vop_read = VOP_PANIC, .vop_reclaim = ufs_reclaim, From owner-svn-src-stable@freebsd.org Wed Jan 24 00:11: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 CB68FED3FA3; Wed, 24 Jan 2018 00:11:46 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7FEA26DC1A; Wed, 24 Jan 2018 00:11:46 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AD7216329; Wed, 24 Jan 2018 00:11:46 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0O0BkcK036954; Wed, 24 Jan 2018 00:11:46 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O0Bk5S036953; Wed, 24 Jan 2018 00:11:46 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801240011.w0O0Bk5S036953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 24 Jan 2018 00:11:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328308 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 328308 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 24 Jan 2018 00:11:47 -0000 Author: pfg Date: Wed Jan 24 00:11:46 2018 New Revision: 328308 URL: https://svnweb.freebsd.org/changeset/base/328308 Log: MFC r328221: Define a new __alloc_size2 attribute to complement the existing support. At least on GCC7, calling __alloc_size(x) twice is not equivalent to calling using the attribute once with two arguments. The later is the documented use in GCC documentation so add a new alloc_size(n, x) alternative to cover for the few places where it is used: basically: calloc(3), reallocarray(3) and mallocarray(9). Submitted by: Mark Millard Modified: stable/11/sys/sys/cdefs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/cdefs.h ============================================================================== --- stable/11/sys/sys/cdefs.h Tue Jan 23 23:30:19 2018 (r328307) +++ stable/11/sys/sys/cdefs.h Wed Jan 24 00:11:46 2018 (r328308) @@ -239,8 +239,10 @@ #endif #if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__) #define __alloc_size(x) __attribute__((__alloc_size__(x))) +#define __alloc_size2(n, x) __attribute__((__alloc_size__(n, x))) #else #define __alloc_size(x) +#define __alloc_size2(n, x) #endif #if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__) #define __alloc_align(x) __attribute__((__alloc_align__(x))) From owner-svn-src-stable@freebsd.org Wed Jan 24 00:32: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 EB536ED59A8; Wed, 24 Jan 2018 00:32:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 989FA6EBB3; Wed, 24 Jan 2018 00:32:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93A47165DB; Wed, 24 Jan 2018 00:32:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0O0W2Kd047620; Wed, 24 Jan 2018 00:32:02 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O0W2AU047619; Wed, 24 Jan 2018 00:32:02 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801240032.w0O0W2AU047619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 00:32:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328309 - in stable: 10/tests/sys/kern 11/tests/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/tests/sys/kern 11/tests/sys/kern X-SVN-Commit-Revision: 328309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 24 Jan 2018 00:32:03 -0000 Author: jhb Date: Wed Jan 24 00:32:02 2018 New Revision: 328309 URL: https://svnweb.freebsd.org/changeset/base/328309 Log: MFC 326953: Catch up to r325719 which makes the kern.proc.pid sysctl "work" for zombies. Some of the ptrace tests need to wait for a child process to become a zombie before preceding. The parent process polls the child process via the kern.proc.pid sysctl to wait for it to become a zombie. Previously the code polled until the sysctl failed with ESRCH. Now it will poll until either the sysctl fails with ESRCH (for compatiblity with older kernels) or returns a kinfo_proc structure with the ki_stat field set to SZOMB. Modified: stable/10/tests/sys/kern/ptrace_test.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/tests/sys/kern/ptrace_test.c Directory Properties: stable/11/ (props changed) Modified: stable/10/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/10/tests/sys/kern/ptrace_test.c Wed Jan 24 00:11:46 2018 (r328308) +++ stable/10/tests/sys/kern/ptrace_test.c Wed Jan 24 00:32:02 2018 (r328309) @@ -103,6 +103,10 @@ wait_for_zombie(pid_t pid) /* * Wait for a process to exit. This is kind of gross, but * there is not a better way. + * + * Prior to r325719, the kern.proc.pid. sysctl failed + * with ESRCH. After that change, a valid struct kinfo_proc + * is returned for zombies with ki_stat set to SZOMB. */ for (;;) { struct kinfo_proc kp; @@ -115,10 +119,11 @@ wait_for_zombie(pid_t pid) mib[3] = pid; len = sizeof(kp); if (sysctl(mib, nitems(mib), &kp, &len, NULL, 0) == -1) { - /* The KERN_PROC_PID sysctl fails for zombies. */ ATF_REQUIRE(errno == ESRCH); break; } + if (kp.ki_stat == SZOMB) + break; usleep(5000); } } From owner-svn-src-stable@freebsd.org Wed Jan 24 00:32: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 0B4EEED59AA; Wed, 24 Jan 2018 00:32:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B37EE6EBB5; Wed, 24 Jan 2018 00:32:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE6EE165DD; Wed, 24 Jan 2018 00:32:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0O0W2PE047626; Wed, 24 Jan 2018 00:32:02 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O0W2GD047625; Wed, 24 Jan 2018 00:32:02 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801240032.w0O0W2GD047625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 00:32:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328309 - in stable: 10/tests/sys/kern 11/tests/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/tests/sys/kern 11/tests/sys/kern X-SVN-Commit-Revision: 328309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 24 Jan 2018 00:32:03 -0000 Author: jhb Date: Wed Jan 24 00:32:02 2018 New Revision: 328309 URL: https://svnweb.freebsd.org/changeset/base/328309 Log: MFC 326953: Catch up to r325719 which makes the kern.proc.pid sysctl "work" for zombies. Some of the ptrace tests need to wait for a child process to become a zombie before preceding. The parent process polls the child process via the kern.proc.pid sysctl to wait for it to become a zombie. Previously the code polled until the sysctl failed with ESRCH. Now it will poll until either the sysctl fails with ESRCH (for compatiblity with older kernels) or returns a kinfo_proc structure with the ki_stat field set to SZOMB. Modified: stable/11/tests/sys/kern/ptrace_test.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/tests/sys/kern/ptrace_test.c Directory Properties: stable/10/ (props changed) Modified: stable/11/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/11/tests/sys/kern/ptrace_test.c Wed Jan 24 00:11:46 2018 (r328308) +++ stable/11/tests/sys/kern/ptrace_test.c Wed Jan 24 00:32:02 2018 (r328309) @@ -104,6 +104,10 @@ wait_for_zombie(pid_t pid) /* * Wait for a process to exit. This is kind of gross, but * there is not a better way. + * + * Prior to r325719, the kern.proc.pid. sysctl failed + * with ESRCH. After that change, a valid struct kinfo_proc + * is returned for zombies with ki_stat set to SZOMB. */ for (;;) { struct kinfo_proc kp; @@ -116,10 +120,11 @@ wait_for_zombie(pid_t pid) mib[3] = pid; len = sizeof(kp); if (sysctl(mib, nitems(mib), &kp, &len, NULL, 0) == -1) { - /* The KERN_PROC_PID sysctl fails for zombies. */ ATF_REQUIRE(errno == ESRCH); break; } + if (kp.ki_stat == SZOMB) + break; usleep(5000); } } From owner-svn-src-stable@freebsd.org Wed Jan 24 00:52:26 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 9658CED7414; Wed, 24 Jan 2018 00:52:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4AF886FDCC; Wed, 24 Jan 2018 00:52:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4479816A6F; Wed, 24 Jan 2018 00:52:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0O0qQ9U056682; Wed, 24 Jan 2018 00:52:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0O0qQYk056680; Wed, 24 Jan 2018 00:52:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201801240052.w0O0qQYk056680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 24 Jan 2018 00:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328310 - stable/11/usr.bin/clang/lld X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.bin/clang/lld X-SVN-Commit-Revision: 328310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 24 Jan 2018 00:52:26 -0000 Author: emaste Date: Wed Jan 24 00:52:25 2018 New Revision: 328310 URL: https://svnweb.freebsd.org/changeset/base/328310 Log: MFC r327770: lld: introduce basic man page Upstream lld has no man page. Introduce a basic one for FreeBSD based on ld.lld --help, with a brief introduction and additional detail for some options. We'll continue refining this in FreeBSD, and then submit it upstream once the first round of edits are complete. Submitted by: krion, Arshan Khanifar, emaste, bjk Sponsored by: The FreeBSD Foundation Added: stable/11/usr.bin/clang/lld/ld.lld.1 - copied unchanged from r327770, head/usr.bin/clang/lld/ld.lld.1 Modified: stable/11/usr.bin/clang/lld/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/clang/lld/Makefile ============================================================================== --- stable/11/usr.bin/clang/lld/Makefile Wed Jan 24 00:32:02 2018 (r328309) +++ stable/11/usr.bin/clang/lld/Makefile Wed Jan 24 00:52:25 2018 (r328310) @@ -7,9 +7,10 @@ LLD_SRCS= ${LLVM_SRCS}/tools/lld PACKAGE= lld PROG_CXX= ld.lld -MAN= + .if ${MK_LLD_IS_LD} != "no" SYMLINKS= ${PROG_CXX} ${BINDIR}/ld +MLINKS= ld.lld.1 ld.1 .endif CFLAGS+= -I${LLD_SRCS}/ELF Copied: stable/11/usr.bin/clang/lld/ld.lld.1 (from r327770, head/usr.bin/clang/lld/ld.lld.1) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/usr.bin/clang/lld/ld.lld.1 Wed Jan 24 00:52:25 2018 (r328310, copy of r327770, head/usr.bin/clang/lld/ld.lld.1) @@ -0,0 +1,364 @@ +.\"- +.\" Copyright (c) 2018 Kirill Ponomarev +.\" Copyright (c) 2018 The FreeBSD Foundation +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 10, 2018 +.Dt LD.LLD 1 +.Os +.Sh NAME +.Nm ld.lld +.Nd ELF linker from the LLVM project +.Sh SYNOPSIS +.Nm ld.lld +.Op Ar options +.Ar objfile ... +.Sh DESCRIPTION +A linker takes one or more object, archive and library files, and combines +them into an output file (an executable, a shared library, or another object +file). +It relocates code and data from the input files and resolves symbol +references between them. +.Pp +.Nm +is a drop-in replacement for the GNU BFD and gold linkers. +It accepts most of the same command line arguments and linker scripts +as GNU linkers. +.Pp +The following options are available: +.Bl -tag -width indent +.It Fl -allow-multiple-definition +Allow multiple definitions. +.It Fl -as-needed +Only set +.Dv DT_NEEDED +for shared libraries if used. +.It Fl -auxiliary Ar value +Set the +.Dv DT_AUXILIARY +field to the specified name. +.It Fl -Bdynamic +Link against shared libraries. +.It Fl -Bstatic +Do not link against shared libraries. +.It Fl -Bsymbolic-functions +Bind defined function symbols locally. +.It Fl -Bsymbolic +Bind defined symbols locally. +.It Fl -build-id= Ns Ar value +Generate a build ID note. +.It Fl -build-id +Generate a build ID note. +.It Fl -color-diagnostics= Ns Ar value +Use colors in diagnostics. +.It Fl -color-diagnostics +Use colors in diagnostics. +.It Fl -compress-debug-sections= Ns Ar value +Compress DWARF debug sections. +.It Fl -define-common +Assign space to common symbols. +.It Fl -defsym= Ns Ar value +Define a symbol alias. +.It Fl -demangle +Demangle symbol names. +.It Fl -disable-new-dtags +Disable new dynamic tags. +.It Fl -discard-all +Delete all local symbols. +.It Fl -discard-locals +Delete temporary local symbols. +.It Fl -discard-none +Keep all symbols in the symbol table. +.It Fl -dynamic-linker Ar value +Specify the dynamic linker to be used for a dynamically linked executable. +This is recorded in an ELF segment of type +.Dv PT_INTERP . +.It Fl -dynamic-list Ar value +Read a list of dynamic symbols. +.It Fl -eh-frame-hdr +Request creation of +.Li .eh_frame_hdr +section and +.Dv PT_GNU_EH_FRAME +segment header. +.It Fl -emit-relocs +Generate relocations in the output. +.It Fl -enable-new-dtags +Enable new dynamic tags. +.It Fl -end-lib +End a grouping of objects that should be treated as if they were together +in an archive. +.It Fl -entry Ar entry +Name of entry point symbol. +.It Fl -error-limit Ar value +Maximum number of errors to emit before stopping. +A value of zero indicates that there is no limit. +.It Fl -error-unresolved-symbols +Report unresolved symbols as errors. +.It Fl -exclude-libs Ar value +Exclude static libraries from automatic export. +.It Fl -export-dynamic-symbol Ar value +Put a symbol in the dynamic symbol table. +.It Fl -export-dynamic +Put symbols in the dynamic symbol table. +.It Fl -fatal-warnings +Treat warnings as errors. +.It Fl -filter= Ns Ar value +Set the +.Dv DT_FILTER +field to the specified value. +.It Fl -fini Ar symbol +Specify a finalizer function. +.It Fl -format= Ns Ar input-format +Change the input format of the inputs following this option. +.It Fl -full-shutdown +Perform a full shutdown instead of calling +.Fn _exit . +.It Fl -gc-sections +Enable garbage collection of unused sections. +.It Fl -gdb-index +Generate +.Li .gdb_index +section. +.It Fl -hash-style Ar value +Specify hash style (sysv, gnu or both). +.It Fl -help +Print a usage message. +.It Fl -icf=all +Enable identical code folding. +.It Fl -icf=none +Disable identical code folding. +.It Fl -image-base= Ns Ar value +Set the base address to +.Ar value . +.It Fl -init Ar symbol +Specify an initializer function. +.It Fl -lto-aa-pipeline= Ns Ar value +AA pipeline to run during LTO. +Used in conjunction with +.Fl -lto-newpm-passes . +.It Fl -lto-newpm-passes= Ns Ar value +Passes to run during LTO. +.It Fl -lto-O Ar opt-level +Optimization level for LTO. +.It Fl -lto-partitions= Ns Ar value +Number of LTO codegen partitions. +.It Fl L Ar dir +Add a directory to the library search path. +.It Fl l Ar libName +Root name of library to use. +.It Fl -Map Ar value +Print a link map to the specified file. +.It Fl m Ar value +Set target emulation. +.It Fl -no-as-needed +Always set +.Dv DT_NEEDED +for shared libraries. +.It Fl -no-color-diagnostics +Do not use colors in diagnostics. +.It Fl -no-define-common +Do not assign space to common symbols. +.It Fl -no-demangle +Do not demangle symbol names. +.It Fl -no-dynamic-linker +Inhibit output of an +.Li .interp +section. +.It Fl -no-gc-sections +Disable garbage collection of unused sections. +.It Fl -no-gnu-unique +Disable STB_GNU_UNIQUE symbol binding. +.It Fl -no-rosegment +Do not put read-only non-executable sections in their own segment. +.It Fl -no-threads +Do not run the linker multi-threaded. +.It Fl -no-undefined-version +Report version scripts that refer undefined symbols. +.It Fl -no-undefined +Report unresolved symbols even if the linker is creating a shared library. +.It Fl -no-whole-archive +Restores the default behavior of loading archive members. +.It Fl -noinhibit-exec +Retain the executable output file whenever it is still usable. +.It Fl -nopie +Do not create a position independent executable. +.It Fl -nostdlib +Only search directories specified on the command line. +.It Fl -oformat Ar format +Specify the binary format for the output object file. +.It Fl -omagic +Set the text and data sections to be readable and writable. +.It Fl -opt-remarks-filename Ar value +YAML output file for optimization remarks. +.It Fl -opt-remarks-with-hotness +Include hotness information in the optimization remarks file. +.It Fl O Ar value +Optimize output file size. +.It Fl o Ar path +Write the output executable, library or object to +.Ar path . +If not specified, +.Dv a.out +is used as a default. +.It Fl -pie +Create a position independent executable. +.It Fl -print-gc-sections +List removed unused sections. +.It Fl -print-map +Print a link map to the standard output. +.It Fl -relocatable +Create relocatable object file. +.It Fl -reproduce Ar value +Dump linker invocation and input files for debugging. +.It Fl -retain-symbols-file= Ns Ar file +Retain only the symbols listed in the file. +.It Fl -rpath Ar value +Add a +.Dv DT_RUNPATH +to the output. +.It Fl -rsp-quoting= Ns Ar value +Quoting style for response files. +The supported values are +.Ar windows +and +.Ar posix . +.It Fl -script Ar value +Read linker script from the path +.Ar value . +.It Fl -section-start Ar address +Set address of section. +.It Fl -shared +Build a shared object. +.It Fl -soname= Ns Ar value +Set +.Dv DT_SONAME +to +.Ar value . +.It Fl -sort-section Ar value +Specifies sections sorting rule when linkerscript is used. +.It Fl -start-lib +Start a grouping of objects that should be treated as if they were together +in an archive. +.It Fl -strip-all +Strip all symbols. +.It Fl -strip-debug +Strip debugging information. +.It Fl -symbol-ordering-file Ar value +Lay out sections in the order specified by the symbol file. +.It Fl -sysroot= Ns Ar value +Set the system root. +.It Fl -target1-abs +Interpret +.Dv R_ARM_TARGET1 +as +.Dv R_ARM_ABS32 . +.It Fl -target1-rel +Interpret +.Dv R_ARM_TARGET1 +as +.Dv R_ARM_REL32 . +.It Fl -target2=type +Interpret +.Dv R_ARM_TARGET2 +as +.Ar type , +where +.Ar type +is one of +.Li rel , +.Li abs , +or +.Li got-rel . +.It Fl -Tbss Ar value +Same as +.Fl -section-start +with +.Li .bss +as the sectionname. +.It Fl -Tdata Ar value +Same as +.Fl -section-start +with +.Li .data +as the sectionname. +.It Fl -thinlto-cache-dir= Ns Ar value +Path to ThinLTO cached object file directory. +.It Fl -thinlto-cache-policy Ar value +Pruning policy for the ThinLTO cache. +.It Fl -thinlto-jobs= Ns Ar value +Number of ThinLTO jobs. +.It Fl -threads +Run the linker multi-threaded. +.It Fl -trace-symbol Ar value +Trace references to symbols. +.It Fl -trace +Print the names of the input files. +.It Fl -Ttext Ar value +Same as +.Fl -section-start +with +.Li .text +as the sectionname. +.It Fl -undefined Ar value +Force undefined symbol during linking. +.It Fl -unresolved-symbols= Ns Ar value +Determine how to handle unresolved symbols. +.It Fl -verbose +Verbose mode. +.It Fl -version-script Ar value +Read a version script. +.It Fl V , Fl -version +Display the version number and exit. +.It Fl v +Display the version number, and proceed with linking if object files are +specified. +.It Fl -warn-common +Warn about duplicate common symbols. +.It Fl -warn-unresolved-symbols +Report unresolved symbols as warnings. +.It Fl -whole-archive +Force load of all members in a static library. +.It Fl -wrap Ar symbol +Use wrapper functions for symbol. +.It Fl z Ar option +Linker option extensions. +.Bl -tag -width indent +.It Cm notext +Allow relocations against read-only segments. +Sets the +.Dv DT_TEXTREL flag in the +.Dv DYNAMIC +section. +.It Cm text +Do not allow relocations against read-only segments. +This is the default. +.El +.El +.Sh IMPLEMENTATION NOTES +The targets supported by +.Nm +are: +elf32-i386 elf32-iamcu elf32-littlearm elf32-ntradbigmips elf32-ntradlittlemips elf32-powerpc elf32-tradbigmips elf32-tradlittlemips elf32-x86-64 elf64-amdgpu elf64-littleaarch64 elf64-powerpc elf64-tradbigmips elf64-tradlittlemips elf64-x86-64 From owner-svn-src-stable@freebsd.org Wed Jan 24 10:50: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 F0272ECCA25; Wed, 24 Jan 2018 10:50:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 97AA482E40; Wed, 24 Jan 2018 10:50:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83C751C9E5; Wed, 24 Jan 2018 10:50:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OAoMIK048835; Wed, 24 Jan 2018 10:50:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OAoMvw048833; Wed, 24 Jan 2018 10:50:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801241050.w0OAoMvw048833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 24 Jan 2018 10:50:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328322 - in stable/11/sys/amd64: amd64 include X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys/amd64: amd64 include X-SVN-Commit-Revision: 328322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 24 Jan 2018 10:50:23 -0000 Author: kib Date: Wed Jan 24 10:50:21 2018 New Revision: 328322 URL: https://svnweb.freebsd.org/changeset/base/328322 Log: MFC r328082: Amd64 user_ldt_deref() is not used outside sys_machdep.c. Mark it as static. Modified: stable/11/sys/amd64/amd64/sys_machdep.c stable/11/sys/amd64/include/proc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/sys_machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/sys_machdep.c Wed Jan 24 10:13:14 2018 (r328321) +++ stable/11/sys/amd64/amd64/sys_machdep.c Wed Jan 24 10:50:21 2018 (r328322) @@ -63,6 +63,9 @@ __FBSDID("$FreeBSD$"); #include +static void user_ldt_deref(struct proc_ldt *pldt); +static void user_ldt_derefl(struct proc_ldt *pldt); + #define MAX_LD 8192 int max_ldt_segment = 512; @@ -81,8 +84,6 @@ max_ldt_segment_init(void *arg __unused) } SYSINIT(maxldt, SI_SUB_VM_CONF, SI_ORDER_ANY, max_ldt_segment_init, NULL); -static void user_ldt_derefl(struct proc_ldt *pldt); - #ifndef _SYS_SYSPROTO_H_ struct sysarch_args { int op; @@ -529,7 +530,7 @@ user_ldt_derefl(struct proc_ldt *pldt) } } -void +static void user_ldt_deref(struct proc_ldt *pldt) { Modified: stable/11/sys/amd64/include/proc.h ============================================================================== --- stable/11/sys/amd64/include/proc.h Wed Jan 24 10:13:14 2018 (r328321) +++ stable/11/sys/amd64/include/proc.h Wed Jan 24 10:50:21 2018 (r328322) @@ -90,7 +90,6 @@ struct syscall_args { struct proc_ldt *user_ldt_alloc(struct proc *, int); void user_ldt_free(struct thread *); -void user_ldt_deref(struct proc_ldt *); struct sysarch_args; int sysarch_ldt(struct thread *td, struct sysarch_args *uap, int uap_space); int amd64_set_ldt_data(struct thread *td, int start, int num, From owner-svn-src-stable@freebsd.org Wed Jan 24 12:51: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 8EF27ED26A1; Wed, 24 Jan 2018 12:51:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40E7587E44; Wed, 24 Jan 2018 12:51:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BD051DE39; Wed, 24 Jan 2018 12:51:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OCpEow011826; Wed, 24 Jan 2018 12:51:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OCpEW4011824; Wed, 24 Jan 2018 12:51:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201801241251.w0OCpEW4011824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 24 Jan 2018 12:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328327 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 328327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 24 Jan 2018 12:51:14 -0000 Author: hselasky Date: Wed Jan 24 12:51:13 2018 New Revision: 328327 URL: https://svnweb.freebsd.org/changeset/base/328327 Log: MFC r322596: Add SI_SUB_TASKQ after SI_SUB_INTR and move taskqueue initialization there for EARLY_AP_STARTUP This fixes a regression accidentally introduced in r322588, due to an interaction with EARLY_AP_STARTUP. Discussed with: cem@ Reviewed by: bdrewery@, jhb@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12053 Modified: stable/11/sys/sys/kernel.h stable/11/sys/sys/taskqueue.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/kernel.h ============================================================================== --- stable/11/sys/sys/kernel.h Wed Jan 24 12:40:28 2018 (r328326) +++ stable/11/sys/sys/kernel.h Wed Jan 24 12:51:13 2018 (r328327) @@ -118,6 +118,7 @@ enum sysinit_sub_id { SI_SUB_SCHED_IDLE = 0x2600000, /* required idle procs */ SI_SUB_MBUF = 0x2700000, /* mbuf subsystem */ SI_SUB_INTR = 0x2800000, /* interrupt threads */ + SI_SUB_TASKQ = 0x2880000, /* task queues */ #ifdef EARLY_AP_STARTUP SI_SUB_SMP = 0x2900000, /* start the APs*/ #endif Modified: stable/11/sys/sys/taskqueue.h ============================================================================== --- stable/11/sys/sys/taskqueue.h Wed Jan 24 12:40:28 2018 (r328326) +++ stable/11/sys/sys/taskqueue.h Wed Jan 24 12:51:13 2018 (r328327) @@ -149,7 +149,7 @@ taskqueue_define_##name(void *arg) \ init; \ } \ \ -SYSINIT(taskqueue_##name, SI_SUB_INIT_IF, SI_ORDER_SECOND, \ +SYSINIT(taskqueue_##name, SI_SUB_TASKQ, SI_ORDER_SECOND, \ taskqueue_define_##name, NULL); \ \ struct __hack @@ -174,7 +174,7 @@ taskqueue_define_##name(void *arg) \ init; \ } \ \ -SYSINIT(taskqueue_##name, SI_SUB_INIT_IF, SI_ORDER_SECOND, \ +SYSINIT(taskqueue_##name, SI_SUB_TASKQ, SI_ORDER_SECOND, \ taskqueue_define_##name, NULL); \ \ struct __hack From owner-svn-src-stable@freebsd.org Wed Jan 24 13:12: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 AD3C5ED35D9; Wed, 24 Jan 2018 13:12:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5BB5488AA1; Wed, 24 Jan 2018 13:12:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56BAA1E1B9; Wed, 24 Jan 2018 13:12:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0ODCM55023587; Wed, 24 Jan 2018 13:12:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0ODCMro023584; Wed, 24 Jan 2018 13:12:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201801241312.w0ODCMro023584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 24 Jan 2018 13:12:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328328 - in stable/11/sys: kern net sys X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: kern net sys X-SVN-Commit-Revision: 328328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 24 Jan 2018 13:12:22 -0000 Author: hselasky Date: Wed Jan 24 13:12:21 2018 New Revision: 328328 URL: https://svnweb.freebsd.org/changeset/base/328328 Log: MFC r314502: Make gtaskqueue compatible with drm-next such that they can be used with the linuxkpi tasklets. Submitted by: mmacy@nextbsd.org Reported by: hselasky (hps) Modified: stable/11/sys/kern/subr_gtaskqueue.c stable/11/sys/net/iflib.c stable/11/sys/sys/gtaskqueue.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/11/sys/kern/subr_gtaskqueue.c Wed Jan 24 12:51:13 2018 (r328327) +++ stable/11/sys/kern/subr_gtaskqueue.c Wed Jan 24 13:12:21 2018 (r328328) @@ -52,6 +52,7 @@ static MALLOC_DEFINE(M_GTASKQUEUE, "taskqueue", "Task static void gtaskqueue_thread_enqueue(void *); static void gtaskqueue_thread_loop(void *arg); +TASKQGROUP_DEFINE(softirq, mp_ncpus, 1); struct gtaskqueue_busy { struct gtask *tb_running; Modified: stable/11/sys/net/iflib.c ============================================================================== --- stable/11/sys/net/iflib.c Wed Jan 24 12:51:13 2018 (r328327) +++ stable/11/sys/net/iflib.c Wed Jan 24 13:12:21 2018 (r328328) @@ -480,7 +480,6 @@ MODULE_VERSION(iflib, 1); MODULE_DEPEND(iflib, pci, 1, 1, 1); MODULE_DEPEND(iflib, ether, 1, 1, 1); -TASKQGROUP_DEFINE(if_io_tqg, mp_ncpus, 1); TASKQGROUP_DEFINE(if_config_tqg, 1, 1); #ifndef IFLIB_DEBUG_COUNTERS @@ -3706,7 +3705,7 @@ iflib_device_deregister(if_ctx_t ctx) if (ctx->ifc_led_dev != NULL) led_destroy(ctx->ifc_led_dev); /* XXX drain any dependent tasks */ - tqg = qgroup_if_io_tqg; + tqg = qgroup_softirq; for (txq = ctx->ifc_txqs, i = 0; i < NTXQSETS(ctx); i++, txq++) { callout_drain(&txq->ift_timer); callout_drain(&txq->ift_db_check); @@ -4328,7 +4327,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, in q = &ctx->ifc_txqs[qid]; info = &ctx->ifc_txqs[qid].ift_filter_info; gtask = &ctx->ifc_txqs[qid].ift_task; - tqg = qgroup_if_io_tqg; + tqg = qgroup_softirq; tqrid = irq->ii_rid; fn = _task_fn_tx; break; @@ -4336,7 +4335,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, in q = &ctx->ifc_rxqs[qid]; info = &ctx->ifc_rxqs[qid].ifr_filter_info; gtask = &ctx->ifc_rxqs[qid].ifr_task; - tqg = qgroup_if_io_tqg; + tqg = qgroup_softirq; tqrid = irq->ii_rid; fn = _task_fn_rx; break; @@ -4384,13 +4383,13 @@ iflib_softirq_alloc_generic(if_ctx_t ctx, int rid, ifl case IFLIB_INTR_TX: q = &ctx->ifc_txqs[qid]; gtask = &ctx->ifc_txqs[qid].ift_task; - tqg = qgroup_if_io_tqg; + tqg = qgroup_softirq; fn = _task_fn_tx; break; case IFLIB_INTR_RX: q = &ctx->ifc_rxqs[qid]; gtask = &ctx->ifc_rxqs[qid].ifr_task; - tqg = qgroup_if_io_tqg; + tqg = qgroup_softirq; fn = _task_fn_rx; break; case IFLIB_INTR_ADMIN: @@ -4441,7 +4440,7 @@ iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filte q = &ctx->ifc_rxqs[0]; info = &rxq[0].ifr_filter_info; gtask = &rxq[0].ifr_task; - tqg = qgroup_if_io_tqg; + tqg = qgroup_softirq; tqrid = irq->ii_rid = *rid; fn = _task_fn_rx; @@ -4457,7 +4456,7 @@ iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filte taskqgroup_attach(tqg, gtask, q, tqrid, name); GROUPTASK_INIT(&txq->ift_task, 0, _task_fn_tx, txq); - taskqgroup_attach(qgroup_if_io_tqg, &txq->ift_task, txq, tqrid, "tx"); + taskqgroup_attach(qgroup_softirq, &txq->ift_task, txq, tqrid, "tx"); GROUPTASK_INIT(&ctx->ifc_admin_task, 0, _task_fn_admin, ctx); taskqgroup_attach(qgroup_if_config_tqg, &ctx->ifc_admin_task, ctx, -1, "admin/link"); @@ -4504,7 +4503,7 @@ void iflib_io_tqg_attach(struct grouptask *gt, void *uniq, int cpu, char *name) { - taskqgroup_attach_cpu(qgroup_if_io_tqg, gt, uniq, cpu, -1, name); + taskqgroup_attach_cpu(qgroup_softirq, gt, uniq, cpu, -1, name); } void Modified: stable/11/sys/sys/gtaskqueue.h ============================================================================== --- stable/11/sys/sys/gtaskqueue.h Wed Jan 24 12:51:13 2018 (r328327) +++ stable/11/sys/sys/gtaskqueue.h Wed Jan 24 13:12:21 2018 (r328328) @@ -121,5 +121,6 @@ SYSINIT(taskqgroup_adj_##name, SI_SUB_SMP, SI_ORDER_AN struct __hack #endif TASKQGROUP_DECLARE(net); +TASKQGROUP_DECLARE(softirq); #endif /* !_SYS_GTASKQUEUE_H_ */ From owner-svn-src-stable@freebsd.org Wed Jan 24 15:15: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 39E3EED8B1C; Wed, 24 Jan 2018 15:15:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E04638D52B; Wed, 24 Jan 2018 15:15:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C25621F511; Wed, 24 Jan 2018 15:15:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OFFIbC083796; Wed, 24 Jan 2018 15:15:18 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OFFI74083795; Wed, 24 Jan 2018 15:15:18 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801241515.w0OFFI74083795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 24 Jan 2018 15:15:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328333 - stable/11/sys/geom/mirror X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/geom/mirror X-SVN-Commit-Revision: 328333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 24 Jan 2018 15:15:19 -0000 Author: markj Date: Wed Jan 24 15:15:18 2018 New Revision: 328333 URL: https://svnweb.freebsd.org/changeset/base/328333 Log: MFC r327496, r327760: Fix some I/O ordering issues in gmirror. Modified: stable/11/sys/geom/mirror/g_mirror.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/11/sys/geom/mirror/g_mirror.c Wed Jan 24 14:24:17 2018 (r328332) +++ stable/11/sys/geom/mirror/g_mirror.c Wed Jan 24 15:15:18 2018 (r328333) @@ -109,7 +109,8 @@ static void g_mirror_update_device(struct g_mirror_sof static void g_mirror_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp); static void g_mirror_sync_stop(struct g_mirror_disk *disk, int type); -static void g_mirror_register_request(struct bio *bp); +static void g_mirror_register_request(struct g_mirror_softc *sc, + struct bio *bp); static void g_mirror_sync_release(struct g_mirror_softc *sc); @@ -890,27 +891,6 @@ g_mirror_unidle(struct g_mirror_softc *sc) } static void -g_mirror_flush_done(struct bio *bp) -{ - struct g_mirror_softc *sc; - struct bio *pbp; - - pbp = bp->bio_parent; - sc = pbp->bio_to->private; - mtx_lock(&sc->sc_done_mtx); - if (pbp->bio_error == 0) - pbp->bio_error = bp->bio_error; - pbp->bio_completed += bp->bio_completed; - pbp->bio_inbed++; - if (pbp->bio_children == pbp->bio_inbed) { - mtx_unlock(&sc->sc_done_mtx); - g_io_deliver(pbp, pbp->bio_error); - } else - mtx_unlock(&sc->sc_done_mtx); - g_destroy_bio(bp); -} - -static void g_mirror_done(struct bio *bp) { struct g_mirror_softc *sc; @@ -924,16 +904,46 @@ g_mirror_done(struct bio *bp) } static void -g_mirror_regular_request(struct bio *bp) +g_mirror_regular_request_error(struct g_mirror_softc *sc, + struct g_mirror_disk *disk, struct bio *bp) { - struct g_mirror_softc *sc; + + if (bp->bio_cmd == BIO_FLUSH && bp->bio_error == EOPNOTSUPP) + return; + + if ((disk->d_flags & G_MIRROR_DISK_FLAG_BROKEN) == 0) { + disk->d_flags |= G_MIRROR_DISK_FLAG_BROKEN; + G_MIRROR_LOGREQ(0, bp, "Request failed (error=%d).", + bp->bio_error); + } else { + G_MIRROR_LOGREQ(1, bp, "Request failed (error=%d).", + bp->bio_error); + } + if (g_mirror_disconnect_on_failure && + g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE) > 1) { + if (bp->bio_error == ENXIO && + bp->bio_cmd == BIO_READ) + sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; + else if (bp->bio_error == ENXIO) + sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID_NOW; + else + sc->sc_bump_id |= G_MIRROR_BUMP_GENID; + g_mirror_event_send(disk, G_MIRROR_DISK_STATE_DISCONNECTED, + G_MIRROR_EVENT_DONTWAIT); + } +} + +static void +g_mirror_regular_request(struct g_mirror_softc *sc, struct bio *bp) +{ struct g_mirror_disk *disk; struct bio *pbp; g_topology_assert_not(); + KASSERT(sc->sc_provider == bp->bio_parent->bio_to, + ("regular request %p with unexpected origin", bp)); pbp = bp->bio_parent; - sc = pbp->bio_to->private; bp->bio_from->index--; if (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_DELETE) sc->sc_writes--; @@ -944,12 +954,24 @@ g_mirror_regular_request(struct bio *bp) g_topology_unlock(); } - if (bp->bio_cmd == BIO_READ) + switch (bp->bio_cmd) { + case BIO_READ: KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_read, bp->bio_error); - else if (bp->bio_cmd == BIO_WRITE) + break; + case BIO_WRITE: KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_write, bp->bio_error); + break; + case BIO_DELETE: + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_delete, + bp->bio_error); + break; + case BIO_FLUSH: + KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_flush, + bp->bio_error); + break; + } pbp->bio_inbed++; KASSERT(pbp->bio_inbed <= pbp->bio_children, @@ -973,35 +995,12 @@ g_mirror_regular_request(struct bio *bp) } else if (bp->bio_error != 0) { if (pbp->bio_error == 0) pbp->bio_error = bp->bio_error; - if (disk != NULL) { - if ((disk->d_flags & G_MIRROR_DISK_FLAG_BROKEN) == 0) { - disk->d_flags |= G_MIRROR_DISK_FLAG_BROKEN; - G_MIRROR_LOGREQ(0, bp, - "Request failed (error=%d).", - bp->bio_error); - } else { - G_MIRROR_LOGREQ(1, bp, - "Request failed (error=%d).", - bp->bio_error); - } - if (g_mirror_disconnect_on_failure && - g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE) > 1) - { - if (bp->bio_error == ENXIO && - bp->bio_cmd == BIO_READ) - sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; - else if (bp->bio_error == ENXIO) - sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID_NOW; - else - sc->sc_bump_id |= G_MIRROR_BUMP_GENID; - g_mirror_event_send(disk, - G_MIRROR_DISK_STATE_DISCONNECTED, - G_MIRROR_EVENT_DONTWAIT); - } - } + if (disk != NULL) + g_mirror_regular_request_error(sc, disk, bp); switch (pbp->bio_cmd) { case BIO_DELETE: case BIO_WRITE: + case BIO_FLUSH: pbp->bio_inbed--; pbp->bio_children--; break; @@ -1026,6 +1025,7 @@ g_mirror_regular_request(struct bio *bp) break; case BIO_DELETE: case BIO_WRITE: + case BIO_FLUSH: if (pbp->bio_children == 0) { /* * All requests failed. @@ -1038,9 +1038,11 @@ g_mirror_regular_request(struct bio *bp) pbp->bio_error = 0; pbp->bio_completed = pbp->bio_length; } - TAILQ_REMOVE(&sc->sc_inflight, pbp, bio_queue); - /* Release delayed sync requests if possible. */ - g_mirror_sync_release(sc); + if (pbp->bio_cmd == BIO_WRITE || pbp->bio_cmd == BIO_DELETE) { + TAILQ_REMOVE(&sc->sc_inflight, pbp, bio_queue); + /* Release delayed sync requests if possible. */ + g_mirror_sync_release(sc); + } g_io_deliver(pbp, pbp->bio_error); break; default: @@ -1113,47 +1115,6 @@ g_mirror_kernel_dump(struct bio *bp) } static void -g_mirror_flush(struct g_mirror_softc *sc, struct bio *bp) -{ - struct bio_queue queue; - struct g_mirror_disk *disk; - struct g_consumer *cp; - struct bio *cbp; - - TAILQ_INIT(&queue); - LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_state != G_MIRROR_DISK_STATE_ACTIVE) - continue; - cbp = g_clone_bio(bp); - if (cbp == NULL) { - while ((cbp = TAILQ_FIRST(&queue)) != NULL) { - TAILQ_REMOVE(&queue, cbp, bio_queue); - g_destroy_bio(cbp); - } - if (bp->bio_error == 0) - bp->bio_error = ENOMEM; - g_io_deliver(bp, bp->bio_error); - return; - } - TAILQ_INSERT_TAIL(&queue, cbp, bio_queue); - cbp->bio_done = g_mirror_flush_done; - cbp->bio_caller1 = disk; - cbp->bio_to = disk->d_consumer->provider; - } - while ((cbp = TAILQ_FIRST(&queue)) != NULL) { - TAILQ_REMOVE(&queue, cbp, bio_queue); - G_MIRROR_LOGREQ(3, cbp, "Sending request."); - disk = cbp->bio_caller1; - cbp->bio_caller1 = NULL; - cp = disk->d_consumer; - KASSERT(cp->acr >= 1 && cp->acw >= 1 && cp->ace >= 1, - ("Consumer %s not opened (r%dw%de%d).", cp->provider->name, - cp->acr, cp->acw, cp->ace)); - g_io_request(cbp, disk->d_consumer); - } -} - -static void g_mirror_start(struct bio *bp) { struct g_mirror_softc *sc; @@ -1172,10 +1133,8 @@ g_mirror_start(struct bio *bp) case BIO_READ: case BIO_WRITE: case BIO_DELETE: - break; case BIO_FLUSH: - g_mirror_flush(sc, bp); - return; + break; case BIO_GETATTR: if (!strcmp(bp->bio_attribute, "GEOM::candelete")) { g_mirror_candelete(bp); @@ -1257,14 +1216,14 @@ g_mirror_regular_collision(struct g_mirror_softc *sc, } /* - * Puts request onto delayed queue. + * Puts regular request onto delayed queue. */ static void g_mirror_regular_delay(struct g_mirror_softc *sc, struct bio *bp) { G_MIRROR_LOGREQ(2, bp, "Delaying request."); - TAILQ_INSERT_HEAD(&sc->sc_regular_delayed, bp, bio_queue); + TAILQ_INSERT_TAIL(&sc->sc_regular_delayed, bp, bio_queue); } /* @@ -1279,23 +1238,23 @@ g_mirror_sync_delay(struct g_mirror_softc *sc, struct } /* - * Releases delayed regular requests which don't collide anymore with sync - * requests. + * Requeue delayed regular requests. */ static void g_mirror_regular_release(struct g_mirror_softc *sc) { - struct bio *bp, *bp2; + struct bio *bp; - TAILQ_FOREACH_SAFE(bp, &sc->sc_regular_delayed, bio_queue, bp2) { - if (g_mirror_sync_collision(sc, bp)) - continue; - TAILQ_REMOVE(&sc->sc_regular_delayed, bp, bio_queue); - G_MIRROR_LOGREQ(2, bp, "Releasing delayed request (%p).", bp); - mtx_lock(&sc->sc_queue_mtx); - TAILQ_INSERT_HEAD(&sc->sc_queue, bp, bio_queue); - mtx_unlock(&sc->sc_queue_mtx); - } + if ((bp = TAILQ_FIRST(&sc->sc_regular_delayed)) == NULL) + return; + if (g_mirror_sync_collision(sc, bp)) + return; + + G_MIRROR_DEBUG(2, "Requeuing regular requests after collision."); + mtx_lock(&sc->sc_queue_mtx); + TAILQ_CONCAT(&sc->sc_regular_delayed, &sc->sc_queue, bio_queue); + TAILQ_SWAP(&sc->sc_regular_delayed, &sc->sc_queue, bio, bio_queue); + mtx_unlock(&sc->sc_queue_mtx); } /* @@ -1343,14 +1302,17 @@ g_mirror_sync_request_free(struct g_mirror_disk *disk, * send. */ static void -g_mirror_sync_request(struct bio *bp) +g_mirror_sync_request(struct g_mirror_softc *sc, struct bio *bp) { - struct g_mirror_softc *sc; struct g_mirror_disk *disk; struct g_mirror_disk_sync *sync; + KASSERT((bp->bio_cmd == BIO_READ && + bp->bio_from->geom == sc->sc_sync.ds_geom) || + (bp->bio_cmd == BIO_WRITE && bp->bio_from->geom == sc->sc_geom), + ("Sync BIO %p with unexpected origin", bp)); + bp->bio_from->index--; - sc = bp->bio_from->geom->softc; disk = bp->bio_from->private; if (disk == NULL) { sx_xunlock(&sc->sc_lock); /* Avoid recursion on sc_lock. */ @@ -1455,7 +1417,7 @@ g_mirror_sync_request(struct bio *bp) else g_io_request(bp, sync->ds_consumer); - /* Release delayed requests if possible. */ + /* Requeue delayed requests if possible. */ g_mirror_regular_release(sc); /* Find the smallest offset */ @@ -1683,11 +1645,26 @@ g_mirror_request_split(struct g_mirror_softc *sc, stru } static void -g_mirror_register_request(struct bio *bp) +g_mirror_register_request(struct g_mirror_softc *sc, struct bio *bp) { - struct g_mirror_softc *sc; + struct bio_queue queue; + struct bio *cbp; + struct g_consumer *cp; + struct g_mirror_disk *disk; - sc = bp->bio_to->private; + sx_assert(&sc->sc_lock, SA_XLOCKED); + + /* + * To avoid ordering issues, if a write is deferred because of a + * collision with a sync request, all I/O is deferred until that + * write is initiated. + */ + if (bp->bio_from->geom != sc->sc_sync.ds_geom && + !TAILQ_EMPTY(&sc->sc_regular_delayed)) { + g_mirror_regular_delay(sc, bp); + return; + } + switch (bp->bio_cmd) { case BIO_READ: switch (sc->sc_balance) { @@ -1707,13 +1684,6 @@ g_mirror_register_request(struct bio *bp) return; case BIO_WRITE: case BIO_DELETE: - { - struct bio_queue queue; - struct g_mirror_disk *disk; - struct g_mirror_disk_sync *sync; - struct g_consumer *cp; - struct bio *cbp; - /* * Delay the request if it is colliding with a synchronization * request. @@ -1742,12 +1712,11 @@ g_mirror_register_request(struct bio *bp) */ TAILQ_INIT(&queue); LIST_FOREACH(disk, &sc->sc_disks, d_next) { - sync = &disk->d_sync; switch (disk->d_state) { case G_MIRROR_DISK_STATE_ACTIVE: break; case G_MIRROR_DISK_STATE_SYNCHRONIZING: - if (bp->bio_offset >= sync->ds_offset) + if (bp->bio_offset >= disk->d_sync.ds_offset) continue; break; default: @@ -1777,6 +1746,8 @@ g_mirror_register_request(struct bio *bp) cp->provider->name, cp->acr, cp->acw, cp->ace)); } if (TAILQ_EMPTY(&queue)) { + KASSERT(bp->bio_cmd == BIO_DELETE, + ("No consumers for regular request %p", bp)); g_io_deliver(bp, EOPNOTSUPP); return; } @@ -1795,7 +1766,42 @@ g_mirror_register_request(struct bio *bp) */ TAILQ_INSERT_TAIL(&sc->sc_inflight, bp, bio_queue); return; - } + case BIO_FLUSH: + TAILQ_INIT(&queue); + LIST_FOREACH(disk, &sc->sc_disks, d_next) { + if (disk->d_state != G_MIRROR_DISK_STATE_ACTIVE) + continue; + cbp = g_clone_bio(bp); + if (cbp == NULL) { + while ((cbp = TAILQ_FIRST(&queue)) != NULL) { + TAILQ_REMOVE(&queue, cbp, bio_queue); + g_destroy_bio(cbp); + } + if (bp->bio_error == 0) + bp->bio_error = ENOMEM; + g_io_deliver(bp, bp->bio_error); + return; + } + TAILQ_INSERT_TAIL(&queue, cbp, bio_queue); + cbp->bio_done = g_mirror_done; + cbp->bio_caller1 = disk; + cbp->bio_to = disk->d_consumer->provider; + } + KASSERT(!TAILQ_EMPTY(&queue), + ("No consumers for regular request %p", bp)); + while ((cbp = TAILQ_FIRST(&queue)) != NULL) { + G_MIRROR_LOGREQ(3, cbp, "Sending request."); + TAILQ_REMOVE(&queue, cbp, bio_queue); + disk = cbp->bio_caller1; + cbp->bio_caller1 = NULL; + cp = disk->d_consumer; + KASSERT(cp->acr >= 1 && cp->acw >= 1 && cp->ace >= 1, + ("Consumer %s not opened (r%dw%de%d).", cp->provider->name, + cp->acr, cp->acw, cp->ace)); + cp->index++; + g_io_request(cbp, cp); + } + break; default: KASSERT(1 == 0, ("Invalid command here: %u (device=%s)", bp->bio_cmd, sc->sc_name)); @@ -1926,15 +1932,16 @@ g_mirror_worker(void *arg) G_MIRROR_DEBUG(5, "%s: I'm here 1.", __func__); continue; } + /* * Check if we can mark array as CLEAN and if we can't take * how much seconds should we wait. */ timeout = g_mirror_idle(sc, -1); + /* - * Now I/O requests. + * Handle I/O requests. */ - /* Get first request from the queue. */ mtx_lock(&sc->sc_queue_mtx); bp = TAILQ_FIRST(&sc->sc_queue); if (bp != NULL) @@ -1969,19 +1976,33 @@ g_mirror_worker(void *arg) if (bp->bio_from->geom == sc->sc_sync.ds_geom && (bp->bio_cflags & G_MIRROR_BIO_FLAG_SYNC) != 0) { - g_mirror_sync_request(bp); /* READ */ + /* + * Handle completion of the first half (the read) of a + * block synchronization operation. + */ + g_mirror_sync_request(sc, bp); } else if (bp->bio_to != sc->sc_provider) { if ((bp->bio_cflags & G_MIRROR_BIO_FLAG_REGULAR) != 0) - g_mirror_regular_request(bp); + /* + * Handle completion of a regular I/O request. + */ + g_mirror_regular_request(sc, bp); else if ((bp->bio_cflags & G_MIRROR_BIO_FLAG_SYNC) != 0) - g_mirror_sync_request(bp); /* WRITE */ + /* + * Handle completion of the second half (the + * write) of a block synchronization operation. + */ + g_mirror_sync_request(sc, bp); else { KASSERT(0, ("Invalid request cflags=0x%hx to=%s.", bp->bio_cflags, bp->bio_to->name)); } } else { - g_mirror_register_request(bp); + /* + * Initiate an I/O request. + */ + g_mirror_register_request(sc, bp); } G_MIRROR_DEBUG(5, "%s: I'm here 9.", __func__); } From owner-svn-src-stable@freebsd.org Wed Jan 24 15:16: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 1693DED8C13; Wed, 24 Jan 2018 15:16:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B7CC48D68D; Wed, 24 Jan 2018 15:16:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B27B11F512; Wed, 24 Jan 2018 15:16:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OFGHwf083908; Wed, 24 Jan 2018 15:16:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OFGHRB083905; Wed, 24 Jan 2018 15:16:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801241516.w0OFGHRB083905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 24 Jan 2018 15:16:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328334 - in stable/11: sys/geom/mirror tests/sys/geom/class/mirror X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11: sys/geom/mirror tests/sys/geom/class/mirror X-SVN-Commit-Revision: 328334 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 24 Jan 2018 15:16:18 -0000 Author: markj Date: Wed Jan 24 15:16:17 2018 New Revision: 328334 URL: https://svnweb.freebsd.org/changeset/base/328334 Log: MFC r327779, r327780: Fix handling of read errors during synchronization. Added: stable/11/tests/sys/geom/class/mirror/sync_error.sh - copied unchanged from r327780, head/tests/sys/geom/class/mirror/sync_error.sh Modified: stable/11/sys/geom/mirror/g_mirror.c stable/11/tests/sys/geom/class/mirror/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/11/sys/geom/mirror/g_mirror.c Wed Jan 24 15:15:18 2018 (r328333) +++ stable/11/sys/geom/mirror/g_mirror.c Wed Jan 24 15:16:17 2018 (r328334) @@ -108,6 +108,8 @@ static int g_mirror_update_disk(struct g_mirror_disk * static void g_mirror_update_device(struct g_mirror_softc *sc, bool force); static void g_mirror_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp); +static void g_mirror_sync_reinit(const struct g_mirror_disk *disk, + struct bio *bp, off_t offset); static void g_mirror_sync_stop(struct g_mirror_disk *disk, int type); static void g_mirror_register_request(struct g_mirror_softc *sc, struct bio *bp); @@ -1296,10 +1298,11 @@ g_mirror_sync_request_free(struct g_mirror_disk *disk, /* * Handle synchronization requests. - * Every synchronization request is two-steps process: first, READ request is - * send to active provider and then WRITE request (with read data) to the provider - * being synchronized. When WRITE is finished, new synchronization request is - * send. + * Every synchronization request is a two-step process: first, a read request is + * sent to the mirror provider via the sync consumer. If that request completes + * successfully, it is converted to a write and sent to the disk being + * synchronized. If the write also completes successfully, the synchronization + * offset is advanced and a new read request is submitted. */ static void g_mirror_sync_request(struct g_mirror_softc *sc, struct bio *bp) @@ -1324,13 +1327,16 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc return; } + sync = &disk->d_sync; + /* * Synchronization request. */ switch (bp->bio_cmd) { - case BIO_READ: - { + case BIO_READ: { + struct g_mirror_disk *d; struct g_consumer *cp; + int readable; KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_read, bp->bio_error); @@ -1339,7 +1345,33 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc G_MIRROR_LOGREQ(0, bp, "Synchronization request failed (error=%d).", bp->bio_error); - g_mirror_sync_request_free(disk, bp); + + /* + * If there's at least one other disk from which we can + * read the block, retry the request. + */ + readable = 0; + LIST_FOREACH(d, &sc->sc_disks, d_next) + if (d->d_state == G_MIRROR_DISK_STATE_ACTIVE && + !(d->d_flags & G_MIRROR_DISK_FLAG_BROKEN)) + readable++; + + /* + * The read error will trigger a syncid bump, so there's + * no need to do that here. + * + * If we can retry the read from another disk, do so. + * Otherwise, all we can do is kick out the new disk. + */ + if (readable == 0) { + g_mirror_sync_request_free(disk, bp); + g_mirror_event_send(disk, + G_MIRROR_DISK_STATE_DISCONNECTED, + G_MIRROR_EVENT_DONTWAIT); + } else { + g_mirror_sync_reinit(disk, bp, bp->bio_offset); + goto retry_read; + } return; } G_MIRROR_LOGREQ(3, bp, @@ -1353,12 +1385,10 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc cp->index++; g_io_request(bp, cp); return; - } - case BIO_WRITE: - { + } + case BIO_WRITE: { off_t offset; - void *data; - int i, idx; + int i; KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_sync_request_write, bp->bio_error); @@ -1375,7 +1405,6 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc return; } G_MIRROR_LOGREQ(3, bp, "Synchronization request finished."); - sync = &disk->d_sync; if (sync->ds_offset >= sc->sc_mediasize || sync->ds_consumer == NULL || (sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0) { @@ -1395,20 +1424,13 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc } /* Send next synchronization request. */ - data = bp->bio_data; - idx = (int)(uintptr_t)bp->bio_caller1; - g_reset_bio(bp); - bp->bio_cmd = BIO_READ; - bp->bio_offset = sync->ds_offset; - bp->bio_length = MIN(MAXPHYS, sc->sc_mediasize - bp->bio_offset); + g_mirror_sync_reinit(disk, bp, sync->ds_offset); sync->ds_offset += bp->bio_length; - bp->bio_done = g_mirror_sync_done; - bp->bio_data = data; - bp->bio_from = sync->ds_consumer; - bp->bio_to = sc->sc_provider; - bp->bio_caller1 = (void *)(uintptr_t)idx; + +retry_read: G_MIRROR_LOGREQ(3, bp, "Sending synchronization request."); sync->ds_consumer->index++; + /* * Delay the request if it is colliding with a regular request. */ @@ -1434,11 +1456,9 @@ g_mirror_sync_request(struct g_mirror_softc *sc, struc sync->ds_update_ts = time_uptime; } return; - } + } default: - KASSERT(1 == 0, ("Invalid command here: %u (device=%s)", - bp->bio_cmd, sc->sc_name)); - break; + panic("Invalid I/O request %p", bp); } } @@ -2029,15 +2049,39 @@ g_mirror_update_idle(struct g_mirror_softc *sc, struct } static void +g_mirror_sync_reinit(const struct g_mirror_disk *disk, struct bio *bp, + off_t offset) +{ + void *data; + int idx; + + data = bp->bio_data; + idx = (int)(uintptr_t)bp->bio_caller1; + g_reset_bio(bp); + + bp->bio_cmd = BIO_READ; + bp->bio_data = data; + bp->bio_done = g_mirror_sync_done; + bp->bio_from = disk->d_sync.ds_consumer; + bp->bio_to = disk->d_softc->sc_provider; + bp->bio_caller1 = (void *)(uintptr_t)idx; + bp->bio_offset = offset; + bp->bio_length = MIN(MAXPHYS, + disk->d_softc->sc_mediasize - bp->bio_offset); +} + +static void g_mirror_sync_start(struct g_mirror_disk *disk) { struct g_mirror_softc *sc; + struct g_mirror_disk_sync *sync; struct g_consumer *cp; struct bio *bp; int error, i; g_topology_assert_not(); sc = disk->d_softc; + sync = &disk->d_sync; sx_assert(&sc->sc_lock, SX_LOCKED); KASSERT(disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING, @@ -2063,54 +2107,48 @@ g_mirror_sync_start(struct g_mirror_disk *disk) g_mirror_get_diskname(disk)); if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_NOFAILSYNC) == 0) disk->d_flags |= G_MIRROR_DISK_FLAG_DIRTY; - KASSERT(disk->d_sync.ds_consumer == NULL, + KASSERT(sync->ds_consumer == NULL, ("Sync consumer already exists (device=%s, disk=%s).", sc->sc_name, g_mirror_get_diskname(disk))); - disk->d_sync.ds_consumer = cp; - disk->d_sync.ds_consumer->private = disk; - disk->d_sync.ds_consumer->index = 0; + sync->ds_consumer = cp; + sync->ds_consumer->private = disk; + sync->ds_consumer->index = 0; /* * Allocate memory for synchronization bios and initialize them. */ - disk->d_sync.ds_bios = malloc(sizeof(struct bio *) * g_mirror_syncreqs, + sync->ds_bios = malloc(sizeof(struct bio *) * g_mirror_syncreqs, M_MIRROR, M_WAITOK); for (i = 0; i < g_mirror_syncreqs; i++) { bp = g_alloc_bio(); - disk->d_sync.ds_bios[i] = bp; - bp->bio_parent = NULL; - bp->bio_cmd = BIO_READ; + sync->ds_bios[i] = bp; + bp->bio_data = malloc(MAXPHYS, M_MIRROR, M_WAITOK); - bp->bio_cflags = 0; - bp->bio_offset = disk->d_sync.ds_offset; - bp->bio_length = MIN(MAXPHYS, sc->sc_mediasize - bp->bio_offset); - disk->d_sync.ds_offset += bp->bio_length; - bp->bio_done = g_mirror_sync_done; - bp->bio_from = disk->d_sync.ds_consumer; - bp->bio_to = sc->sc_provider; bp->bio_caller1 = (void *)(uintptr_t)i; + g_mirror_sync_reinit(disk, bp, sync->ds_offset); + sync->ds_offset += bp->bio_length; } /* Increase the number of disks in SYNCHRONIZING state. */ sc->sc_sync.ds_ndisks++; /* Set the number of in-flight synchronization requests. */ - disk->d_sync.ds_inflight = g_mirror_syncreqs; + sync->ds_inflight = g_mirror_syncreqs; /* * Fire off first synchronization requests. */ for (i = 0; i < g_mirror_syncreqs; i++) { - bp = disk->d_sync.ds_bios[i]; + bp = sync->ds_bios[i]; G_MIRROR_LOGREQ(3, bp, "Sending synchronization request."); - disk->d_sync.ds_consumer->index++; + sync->ds_consumer->index++; /* * Delay the request if it is colliding with a regular request. */ if (g_mirror_regular_collision(sc, bp)) g_mirror_sync_delay(sc, bp); else - g_io_request(bp, disk->d_sync.ds_consumer); + g_io_request(bp, sync->ds_consumer); } } Modified: stable/11/tests/sys/geom/class/mirror/Makefile ============================================================================== --- stable/11/tests/sys/geom/class/mirror/Makefile Wed Jan 24 15:15:18 2018 (r328333) +++ stable/11/tests/sys/geom/class/mirror/Makefile Wed Jan 24 15:16:17 2018 (r328334) @@ -18,6 +18,8 @@ TAP_TESTS_SH+= 11_test TAP_TESTS_SH+= 12_test TAP_TESTS_SH+= 13_test +ATF_TESTS_SH+= sync_error + ${PACKAGE}FILES+= conf.sh .for t in ${TAP_TESTS_SH} Copied: stable/11/tests/sys/geom/class/mirror/sync_error.sh (from r327780, head/tests/sys/geom/class/mirror/sync_error.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tests/sys/geom/class/mirror/sync_error.sh Wed Jan 24 15:16:17 2018 (r328334, copy of r327780, head/tests/sys/geom/class/mirror/sync_error.sh) @@ -0,0 +1,110 @@ +# $FreeBSD$ + +REG_READ_FP=debug.fail_point.g_mirror_regular_request_read + +atf_test_case sync_read_error_2_disks cleanup +sync_read_error_2_disks_head() +{ + atf_set "descr" \ + "Ensure that we properly handle read errors during synchronization." + atf_set "require.user" "root" +} +sync_read_error_2_disks_body() +{ + . $(atf_get_srcdir)/conf.sh + + f1=$(mktemp ${base}.XXXXXX) + f2=$(mktemp ${base}.XXXXXX) + + atf_check dd if=/dev/zero bs=1M count=32 of=$f1 status=none + atf_check truncate -s 32M $f2 + + md1=$(attach_md -t vnode -f ${f1}) + md2=$(attach_md -t vnode -f ${f2}) + + atf_check gmirror label $name $md1 + devwait + + atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='1*return(5)' + + # If a read error occurs while synchronizing and the mirror contains + # a single active disk, gmirror has no choice but to fail the + # synchronization and kick the new disk out of the mirror. + atf_check gmirror insert $name $md2 + sleep 0.1 + syncwait + atf_check [ $(gmirror status -s $name | wc -l) -eq 1 ] + atf_check -s exit:0 -o match:"DEGRADED $md1 \(ACTIVE\)" \ + gmirror status -s $name +} +sync_read_error_2_disks_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + + atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='off' + gmirror_test_cleanup +} + +atf_test_case sync_read_error_3_disks cleanup +sync_read_error_3_disks_head() +{ + atf_set "descr" \ + "Ensure that we properly handle read errors during synchronization." + atf_set "require.user" "root" +} +sync_read_error_3_disks_body() +{ + . $(atf_get_srcdir)/conf.sh + + f1=$(mktemp ${base}.XXXXXX) + f2=$(mktemp ${base}.XXXXXX) + f3=$(mktemp ${base}.XXXXXX) + + atf_check dd if=/dev/random bs=1M count=32 of=$f1 status=none + atf_check truncate -s 32M $f2 + atf_check truncate -s 32M $f3 + + md1=$(attach_md -t vnode -f ${f1}) + md2=$(attach_md -t vnode -f ${f2}) + md3=$(attach_md -t vnode -f ${f3}) + + atf_check gmirror label $name $md1 + devwait + + atf_check gmirror insert $name $md2 + syncwait + + atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='1*return(5)' + + # If a read error occurs while synchronizing a new disk, and we have + # multiple active disks, we retry the read after an error. The disk + # which returned the read error is kicked out of the mirror. + atf_check gmirror insert $name $md3 + syncwait + atf_check [ $(gmirror status -s $name | wc -l) -eq 2 ] + atf_check -s exit:0 -o match:"DEGRADED $md3 \(ACTIVE\)" \ + gmirror status -s $name + + # Make sure that the two active disks are identical. Destroy the + # mirror first so that the metadata sectors are wiped. + if $(gmirror status -s $name | grep -q $md1); then + active=$md1 + else + active=$md2 + fi + atf_check gmirror destroy $name + atf_check cmp /dev/$active /dev/$md3 +} +sync_read_error_3_disks_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + + atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='off' + gmirror_test_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case sync_read_error_2_disks + atf_add_test_case sync_read_error_3_disks +} From owner-svn-src-stable@freebsd.org Wed Jan 24 21:48: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 B322FEC8380; Wed, 24 Jan 2018 21:48:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 593C77A304; Wed, 24 Jan 2018 21:48:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5096C234BC; Wed, 24 Jan 2018 21:48:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OLme1T083527; Wed, 24 Jan 2018 21:48:40 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OLmdTr083524; Wed, 24 Jan 2018 21:48:39 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801242148.w0OLmdTr083524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 21:48:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328379 - in stable: 10/sys/kern 10/sys/sys 10/tests/sys/kern 11/sys/kern 11/sys/sys 11/tests/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/sys/kern 10/sys/sys 10/tests/sys/kern 11/sys/kern 11/sys/sys 11/tests/sys/kern X-SVN-Commit-Revision: 328379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 24 Jan 2018 21:48:41 -0000 Author: jhb Date: Wed Jan 24 21:48:39 2018 New Revision: 328379 URL: https://svnweb.freebsd.org/changeset/base/328379 Log: MFC 325028,328344: Discard the correct thread event reported for a ptrace stop. 325028: Discard the correct thread event reported for a ptrace stop. When multiple threads wish to report a tracing event to a debugger, both threads call ptracestop() and one thread will win the race to be the reporting thread (p->p_xthread). The debugger uses PT_LWPINFO with the process ID to determine which thread / LWP is reporting an event and the details of that event. This event is cleared as a side effect of the subsequent ptrace event that resumed the process (PT_CONTINUE, PT_STEP, etc.). However, ptrace() was clearing the event identified by the LWP ID passed to the resume request even if that wasn't the 'p_xthread'. This could result in clearing an event that had not yet been observed by the debugger and leaving the existing event for 'p_thread' pending so that it was reported a second time. Specifically, if the debugger stopped due to a software breakpoint in one thread, but then switched to another thread that was used to resume (e.g. if the user switched to a different thread and issued a step), the resume request (PT_STEP) cleared a pending event (if any) for the thread being stepped. However, the process immediately stopped and the first thread reported it's breakpoint event a second time. The debugger decremented the PC for "both" breakpoint events which resulted in the PC now pointing into the middle of an instruction (on x86) and a SIGILL fault when the process was resumed a second time. To fix, always clear the pending event for 'p_xthread' when resuming a process. ptrace() still honors the requested LWP ID when enabling single-stepping (PT_STEP) or setting a different PC (PT_CONTINUE). 328344: Mark the unused argument to continue_thread() as such. clang in HEAD and 11 does not warn about this, but clang in 10 does. Modified: stable/10/sys/kern/sys_process.c stable/10/sys/sys/param.h stable/10/tests/sys/kern/ptrace_test.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/kern/sys_process.c stable/11/sys/sys/param.h stable/11/tests/sys/kern/ptrace_test.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/kern/sys_process.c ============================================================================== --- stable/10/sys/kern/sys_process.c Wed Jan 24 21:39:40 2018 (r328378) +++ stable/10/sys/kern/sys_process.c Wed Jan 24 21:48:39 2018 (r328379) @@ -1072,6 +1072,13 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi } sendsig: + /* + * Clear the pending event for the thread that just + * reported its event (p_xthread). This may not be + * the thread passed to PT_CONTINUE, PT_STEP, etc. if + * the debugger is resuming a different thread. + */ + td2 = p->p_xthread; if (proctree_locked) { sx_xunlock(&proctree_lock); proctree_locked = 0; Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Wed Jan 24 21:39:40 2018 (r328378) +++ stable/10/sys/sys/param.h Wed Jan 24 21:48:39 2018 (r328379) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1004500 /* Master, propagated to newvers */ +#define __FreeBSD_version 1004501 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: stable/10/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/10/tests/sys/kern/ptrace_test.c Wed Jan 24 21:39:40 2018 (r328378) +++ stable/10/tests/sys/kern/ptrace_test.c Wed Jan 24 21:48:39 2018 (r328379) @@ -2944,6 +2944,174 @@ ATF_TC_BODY(ptrace__event_mask_sigkill_discard, tc) ATF_REQUIRE(errno == ECHILD); } +#if defined(__amd64__) || defined(__i386__) +/* + * Only x86 both define breakpoint() and have a PC after breakpoint so + * that restarting doesn't retrigger the breakpoint. + */ +static void * +continue_thread(void *arg __unused) +{ + breakpoint(); + return (NULL); +} + +static __dead2 void +continue_thread_main(void) +{ + pthread_t threads[2]; + + CHILD_REQUIRE(pthread_create(&threads[0], NULL, continue_thread, + NULL) == 0); + CHILD_REQUIRE(pthread_create(&threads[1], NULL, continue_thread, + NULL) == 0); + CHILD_REQUIRE(pthread_join(threads[0], NULL) == 0); + CHILD_REQUIRE(pthread_join(threads[1], NULL) == 0); + exit(1); +} + +/* + * Ensure that PT_CONTINUE clears the status of the thread that + * triggered the stop even if a different thread's LWP was passed to + * PT_CONTINUE. + */ +ATF_TC_WITHOUT_HEAD(ptrace__PT_CONTINUE_different_thread); +ATF_TC_BODY(ptrace__PT_CONTINUE_different_thread, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + lwpid_t lwps[2]; + bool hit_break[2]; + int i, j, status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + continue_thread_main(); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, + sizeof(pl)) != -1); + + ATF_REQUIRE(ptrace(PT_LWP_EVENTS, wpid, NULL, 1) == 0); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* One of the new threads should report it's birth. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) == + (PL_FLAG_BORN | PL_FLAG_SCX)); + lwps[0] = pl.pl_lwpid; + + /* + * Suspend this thread to ensure both threads are alive before + * hitting the breakpoint. + */ + ATF_REQUIRE(ptrace(PT_SUSPEND, lwps[0], NULL, 0) != -1); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* Second thread should report it's birth. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) == + (PL_FLAG_BORN | PL_FLAG_SCX)); + ATF_REQUIRE(pl.pl_lwpid != lwps[0]); + lwps[1] = pl.pl_lwpid; + + /* Resume both threads waiting for breakpoint events. */ + hit_break[0] = hit_break[1] = false; + ATF_REQUIRE(ptrace(PT_RESUME, lwps[0], NULL, 0) != -1); + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* One thread should report a breakpoint. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP && + pl.pl_siginfo.si_code == TRAP_BRKPT); + if (pl.pl_lwpid == lwps[0]) + i = 0; + else + i = 1; + hit_break[i] = true; + + /* + * Resume both threads but pass the other thread's LWPID to + * PT_CONTINUE. + */ + ATF_REQUIRE(ptrace(PT_CONTINUE, lwps[i ^ 1], (caddr_t)1, 0) == 0); + + /* + * Will now get two thread exit events and one more breakpoint + * event. + */ + for (j = 0; j < 3; j++) { + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, + sizeof(pl)) != -1); + + if (pl.pl_lwpid == lwps[0]) + i = 0; + else + i = 1; + + ATF_REQUIRE_MSG(lwps[i] != 0, "event for exited thread"); + if (pl.pl_flags & PL_FLAG_EXITED) { + ATF_REQUIRE_MSG(hit_break[i], + "exited thread did not report breakpoint"); + lwps[i] = 0; + } else { + ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP && + pl.pl_siginfo.si_code == TRAP_BRKPT); + ATF_REQUIRE_MSG(!hit_break[i], + "double breakpoint event"); + hit_break[i] = true; + } + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + } + + /* Both threads should have exited. */ + ATF_REQUIRE(lwps[0] == 0); + ATF_REQUIRE(lwps[1] == 0); + + /* The last event should be for the child process's exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} +#endif + ATF_TP_ADD_TCS(tp) { @@ -2990,6 +3158,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__parent_terminate_with_pending_sigstop1); ATF_TP_ADD_TC(tp, ptrace__parent_terminate_with_pending_sigstop2); ATF_TP_ADD_TC(tp, ptrace__event_mask_sigkill_discard); +#if defined(__amd64__) || defined(__i386__) + ATF_TP_ADD_TC(tp, ptrace__PT_CONTINUE_different_thread); +#endif return (atf_no_error()); } From owner-svn-src-stable@freebsd.org Wed Jan 24 21:48: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 304FDEC8384; Wed, 24 Jan 2018 21:48:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4C617A305; Wed, 24 Jan 2018 21:48:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFB2B234BD; Wed, 24 Jan 2018 21:48:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0OLmeem083535; Wed, 24 Jan 2018 21:48:40 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0OLmeQc083532; Wed, 24 Jan 2018 21:48:40 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801242148.w0OLmeQc083532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 24 Jan 2018 21:48:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328379 - in stable: 10/sys/kern 10/sys/sys 10/tests/sys/kern 11/sys/kern 11/sys/sys 11/tests/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/sys/kern 10/sys/sys 10/tests/sys/kern 11/sys/kern 11/sys/sys 11/tests/sys/kern X-SVN-Commit-Revision: 328379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 24 Jan 2018 21:48:41 -0000 Author: jhb Date: Wed Jan 24 21:48:39 2018 New Revision: 328379 URL: https://svnweb.freebsd.org/changeset/base/328379 Log: MFC 325028,328344: Discard the correct thread event reported for a ptrace stop. 325028: Discard the correct thread event reported for a ptrace stop. When multiple threads wish to report a tracing event to a debugger, both threads call ptracestop() and one thread will win the race to be the reporting thread (p->p_xthread). The debugger uses PT_LWPINFO with the process ID to determine which thread / LWP is reporting an event and the details of that event. This event is cleared as a side effect of the subsequent ptrace event that resumed the process (PT_CONTINUE, PT_STEP, etc.). However, ptrace() was clearing the event identified by the LWP ID passed to the resume request even if that wasn't the 'p_xthread'. This could result in clearing an event that had not yet been observed by the debugger and leaving the existing event for 'p_thread' pending so that it was reported a second time. Specifically, if the debugger stopped due to a software breakpoint in one thread, but then switched to another thread that was used to resume (e.g. if the user switched to a different thread and issued a step), the resume request (PT_STEP) cleared a pending event (if any) for the thread being stepped. However, the process immediately stopped and the first thread reported it's breakpoint event a second time. The debugger decremented the PC for "both" breakpoint events which resulted in the PC now pointing into the middle of an instruction (on x86) and a SIGILL fault when the process was resumed a second time. To fix, always clear the pending event for 'p_xthread' when resuming a process. ptrace() still honors the requested LWP ID when enabling single-stepping (PT_STEP) or setting a different PC (PT_CONTINUE). 328344: Mark the unused argument to continue_thread() as such. clang in HEAD and 11 does not warn about this, but clang in 10 does. Modified: stable/11/sys/kern/sys_process.c stable/11/sys/sys/param.h stable/11/tests/sys/kern/ptrace_test.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/kern/sys_process.c stable/10/sys/sys/param.h stable/10/tests/sys/kern/ptrace_test.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/kern/sys_process.c ============================================================================== --- stable/11/sys/kern/sys_process.c Wed Jan 24 21:39:40 2018 (r328378) +++ stable/11/sys/kern/sys_process.c Wed Jan 24 21:48:39 2018 (r328379) @@ -1130,6 +1130,13 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi } sendsig: + /* + * Clear the pending event for the thread that just + * reported its event (p_xthread). This may not be + * the thread passed to PT_CONTINUE, PT_STEP, etc. if + * the debugger is resuming a different thread. + */ + td2 = p->p_xthread; if (proctree_locked) { sx_xunlock(&proctree_lock); proctree_locked = 0; Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Wed Jan 24 21:39:40 2018 (r328378) +++ stable/11/sys/sys/param.h Wed Jan 24 21:48:39 2018 (r328379) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1101506 /* Master, propagated to newvers */ +#define __FreeBSD_version 1101507 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: stable/11/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/11/tests/sys/kern/ptrace_test.c Wed Jan 24 21:39:40 2018 (r328378) +++ stable/11/tests/sys/kern/ptrace_test.c Wed Jan 24 21:48:39 2018 (r328379) @@ -3468,6 +3468,174 @@ ATF_TC_BODY(ptrace__PT_STEP_with_signal, tc) ATF_REQUIRE(errno == ECHILD); } +#if defined(__amd64__) || defined(__i386__) +/* + * Only x86 both define breakpoint() and have a PC after breakpoint so + * that restarting doesn't retrigger the breakpoint. + */ +static void * +continue_thread(void *arg __unused) +{ + breakpoint(); + return (NULL); +} + +static __dead2 void +continue_thread_main(void) +{ + pthread_t threads[2]; + + CHILD_REQUIRE(pthread_create(&threads[0], NULL, continue_thread, + NULL) == 0); + CHILD_REQUIRE(pthread_create(&threads[1], NULL, continue_thread, + NULL) == 0); + CHILD_REQUIRE(pthread_join(threads[0], NULL) == 0); + CHILD_REQUIRE(pthread_join(threads[1], NULL) == 0); + exit(1); +} + +/* + * Ensure that PT_CONTINUE clears the status of the thread that + * triggered the stop even if a different thread's LWP was passed to + * PT_CONTINUE. + */ +ATF_TC_WITHOUT_HEAD(ptrace__PT_CONTINUE_different_thread); +ATF_TC_BODY(ptrace__PT_CONTINUE_different_thread, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + lwpid_t lwps[2]; + bool hit_break[2]; + int i, j, status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + continue_thread_main(); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, + sizeof(pl)) != -1); + + ATF_REQUIRE(ptrace(PT_LWP_EVENTS, wpid, NULL, 1) == 0); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* One of the new threads should report it's birth. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) == + (PL_FLAG_BORN | PL_FLAG_SCX)); + lwps[0] = pl.pl_lwpid; + + /* + * Suspend this thread to ensure both threads are alive before + * hitting the breakpoint. + */ + ATF_REQUIRE(ptrace(PT_SUSPEND, lwps[0], NULL, 0) != -1); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* Second thread should report it's birth. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) == + (PL_FLAG_BORN | PL_FLAG_SCX)); + ATF_REQUIRE(pl.pl_lwpid != lwps[0]); + lwps[1] = pl.pl_lwpid; + + /* Resume both threads waiting for breakpoint events. */ + hit_break[0] = hit_break[1] = false; + ATF_REQUIRE(ptrace(PT_RESUME, lwps[0], NULL, 0) != -1); + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* One thread should report a breakpoint. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP && + pl.pl_siginfo.si_code == TRAP_BRKPT); + if (pl.pl_lwpid == lwps[0]) + i = 0; + else + i = 1; + hit_break[i] = true; + + /* + * Resume both threads but pass the other thread's LWPID to + * PT_CONTINUE. + */ + ATF_REQUIRE(ptrace(PT_CONTINUE, lwps[i ^ 1], (caddr_t)1, 0) == 0); + + /* + * Will now get two thread exit events and one more breakpoint + * event. + */ + for (j = 0; j < 3; j++) { + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, + sizeof(pl)) != -1); + + if (pl.pl_lwpid == lwps[0]) + i = 0; + else + i = 1; + + ATF_REQUIRE_MSG(lwps[i] != 0, "event for exited thread"); + if (pl.pl_flags & PL_FLAG_EXITED) { + ATF_REQUIRE_MSG(hit_break[i], + "exited thread did not report breakpoint"); + lwps[i] = 0; + } else { + ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP && + pl.pl_siginfo.si_code == TRAP_BRKPT); + ATF_REQUIRE_MSG(!hit_break[i], + "double breakpoint event"); + hit_break[i] = true; + } + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + } + + /* Both threads should have exited. */ + ATF_REQUIRE(lwps[0] == 0); + ATF_REQUIRE(lwps[1] == 0); + + /* The last event should be for the child process's exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} +#endif + ATF_TP_ADD_TCS(tp) { @@ -3520,6 +3688,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__event_mask_sigkill_discard); ATF_TP_ADD_TC(tp, ptrace__PT_ATTACH_with_SBDRY_thread); ATF_TP_ADD_TC(tp, ptrace__PT_STEP_with_signal); +#if defined(__amd64__) || defined(__i386__) + ATF_TP_ADD_TC(tp, ptrace__PT_CONTINUE_different_thread); +#endif return (atf_no_error()); } From owner-svn-src-stable@freebsd.org Thu Jan 25 00: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 7BCACECE566; Thu, 25 Jan 2018 00:08:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2FAAF7EB2A; Thu, 25 Jan 2018 00:08:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A9ED24B29; Thu, 25 Jan 2018 00:08:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0P08Eve052637; Thu, 25 Jan 2018 00:08:14 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P08E9c052636; Thu, 25 Jan 2018 00:08:14 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801250008.w0P08E9c052636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 25 Jan 2018 00:08:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328384 - stable/10/tests/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/10/tests/sys/kern X-SVN-Commit-Revision: 328384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 25 Jan 2018 00:08:14 -0000 Author: jhb Date: Thu Jan 25 00:08:13 2018 New Revision: 328384 URL: https://svnweb.freebsd.org/changeset/base/328384 Log: MFC 287600,287602: Fixes for fork following tests. 287600: Properly size the children[] arrays in the follow fork tests. 287602: Use _exit() instead of exit() in child processes created during tests. Modified: stable/10/tests/sys/kern/ptrace_test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/10/tests/sys/kern/ptrace_test.c Wed Jan 24 23:57:40 2018 (r328383) +++ stable/10/tests/sys/kern/ptrace_test.c Thu Jan 25 00:08:13 2018 (r328384) @@ -143,7 +143,7 @@ ATF_TC_BODY(ptrace__parent_wait_after_trace_me, tc) /* Child process. */ trace_me(); - exit(1); + _exit(1); } /* Parent process. */ @@ -189,7 +189,7 @@ ATF_TC_BODY(ptrace__parent_wait_after_attach, tc) /* Wait for the parent to attach. */ CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == 0); - exit(1); + _exit(1); } close(cpipe[1]); @@ -237,7 +237,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debug /* Wait for parent to be ready. */ CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c)); - exit(1); + _exit(1); } close(cpipe[1]); @@ -268,7 +268,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debug CHILD_REQUIRE(WIFEXITED(status)); CHILD_REQUIRE(WEXITSTATUS(status) == 1); - exit(0); + _exit(0); } close(dpipe[1]); @@ -331,7 +331,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_d /* Wait for parent to be ready. */ CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c)); - exit(1); + _exit(1); } close(cpipe[1]); @@ -347,7 +347,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_d */ CHILD_REQUIRE((fpid = fork()) != -1); if (fpid != 0) - exit(2); + _exit(2); /* Debugger process. */ close(dpipe[0]); @@ -372,7 +372,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_d CHILD_REQUIRE(WIFEXITED(status)); CHILD_REQUIRE(WEXITSTATUS(status) == 1); - exit(0); + _exit(0); } close(dpipe[1]); @@ -437,14 +437,14 @@ follow_fork_parent(bool use_vfork) if (fpid == 0) /* Child */ - exit(2); + _exit(2); wpid = waitpid(fpid, &status, 0); CHILD_REQUIRE(wpid == fpid); CHILD_REQUIRE(WIFEXITED(status)); CHILD_REQUIRE(WEXITSTATUS(status) == 2); - exit(1); + _exit(1); } /* @@ -516,7 +516,7 @@ handle_fork_events(pid_t parent, struct ptrace_lwpinfo ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_both_attached); ATF_TC_BODY(ptrace__follow_fork_both_attached, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int status; ATF_REQUIRE((fpid = fork()) != -1); @@ -572,7 +572,7 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached, tc) ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_child_detached); ATF_TC_BODY(ptrace__follow_fork_child_detached, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int status; ATF_REQUIRE((fpid = fork()) != -1); @@ -623,7 +623,7 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached, tc) ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_parent_detached); ATF_TC_BODY(ptrace__follow_fork_parent_detached, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int status; ATF_REQUIRE((fpid = fork()) != -1); @@ -685,7 +685,7 @@ attach_fork_parent(int cpipe[2]) /* Double-fork to disassociate from the debugger. */ CHILD_REQUIRE((fpid = fork()) != -1); if (fpid != 0) - exit(3); + _exit(3); /* Send the pid of the disassociated child to the debugger. */ fpid = getpid(); @@ -704,7 +704,7 @@ attach_fork_parent(int cpipe[2]) ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_both_attached_unrelated_debugger); ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelated_debugger, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int cpipe[2], status; ATF_REQUIRE(pipe(cpipe) == 0); @@ -772,7 +772,7 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelate ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_child_detached_unrelated_debugger); ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelated_debugger, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int cpipe[2], status; ATF_REQUIRE(pipe(cpipe) == 0); @@ -835,7 +835,7 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelat ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_parent_detached_unrelated_debugger); ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrelated_debugger, tc) { - pid_t children[0], fpid, wpid; + pid_t children[2], fpid, wpid; int cpipe[2], status; ATF_REQUIRE(pipe(cpipe) == 0); From owner-svn-src-stable@freebsd.org Thu Jan 25 00:09:45 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 3C5FFECE648; Thu, 25 Jan 2018 00:09:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E1D137EC80; Thu, 25 Jan 2018 00:09:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCA9524B2A; Thu, 25 Jan 2018 00:09:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0P09iEp052733; Thu, 25 Jan 2018 00:09:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P09iZg052732; Thu, 25 Jan 2018 00:09:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801250009.w0P09iZg052732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 25 Jan 2018 00:09:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328385 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 25 Jan 2018 00:09:45 -0000 Author: jhb Date: Thu Jan 25 00:09:44 2018 New Revision: 328385 URL: https://svnweb.freebsd.org/changeset/base/328385 Log: MFC 312534: ANSYfy kern_ktrace.c and remove archaic register keyword Modified: stable/11/sys/kern/kern_ktrace.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_ktrace.c ============================================================================== --- stable/11/sys/kern/kern_ktrace.c Thu Jan 25 00:08:13 2018 (r328384) +++ stable/11/sys/kern/kern_ktrace.c Thu Jan 25 00:09:44 2018 (r328385) @@ -437,9 +437,7 @@ ktr_freeproc(struct proc *p, struct ucred **uc, struct } void -ktrsyscall(code, narg, args) - int code, narg; - register_t args[]; +ktrsyscall(int code, int narg, register_t args[]) { struct ktr_request *req; struct ktr_syscall *ktp; @@ -468,9 +466,7 @@ ktrsyscall(code, narg, args) } void -ktrsysret(code, error, retval) - int code, error; - register_t retval; +ktrsysret(int code, int error, register_t retval) { struct ktr_request *req; struct ktr_sysret *ktp; @@ -637,9 +633,7 @@ ktrnamei(path) } void -ktrsysctl(name, namelen) - int *name; - u_int namelen; +ktrsysctl(int *name, u_int namelen) { struct ktr_request *req; u_int mib[CTL_MAXNAME + 2]; @@ -671,11 +665,7 @@ ktrsysctl(name, namelen) } void -ktrgenio(fd, rw, uio, error) - int fd; - enum uio_rw rw; - struct uio *uio; - int error; +ktrgenio(int fd, enum uio_rw rw, struct uio *uio, int error) { struct ktr_request *req; struct ktr_genio *ktg; @@ -710,11 +700,7 @@ ktrgenio(fd, rw, uio, error) } void -ktrpsig(sig, action, mask, code) - int sig; - sig_t action; - sigset_t *mask; - int code; +ktrpsig(int sig, sig_t action, sigset_t *mask, int code) { struct thread *td = curthread; struct ktr_request *req; @@ -733,9 +719,7 @@ ktrpsig(sig, action, mask, code) } void -ktrcsw(out, user, wmesg) - int out, user; - const char *wmesg; +ktrcsw(int out, int user, const char *wmesg) { struct thread *td = curthread; struct ktr_request *req; @@ -756,10 +740,7 @@ ktrcsw(out, user, wmesg) } void -ktrstruct(name, data, datalen) - const char *name; - void *data; - size_t datalen; +ktrstruct(const char *name, void *data, size_t datalen) { struct ktr_request *req; char *buf; @@ -782,10 +763,8 @@ ktrstruct(name, data, datalen) } void -ktrcapfail(type, needed, held) - enum ktr_cap_fail_type type; - const cap_rights_t *needed; - const cap_rights_t *held; +ktrcapfail(enum ktr_cap_fail_type type, const cap_rights_t *needed, + const cap_rights_t *held) { struct thread *td = curthread; struct ktr_request *req; @@ -809,9 +788,7 @@ ktrcapfail(type, needed, held) } void -ktrfault(vaddr, type) - vm_offset_t vaddr; - int type; +ktrfault(vm_offset_t vaddr, int type) { struct thread *td = curthread; struct ktr_request *req; @@ -828,8 +805,7 @@ ktrfault(vaddr, type) } void -ktrfaultend(result) - int result; +ktrfaultend(int result) { struct thread *td = curthread; struct ktr_request *req; @@ -857,13 +833,11 @@ struct ktrace_args { #endif /* ARGSUSED */ int -sys_ktrace(td, uap) - struct thread *td; - register struct ktrace_args *uap; +sys_ktrace(struct thread *td, struct ktrace_args *uap) { #ifdef KTRACE - register struct vnode *vp = NULL; - register struct proc *p; + struct vnode *vp = NULL; + struct proc *p; struct pgrp *pg; int facs = uap->facs & ~KTRFAC_ROOT; int ops = KTROP(uap->ops); @@ -1002,9 +976,7 @@ done: /* ARGSUSED */ int -sys_utrace(td, uap) - struct thread *td; - register struct utrace_args *uap; +sys_utrace(struct thread *td, struct utrace_args *uap) { #ifdef KTRACE @@ -1038,11 +1010,7 @@ sys_utrace(td, uap) #ifdef KTRACE static int -ktrops(td, p, ops, facs, vp) - struct thread *td; - struct proc *p; - int ops, facs; - struct vnode *vp; +ktrops(struct thread *td, struct proc *p, int ops, int facs, struct vnode *vp) { struct vnode *tracevp = NULL; struct ucred *tracecred = NULL; @@ -1093,14 +1061,11 @@ ktrops(td, p, ops, facs, vp) } static int -ktrsetchildren(td, top, ops, facs, vp) - struct thread *td; - struct proc *top; - int ops, facs; - struct vnode *vp; +ktrsetchildren(struct thread *td, struct proc *top, int ops, int facs, + struct vnode *vp) { - register struct proc *p; - register int ret = 0; + struct proc *p; + int ret = 0; p = top; PROC_LOCK_ASSERT(p, MA_OWNED); @@ -1260,9 +1225,7 @@ ktr_writerequest(struct thread *td, struct ktr_request * so, only root may further change it. */ static int -ktrcanset(td, targetp) - struct thread *td; - struct proc *targetp; +ktrcanset(struct thread *td, struct proc *targetp) { PROC_LOCK_ASSERT(targetp, MA_OWNED); From owner-svn-src-stable@freebsd.org Thu Jan 25 02:45:24 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 3ECB1ED7AB0; Thu, 25 Jan 2018 02:45:24 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE4E0857F3; Thu, 25 Jan 2018 02:45:23 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7EA52675D; Thu, 25 Jan 2018 02:45:23 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0P2jNkL032685; Thu, 25 Jan 2018 02:45:23 GMT (envelope-from pkelsey@FreeBSD.org) Received: (from pkelsey@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P2jL0O032660; Thu, 25 Jan 2018 02:45:21 GMT (envelope-from pkelsey@FreeBSD.org) Message-Id: <201801250245.w0P2jL0O032660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pkelsey set sender to pkelsey@FreeBSD.org using -f From: Patrick Kelsey Date: Thu, 25 Jan 2018 02:45:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328386 - in stable/11/sys: amd64/amd64 amd64/include arm/arm arm/include arm64/include cddl/dev/dtrace/aarch64 cddl/dev/dtrace/amd64 cddl/dev/dtrace/arm cddl/dev/dtrace/i386 cddl/dev/d... X-SVN-Group: stable-11 X-SVN-Commit-Author: pkelsey X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 amd64/include arm/arm arm/include arm64/include cddl/dev/dtrace/aarch64 cddl/dev/dtrace/amd64 cddl/dev/dtrace/arm cddl/dev/dtrace/i386 cddl/dev/dtrace/mips cddl/dev/dtrac... X-SVN-Commit-Revision: 328386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 25 Jan 2018 02:45:24 -0000 Author: pkelsey Date: Thu Jan 25 02:45:21 2018 New Revision: 328386 URL: https://svnweb.freebsd.org/changeset/base/328386 Log: MFC r316648: Corrected misspelled versions of rendezvous. The MFC maintains smp_no_rendevous_barrier() as a symbol alias of smp_no_rendezvous_barrier(). __FreeBSD_version bumped to indicate presence of the new name smp_no_rendezvous_barrier(). Reviewed by: gnn, jhb (email), kib Differential Revision: https://reviews.freebsd.org/D10313 Modified: stable/11/sys/amd64/amd64/pmap.c stable/11/sys/amd64/include/counter.h stable/11/sys/arm/arm/pmap-v6.c stable/11/sys/arm/include/counter.h stable/11/sys/arm64/include/counter.h stable/11/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c stable/11/sys/cddl/dev/dtrace/amd64/dtrace_subr.c stable/11/sys/cddl/dev/dtrace/arm/dtrace_subr.c stable/11/sys/cddl/dev/dtrace/i386/dtrace_subr.c stable/11/sys/cddl/dev/dtrace/mips/dtrace_subr.c stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c stable/11/sys/cddl/dev/dtrace/riscv/dtrace_subr.c stable/11/sys/dev/acpica/acpi_cpu.c stable/11/sys/i386/i386/pmap.c stable/11/sys/i386/include/counter.h stable/11/sys/kern/kern_rmlock.c stable/11/sys/kern/subr_smp.c stable/11/sys/mips/include/counter.h stable/11/sys/powerpc/include/counter.h stable/11/sys/powerpc/ofw/ofw_machdep.c stable/11/sys/riscv/include/counter.h stable/11/sys/sparc64/include/counter.h stable/11/sys/sys/param.h stable/11/sys/sys/smp.h stable/11/sys/x86/x86/tsc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/amd64/amd64/pmap.c Thu Jan 25 02:45:21 2018 (r328386) @@ -1753,7 +1753,7 @@ pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_ act.newpde = newpde; CPU_SET(cpuid, &active); smp_rendezvous_cpus(active, - smp_no_rendevous_barrier, pmap_update_pde_action, + smp_no_rendezvous_barrier, pmap_update_pde_action, pmap_update_pde_teardown, &act); } else { pmap_update_pde_store(pmap, pde, newpde); Modified: stable/11/sys/amd64/include/counter.h ============================================================================== --- stable/11/sys/amd64/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/amd64/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -69,8 +69,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/arm/arm/pmap-v6.c ============================================================================== --- stable/11/sys/arm/arm/pmap-v6.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/arm/arm/pmap-v6.c Thu Jan 25 02:45:21 2018 (r328386) @@ -3367,7 +3367,7 @@ pmap_change_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_o act.va = va; act.npte1 = npte1; act.update = PCPU_GET(cpuid); - smp_rendezvous_cpus(all_cpus, smp_no_rendevous_barrier, + smp_rendezvous_cpus(all_cpus, smp_no_rendezvous_barrier, pmap_update_pte1_action, NULL, &act); sched_unpin(); } else { Modified: stable/11/sys/arm/include/counter.h ============================================================================== --- stable/11/sys/arm/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/arm/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -70,8 +70,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/arm64/include/counter.h ============================================================================== --- stable/11/sys/arm64/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/arm64/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -68,8 +68,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -134,8 +134,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void Modified: stable/11/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -125,8 +125,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void @@ -331,7 +331,7 @@ dtrace_gethrtime_init(void *arg) smp_rendezvous_cpus(map, NULL, dtrace_gethrtime_init_cpu, - smp_no_rendevous_barrier, (void *)(uintptr_t) i); + smp_no_rendezvous_barrier, (void *)(uintptr_t) i); tsc_skew[i] = tgt_cpu_tsc - hst_cpu_tsc; } Modified: stable/11/sys/cddl/dev/dtrace/arm/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/arm/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/arm/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -136,8 +136,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void Modified: stable/11/sys/cddl/dev/dtrace/i386/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/i386/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/i386/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -127,8 +127,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void @@ -333,7 +333,7 @@ dtrace_gethrtime_init(void *arg) smp_rendezvous_cpus(map, NULL, dtrace_gethrtime_init_cpu, - smp_no_rendevous_barrier, (void *)(uintptr_t) i); + smp_no_rendezvous_barrier, (void *)(uintptr_t) i); tsc_skew[i] = tgt_cpu_tsc - hst_cpu_tsc; } Modified: stable/11/sys/cddl/dev/dtrace/mips/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/mips/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/mips/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -131,8 +131,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void Modified: stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -133,8 +133,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void @@ -212,7 +212,7 @@ dtrace_gethrtime_init(void *arg) smp_rendezvous_cpus(map, NULL, dtrace_gethrtime_init_cpu, - smp_no_rendevous_barrier, (void *)(uintptr_t) i); + smp_no_rendezvous_barrier, (void *)(uintptr_t) i); timebase_skew[i] = tgt_cpu_tsc - hst_cpu_tsc; } Modified: stable/11/sys/cddl/dev/dtrace/riscv/dtrace_subr.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Thu Jan 25 02:45:21 2018 (r328386) @@ -137,8 +137,8 @@ dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, v else CPU_SETOF(cpu, &cpus); - smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func, - smp_no_rendevous_barrier, arg); + smp_rendezvous_cpus(cpus, smp_no_rendezvous_barrier, func, + smp_no_rendezvous_barrier, arg); } static void Modified: stable/11/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/11/sys/dev/acpica/acpi_cpu.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/dev/acpica/acpi_cpu.c Thu Jan 25 02:45:21 2018 (r328386) @@ -466,8 +466,8 @@ disable_idle(struct acpi_cpu_softc *sc) * is called and executed in such a context with interrupts being re-enabled * right before return. */ - smp_rendezvous_cpus(cpuset, smp_no_rendevous_barrier, NULL, - smp_no_rendevous_barrier, NULL); + smp_rendezvous_cpus(cpuset, smp_no_rendezvous_barrier, NULL, + smp_no_rendezvous_barrier, NULL); } static void Modified: stable/11/sys/i386/i386/pmap.c ============================================================================== --- stable/11/sys/i386/i386/pmap.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/i386/i386/pmap.c Thu Jan 25 02:45:21 2018 (r328386) @@ -1200,7 +1200,7 @@ pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_ act.newpde = newpde; CPU_SET(cpuid, &active); smp_rendezvous_cpus(active, - smp_no_rendevous_barrier, pmap == kernel_pmap ? + smp_no_rendezvous_barrier, pmap == kernel_pmap ? pmap_update_pde_kernel : pmap_update_pde_user, pmap_update_pde_teardown, &act); } else { Modified: stable/11/sys/i386/include/counter.h ============================================================================== --- stable/11/sys/i386/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/i386/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -148,8 +148,8 @@ counter_u64_zero_inline(counter_u64_t c) *(uint64_t *)((char *)c + sizeof(struct pcpu) * i) = 0; critical_exit(); } else { - smp_rendezvous(smp_no_rendevous_barrier, - counter_u64_zero_one_cpu, smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, + counter_u64_zero_one_cpu, smp_no_rendezvous_barrier, c); } } #endif Modified: stable/11/sys/kern/kern_rmlock.c ============================================================================== --- stable/11/sys/kern/kern_rmlock.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/kern/kern_rmlock.c Thu Jan 25 02:45:21 2018 (r328386) @@ -549,9 +549,9 @@ _rm_wlock(struct rmlock *rm) */ #ifdef SMP smp_rendezvous_cpus(readcpus, - smp_no_rendevous_barrier, + smp_no_rendezvous_barrier, rm_cleanIPI, - smp_no_rendevous_barrier, + smp_no_rendezvous_barrier, rm); #else Modified: stable/11/sys/kern/subr_smp.c ============================================================================== --- stable/11/sys/kern/subr_smp.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/kern/subr_smp.c Thu Jan 25 02:45:21 2018 (r328386) @@ -451,7 +451,7 @@ smp_rendezvous_action(void) * function. Ensure all CPUs have completed the setup * function before moving on to the action function. */ - if (local_setup_func != smp_no_rendevous_barrier) { + if (local_setup_func != smp_no_rendezvous_barrier) { if (smp_rv_setup_func != NULL) smp_rv_setup_func(smp_rv_func_arg); atomic_add_int(&smp_rv_waiters[1], 1); @@ -462,7 +462,7 @@ smp_rendezvous_action(void) if (local_action_func != NULL) local_action_func(local_func_arg); - if (local_teardown_func != smp_no_rendevous_barrier) { + if (local_teardown_func != smp_no_rendezvous_barrier) { /* * Signal that the main action has been completed. If a * full exit rendezvous is requested, then all CPUs will @@ -821,11 +821,18 @@ SYSINIT(cpu_mp_setvariables, SI_SUB_TUNABLES, SI_ORDER mp_setvariables_for_up, NULL); #endif /* SMP */ +/* + * smp_no_rendevous_barrier was renamed to smp_no_rendezvous_barrier + * in __FreeBSD_version 1101508, with the old name remaining in 11.x + * as an alias for compatibility. The old name will be gone in 12.0 + * (__FreeBSD_version >= 1200028). + */ +__strong_reference(smp_no_rendezvous_barrier, smp_no_rendevous_barrier); void -smp_no_rendevous_barrier(void *dummy) +smp_no_rendezvous_barrier(void *dummy) { #ifdef SMP - KASSERT((!smp_started),("smp_no_rendevous called and smp is started")); + KASSERT((!smp_started),("smp_no_rendezvous called and smp is started")); #endif } Modified: stable/11/sys/mips/include/counter.h ============================================================================== --- stable/11/sys/mips/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/mips/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -72,8 +72,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/powerpc/include/counter.h ============================================================================== --- stable/11/sys/powerpc/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/powerpc/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -72,8 +72,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif @@ -138,8 +138,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- stable/11/sys/powerpc/ofw/ofw_machdep.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/powerpc/ofw/ofw_machdep.c Thu Jan 25 02:45:21 2018 (r328386) @@ -528,8 +528,8 @@ openfirmware(void *args) #ifdef SMP rv_args.args = args; rv_args.in_progress = 1; - smp_rendezvous(smp_no_rendevous_barrier, ofw_rendezvous_dispatch, - smp_no_rendevous_barrier, &rv_args); + smp_rendezvous(smp_no_rendezvous_barrier, ofw_rendezvous_dispatch, + smp_no_rendezvous_barrier, &rv_args); result = rv_args.retval; #else result = openfirmware_core(args); Modified: stable/11/sys/riscv/include/counter.h ============================================================================== --- stable/11/sys/riscv/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/riscv/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -71,8 +71,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/sparc64/include/counter.h ============================================================================== --- stable/11/sys/sparc64/include/counter.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/sparc64/include/counter.h Thu Jan 25 02:45:21 2018 (r328386) @@ -71,8 +71,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/sys/param.h Thu Jan 25 02:45:21 2018 (r328386) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1101507 /* Master, propagated to newvers */ +#define __FreeBSD_version 1101508 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: stable/11/sys/sys/smp.h ============================================================================== --- stable/11/sys/sys/smp.h Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/sys/smp.h Thu Jan 25 02:45:21 2018 (r328386) @@ -240,7 +240,14 @@ extern struct mtx smp_ipi_mtx; int quiesce_all_cpus(const char *, int); int quiesce_cpus(cpuset_t, const char *, int); +/* + * smp_no_rendevous_barrier was renamed to smp_no_rendezvous_barrier + * in __FreeBSD_version 1101508, with the old name remaining in 11.x + * as an alias for compatibility. The old name will be gone in 12.0 + * (__FreeBSD_version >= 1200028). + */ void smp_no_rendevous_barrier(void *); +void smp_no_rendezvous_barrier(void *); void smp_rendezvous(void (*)(void *), void (*)(void *), void (*)(void *), Modified: stable/11/sys/x86/x86/tsc.c ============================================================================== --- stable/11/sys/x86/x86/tsc.c Thu Jan 25 00:09:44 2018 (r328385) +++ stable/11/sys/x86/x86/tsc.c Thu Jan 25 02:45:21 2018 (r328386) @@ -443,12 +443,12 @@ retry: for (i = 0, tsc = data; i < N; i++, tsc += size) smp_rendezvous(tsc_read_0, tsc_read_1, tsc_read_2, tsc); smp_tsc = 1; /* XXX */ - smp_rendezvous(smp_no_rendevous_barrier, comp_smp_tsc, - smp_no_rendevous_barrier, data); + smp_rendezvous(smp_no_rendezvous_barrier, comp_smp_tsc, + smp_no_rendezvous_barrier, data); if (!smp_tsc && adj < smp_tsc_adjust) { adj++; - smp_rendezvous(smp_no_rendevous_barrier, adj_smp_tsc, - smp_no_rendevous_barrier, data); + smp_rendezvous(smp_no_rendezvous_barrier, adj_smp_tsc, + smp_no_rendezvous_barrier, data); goto retry; } free(data, M_TEMP); From owner-svn-src-stable@freebsd.org Thu Jan 25 07:19: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 3D27DEC5799; Thu, 25 Jan 2018 07:19:08 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D6A496F619; Thu, 25 Jan 2018 07:19:07 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA77D15C8; Thu, 25 Jan 2018 07:19:07 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0P7J7QD067551; Thu, 25 Jan 2018 07:19:07 GMT (envelope-from pkelsey@FreeBSD.org) Received: (from pkelsey@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P7J73I067547; Thu, 25 Jan 2018 07:19:07 GMT (envelope-from pkelsey@FreeBSD.org) Message-Id: <201801250719.w0P7J73I067547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pkelsey set sender to pkelsey@FreeBSD.org using -f From: Patrick Kelsey Date: Thu, 25 Jan 2018 07:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328391 - in stable/11/sys: net sys X-SVN-Group: stable-11 X-SVN-Commit-Author: pkelsey X-SVN-Commit-Paths: in stable/11/sys: net sys X-SVN-Commit-Revision: 328391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 25 Jan 2018 07:19:08 -0000 Author: pkelsey Date: Thu Jan 25 07:19:07 2018 New Revision: 328391 URL: https://svnweb.freebsd.org/changeset/base/328391 Log: MFC of r316630, r316631, r316632, r316633, r316634 Fixed various typos. Modified: stable/11/sys/net/if_epair.c stable/11/sys/net/rtsock.c stable/11/sys/sys/event.h stable/11/sys/sys/mbuf.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_epair.c ============================================================================== --- stable/11/sys/net/if_epair.c Thu Jan 25 06:37:14 2018 (r328390) +++ stable/11/sys/net/if_epair.c Thu Jan 25 07:19:07 2018 (r328391) @@ -402,8 +402,8 @@ epair_start_locked(struct ifnet *ifp) return; /* - * We get patckets here from ether_output via if_handoff() - * and ned to put them into the input queue of the oifp + * We get packets here from ether_output via if_handoff() + * and need to put them into the input queue of the oifp * and call oifp->if_input() via netisr/epair_sintr(). */ oifp = sc->oifp; Modified: stable/11/sys/net/rtsock.c ============================================================================== --- stable/11/sys/net/rtsock.c Thu Jan 25 06:37:14 2018 (r328390) +++ stable/11/sys/net/rtsock.c Thu Jan 25 07:19:07 2018 (r328391) @@ -728,7 +728,7 @@ route_output(struct mbuf *m, struct socket *so, ...) if (info.rti_info[RTAX_NETMASK] == NULL && rtm->rtm_type == RTM_GET) { /* - * Provide logest prefix match for + * Provide longest prefix match for * address lookup (no mask). * 'route -n get addr' */ Modified: stable/11/sys/sys/event.h ============================================================================== --- stable/11/sys/sys/event.h Thu Jan 25 06:37:14 2018 (r328390) +++ stable/11/sys/sys/event.h Thu Jan 25 07:19:07 2018 (r328391) @@ -171,7 +171,7 @@ struct knlist { #define KNF_LISTLOCKED 0x0001 /* knlist is locked */ #define KNF_NOKQLOCK 0x0002 /* do not keep KQ_LOCK */ -#define KNOTE(list, hist, flags) knote(list, hist, flags) +#define KNOTE(list, hint, flags) knote(list, hint, flags) #define KNOTE_LOCKED(list, hint) knote(list, hint, KNF_LISTLOCKED) #define KNOTE_UNLOCKED(list, hint) knote(list, hint, 0) Modified: stable/11/sys/sys/mbuf.h ============================================================================== --- stable/11/sys/sys/mbuf.h Thu Jan 25 06:37:14 2018 (r328390) +++ stable/11/sys/sys/mbuf.h Thu Jan 25 07:19:07 2018 (r328391) @@ -472,7 +472,7 @@ void sf_ext_free_nocache(void *, void *); #define CSUM_L4_VALID 0x08000000 /* checksum is correct */ #define CSUM_L5_CALC 0x10000000 /* calculated layer 5 csum */ #define CSUM_L5_VALID 0x20000000 /* checksum is correct */ -#define CSUM_COALESED 0x40000000 /* contains merged segments */ +#define CSUM_COALESCED 0x40000000 /* contains merged segments */ /* * CSUM flag description for use with printf(9) %b identifier. @@ -483,7 +483,7 @@ void sf_ext_free_nocache(void *, void *); "\12CSUM_IP6_UDP\13CSUM_IP6_TCP\14CSUM_IP6_SCTP\15CSUM_IP6_TSO" \ "\16CSUM_IP6_ISCSI" \ "\31CSUM_L3_CALC\32CSUM_L3_VALID\33CSUM_L4_CALC\34CSUM_L4_VALID" \ - "\35CSUM_L5_CALC\36CSUM_L5_VALID\37CSUM_COALESED" + "\35CSUM_L5_CALC\36CSUM_L5_VALID\37CSUM_COALESCED" /* CSUM flags compatibility mappings. */ #define CSUM_IP_CHECKED CSUM_L3_CALC From owner-svn-src-stable@freebsd.org Thu Jan 25 07:27: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 09984EC5E0A; Thu, 25 Jan 2018 07:27:04 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B02766FAAC; Thu, 25 Jan 2018 07:27:03 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5A891755; Thu, 25 Jan 2018 07:27:03 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0P7R3bu072231; Thu, 25 Jan 2018 07:27:03 GMT (envelope-from pkelsey@FreeBSD.org) Received: (from pkelsey@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0P7R36D072230; Thu, 25 Jan 2018 07:27:03 GMT (envelope-from pkelsey@FreeBSD.org) Message-Id: <201801250727.w0P7R36D072230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pkelsey set sender to pkelsey@FreeBSD.org using -f From: Patrick Kelsey Date: Thu, 25 Jan 2018 07:27:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328392 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: pkelsey X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 328392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 25 Jan 2018 07:27:04 -0000 Author: pkelsey Date: Thu Jan 25 07:27:03 2018 New Revision: 328392 URL: https://svnweb.freebsd.org/changeset/base/328392 Log: MFC of r305169: _taskqueue_start_threads() now fails if it doesn't actually start any threads. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D7701 Modified: stable/11/sys/kern/subr_taskqueue.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_taskqueue.c ============================================================================== --- stable/11/sys/kern/subr_taskqueue.c Thu Jan 25 07:19:07 2018 (r328391) +++ stable/11/sys/kern/subr_taskqueue.c Thu Jan 25 07:27:03 2018 (r328392) @@ -672,6 +672,11 @@ _taskqueue_start_threads(struct taskqueue **tqp, int c } else tq->tq_tcount++; } + if (tq->tq_tcount == 0) { + free(tq->tq_threads, M_TASKQUEUE); + tq->tq_threads = NULL; + return (ENOMEM); + } for (i = 0; i < count; i++) { if (tq->tq_threads[i] == NULL) continue; From owner-svn-src-stable@freebsd.org Thu Jan 25 15:28: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 78D0DEB5A74; Thu, 25 Jan 2018 15:28:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E37C82118; Thu, 25 Jan 2018 15:28:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4936E6AB1; Thu, 25 Jan 2018 15:28:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0PFSipQ013931; Thu, 25 Jan 2018 15:28:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0PFSixU013929; Thu, 25 Jan 2018 15:28:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801251528.w0PFSixU013929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 25 Jan 2018 15:28:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328397 - in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 328397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 25 Jan 2018 15:28:44 -0000 Author: kib Date: Thu Jan 25 15:28:43 2018 New Revision: 328397 URL: https://svnweb.freebsd.org/changeset/base/328397 Log: MFC r327820: Remove redundand CLD instructions. Modified: stable/11/sys/amd64/amd64/support.S stable/11/sys/i386/i386/support.s Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/support.S ============================================================================== --- stable/11/sys/amd64/amd64/support.S Thu Jan 25 14:36:47 2018 (r328396) +++ stable/11/sys/amd64/amd64/support.S Thu Jan 25 15:28:43 2018 (r328397) @@ -50,7 +50,6 @@ ENTRY(bzero) movq %rsi,%rcx xorl %eax,%eax shrq $3,%rcx - cld rep stosq movq %rsi,%rcx @@ -76,7 +75,6 @@ ENTRY(bcmp) PUSH_FRAME_POINTER movq %rdx,%rcx shrq $3,%rcx - cld /* compare forwards */ repe cmpsq jne 1f @@ -108,7 +106,6 @@ ENTRY(bcopy) jb 1f shrq $3,%rcx /* copy by 64-bit words */ - cld /* nope, copy forwards */ rep movsq movq %rdx,%rcx @@ -147,7 +144,6 @@ ENTRY(memcpy) movq %rdi,%rax movq %rdx,%rcx shrq $3,%rcx /* copy by 64-bit words */ - cld /* copy forwards */ rep movsq movq %rdx,%rcx @@ -194,7 +190,6 @@ ENTRY(fillw) movq %rdi,%rax movq %rsi,%rdi movq %rdx,%rcx - cld rep stosw POP_FRAME_POINTER @@ -251,7 +246,6 @@ ENTRY(copyout) movq %rdx,%rcx shrq $3,%rcx - cld rep movsq movb %dl,%cl @@ -300,7 +294,6 @@ ENTRY(copyin) movq %rdx,%rcx movb %cl,%al shrq $3,%rcx /* copy longword-wise */ - cld rep movsq movb %al,%cl @@ -597,7 +590,6 @@ ENTRY(copyinstr) movq %rax,%r8 1: incq %rdx - cld 2: decq %rdx @@ -648,7 +640,6 @@ ENTRY(copystr) xchgq %rdi,%rsi incq %rdx - cld 1: decq %rdx jz 4f Modified: stable/11/sys/i386/i386/support.s ============================================================================== --- stable/11/sys/i386/i386/support.s Thu Jan 25 14:36:47 2018 (r328396) +++ stable/11/sys/i386/i386/support.s Thu Jan 25 15:28:43 2018 (r328397) @@ -50,7 +50,6 @@ ENTRY(bzero) movl 12(%esp),%ecx xorl %eax,%eax shrl $2,%ecx - cld rep stosl movl 12(%esp),%ecx @@ -83,7 +82,6 @@ ENTRY(i686_pagezero) movl 12(%esp),%edi movl $1024,%ecx - cld ALIGN_TEXT 1: @@ -134,7 +132,6 @@ ENTRY(fillw) movl 8(%esp),%eax movl 12(%esp),%edi movl 16(%esp),%ecx - cld rep stosw popl %edi @@ -151,7 +148,6 @@ ENTRY(bcopyb) subl %esi,%eax cmpl %ecx,%eax /* overlapping && src < dst? */ jb 1f - cld /* nope, copy forwards */ rep movsb popl %edi @@ -192,7 +188,6 @@ ENTRY(bcopy) jb 1f shrl $2,%ecx /* copy by 32-bit words */ - cld /* nope, copy forwards */ rep movsl movl 16(%ebp),%ecx @@ -238,7 +233,6 @@ ENTRY(memcpy) movl 20(%esp),%ecx movl %edi,%eax shrl $2,%ecx /* copy by 32-bit words */ - cld /* nope, copy forwards */ rep movsl movl 20(%esp),%ecx @@ -308,7 +302,6 @@ ENTRY(copyout) movl %ebx,%ecx shrl $2,%ecx - cld rep movsl movb %bl,%cl @@ -359,7 +352,6 @@ ENTRY(copyin) movb %cl,%al shrl $2,%ecx /* copy longword-wise */ - cld rep movsl movb %al,%cl @@ -576,7 +568,6 @@ ENTRY(copyinstr) movl %eax,20(%esp) 1: incl %edx - cld 2: decl %edx @@ -629,7 +620,6 @@ ENTRY(copystr) movl 16(%esp),%edi /* %edi = to */ movl 20(%esp),%edx /* %edx = maxlen */ incl %edx - cld 1: decl %edx jz 4f @@ -669,7 +659,6 @@ ENTRY(bcmp) movl %edx,%ecx shrl $2,%ecx - cld /* compare forwards */ repe cmpsl jne 1f From owner-svn-src-stable@freebsd.org Fri Jan 26 00:34: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 9829DED8538; Fri, 26 Jan 2018 00:34:34 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 489F87A26E; Fri, 26 Jan 2018 00:34:34 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 427B214633; Fri, 26 Jan 2018 00:34:34 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q0YY52087535; Fri, 26 Jan 2018 00:34:34 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q0YYI1087534; Fri, 26 Jan 2018 00:34:34 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201801260034.w0Q0YYI1087534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 26 Jan 2018 00:34:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328421 - stable/11/usr.bin/procstat X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/usr.bin/procstat X-SVN-Commit-Revision: 328421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 26 Jan 2018 00:34:34 -0000 Author: brooks Date: Fri Jan 26 00:34:33 2018 New Revision: 328421 URL: https://svnweb.freebsd.org/changeset/base/328421 Log: MFC r328297: Don't escape '?'s in protocol output. This isn't required by mandoc and is nonfunctional in groff. PR: 224632 Reported by: w.schwarzenfeld@utanet.at Differential Revision: https://reviews.freebsd.org/D13779 Modified: stable/11/usr.bin/procstat/procstat.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/procstat/procstat.1 ============================================================================== --- stable/11/usr.bin/procstat/procstat.1 Fri Jan 26 00:03:14 2018 (r328420) +++ stable/11/usr.bin/procstat/procstat.1 Fri Jan 26 00:34:33 2018 (r328421) @@ -288,7 +288,7 @@ see .Dv IPPROTO_DIVERT ; see .Xr divert 4 . -.It IP\? +.It IP? unknown protocol. .It RAW .Dv IPPROTO_RAW ; @@ -319,12 +319,12 @@ see .Dv IPPROTO_TCP ; see .Xr tcp 4 . -.It UD\? +.It UD? unknown protocol. .El .Pp .Bl -tag -width indent -compact -.It \? +.It ? unknown address family. .El .Ss Signal Disposition Information From owner-svn-src-stable@freebsd.org Fri Jan 26 00:35: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 2598EED860C; Fri, 26 Jan 2018 00:35:34 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C9DE17A3B5; Fri, 26 Jan 2018 00:35:33 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C489C14637; Fri, 26 Jan 2018 00:35:33 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q0ZXu3087644; Fri, 26 Jan 2018 00:35:33 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q0ZXRH087643; Fri, 26 Jan 2018 00:35:33 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201801260035.w0Q0ZXRH087643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 26 Jan 2018 00:35:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328422 - stable/10/usr.bin/procstat X-SVN-Group: stable-10 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/10/usr.bin/procstat X-SVN-Commit-Revision: 328422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 26 Jan 2018 00:35:34 -0000 Author: brooks Date: Fri Jan 26 00:35:33 2018 New Revision: 328422 URL: https://svnweb.freebsd.org/changeset/base/328422 Log: MFC r328297: Don't escape '?'s in protocol output. This isn't required by mandoc and is nonfunctional in groff. PR: 224632 Reported by: w.schwarzenfeld@utanet.at Differential Revision: https://reviews.freebsd.org/D13779 Modified: stable/10/usr.bin/procstat/procstat.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/procstat/procstat.1 ============================================================================== --- stable/10/usr.bin/procstat/procstat.1 Fri Jan 26 00:34:33 2018 (r328421) +++ stable/10/usr.bin/procstat/procstat.1 Fri Jan 26 00:35:33 2018 (r328422) @@ -276,7 +276,7 @@ see .Dv IPPROTO_DIVERT ; see .Xr divert 4 . -.It IP\? +.It IP? unknown protocol. .It RAW .Dv IPPROTO_RAW ; @@ -307,12 +307,12 @@ see .Dv IPPROTO_TCP ; see .Xr tcp 4 . -.It UD\? +.It UD? unknown protocol. .El .Pp .Bl -tag -width indent -compact -.It \? +.It ? unknown address family. .El .Ss Signal Disposition Information From owner-svn-src-stable@freebsd.org Fri Jan 26 04:32: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 6B6DDEBE0ED; Fri, 26 Jan 2018 04:32:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1EE8981ECB; Fri, 26 Jan 2018 04:32:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19C7B16EB0; Fri, 26 Jan 2018 04:32:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q4WVOK007737; Fri, 26 Jan 2018 04:32:31 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q4WVho007736; Fri, 26 Jan 2018 04:32:31 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201801260432.w0Q4WVho007736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 26 Jan 2018 04:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328429 - in stable: 10/release 11/release X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release 11/release X-SVN-Commit-Revision: 328429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 26 Jan 2018 04:32:32 -0000 Author: gjb Date: Fri Jan 26 04:32:31 2018 New Revision: 328429 URL: https://svnweb.freebsd.org/changeset/base/328429 Log: MFC r328283, r328284: r328283: When CHROOTBUILD_SKIP is set, evaluate the existence of /bin/sh within the CHROOTDIR. If it does not exist, unset CHROOTBUILD_SKIP to prevent build failures. r328284: Bump Copyright year. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/release.sh Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/release/release.sh Directory Properties: stable/11/ (props changed) Modified: stable/10/release/release.sh ============================================================================== --- stable/10/release/release.sh Fri Jan 26 04:24:39 2018 (r328428) +++ stable/10/release/release.sh Fri Jan 26 04:32:31 2018 (r328429) @@ -1,6 +1,6 @@ #!/bin/sh #- -# Copyright (c) 2013-2017 The FreeBSD Foundation +# Copyright (c) 2013-2018 The FreeBSD Foundation # Copyright (c) 2013 Glen Barber # Copyright (c) 2011 Nathan Whitehorn # All rights reserved. @@ -195,6 +195,11 @@ env_check() { if [ $(id -u) -ne 0 ]; then echo "Needs to be run as root." exit 1 + fi + + # Unset CHROOTBUILD_SKIP if the chroot(8) does not appear to exist. + if [ ! -z "${CHROOTBUILD_SKIP}" -a ! -e ${CHROOTDIR}/bin/sh ]; then + CHROOTBUILD_SKIP= fi CHROOT_MAKEENV="${CHROOT_MAKEENV} \ From owner-svn-src-stable@freebsd.org Fri Jan 26 04:32: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 A2B2FEBE0F1; Fri, 26 Jan 2018 04:32:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54DB781ECD; Fri, 26 Jan 2018 04:32:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F71D16EB1; Fri, 26 Jan 2018 04:32:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q4WWw9007743; Fri, 26 Jan 2018 04:32:32 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q4WW0e007742; Fri, 26 Jan 2018 04:32:32 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201801260432.w0Q4WW0e007742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 26 Jan 2018 04:32:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328429 - in stable: 10/release 11/release X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release 11/release X-SVN-Commit-Revision: 328429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 26 Jan 2018 04:32:32 -0000 Author: gjb Date: Fri Jan 26 04:32:31 2018 New Revision: 328429 URL: https://svnweb.freebsd.org/changeset/base/328429 Log: MFC r328283, r328284: r328283: When CHROOTBUILD_SKIP is set, evaluate the existence of /bin/sh within the CHROOTDIR. If it does not exist, unset CHROOTBUILD_SKIP to prevent build failures. r328284: Bump Copyright year. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/release.sh Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/release/release.sh Directory Properties: stable/10/ (props changed) Modified: stable/11/release/release.sh ============================================================================== --- stable/11/release/release.sh Fri Jan 26 04:24:39 2018 (r328428) +++ stable/11/release/release.sh Fri Jan 26 04:32:31 2018 (r328429) @@ -1,6 +1,6 @@ #!/bin/sh #- -# Copyright (c) 2013-2017 The FreeBSD Foundation +# Copyright (c) 2013-2018 The FreeBSD Foundation # Copyright (c) 2013 Glen Barber # Copyright (c) 2011 Nathan Whitehorn # All rights reserved. @@ -201,6 +201,11 @@ env_check() { if [ $(id -u) -ne 0 ]; then echo "Needs to be run as root." exit 1 + fi + + # Unset CHROOTBUILD_SKIP if the chroot(8) does not appear to exist. + if [ ! -z "${CHROOTBUILD_SKIP}" -a ! -e ${CHROOTDIR}/bin/sh ]; then + CHROOTBUILD_SKIP= fi CHROOT_MAKEENV="${CHROOT_MAKEENV} \ From owner-svn-src-stable@freebsd.org Fri Jan 26 22:23: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 37E22ECCB41; Fri, 26 Jan 2018 22:23:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E1B0368BEF; Fri, 26 Jan 2018 22:23:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCB37218D1; Fri, 26 Jan 2018 22:23:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QMNOvb040990; Fri, 26 Jan 2018 22:23:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QMNOon040989; Fri, 26 Jan 2018 22:23:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801262223.w0QMNOon040989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 26 Jan 2018 22:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328451 - stable/11/sys/boot/fdt X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/boot/fdt X-SVN-Commit-Revision: 328451 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 26 Jan 2018 22:23:25 -0000 Author: kevans Date: Fri Jan 26 22:23:24 2018 New Revision: 328451 URL: https://svnweb.freebsd.org/changeset/base/328451 Log: MFC (conceptually) r327991, r328009: Don't clobber FDT enroute to the kernel This is a direct commit to stable/11 due to path changes that have occured in HEAD. The diffs remain the same, but rebased against their old locations. MFC r327991: stand/fdt: don't send clobbered FDT to the kernel If fdt_overlay_apply fails at some stage to apply the overlay to the base, both the base and overlay may be in an inconsistent state (some fixups applied, some phandles adjusted, some symbols merged). These can be bad for a number of reasons, to include user frustration if some fixups applied and not others. Fail a little safer by making a clean copy of the base FDT for every overlay that we can simply discard if things go awry. This also allows us the luxury of simply discarding overlays if we hit some kind of memory limit or if they're malformed and extremely large for some reason. We'll now leave a nice error message indicating that some overlays could not be applied due to size restrictions and we apply what we can. I note that our overlay implementation has some flaws that might still leave your system in an unbootable state even if an overlay applies correctly; please exercise caution in using overlays until we can swap it out for libfdt's implementation. MFC r328009: stand/fdt: Don't leak next_fdtp if we fail to open overlay Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- stable/11/sys/boot/fdt/fdt_loader_cmd.c Fri Jan 26 22:22:26 2018 (r328450) +++ stable/11/sys/boot/fdt/fdt_loader_cmd.c Fri Jan 26 22:23:24 2018 (r328451) @@ -339,60 +339,79 @@ void fdt_apply_overlays() { struct preloaded_file *fp; - size_t overlays_size, max_overlay_size, new_fdtp_size; + size_t max_overlay_size, next_fdtp_size; + size_t current_fdtp_size; + void *current_fdtp; void *new_fdtp; + void *next_fdtp; void *overlay; int rv; if ((fdtp == NULL) || (fdtp_size == 0)) return; - overlays_size = 0; + new_fdtp = NULL; max_overlay_size = 0; for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { if (max_overlay_size < fp->f_size) max_overlay_size = fp->f_size; - overlays_size += fp->f_size; } /* Nothing to apply */ - if (overlays_size == 0) + if (max_overlay_size == 0) return; - /* It's actually more than enough */ - new_fdtp_size = fdtp_size + overlays_size; - new_fdtp = malloc(new_fdtp_size); - if (new_fdtp == NULL) { - printf("failed to allocate memory for DTB blob with overlays\n"); - return; - } - overlay = malloc(max_overlay_size); if (overlay == NULL) { printf("failed to allocate memory for DTB blob with overlays\n"); - free(new_fdtp); return; } - - rv = fdt_open_into(fdtp, new_fdtp, new_fdtp_size); - if (rv != 0) { - printf("failed to open DTB blob for applying overlays\n"); - free(new_fdtp); - free(overlay); - return; - } - + current_fdtp = fdtp; + current_fdtp_size = fdtp_size; for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { printf("applying DTB overlay '%s'\n", fp->f_name); + next_fdtp_size = current_fdtp_size + fp->f_size; + next_fdtp = malloc(next_fdtp_size); + if (next_fdtp == NULL) { + /* + * Output warning, then move on to applying other + * overlays in case this one is simply too large. + */ + printf("failed to allocate memory for overlay base\n"); + continue; + } + rv = fdt_open_into(current_fdtp, next_fdtp, next_fdtp_size); + if (rv != 0) { + free(next_fdtp); + printf("failed to open base dtb into overlay base\n"); + continue; + } COPYOUT(fp->f_addr, overlay, fp->f_size); /* Both overlay and new_fdtp may be modified in place */ - fdt_overlay_apply(new_fdtp, overlay); + rv = fdt_overlay_apply(next_fdtp, overlay); + if (rv == 0) { + /* Rotate next -> current */ + if (current_fdtp != fdtp) + free(current_fdtp); + current_fdtp = next_fdtp; + current_fdtp_size = next_fdtp_size; + } else { + /* + * Assume here that the base we tried to apply on is + * either trashed or in an inconsistent state. Trying to + * load it might work, but it's better to discard it and + * play it safe. */ + free(next_fdtp); + printf("failed to apply overlay: %s\n", + fdt_strerror(rv)); + } } - - free(fdtp); - fdtp = new_fdtp; - fdtp_size = new_fdtp_size; - + /* We could have failed to apply all overlays; then we do nothing */ + if (current_fdtp != fdtp) { + free(fdtp); + fdtp = current_fdtp; + fdtp_size = current_fdtp_size; + } free(overlay); } From owner-svn-src-stable@freebsd.org Fri Jan 26 23:49: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 896A3ED0869; Fri, 26 Jan 2018 23:49:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A75E6BA24; Fri, 26 Jan 2018 23:49:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35201225A4; Fri, 26 Jan 2018 23:49:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0QNnXJA081846; Fri, 26 Jan 2018 23:49:33 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0QNnVpW081830; Fri, 26 Jan 2018 23:49:31 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201801262349.w0QNnVpW081830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 26 Jan 2018 23:49:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328454 - in stable/11: lib/libsysdecode sys/compat/freebsd32 sys/kern sys/sys usr.bin/kdump usr.bin/ktrace usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/11: lib/libsysdecode sys/compat/freebsd32 sys/kern sys/sys usr.bin/kdump usr.bin/ktrace usr.bin/truss X-SVN-Commit-Revision: 328454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 26 Jan 2018 23:49:33 -0000 Author: jhb Date: Fri Jan 26 23:49:31 2018 New Revision: 328454 URL: https://svnweb.freebsd.org/changeset/base/328454 Log: MFC 326184: Decode kevent structures logged via ktrace(2) in kdump. - Add a new KTR_STRUCT_ARRAY ktrace record type which dumps an array of structures. The structure name in the record payload is preceded by a size_t containing the size of the individual structures. Use this to replace the previous code that dumped the kevent arrays dumped for kevent(). kdump is now able to decode the kevent structures rather than dumping their contents via a hexdump. One change from before is that the 'changes' and 'events' arrays are not marked with separate 'read' and 'write' annotations in kdump output. Instead, the first array is the 'changes' array, and the second array (only present if kevent doesn't fail with an error) is the 'events' array. For kevent(), empty arrays are denoted by an entry with an array containing zero entries rather than no record. - Move kevent decoding tables from truss to libsysdecode. This adds three new functions to decode members of struct kevent: sysdecode_kevent_filter, sysdecode_kevent_flags, and sysdecode_kevent_fflags. kdump uses these helper functions to pretty-print kevent fields. - Move structure definitions for freebsd11 and freebsd32 kevent structures to so that they can be shared with userland. The 32-bit structures are only exposed if _WANT_KEVENT32 is defined. The freebsd11 structures are only exposed if _WANT_FREEBSD11_KEVENT is defined. The 32-bit freebsd11 structure requires both. - Decode freebsd11 kevent structures in truss for the compat11.kevent() system call. - Log 32-bit kevent structures via ktrace for 32-bit compat kevent() system calls. - While here, constify the 'void *data' argument to ktrstruct(). Note that this version of the change for 11.x does not include freebsd11 kevent structures or _WANT_FREEBSD11_KEVENT. It also does not include the change to decode the compat11.kevent system call in truss. Added: stable/11/lib/libsysdecode/sysdecode_kevent.3 - copied unchanged from r326184, head/lib/libsysdecode/sysdecode_kevent.3 Modified: stable/11/lib/libsysdecode/Makefile stable/11/lib/libsysdecode/flags.c stable/11/lib/libsysdecode/mktables stable/11/lib/libsysdecode/sysdecode.3 stable/11/lib/libsysdecode/sysdecode.h stable/11/sys/compat/freebsd32/freebsd32.h stable/11/sys/compat/freebsd32/freebsd32_misc.c stable/11/sys/kern/kern_event.c stable/11/sys/kern/kern_ktrace.c stable/11/sys/sys/event.h stable/11/sys/sys/ktrace.h stable/11/usr.bin/kdump/kdump.c stable/11/usr.bin/ktrace/ktrace.h stable/11/usr.bin/truss/syscall.h stable/11/usr.bin/truss/syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/Makefile ============================================================================== --- stable/11/lib/libsysdecode/Makefile Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/lib/libsysdecode/Makefile Fri Jan 26 23:49:31 2018 (r328454) @@ -17,6 +17,7 @@ MAN= sysdecode.3 \ sysdecode_cap_rights.3 \ sysdecode_enum.3 \ sysdecode_fcntl_arg.3 \ + sysdecode_kevent.3 \ sysdecode_ioctlname.3 \ sysdecode_mask.3 \ sysdecode_quotactl_cmd.3 \ @@ -69,6 +70,9 @@ MLINKS+=sysdecode_enum.3 sysdecode_acltype.3 \ sysdecode_enum.3 sysdecode_vmresult.3 \ sysdecode_enum.3 sysdecode_whence.3 MLINKS+=sysdecode_fcntl_arg.3 sysdecode_fcntl_arg_p.3 +MLINKS+=sysdecode_kevent.3 sysdecode_kevent_fflags.3 \ + sysdecode_kevent.3 sysdecode_kevent_filter.3 \ + sysdecode_kevent.3 sysdecode_kevent_flags.3 MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \ sysdecode_mask.3 sysdecode_atflags.3 \ sysdecode_mask.3 sysdecode_capfcntlrights.3 \ Modified: stable/11/lib/libsysdecode/flags.c ============================================================================== --- stable/11/lib/libsysdecode/flags.c Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/lib/libsysdecode/flags.c Fri Jan 26 23:49:31 2018 (r328454) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -499,6 +500,116 @@ sysdecode_getrusage_who(int who) { return (lookup_value(rusage, who)); +} + +static struct name_table kevent_user_ffctrl[] = { + X(NOTE_FFNOP) X(NOTE_FFAND) X(NOTE_FFOR) X(NOTE_FFCOPY) + XEND +}; + +static struct name_table kevent_rdwr_fflags[] = { + X(NOTE_LOWAT) X(NOTE_FILE_POLL) XEND +}; + +static struct name_table kevent_vnode_fflags[] = { + X(NOTE_DELETE) X(NOTE_WRITE) X(NOTE_EXTEND) X(NOTE_ATTRIB) + X(NOTE_LINK) X(NOTE_RENAME) X(NOTE_REVOKE) X(NOTE_OPEN) X(NOTE_CLOSE) + X(NOTE_CLOSE_WRITE) X(NOTE_READ) XEND +}; + +static struct name_table kevent_proc_fflags[] = { + X(NOTE_EXIT) X(NOTE_FORK) X(NOTE_EXEC) X(NOTE_TRACK) X(NOTE_TRACKERR) + X(NOTE_CHILD) XEND +}; + +static struct name_table kevent_timer_fflags[] = { + X(NOTE_SECONDS) X(NOTE_MSECONDS) X(NOTE_USECONDS) X(NOTE_NSECONDS) + XEND +}; + +void +sysdecode_kevent_fflags(FILE *fp, short filter, int fflags, int base) +{ + int rem; + + if (fflags == 0) { + fputs("0", fp); + return; + } + + switch (filter) { + case EVFILT_READ: + case EVFILT_WRITE: + if (!print_mask_int(fp, kevent_rdwr_fflags, fflags, &rem)) + fprintf(fp, "%#x", rem); + else if (rem != 0) + fprintf(fp, "|%#x", rem); + break; + case EVFILT_VNODE: + if (!print_mask_int(fp, kevent_vnode_fflags, fflags, &rem)) + fprintf(fp, "%#x", rem); + else if (rem != 0) + fprintf(fp, "|%#x", rem); + break; + case EVFILT_PROC: + case EVFILT_PROCDESC: + if (!print_mask_int(fp, kevent_proc_fflags, fflags, &rem)) + fprintf(fp, "%#x", rem); + else if (rem != 0) + fprintf(fp, "|%#x", rem); + break; + case EVFILT_TIMER: + if (!print_mask_int(fp, kevent_timer_fflags, fflags, &rem)) + fprintf(fp, "%#x", rem); + else if (rem != 0) + fprintf(fp, "|%#x", rem); + break; + case EVFILT_USER: { + unsigned int ctrl, data; + + ctrl = fflags & NOTE_FFCTRLMASK; + data = fflags & NOTE_FFLAGSMASK; + + if (fflags & NOTE_TRIGGER) { + fputs("NOTE_TRIGGER", fp); + if (fflags == NOTE_TRIGGER) + return; + fputc('|', fp); + } + + /* + * An event with 'ctrl' == NOTE_FFNOP is either a reported + * (output) event for which only 'data' should be output + * or a pointless input event. Assume that pointless + * input events don't occur in practice. An event with + * NOTE_TRIGGER is always an input event. + */ + if (ctrl != NOTE_FFNOP || fflags & NOTE_TRIGGER) { + fprintf(fp, "%s|%#x", + lookup_value(kevent_user_ffctrl, ctrl), data); + } else { + print_integer(fp, data, base); + } + break; + } + default: + print_integer(fp, fflags, base); + break; + } +} + +bool +sysdecode_kevent_flags(FILE *fp, int flags, int *rem) +{ + + return (print_mask_int(fp, keventflags, flags, rem)); +} + +const char * +sysdecode_kevent_filter(int filter) +{ + + return (lookup_value(keventfilters, filter)); } const char * Modified: stable/11/lib/libsysdecode/mktables ============================================================================== --- stable/11/lib/libsysdecode/mktables Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/lib/libsysdecode/mktables Fri Jan 26 23:49:31 2018 (r328454) @@ -107,6 +107,8 @@ gen_table "mmapprot" "PROT_[A-Z]+[[:space:]]+0x gen_table "ngbtsolevel" "SOL_[A-Z0-9]+[[:space:]]+0x[0-9A-Fa-f]+" "netgraph/bluetooth/include/ng_btsocket.h" gen_table "fileflags" "[SU]F_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/stat.h" "UF_COMPRESSED|UF_TRACKED|UF_SETTABLE|SF_SETTABLE" gen_table "filemode" "S_[A-Z]+[[:space:]]+[0-6]{7}" "sys/stat.h" +gen_table "keventflags" "EV_[A-Z]+[[:space:]]+0x[0-9]+" "sys/event.h" "EV_SYSFLAGS|EV_DROP|EV_FLAG[12]" +gen_table "keventfilters" "EVFILT_[A-Z]+[[:space:]]+\(-[0-9]+\)" "sys/event.h" gen_table "mountflags" "MNT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mount.h" gen_table "msyncflags" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h" gen_table "nfssvcflags" "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+" "nfs/nfssvc.h" Modified: stable/11/lib/libsysdecode/sysdecode.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.3 Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/lib/libsysdecode/sysdecode.3 Fri Jan 26 23:49:31 2018 (r328454) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 3, 2017 +.Dd November 24, 2017 .Dt SYSDECODE 3 .Os .Sh NAME @@ -73,6 +73,7 @@ A placeholder for use when the ABI is not known. .Xr sysdecode_enum 3 , .Xr sysdecode_fcntl_arg 3 , .Xr sysdecode_ioctlname 3 , +.Xr sysdecode_kevent 3 , .Xr sysdecode_mask 3 , .Xr sysdecode_quotactl_cmd 3 , .Xr sysdecode_sigcode 3 , Modified: stable/11/lib/libsysdecode/sysdecode.h ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.h Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/lib/libsysdecode/sysdecode.h Fri Jan 26 23:49:31 2018 (r328454) @@ -60,6 +60,10 @@ const char *sysdecode_getrusage_who(int _who); const char *sysdecode_idtype(int _idtype); const char *sysdecode_ioctlname(unsigned long _val); const char *sysdecode_ipproto(int _protocol); +void sysdecode_kevent_fflags(FILE *_fp, short _filter, int _fflags, + int _base); +const char *sysdecode_kevent_filter(int _filter); +bool sysdecode_kevent_flags(FILE *_fp, int _flags, int *_rem); const char *sysdecode_kldsym_cmd(int _cmd); const char *sysdecode_kldunload_flags(int _flags); const char *sysdecode_lio_listio_mode(int _mode); Copied: stable/11/lib/libsysdecode/sysdecode_kevent.3 (from r326184, head/lib/libsysdecode/sysdecode_kevent.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libsysdecode/sysdecode_kevent.3 Fri Jan 26 23:49:31 2018 (r328454, copy of r326184, head/lib/libsysdecode/sysdecode_kevent.3) @@ -0,0 +1,126 @@ +.\" +.\" Copyright (c) 2017 John Baldwin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 24, 2017 +.Dt sysdecode_kevent 3 +.Os +.Sh NAME +.Nm sysdecode_kevent , +.Nm sysdecode_kevent_fflags , +.Nm sysdecode_kevent_filter , +.Nm sysdecode_kevent_flags +.Nd output description of kevent structure fields +.Sh LIBRARY +.Lb libsysdecode +.Sh SYNOPSIS +.In sys/types.h +.In stdbool.h +.In stdio.h +.In sysdecode.h +.Ft void +.Fn sysdecode_kevent_fflags "FILE *fp" "short filter" "int fflags" "int base" +.Ft bool +.Fn sysdecode_kevent_flags "FILE *fp" "int flags" "int *rem" +.Ft const char * +.Fn sysdecode_kevent_filter "int filter" +.Sh DESCRIPTION +These functions provide text descriptions of +.Vt struct kevent +fields. +.Pp +The +.Fn sysdecode_kevent_fflags +function outputs a text description of the +.Fa fflags +member of a +.Vt struct kevent +to the stream +.Fa fp . +For the +.Dv EVFILT_READ , +.Dv EVFILT_WRITE , +.Dv EVFILT_VNODE , +.Dv EVFILT_PROC , +.Dv EVFILT_PROCDESC , +.Dv EVFILT_TIMER , +and +.Dv EVFILT_USER +filters, +.Fn sysdecode_kevent_fflags +outputs a bitmask of filter-specific +.Dv NOTE_* +flags as documented in +.Xr kevent 2 . +For other values of +.Fa filter , +the value of +.Fa fflags +is output in the indicated +.Fa base +.Pq one of 8, 10, or 16 . +.Pp +The +.Fn sysdecode_kevent_filter +function returns a text description of the +.Fa filter +member of a +.Vt struct kevent . +.Dv NULL +is returned if the +.Fa filter +value is unknown. +.Pp +The +.Fn sysdecode_kevent_flags +function outputs a text description of the +.Fa flags +member of a +.Vt struct kevent +to the stream +.Fa fp . +This function uses the same calling convention and formatting as the other +functions described in +.Xr sysdecode_mask 3 . +.Sh RETURN VALUES +The +.Nm sysdecode_kevent_filter +function returns the name of a filter or +.Dv NULL if the filter value is unknown. +.Pp +The +.Nm sysdecode_kevent_flags +function returns +.Dv true +if any flags in the +.Fa flags +field were decoded and +.Dv false +if no flags were decoded. +.Sh SEE ALSO +.Xr sysdecode 3 , +.Xr sysdecode_enum 3 , +.Xr sysdecode_mask 3 Modified: stable/11/sys/compat/freebsd32/freebsd32.h ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32.h Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/sys/compat/freebsd32/freebsd32.h Fri Jan 26 23:49:31 2018 (r328454) @@ -135,15 +135,6 @@ struct statfs32 { int32_t f_spare[2]; }; -struct kevent32 { - u_int32_t ident; /* identifier for this event */ - short filter; /* filter for event */ - u_short flags; - u_int fflags; - int32_t data; - u_int32_t udata; /* opaque user data identifier */ -}; - struct iovec32 { u_int32_t iov_base; int iov_len; Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 26 23:49:31 2018 (r328454) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_ktrace.h" #define __ELF_WORD_SIZE 32 @@ -83,6 +84,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef KTRACE +#include +#endif #ifdef INET #include @@ -658,6 +662,9 @@ freebsd32_kevent(struct thread *td, struct freebsd32_k .k_copyout = freebsd32_kevent_copyout, .k_copyin = freebsd32_kevent_copyin, }; +#ifdef KTRACE + struct kevent32 *eventlist = uap->eventlist; +#endif int error; @@ -670,8 +677,18 @@ freebsd32_kevent(struct thread *td, struct freebsd32_k tsp = &ts; } else tsp = NULL; +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT_ARRAY)) + ktrstructarray("kevent32", UIO_USERSPACE, uap->changelist, + uap->nchanges, sizeof(struct kevent32)); +#endif error = kern_kevent(td, uap->fd, uap->nchanges, uap->nevents, &k_ops, tsp); +#ifdef KTRACE + if (error == 0 && KTRPOINT(td, KTR_STRUCT_ARRAY)) + ktrstructarray("kevent32", UIO_USERSPACE, eventlist, + td->td_retval[0], sizeof(struct kevent32)); +#endif return (error); } Modified: stable/11/sys/kern/kern_event.c ============================================================================== --- stable/11/sys/kern/kern_event.c Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/sys/kern/kern_event.c Fri Jan 26 23:49:31 2018 (r328454) @@ -860,17 +860,6 @@ kern_kqueue(struct thread *td, int flags, struct filec return (0); } -#ifdef KTRACE -static size_t -kev_iovlen(int n, u_int kgio) -{ - - if (n < 0 || n >= kgio / sizeof(struct kevent)) - return (kgio); - return (n * sizeof(struct kevent)); -} -#endif - #ifndef _SYS_SYSPROTO_H_ struct kevent_args { int fd; @@ -890,14 +879,10 @@ sys_kevent(struct thread *td, struct kevent_args *uap) .k_copyout = kevent_copyout, .k_copyin = kevent_copyin, }; - int error; #ifdef KTRACE - struct uio ktruio; - struct iovec ktriov; - struct uio *ktruioin = NULL; - struct uio *ktruioout = NULL; - u_int kgio; + struct kevent *eventlist = uap->eventlist; #endif + int error; if (uap->timeout != NULL) { error = copyin(uap->timeout, &ts, sizeof(ts)); @@ -908,31 +893,18 @@ sys_kevent(struct thread *td, struct kevent_args *uap) tsp = NULL; #ifdef KTRACE - if (KTRPOINT(td, KTR_GENIO)) { - kgio = ktr_geniosize; - ktriov.iov_base = uap->changelist; - ktriov.iov_len = kev_iovlen(uap->nchanges, kgio); - ktruio = (struct uio){ .uio_iov = &ktriov, .uio_iovcnt = 1, - .uio_segflg = UIO_USERSPACE, .uio_rw = UIO_READ, - .uio_td = td }; - ktruioin = cloneuio(&ktruio); - ktriov.iov_base = uap->eventlist; - ktriov.iov_len = kev_iovlen(uap->nevents, kgio); - ktriov.iov_len = uap->nevents * sizeof(struct kevent); - ktruioout = cloneuio(&ktruio); - } + if (KTRPOINT(td, KTR_STRUCT_ARRAY)) + ktrstructarray("kevent", UIO_USERSPACE, uap->changelist, + uap->nchanges, sizeof(struct kevent)); #endif error = kern_kevent(td, uap->fd, uap->nchanges, uap->nevents, &k_ops, tsp); #ifdef KTRACE - if (ktruioin != NULL) { - ktruioin->uio_resid = kev_iovlen(uap->nchanges, kgio); - ktrgenio(uap->fd, UIO_WRITE, ktruioin, 0); - ktruioout->uio_resid = kev_iovlen(td->td_retval[0], kgio); - ktrgenio(uap->fd, UIO_READ, ktruioout, error); - } + if (error == 0 && KTRPOINT(td, KTR_STRUCT_ARRAY)) + ktrstructarray("kevent", UIO_USERSPACE, eventlist, + td->td_retval[0], sizeof(struct kevent)); #endif return (error); Modified: stable/11/sys/kern/kern_ktrace.c ============================================================================== --- stable/11/sys/kern/kern_ktrace.c Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/sys/kern/kern_ktrace.c Fri Jan 26 23:49:31 2018 (r328454) @@ -104,6 +104,7 @@ struct ktr_request { struct ktr_csw ktr_csw; struct ktr_fault ktr_fault; struct ktr_faultend ktr_faultend; + struct ktr_struct_array ktr_struct_array; } ktr_data; STAILQ_ENTRY(ktr_request) ktr_list; }; @@ -123,6 +124,7 @@ static int data_lengths[] = { [KTR_CAPFAIL] = sizeof(struct ktr_cap_fail), [KTR_FAULT] = sizeof(struct ktr_fault), [KTR_FAULTEND] = sizeof(struct ktr_faultend), + [KTR_STRUCT_ARRAY] = sizeof(struct ktr_struct_array), }; static STAILQ_HEAD(, ktr_request) ktr_free; @@ -740,7 +742,7 @@ ktrcsw(int out, int user, const char *wmesg) } void -ktrstruct(const char *name, void *data, size_t datalen) +ktrstruct(const char *name, const void *data, size_t datalen) { struct ktr_request *req; char *buf; @@ -757,6 +759,52 @@ ktrstruct(const char *name, void *data, size_t datalen free(buf, M_KTRACE); return; } + req->ktr_buffer = buf; + req->ktr_header.ktr_len = buflen; + ktr_submitrequest(curthread, req); +} + +void +ktrstructarray(const char *name, enum uio_seg seg, const void *data, + int num_items, size_t struct_size) +{ + struct ktr_request *req; + struct ktr_struct_array *ksa; + char *buf; + size_t buflen, datalen, namelen; + int max_items; + + /* Trim array length to genio size. */ + max_items = ktr_geniosize / struct_size; + if (num_items > max_items) { + if (max_items == 0) + num_items = 1; + else + num_items = max_items; + } + datalen = num_items * struct_size; + + if (data == NULL) + datalen = 0; + + namelen = strlen(name) + 1; + buflen = namelen + datalen; + buf = malloc(buflen, M_KTRACE, M_WAITOK); + strcpy(buf, name); + if (seg == UIO_SYSSPACE) + bcopy(data, buf + namelen, datalen); + else { + if (copyin(data, buf + namelen, datalen) != 0) { + free(buf, M_KTRACE); + return; + } + } + if ((req = ktr_getrequest(KTR_STRUCT_ARRAY)) == NULL) { + free(buf, M_KTRACE); + return; + } + ksa = &req->ktr_data.ktr_struct_array; + ksa->struct_size = struct_size; req->ktr_buffer = buf; req->ktr_header.ktr_len = buflen; ktr_submitrequest(curthread, req); Modified: stable/11/sys/sys/event.h ============================================================================== --- stable/11/sys/sys/event.h Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/sys/sys/event.h Fri Jan 26 23:49:31 2018 (r328454) @@ -64,6 +64,17 @@ struct kevent { void *udata; /* opaque user data identifier */ }; +#if defined(_WANT_KEVENT32) || (defined(_KERNEL) && defined(__LP64__)) +struct kevent32 { + u_int32_t ident; /* identifier for this event */ + short filter; /* filter for event */ + u_short flags; + u_int fflags; + int32_t data; + u_int32_t udata; /* opaque user data identifier */ +}; +#endif + /* actions */ #define EV_ADD 0x0001 /* add event to kq (implies enable) */ #define EV_DELETE 0x0002 /* delete event from kq */ Modified: stable/11/sys/sys/ktrace.h ============================================================================== --- stable/11/sys/sys/ktrace.h Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/sys/sys/ktrace.h Fri Jan 26 23:49:31 2018 (r328454) @@ -219,6 +219,18 @@ struct ktr_faultend { }; /* + * KTR_STRUCT_ARRAY - array of misc. structs + */ +#define KTR_STRUCT_ARRAY 15 +struct ktr_struct_array { + size_t struct_size; + /* + * Followed by null-terminated structure name and then payload + * contents. + */ +}; + +/* * KTR_DROP - If this bit is set in ktr_type, then at least one event * between the previous record and this record was dropped. */ @@ -242,6 +254,7 @@ struct ktr_faultend { #define KTRFAC_CAPFAIL (1< #include #include #include #include +#include #include #include #include @@ -109,6 +113,8 @@ void ktrstruct(char *, size_t); void ktrcapfail(struct ktr_cap_fail *); void ktrfault(struct ktr_fault *); void ktrfaultend(struct ktr_faultend *); +void ktrkevent(struct kevent *); +void ktrstructarray(struct ktr_struct_array *, size_t); void limitfd(int fd); void usage(void); @@ -546,6 +552,9 @@ main(int argc, char *argv[]) case KTR_FAULTEND: ktrfaultend((struct ktr_faultend *)m); break; + case KTR_STRUCT_ARRAY: + ktrstructarray((struct ktr_struct_array *)m, ktrlen); + break; default: printf("\n"); break; @@ -714,6 +723,7 @@ dumpheader(struct ktr_header *kth) type = "USER"; break; case KTR_STRUCT: + case KTR_STRUCT_ARRAY: type = "STRU"; break; case KTR_SYSCTL: @@ -2106,6 +2116,104 @@ ktrfaultend(struct ktr_faultend *ktr) else printf("", ktr->result); printf("\n"); +} + +void +ktrkevent(struct kevent *kev) +{ + + printf("{ ident="); + switch (kev->filter) { + case EVFILT_READ: + case EVFILT_WRITE: + case EVFILT_VNODE: + case EVFILT_PROC: + case EVFILT_TIMER: + case EVFILT_PROCDESC: + printf("%ju", (uintmax_t)kev->ident); + break; + case EVFILT_SIGNAL: + print_signal(kev->ident); + break; + default: + printf("%p", (void *)kev->ident); + } + printf(", filter="); + print_integer_arg(sysdecode_kevent_filter, kev->filter); + printf(", flags="); + print_mask_arg0(sysdecode_kevent_flags, kev->flags); + printf(", fflags="); + sysdecode_kevent_fflags(stdout, kev->filter, kev->fflags, + decimal ? 10 : 16); + printf(", data=%#jx, udata=%p }", (uintmax_t)kev->data, kev->udata); +} + +void +ktrstructarray(struct ktr_struct_array *ksa, size_t buflen) +{ + struct kevent kev; + char *name, *data; + size_t namelen, datalen; + int i; + bool first; + + buflen -= sizeof(*ksa); + for (name = (char *)(ksa + 1), namelen = 0; + namelen < buflen && name[namelen] != '\0'; + ++namelen) + /* nothing */; + if (namelen == buflen) + goto invalid; + if (name[namelen] != '\0') + goto invalid; + /* sanity check */ + for (i = 0; i < (int)namelen; ++i) + if (!isalnum(name[i]) && name[i] != '_') + goto invalid; + data = name + namelen + 1; + datalen = buflen - namelen - 1; + printf("struct %s[] = { ", name); + first = true; + for (; datalen >= ksa->struct_size; + data += ksa->struct_size, datalen -= ksa->struct_size) { + if (!first) + printf("\n "); + else + first = false; + if (strcmp(name, "kevent") == 0) { + if (ksa->struct_size != sizeof(kev)) + goto bad_size; + memcpy(&kev, data, sizeof(kev)); + ktrkevent(&kev); +#ifdef _WANT_KEVENT32 + } else if (strcmp(name, "kevent32") == 0) { + struct kevent32 kev32; + + if (ksa->struct_size != sizeof(kev32)) + goto bad_size; + memcpy(&kev32, data, sizeof(kev32)); + memset(&kev, 0, sizeof(kev)); + kev.ident = kev32.ident; + kev.filter = kev32.filter; + kev.flags = kev32.flags; + kev.fflags = kev32.fflags; + kev.data = kev32.data; + kev.udata = (void *)(uintptr_t)kev32.udata; + ktrkevent(&kev); +#endif + } else { + printf(" }\n"); + return; + } + } + printf(" }\n"); + return; +invalid: + printf("invalid record\n"); + return; +bad_size: + printf(" }\n"); + return; } void Modified: stable/11/usr.bin/ktrace/ktrace.h ============================================================================== --- stable/11/usr.bin/ktrace/ktrace.h Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/usr.bin/ktrace/ktrace.h Fri Jan 26 23:49:31 2018 (r328454) @@ -32,7 +32,8 @@ #define DEF_POINTS (KTRFAC_SYSCALL | KTRFAC_SYSRET | KTRFAC_NAMEI | \ KTRFAC_GENIO | KTRFAC_PSIG | KTRFAC_USER | \ - KTRFAC_STRUCT | KTRFAC_SYSCTL | KTRFAC_CAPFAIL) + KTRFAC_STRUCT | KTRFAC_SYSCTL | KTRFAC_CAPFAIL | \ + KTRFAC_STRUCT_ARRAY) #define PROC_ABI_POINTS (KTRFAC_PROCCTOR | KTRFAC_PROCDTOR) Modified: stable/11/usr.bin/truss/syscall.h ============================================================================== --- stable/11/usr.bin/truss/syscall.h Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/usr.bin/truss/syscall.h Fri Jan 26 23:49:31 2018 (r328454) @@ -51,7 +51,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHe Sockoptname, Msgflags, CapRights, PUInt, PQuadHex, Acltype, Extattrnamespace, Minherit, Mlockall, Mountflags, Msync, Priowhich, Ptraceop, Quotactlcmd, Reboothowto, Rtpriofunc, Schedpolicy, Schedparam, - PSig, Siginfo, + PSig, Siginfo, Kevent11, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, Modified: stable/11/usr.bin/truss/syscalls.c ============================================================================== --- stable/11/usr.bin/truss/syscalls.c Fri Jan 26 23:21:50 2018 (r328453) +++ stable/11/usr.bin/truss/syscalls.c Fri Jan 26 23:49:31 2018 (r328454) @@ -638,43 +638,6 @@ struct xlat { #define X(a) { a, #a }, #define XEND { 0, NULL } -static struct xlat kevent_filters[] = { - X(EVFILT_READ) X(EVFILT_WRITE) X(EVFILT_AIO) X(EVFILT_VNODE) - X(EVFILT_PROC) X(EVFILT_SIGNAL) X(EVFILT_TIMER) - X(EVFILT_PROCDESC) X(EVFILT_FS) X(EVFILT_LIO) X(EVFILT_USER) - X(EVFILT_SENDFILE) XEND -}; - -static struct xlat kevent_flags[] = { - X(EV_ADD) X(EV_DELETE) X(EV_ENABLE) X(EV_DISABLE) X(EV_ONESHOT) - X(EV_CLEAR) X(EV_RECEIPT) X(EV_DISPATCH) X(EV_FORCEONESHOT) - X(EV_DROP) X(EV_FLAG1) X(EV_ERROR) X(EV_EOF) XEND -}; - -static struct xlat kevent_user_ffctrl[] = { - X(NOTE_FFNOP) X(NOTE_FFAND) X(NOTE_FFOR) X(NOTE_FFCOPY) - XEND -}; - -static struct xlat kevent_rdwr_fflags[] = { - X(NOTE_LOWAT) X(NOTE_FILE_POLL) XEND -}; - -static struct xlat kevent_vnode_fflags[] = { - X(NOTE_DELETE) X(NOTE_WRITE) X(NOTE_EXTEND) X(NOTE_ATTRIB) - X(NOTE_LINK) X(NOTE_RENAME) X(NOTE_REVOKE) XEND -}; - -static struct xlat kevent_proc_fflags[] = { - X(NOTE_EXIT) X(NOTE_FORK) X(NOTE_EXEC) X(NOTE_TRACK) X(NOTE_TRACKERR) - X(NOTE_CHILD) XEND -}; - -static struct xlat kevent_timer_fflags[] = { - X(NOTE_SECONDS) X(NOTE_MSECONDS) X(NOTE_USECONDS) X(NOTE_NSECONDS) - XEND -}; - static struct xlat poll_flags[] = { X(POLLSTANDARD) X(POLLIN) X(POLLPRI) X(POLLOUT) X(POLLERR) X(POLLHUP) X(POLLNVAL) X(POLLRDNORM) X(POLLRDBAND) @@ -1125,7 +1088,7 @@ strsig2(int sig) } static void -print_kevent(FILE *fp, struct kevent *ke, int input) +print_kevent(FILE *fp, struct kevent *ke) { switch (ke->filter) { @@ -1143,42 +1106,12 @@ print_kevent(FILE *fp, struct kevent *ke, int input) default: fprintf(fp, "%p", (void *)ke->ident); } - fprintf(fp, ",%s,%s,", xlookup(kevent_filters, ke->filter), - xlookup_bits(kevent_flags, ke->flags)); - switch (ke->filter) { - case EVFILT_READ: - case EVFILT_WRITE: - fputs(xlookup_bits(kevent_rdwr_fflags, ke->fflags), fp); - break; - case EVFILT_VNODE: - fputs(xlookup_bits(kevent_vnode_fflags, ke->fflags), fp); - break; - case EVFILT_PROC: - case EVFILT_PROCDESC: - fputs(xlookup_bits(kevent_proc_fflags, ke->fflags), fp); - break; - case EVFILT_TIMER: - fputs(xlookup_bits(kevent_timer_fflags, ke->fflags), fp); - break; - case EVFILT_USER: { - int ctrl, data; - - ctrl = ke->fflags & NOTE_FFCTRLMASK; - data = ke->fflags & NOTE_FFLAGSMASK; - if (input) { - fputs(xlookup(kevent_user_ffctrl, ctrl), fp); - if (ke->fflags & NOTE_TRIGGER) - fputs("|NOTE_TRIGGER", fp); - if (data != 0) - fprintf(fp, "|%#x", data); - } else { - fprintf(fp, "%#x", data); - } - break; - } - default: - fprintf(fp, "%#x", ke->fflags); - } + fprintf(fp, ","); + print_integer_arg(sysdecode_kevent_filter, fp, ke->filter); + fprintf(fp, ","); + print_mask_arg(sysdecode_kevent_flags, fp, ke->flags); + fprintf(fp, ","); + sysdecode_kevent_fflags(fp, ke->filter, ke->fflags, 16); fprintf(fp, ",%p,%p", (void *)ke->data, (void *)ke->udata); } @@ -1783,7 +1716,7 @@ print_arg(struct syscall_args *sc, unsigned long *args fputc('{', fp); for (i = 0; i < numevents; i++) { fputc(' ', fp); - print_kevent(fp, &ke[i], sc->offset == 1); + print_kevent(fp, &ke[i]); } fputs(" }", fp); } else { From owner-svn-src-stable@freebsd.org Sat Jan 27 06:10: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 DE0F1EDF5EE; Sat, 27 Jan 2018 06:10:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C1F7783A6; Sat, 27 Jan 2018 06:10:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6848626764; Sat, 27 Jan 2018 06:10:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R6ALR5071421; Sat, 27 Jan 2018 06:10:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R6AL5x071419; Sat, 27 Jan 2018 06:10:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801270610.w0R6AL5x071419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 06:10:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328460 - in stable/11: share/man/man4 sys/dev/usb/input X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/usb/input X-SVN-Commit-Revision: 328460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 06:10:22 -0000 Author: kevans Date: Sat Jan 27 06:10:20 2018 New Revision: 328460 URL: https://svnweb.freebsd.org/changeset/base/328460 Log: MFC r314467,r328027: Add hw.usb.wsp.enable_single_tap_clicks sysctl MFC r314467 (imp): Make wsp process a single touchpad tap and interpret it as a left-click event. It can be disabled by setting the new hw.usb.wsp.enable_single_tap_clicks sysctl to 0. MFC r328027: wsp(4): Update to reflect new sysctl from r314467 r314467 introduced hw.usb.wsp.enable_single_tap_clicks to enable/disable single-tap left click behavior. Update the man page to reflect the new sysctl. PR: 196624 Modified: stable/11/share/man/man4/wsp.4 stable/11/sys/dev/usb/input/wsp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/wsp.4 ============================================================================== --- stable/11/share/man/man4/wsp.4 Sat Jan 27 05:56:16 2018 (r328459) +++ stable/11/share/man/man4/wsp.4 Sat Jan 27 06:10:20 2018 (r328460) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 7, 2014 +.Dd January 15, 2018 .Dt WSP 4 .Os .Sh NAME @@ -63,6 +63,9 @@ through nodes under .Nm hw.usb.wsp . Pointer sensitivity can be controlled using the sysctl tunable .Nm hw.usb.wsp.scale_factor . +Tap to left-click can be controlled using the sysctl tunable +.Nm hw.usb.wsp.enable_single_tap_clicks , +set to 0 to disable single tap clicks or 1 to enable them (default). .Sh FILES .Nm creates a blocking pseudo-device file, Modified: stable/11/sys/dev/usb/input/wsp.c ============================================================================== --- stable/11/sys/dev/usb/input/wsp.c Sat Jan 27 05:56:16 2018 (r328459) +++ stable/11/sys/dev/usb/input/wsp.c Sat Jan 27 06:10:20 2018 (r328460) @@ -87,6 +87,7 @@ static struct wsp_tuning { int pressure_untouch_threshold; int pressure_tap_threshold; int scr_hor_threshold; + int enable_single_tap_clicks; } wsp_tuning = { @@ -96,6 +97,7 @@ static struct wsp_tuning { .pressure_untouch_threshold = 10, .pressure_tap_threshold = 120, .scr_hor_threshold = 20, + .enable_single_tap_clicks = 1, }; static void @@ -107,6 +109,7 @@ wsp_runing_rangecheck(struct wsp_tuning *ptun) WSP_CLAMP(ptun->pressure_untouch_threshold, 1, 255); WSP_CLAMP(ptun->pressure_tap_threshold, 1, 255); WSP_CLAMP(ptun->scr_hor_threshold, 1, 255); + WSP_CLAMP(ptun->enable_single_tap_clicks, 0, 1); } SYSCTL_INT(_hw_usb_wsp, OID_AUTO, scale_factor, CTLFLAG_RWTUN, @@ -121,6 +124,8 @@ SYSCTL_INT(_hw_usb_wsp, OID_AUTO, pressure_tap_thresho &wsp_tuning.pressure_tap_threshold, 0, "tap pressure threshold"); SYSCTL_INT(_hw_usb_wsp, OID_AUTO, scr_hor_threshold, CTLFLAG_RWTUN, &wsp_tuning.scr_hor_threshold, 0, "horizontal scrolling threshold"); +SYSCTL_INT(_hw_usb_wsp, OID_AUTO, enable_single_tap_clicks, CTLFLAG_RWTUN, + &wsp_tuning.enable_single_tap_clicks, 0, "enable single tap clicks"); /* * Some tables, structures, definitions and constant values for the @@ -966,7 +971,7 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t e */ switch (sc->ntaps) { case 1: - if (!(params->caps & HAS_INTEGRATED_BUTTON)) { + if (!(params->caps & HAS_INTEGRATED_BUTTON) || tun.enable_single_tap_clicks) { wsp_add_to_queue(sc, 0, 0, 0, MOUSE_BUTTON1DOWN); DPRINTFN(WSP_LLEVEL_INFO, "LEFT CLICK!\n"); } From owner-svn-src-stable@freebsd.org Sat Jan 27 06:15: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 0D50CEDF988; Sat, 27 Jan 2018 06:15:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A2BD37872F; Sat, 27 Jan 2018 06:15:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D80426908; Sat, 27 Jan 2018 06:15:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R6FOSS075994; Sat, 27 Jan 2018 06:15:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R6FOGu075993; Sat, 27 Jan 2018 06:15:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801270615.w0R6FOGu075993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 06:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328461 - stable/11/usr.bin/grep/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/grep/tests X-SVN-Commit-Revision: 328461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 06:15:25 -0000 Author: kevans Date: Sat Jan 27 06:15:24 2018 New Revision: 328461 URL: https://svnweb.freebsd.org/changeset/base/328461 Log: MFC r326483: grep test: Fix copyright notice The copyright notice was erroneously introduced as one from the NetBSD foundation due to it being copied from a file in the NetBSD test suite, but this file itself is not derived from or supplied with the NetBSD test suite. Modified: stable/11/usr.bin/grep/tests/grep_freebsd_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/grep/tests/grep_freebsd_test.sh ============================================================================== --- stable/11/usr.bin/grep/tests/grep_freebsd_test.sh Sat Jan 27 06:10:20 2018 (r328460) +++ stable/11/usr.bin/grep/tests/grep_freebsd_test.sh Sat Jan 27 06:15:24 2018 (r328461) @@ -11,17 +11,17 @@ # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # -# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. # # $FreeBSD$ From owner-svn-src-stable@freebsd.org Sat Jan 27 06:31: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 48B8FEE0048; Sat, 27 Jan 2018 06:31:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E9FCC78D94; Sat, 27 Jan 2018 06:31:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB7FC26BDA; Sat, 27 Jan 2018 06:31:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R6VE1d082081; Sat, 27 Jan 2018 06:31:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R6VEU2081903; Sat, 27 Jan 2018 06:31:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801270631.w0R6VEU2081903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 06:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328463 - in stable/11: etc/mtree usr.bin/hexdump usr.bin/hexdump/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: etc/mtree usr.bin/hexdump usr.bin/hexdump/tests X-SVN-Commit-Revision: 328463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 06:31:15 -0000 Author: kevans Date: Sat Jan 27 06:31:14 2018 New Revision: 328463 URL: https://svnweb.freebsd.org/changeset/base/328463 Log: MFC r320930,r324286: Add tests for hexdump(1) MFC r320930: Add some basic tests for hexdump(1)'s various output flags. Formatting tests are omitted for this initial run as there are still some bugs to work out there. This covers -s flag testing on devices and non-devices that would have caught breakage found in PR 219173 as well as other subtle breakage caused locally. MFC r324286: hexdump: Remove expected test failures for now succeeding tests r323990 fixed the -s flag breakage reported by PR 219173. Mark the corresponding hexdump tests accordingly, since they should now both succeed. PR: 222781 Added: stable/11/usr.bin/hexdump/tests/ - copied from r320930, head/usr.bin/hexdump/tests/ Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/usr.bin/hexdump/Makefile stable/11/usr.bin/hexdump/tests/hexdump_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Sat Jan 27 06:20:27 2018 (r328462) +++ stable/11/etc/mtree/BSD.tests.dist Sat Jan 27 06:31:14 2018 (r328463) @@ -652,6 +652,8 @@ .. head .. + hexdump + .. ident .. join Modified: stable/11/usr.bin/hexdump/Makefile ============================================================================== --- stable/11/usr.bin/hexdump/Makefile Sat Jan 27 06:20:27 2018 (r328462) +++ stable/11/usr.bin/hexdump/Makefile Sat Jan 27 06:31:14 2018 (r328463) @@ -1,11 +1,17 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= hexdump SRCS= conv.c display.c hexdump.c hexsyntax.c odsyntax.c parse.c MAN= hexdump.1 od.1 MLINKS= hexdump.1 hd.1 LINKS= ${BINDIR}/hexdump ${BINDIR}/od LINKS+= ${BINDIR}/hexdump ${BINDIR}/hd + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Modified: stable/11/usr.bin/hexdump/tests/hexdump_test.sh ============================================================================== --- head/usr.bin/hexdump/tests/hexdump_test.sh Thu Jul 13 03:52:54 2017 (r320930) +++ stable/11/usr.bin/hexdump/tests/hexdump_test.sh Sat Jan 27 06:31:14 2018 (r328463) @@ -134,7 +134,6 @@ s_flag_head() } s_flag_body() { - atf_expect_fail "-s option is currently broken due to capsicum (PR 219173)" atf_check -o file:"$(atf_get_srcdir)/d_hexdump_sflag_a.out" \ hexdump -bs 4 "$(atf_get_srcdir)/d_hexdump_a.in" @@ -148,7 +147,6 @@ v_flag_head() } v_flag_body() { - atf_expect_fail "-s option is currently broken due to capsicum (PR 219173)" for i in $(seq 0 7); do atf_check -o match:"^\*$" \ hexdump -s ${i} "$(atf_get_srcdir)/d_hexdump_c.in" From owner-svn-src-stable@freebsd.org Sat Jan 27 05:08:45 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 3B39EEDD6AD; Sat, 27 Jan 2018 05:08:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E33F876770; Sat, 27 Jan 2018 05:08:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE20B25DA0; Sat, 27 Jan 2018 05:08:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R58i3W041519; Sat, 27 Jan 2018 05:08:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R58iNU041518; Sat, 27 Jan 2018 05:08:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201801270508.w0R58iNU041518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 27 Jan 2018 05:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328458 - stable/11/sys/dev/wbwd X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/wbwd X-SVN-Commit-Revision: 328458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 05:08:45 -0000 Author: mav Date: Sat Jan 27 05:08:44 2018 New Revision: 328458 URL: https://svnweb.freebsd.org/changeset/base/328458 Log: MFC r327925: Add IDs for Nuvoton NCT6793/NCT6795. Modified: stable/11/sys/dev/wbwd/wbwd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/wbwd/wbwd.c ============================================================================== --- stable/11/sys/dev/wbwd/wbwd.c Sat Jan 27 00:39:49 2018 (r328457) +++ stable/11/sys/dev/wbwd/wbwd.c Sat Jan 27 05:08:44 2018 (r328458) @@ -95,7 +95,7 @@ __FBSDID("$FreeBSD$"); enum chips { w83627hf, w83627s, w83697hf, w83697ug, w83637hf, w83627thf, w83687thf, w83627ehf, w83627dhg, w83627uhg, w83667hg, w83627dhg_p, w83667hg_b, nct6775, nct6776, nct6779, nct6791, - nct6792, nct6102 }; + nct6792, nct6793, nct6795, nct6102 }; struct wb_softc { device_t dev; @@ -250,6 +250,16 @@ struct winbond_vendor_device_id { .chip = nct6792, .descr = "Nuvoton NCT6792", }, + { + .device_id = 0xd1, + .chip = nct6793, + .descr = "Nuvoton NCT6793", + }, + { + .device_id = 0xd3, + .chip = nct6795, + .descr = "Nuvoton NCT6795", + }, }; static void @@ -808,6 +818,8 @@ wb_attach(device_t dev) case nct6779: case nct6791: case nct6792: + case nct6793: + case nct6795: case nct6102: /* * These chips have a fixed WDTO# output pin (W83627UHG), From owner-svn-src-stable@freebsd.org Sat Jan 27 06:20: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 30733EDFBA9; Sat, 27 Jan 2018 06:20:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D7C7378930; Sat, 27 Jan 2018 06:20:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2A9026916; Sat, 27 Jan 2018 06:20:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R6KRbn076425; Sat, 27 Jan 2018 06:20:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R6KR9p076424; Sat, 27 Jan 2018 06:20:27 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801270620.w0R6KR9p076424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 06:20:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328462 - stable/11/usr.bin/patch X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/patch X-SVN-Commit-Revision: 328462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 06:20:28 -0000 Author: kevans Date: Sat Jan 27 06:20:27 2018 New Revision: 328462 URL: https://svnweb.freebsd.org/changeset/base/328462 Log: MFC r327826: patch(1): Don't check for NUL bytes in Plan A Plan A mmap()'s the entire input file and operates on it in memory. The map(2) call succeeded, so we shouldn't need to bother checking for the NUL byte as long as we're within our buffer space. This was clearly intentional to match "the behavior of the original code", but it creates a discrepancy between Plan A and Plan B that doesn't seem sensible and it's not inherently wrong to allow a NUL byte. This change was motivated by the gemspec in net/rubygem-grpc failing to patch, despite the patch being generated with diff, because a NUL byte was used as a delimiter in the header briefly in an otherwise text file. An alternative was considered: to fallback to plan B if plan A won't process the entire file due to a NUL byte, but I deemed this to be the better option since plan A isn't failing due to memory limitations and will fail later on if it's really dealing with a file it shouldn't be. Modified: stable/11/usr.bin/patch/inp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/patch/inp.c ============================================================================== --- stable/11/usr.bin/patch/inp.c Sat Jan 27 06:15:24 2018 (r328461) +++ stable/11/usr.bin/patch/inp.c Sat Jan 27 06:20:27 2018 (r328462) @@ -213,8 +213,11 @@ plan_a(const char *filename) /* now scan the buffer and build pointer array */ iline = 1; i_ptr[iline] = i_womp; - /* test for NUL too, to maintain the behavior of the original code */ - for (s = i_womp, i = 0; i < i_size && *s != '\0'; s++, i++) { + /* + * Testing for NUL here actively breaks files that innocently use NUL + * for other reasons. mmap(2) succeeded, just scan the whole buffer. + */ + for (s = i_womp, i = 0; i < i_size; s++, i++) { if (*s == '\n') { if (iline == lines_allocated) { if (!reallocate_lines(&lines_allocated)) From owner-svn-src-stable@freebsd.org Sat Jan 27 05:56: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 49DF9EDEC5C; Sat, 27 Jan 2018 05:56:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F16A477B72; Sat, 27 Jan 2018 05:56:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1B6D265D0; Sat, 27 Jan 2018 05:56:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0R5uHwB066117; Sat, 27 Jan 2018 05:56:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0R5uHUK066109; Sat, 27 Jan 2018 05:56:17 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801270556.w0R5uHUK066109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 05:56:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328459 - in stable/11/sys: boot/fdt contrib/libfdt X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/sys: boot/fdt contrib/libfdt X-SVN-Commit-Revision: 328459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 05:56:18 -0000 Author: kevans Date: Sat Jan 27 05:56:16 2018 New Revision: 328459 URL: https://svnweb.freebsd.org/changeset/base/328459 Log: MFC (conceptually) r328106: libfdt: Update to 1.4.6, use libfdt for overlays This is a direct commit to stable/11 due to path changes in HEAD. Diffs have been applied on top of their previous locations, with one minor adjustment as per the "MFC" note below: a include in libfdt_env.h h as been wrapped in an `#ifndef _STANDALONE` block to prevent build failures when built in the bootloader context. These issues are not present in HEAD, thus this differs from HEAD. libfdt highlights since 1.4.3: - fdt_property_placeholder added to create a property without specifying its value at creation time - stringlist helper functions added to libfdt - Improved overlay support - Various internal cleanup Also switch stand/fdt over to using libfdt for overlay support with this update. Our current overlay implementation works only for limited use cases with overlays generated only by some specific versions of our dtc(1). Swap it out for the libfdt implementation, which supports any properly generated overlay being applied to a properly generated base. This will be followed up fairly soon with an update to dtc(1) in tree to properly generate overlays. MFC note: the include this update introduces in libfdt_env.h is apparently not necessary in the context we use this in. It's not immediately clear to me the motivation for it being introduced, but it came in with overlay support. I've left it in for the sake of accuracy and because it's not harmful here on HEAD, but MFC'ing this to stable/11 will require wrapping the #include in an `#ifndef _STANDALONE` block or else it will cause build failures. Added: stable/11/sys/contrib/libfdt/fdt_addresses.c (contents, props changed) stable/11/sys/contrib/libfdt/fdt_overlay.c (contents, props changed) Deleted: stable/11/sys/boot/fdt/fdt_overlay.c stable/11/sys/boot/fdt/fdt_overlay.h Modified: stable/11/sys/boot/fdt/Makefile stable/11/sys/boot/fdt/fdt_loader_cmd.c stable/11/sys/contrib/libfdt/fdt.c stable/11/sys/contrib/libfdt/fdt.h stable/11/sys/contrib/libfdt/fdt_empty_tree.c stable/11/sys/contrib/libfdt/fdt_ro.c stable/11/sys/contrib/libfdt/fdt_rw.c stable/11/sys/contrib/libfdt/fdt_strerror.c stable/11/sys/contrib/libfdt/fdt_sw.c stable/11/sys/contrib/libfdt/fdt_wip.c stable/11/sys/contrib/libfdt/libfdt.h stable/11/sys/contrib/libfdt/libfdt_env.h stable/11/sys/contrib/libfdt/libfdt_internal.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/fdt/Makefile ============================================================================== --- stable/11/sys/boot/fdt/Makefile Sat Jan 27 05:08:44 2018 (r328458) +++ stable/11/sys/boot/fdt/Makefile Sat Jan 27 05:56:16 2018 (r328459) @@ -7,10 +7,10 @@ INTERNALLIB= # Vendor sources of libfdt. SRCS+= fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c \ - fdt_empty_tree.c + fdt_empty_tree.c fdt_addresses.c fdt_overlay.c # Loader's fdt commands extension sources. -SRCS+= fdt_loader_cmd.c fdt_overlay.c +SRCS+= fdt_loader_cmd.c CFLAGS+= -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/ Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- stable/11/sys/boot/fdt/fdt_loader_cmd.c Sat Jan 27 05:08:44 2018 (r328458) +++ stable/11/sys/boot/fdt/fdt_loader_cmd.c Sat Jan 27 05:56:16 2018 (r328459) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "fdt_platform.h" -#include "fdt_overlay.h" #ifdef DEBUG #define debugf(fmt, args...) do { printf("%s(): ", __func__); \ Modified: stable/11/sys/contrib/libfdt/fdt.c ============================================================================== --- stable/11/sys/contrib/libfdt/fdt.c Sat Jan 27 05:08:44 2018 (r328458) +++ stable/11/sys/contrib/libfdt/fdt.c Sat Jan 27 05:56:16 2018 (r328459) @@ -76,23 +76,24 @@ int fdt_check_header(const void *fdt) const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int len) { - const char *p; + unsigned absoffset = offset + fdt_off_dt_struct(fdt); + if ((absoffset < offset) + || ((absoffset + len) < absoffset) + || (absoffset + len) > fdt_totalsize(fdt)) + return NULL; + if (fdt_version(fdt) >= 0x11) if (((offset + len) < offset) || ((offset + len) > fdt_size_dt_struct(fdt))) return NULL; - p = _fdt_offset_ptr(fdt, offset); - - if (p + len < p) - return NULL; - return p; + return fdt_offset_ptr_(fdt, offset); } uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset) { - const uint32_t *tagp, *lenp; + const fdt32_t *tagp, *lenp; uint32_t tag; int offset = startoffset; const char *p; @@ -140,7 +141,7 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset return tag; } -int _fdt_check_node_offset(const void *fdt, int offset) +int fdt_check_node_offset_(const void *fdt, int offset) { if ((offset < 0) || (offset % FDT_TAGSIZE) || (fdt_next_tag(fdt, offset, &offset) != FDT_BEGIN_NODE)) @@ -149,7 +150,7 @@ int _fdt_check_node_offset(const void *fdt, int offset return offset; } -int _fdt_check_prop_offset(const void *fdt, int offset) +int fdt_check_prop_offset_(const void *fdt, int offset) { if ((offset < 0) || (offset % FDT_TAGSIZE) || (fdt_next_tag(fdt, offset, &offset) != FDT_PROP)) @@ -164,7 +165,7 @@ int fdt_next_node(const void *fdt, int offset, int *de uint32_t tag; if (offset >= 0) - if ((nextoffset = _fdt_check_node_offset(fdt, offset)) < 0) + if ((nextoffset = fdt_check_node_offset_(fdt, offset)) < 0) return nextoffset; do { @@ -198,7 +199,35 @@ int fdt_next_node(const void *fdt, int offset, int *de return offset; } -const char *_fdt_find_string(const char *strtab, int tabsize, const char *s) +int fdt_first_subnode(const void *fdt, int offset) +{ + int depth = 0; + + offset = fdt_next_node(fdt, offset, &depth); + if (offset < 0 || depth != 1) + return -FDT_ERR_NOTFOUND; + + return offset; +} + +int fdt_next_subnode(const void *fdt, int offset) +{ + int depth = 1; + + /* + * With respect to the parent, the depth of the next subnode will be + * the same as the last. + */ + do { + offset = fdt_next_node(fdt, offset, &depth); + if (offset < 0 || depth < 1) + return -FDT_ERR_NOTFOUND; + } while (depth > 1); + + return offset; +} + +const char *fdt_find_string_(const char *strtab, int tabsize, const char *s) { int len = strlen(s) + 1; const char *last = strtab + tabsize - len; Modified: stable/11/sys/contrib/libfdt/fdt.h ============================================================================== --- stable/11/sys/contrib/libfdt/fdt.h Sat Jan 27 05:08:44 2018 (r328458) +++ stable/11/sys/contrib/libfdt/fdt.h Sat Jan 27 05:56:16 2018 (r328459) @@ -1,48 +1,99 @@ -#ifndef _FDT_H -#define _FDT_H +#ifndef FDT_H +#define FDT_H +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. + * Copyright 2012 Kim Phillips, Freescale Semiconductor. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #ifndef __ASSEMBLY__ struct fdt_header { - uint32_t magic; /* magic word FDT_MAGIC */ - uint32_t totalsize; /* total size of DT block */ - uint32_t off_dt_struct; /* offset to structure */ - uint32_t off_dt_strings; /* offset to strings */ - uint32_t off_mem_rsvmap; /* offset to memory reserve map */ - uint32_t version; /* format version */ - uint32_t last_comp_version; /* last compatible version */ + fdt32_t magic; /* magic word FDT_MAGIC */ + fdt32_t totalsize; /* total size of DT block */ + fdt32_t off_dt_struct; /* offset to structure */ + fdt32_t off_dt_strings; /* offset to strings */ + fdt32_t off_mem_rsvmap; /* offset to memory reserve map */ + fdt32_t version; /* format version */ + fdt32_t last_comp_version; /* last compatible version */ /* version 2 fields below */ - uint32_t boot_cpuid_phys; /* Which physical CPU id we're + fdt32_t boot_cpuid_phys; /* Which physical CPU id we're booting on */ /* version 3 fields below */ - uint32_t size_dt_strings; /* size of the strings block */ + fdt32_t size_dt_strings; /* size of the strings block */ /* version 17 fields below */ - uint32_t size_dt_struct; /* size of the structure block */ + fdt32_t size_dt_struct; /* size of the structure block */ }; struct fdt_reserve_entry { - uint64_t address; - uint64_t size; + fdt64_t address; + fdt64_t size; }; struct fdt_node_header { - uint32_t tag; + fdt32_t tag; char name[0]; }; struct fdt_property { - uint32_t tag; - uint32_t len; - uint32_t nameoff; + fdt32_t tag; + fdt32_t len; + fdt32_t nameoff; char data[0]; }; #endif /* !__ASSEMBLY */ #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ -#define FDT_TAGSIZE sizeof(uint32_t) +#define FDT_TAGSIZE sizeof(fdt32_t) #define FDT_BEGIN_NODE 0x1 /* Start node: full name */ #define FDT_END_NODE 0x2 /* End node */ @@ -51,10 +102,10 @@ struct fdt_property { #define FDT_NOP 0x4 /* nop */ #define FDT_END 0x9 -#define FDT_V1_SIZE (7*sizeof(uint32_t)) -#define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(uint32_t)) -#define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(uint32_t)) +#define FDT_V1_SIZE (7*sizeof(fdt32_t)) +#define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(fdt32_t)) +#define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(fdt32_t)) #define FDT_V16_SIZE FDT_V3_SIZE -#define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(uint32_t)) +#define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(fdt32_t)) -#endif /* _FDT_H */ +#endif /* FDT_H */ Added: stable/11/sys/contrib/libfdt/fdt_addresses.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/contrib/libfdt/fdt_addresses.c Sat Jan 27 05:56:16 2018 (r328459) @@ -0,0 +1,96 @@ +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2014 David Gibson + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "libfdt_env.h" + +#include +#include + +#include "libfdt_internal.h" + +int fdt_address_cells(const void *fdt, int nodeoffset) +{ + const fdt32_t *ac; + int val; + int len; + + ac = fdt_getprop(fdt, nodeoffset, "#address-cells", &len); + if (!ac) + return 2; + + if (len != sizeof(*ac)) + return -FDT_ERR_BADNCELLS; + + val = fdt32_to_cpu(*ac); + if ((val <= 0) || (val > FDT_MAX_NCELLS)) + return -FDT_ERR_BADNCELLS; + + return val; +} + +int fdt_size_cells(const void *fdt, int nodeoffset) +{ + const fdt32_t *sc; + int val; + int len; + + sc = fdt_getprop(fdt, nodeoffset, "#size-cells", &len); + if (!sc) + return 2; + + if (len != sizeof(*sc)) + return -FDT_ERR_BADNCELLS; + + val = fdt32_to_cpu(*sc); + if ((val < 0) || (val > FDT_MAX_NCELLS)) + return -FDT_ERR_BADNCELLS; + + return val; +} Modified: stable/11/sys/contrib/libfdt/fdt_empty_tree.c ============================================================================== --- stable/11/sys/contrib/libfdt/fdt_empty_tree.c Sat Jan 27 05:08:44 2018 (r328458) +++ stable/11/sys/contrib/libfdt/fdt_empty_tree.c Sat Jan 27 05:56:16 2018 (r328459) @@ -81,4 +81,3 @@ int fdt_create_empty_tree(void *buf, int bufsize) return fdt_open_into(buf, buf, bufsize); } - Added: stable/11/sys/contrib/libfdt/fdt_overlay.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/contrib/libfdt/fdt_overlay.c Sat Jan 27 05:56:16 2018 (r328459) @@ -0,0 +1,861 @@ +#include "libfdt_env.h" + +#include +#include + +#include "libfdt_internal.h" + +/** + * overlay_get_target_phandle - retrieves the target phandle of a fragment + * @fdto: pointer to the device tree overlay blob + * @fragment: node offset of the fragment in the overlay + * + * overlay_get_target_phandle() retrieves the target phandle of an + * overlay fragment when that fragment uses a phandle (target + * property) instead of a path (target-path property). + * + * returns: + * the phandle pointed by the target property + * 0, if the phandle was not found + * -1, if the phandle was malformed + */ +static uint32_t overlay_get_target_phandle(const void *fdto, int fragment) +{ + const fdt32_t *val; + int len; + + val = fdt_getprop(fdto, fragment, "target", &len); + if (!val) + return 0; + + if ((len != sizeof(*val)) || (fdt32_to_cpu(*val) == (uint32_t)-1)) + return (uint32_t)-1; + + return fdt32_to_cpu(*val); +} + +/** + * overlay_get_target - retrieves the offset of a fragment's target + * @fdt: Base device tree blob + * @fdto: Device tree overlay blob + * @fragment: node offset of the fragment in the overlay + * @pathp: pointer which receives the path of the target (or NULL) + * + * overlay_get_target() retrieves the target offset in the base + * device tree of a fragment, no matter how the actual targetting is + * done (through a phandle or a path) + * + * returns: + * the targetted node offset in the base device tree + * Negative error code on error + */ +static int overlay_get_target(const void *fdt, const void *fdto, + int fragment, char const **pathp) +{ + uint32_t phandle; + const char *path = NULL; + int path_len = 0, ret; + + /* Try first to do a phandle based lookup */ + phandle = overlay_get_target_phandle(fdto, fragment); + if (phandle == (uint32_t)-1) + return -FDT_ERR_BADPHANDLE; + + /* no phandle, try path */ + if (!phandle) { + /* And then a path based lookup */ + path = fdt_getprop(fdto, fragment, "target-path", &path_len); + if (path) + ret = fdt_path_offset(fdt, path); + else + ret = path_len; + } else + ret = fdt_node_offset_by_phandle(fdt, phandle); + + /* + * If we haven't found either a target or a + * target-path property in a node that contains a + * __overlay__ subnode (we wouldn't be called + * otherwise), consider it a improperly written + * overlay + */ + if (ret < 0 && path_len == -FDT_ERR_NOTFOUND) + ret = -FDT_ERR_BADOVERLAY; + + /* return on error */ + if (ret < 0) + return ret; + + /* return pointer to path (if available) */ + if (pathp) + *pathp = path ? path : NULL; + + return ret; +} + +/** + * overlay_phandle_add_offset - Increases a phandle by an offset + * @fdt: Base device tree blob + * @node: Device tree overlay blob + * @name: Name of the property to modify (phandle or linux,phandle) + * @delta: offset to apply + * + * overlay_phandle_add_offset() increments a node phandle by a given + * offset. + * + * returns: + * 0 on success. + * Negative error code on error + */ +static int overlay_phandle_add_offset(void *fdt, int node, + const char *name, uint32_t delta) +{ + const fdt32_t *val; + uint32_t adj_val; + int len; + + val = fdt_getprop(fdt, node, name, &len); + if (!val) + return len; + + if (len != sizeof(*val)) + return -FDT_ERR_BADPHANDLE; + + adj_val = fdt32_to_cpu(*val); + if ((adj_val + delta) < adj_val) + return -FDT_ERR_NOPHANDLES; + + adj_val += delta; + if (adj_val == (uint32_t)-1) + return -FDT_ERR_NOPHANDLES; + + return fdt_setprop_inplace_u32(fdt, node, name, adj_val); +} + +/** + * overlay_adjust_node_phandles - Offsets the phandles of a node + * @fdto: Device tree overlay blob + * @node: Offset of the node we want to adjust + * @delta: Offset to shift the phandles of + * + * overlay_adjust_node_phandles() adds a constant to all the phandles + * of a given node. This is mainly use as part of the overlay + * application process, when we want to update all the overlay + * phandles to not conflict with the overlays of the base device tree. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_adjust_node_phandles(void *fdto, int node, + uint32_t delta) +{ + int child; + int ret; + + ret = overlay_phandle_add_offset(fdto, node, "phandle", delta); + if (ret && ret != -FDT_ERR_NOTFOUND) + return ret; + + ret = overlay_phandle_add_offset(fdto, node, "linux,phandle", delta); + if (ret && ret != -FDT_ERR_NOTFOUND) + return ret; + + fdt_for_each_subnode(child, fdto, node) { + ret = overlay_adjust_node_phandles(fdto, child, delta); + if (ret) + return ret; + } + + return 0; +} + +/** + * overlay_adjust_local_phandles - Adjust the phandles of a whole overlay + * @fdto: Device tree overlay blob + * @delta: Offset to shift the phandles of + * + * overlay_adjust_local_phandles() adds a constant to all the + * phandles of an overlay. This is mainly use as part of the overlay + * application process, when we want to update all the overlay + * phandles to not conflict with the overlays of the base device tree. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_adjust_local_phandles(void *fdto, uint32_t delta) +{ + /* + * Start adjusting the phandles from the overlay root + */ + return overlay_adjust_node_phandles(fdto, 0, delta); +} + +/** + * overlay_update_local_node_references - Adjust the overlay references + * @fdto: Device tree overlay blob + * @tree_node: Node offset of the node to operate on + * @fixup_node: Node offset of the matching local fixups node + * @delta: Offset to shift the phandles of + * + * overlay_update_local_nodes_references() update the phandles + * pointing to a node within the device tree overlay by adding a + * constant delta. + * + * This is mainly used as part of a device tree application process, + * where you want the device tree overlays phandles to not conflict + * with the ones from the base device tree before merging them. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_update_local_node_references(void *fdto, + int tree_node, + int fixup_node, + uint32_t delta) +{ + int fixup_prop; + int fixup_child; + int ret; + + fdt_for_each_property_offset(fixup_prop, fdto, fixup_node) { + const fdt32_t *fixup_val; + const char *tree_val; + const char *name; + int fixup_len; + int tree_len; + int i; + + fixup_val = fdt_getprop_by_offset(fdto, fixup_prop, + &name, &fixup_len); + if (!fixup_val) + return fixup_len; + + if (fixup_len % sizeof(uint32_t)) + return -FDT_ERR_BADOVERLAY; + + tree_val = fdt_getprop(fdto, tree_node, name, &tree_len); + if (!tree_val) { + if (tree_len == -FDT_ERR_NOTFOUND) + return -FDT_ERR_BADOVERLAY; + + return tree_len; + } + + for (i = 0; i < (fixup_len / sizeof(uint32_t)); i++) { + fdt32_t adj_val; + uint32_t poffset; + + poffset = fdt32_to_cpu(fixup_val[i]); + + /* + * phandles to fixup can be unaligned. + * + * Use a memcpy for the architectures that do + * not support unaligned accesses. + */ + memcpy(&adj_val, tree_val + poffset, sizeof(adj_val)); + + adj_val = cpu_to_fdt32(fdt32_to_cpu(adj_val) + delta); + + ret = fdt_setprop_inplace_namelen_partial(fdto, + tree_node, + name, + strlen(name), + poffset, + &adj_val, + sizeof(adj_val)); + if (ret == -FDT_ERR_NOSPACE) + return -FDT_ERR_BADOVERLAY; + + if (ret) + return ret; + } + } + + fdt_for_each_subnode(fixup_child, fdto, fixup_node) { + const char *fixup_child_name = fdt_get_name(fdto, fixup_child, + NULL); + int tree_child; + + tree_child = fdt_subnode_offset(fdto, tree_node, + fixup_child_name); + if (tree_child == -FDT_ERR_NOTFOUND) + return -FDT_ERR_BADOVERLAY; + if (tree_child < 0) + return tree_child; + + ret = overlay_update_local_node_references(fdto, + tree_child, + fixup_child, + delta); + if (ret) + return ret; + } + + return 0; +} + +/** + * overlay_update_local_references - Adjust the overlay references + * @fdto: Device tree overlay blob + * @delta: Offset to shift the phandles of + * + * overlay_update_local_references() update all the phandles pointing + * to a node within the device tree overlay by adding a constant + * delta to not conflict with the base overlay. + * + * This is mainly used as part of a device tree application process, + * where you want the device tree overlays phandles to not conflict + * with the ones from the base device tree before merging them. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_update_local_references(void *fdto, uint32_t delta) +{ + int fixups; + + fixups = fdt_path_offset(fdto, "/__local_fixups__"); + if (fixups < 0) { + /* There's no local phandles to adjust, bail out */ + if (fixups == -FDT_ERR_NOTFOUND) + return 0; + + return fixups; + } + + /* + * Update our local references from the root of the tree + */ + return overlay_update_local_node_references(fdto, 0, fixups, + delta); +} + +/** + * overlay_fixup_one_phandle - Set an overlay phandle to the base one + * @fdt: Base Device Tree blob + * @fdto: Device tree overlay blob + * @symbols_off: Node offset of the symbols node in the base device tree + * @path: Path to a node holding a phandle in the overlay + * @path_len: number of path characters to consider + * @name: Name of the property holding the phandle reference in the overlay + * @name_len: number of name characters to consider + * @poffset: Offset within the overlay property where the phandle is stored + * @label: Label of the node referenced by the phandle + * + * overlay_fixup_one_phandle() resolves an overlay phandle pointing to + * a node in the base device tree. + * + * This is part of the device tree overlay application process, when + * you want all the phandles in the overlay to point to the actual + * base dt nodes. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_fixup_one_phandle(void *fdt, void *fdto, + int symbols_off, + const char *path, uint32_t path_len, + const char *name, uint32_t name_len, + int poffset, const char *label) +{ + const char *symbol_path; + uint32_t phandle; + fdt32_t phandle_prop; + int symbol_off, fixup_off; + int prop_len; + + if (symbols_off < 0) + return symbols_off; + + symbol_path = fdt_getprop(fdt, symbols_off, label, + &prop_len); + if (!symbol_path) + return prop_len; + + symbol_off = fdt_path_offset(fdt, symbol_path); + if (symbol_off < 0) + return symbol_off; + + phandle = fdt_get_phandle(fdt, symbol_off); + if (!phandle) + return -FDT_ERR_NOTFOUND; + + fixup_off = fdt_path_offset_namelen(fdto, path, path_len); + if (fixup_off == -FDT_ERR_NOTFOUND) + return -FDT_ERR_BADOVERLAY; + if (fixup_off < 0) + return fixup_off; + + phandle_prop = cpu_to_fdt32(phandle); + return fdt_setprop_inplace_namelen_partial(fdto, fixup_off, + name, name_len, poffset, + &phandle_prop, + sizeof(phandle_prop)); +}; + +/** + * overlay_fixup_phandle - Set an overlay phandle to the base one + * @fdt: Base Device Tree blob + * @fdto: Device tree overlay blob + * @symbols_off: Node offset of the symbols node in the base device tree + * @property: Property offset in the overlay holding the list of fixups + * + * overlay_fixup_phandle() resolves all the overlay phandles pointed + * to in a __fixups__ property, and updates them to match the phandles + * in use in the base device tree. + * + * This is part of the device tree overlay application process, when + * you want all the phandles in the overlay to point to the actual + * base dt nodes. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off, + int property) +{ + const char *value; + const char *label; + int len; + + value = fdt_getprop_by_offset(fdto, property, + &label, &len); + if (!value) { + if (len == -FDT_ERR_NOTFOUND) + return -FDT_ERR_INTERNAL; + + return len; + } + + do { + const char *path, *name, *fixup_end; + const char *fixup_str = value; + uint32_t path_len, name_len; + uint32_t fixup_len; + char *sep, *endptr; + int poffset, ret; + + fixup_end = memchr(value, '\0', len); + if (!fixup_end) + return -FDT_ERR_BADOVERLAY; + fixup_len = fixup_end - fixup_str; + + len -= fixup_len + 1; + value += fixup_len + 1; + + path = fixup_str; + sep = memchr(fixup_str, ':', fixup_len); + if (!sep || *sep != ':') + return -FDT_ERR_BADOVERLAY; + + path_len = sep - path; + if (path_len == (fixup_len - 1)) + return -FDT_ERR_BADOVERLAY; + + fixup_len -= path_len + 1; + name = sep + 1; + sep = memchr(name, ':', fixup_len); + if (!sep || *sep != ':') + return -FDT_ERR_BADOVERLAY; + + name_len = sep - name; + if (!name_len) + return -FDT_ERR_BADOVERLAY; + + poffset = strtoul(sep + 1, &endptr, 10); + if ((*endptr != '\0') || (endptr <= (sep + 1))) + return -FDT_ERR_BADOVERLAY; + + ret = overlay_fixup_one_phandle(fdt, fdto, symbols_off, + path, path_len, name, name_len, + poffset, label); + if (ret) + return ret; + } while (len > 0); + + return 0; +} + +/** + * overlay_fixup_phandles - Resolve the overlay phandles to the base + * device tree + * @fdt: Base Device Tree blob + * @fdto: Device tree overlay blob + * + * overlay_fixup_phandles() resolves all the overlay phandles pointing + * to nodes in the base device tree. + * + * This is one of the steps of the device tree overlay application + * process, when you want all the phandles in the overlay to point to + * the actual base dt nodes. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_fixup_phandles(void *fdt, void *fdto) +{ + int fixups_off, symbols_off; + int property; + + /* We can have overlays without any fixups */ + fixups_off = fdt_path_offset(fdto, "/__fixups__"); + if (fixups_off == -FDT_ERR_NOTFOUND) + return 0; /* nothing to do */ + if (fixups_off < 0) + return fixups_off; + + /* And base DTs without symbols */ + symbols_off = fdt_path_offset(fdt, "/__symbols__"); + if ((symbols_off < 0 && (symbols_off != -FDT_ERR_NOTFOUND))) + return symbols_off; + + fdt_for_each_property_offset(property, fdto, fixups_off) { + int ret; + + ret = overlay_fixup_phandle(fdt, fdto, symbols_off, property); + if (ret) + return ret; + } + + return 0; +} + +/** + * overlay_apply_node - Merges a node into the base device tree + * @fdt: Base Device Tree blob + * @target: Node offset in the base device tree to apply the fragment to + * @fdto: Device tree overlay blob + * @node: Node offset in the overlay holding the changes to merge + * + * overlay_apply_node() merges a node into a target base device tree + * node pointed. + * + * This is part of the final step in the device tree overlay + * application process, when all the phandles have been adjusted and + * resolved and you just have to merge overlay into the base device + * tree. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_apply_node(void *fdt, int target, + void *fdto, int node) +{ + int property; + int subnode; + + fdt_for_each_property_offset(property, fdto, node) { + const char *name; + const void *prop; + int prop_len; + int ret; + + prop = fdt_getprop_by_offset(fdto, property, &name, + &prop_len); + if (prop_len == -FDT_ERR_NOTFOUND) + return -FDT_ERR_INTERNAL; + if (prop_len < 0) + return prop_len; + + ret = fdt_setprop(fdt, target, name, prop, prop_len); + if (ret) + return ret; + } + + fdt_for_each_subnode(subnode, fdto, node) { + const char *name = fdt_get_name(fdto, subnode, NULL); + int nnode; + int ret; + + nnode = fdt_add_subnode(fdt, target, name); + if (nnode == -FDT_ERR_EXISTS) { + nnode = fdt_subnode_offset(fdt, target, name); + if (nnode == -FDT_ERR_NOTFOUND) + return -FDT_ERR_INTERNAL; + } + + if (nnode < 0) + return nnode; + + ret = overlay_apply_node(fdt, nnode, fdto, subnode); + if (ret) + return ret; + } + + return 0; +} + +/** + * overlay_merge - Merge an overlay into its base device tree + * @fdt: Base Device Tree blob + * @fdto: Device tree overlay blob + * + * overlay_merge() merges an overlay into its base device tree. + * + * This is the next to last step in the device tree overlay application + * process, when all the phandles have been adjusted and resolved and + * you just have to merge overlay into the base device tree. + * + * returns: + * 0 on success + * Negative error code on failure + */ +static int overlay_merge(void *fdt, void *fdto) +{ + int fragment; + + fdt_for_each_subnode(fragment, fdto, 0) { + int overlay; + int target; + int ret; + + /* + * Each fragments will have an __overlay__ node. If + * they don't, it's not supposed to be merged + */ + overlay = fdt_subnode_offset(fdto, fragment, "__overlay__"); + if (overlay == -FDT_ERR_NOTFOUND) + continue; + + if (overlay < 0) + return overlay; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Sat Jan 27 11:40: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 D8C03EB62AE; Sat, 27 Jan 2018 11:40:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B79C841B5; Sat, 27 Jan 2018 11:40:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 867141D27; Sat, 27 Jan 2018 11:40:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RBek6X039184; Sat, 27 Jan 2018 11:40:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RBek2K039181; Sat, 27 Jan 2018 11:40:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801271140.w0RBek2K039181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 27 Jan 2018 11:40:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328469 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 328469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 11:40:47 -0000 Author: kib Date: Sat Jan 27 11:40:46 2018 New Revision: 328469 URL: https://svnweb.freebsd.org/changeset/base/328469 Log: MFC r328192: Assign map->header values to avoid boundary checks. Modified: stable/11/sys/vm/vm_map.c stable/11/sys/vm/vm_map.h stable/11/sys/vm/vm_mmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_map.c ============================================================================== --- stable/11/sys/vm/vm_map.c Sat Jan 27 11:33:21 2018 (r328468) +++ stable/11/sys/vm/vm_map.c Sat Jan 27 11:40:46 2018 (r328469) @@ -998,12 +998,10 @@ vm_map_entry_link(vm_map_t map, "vm_map_entry_link: map %p, nentries %d, entry %p, after %p", map, map->nentries, entry, after_where); VM_MAP_ASSERT_LOCKED(map); - KASSERT(after_where == &map->header || - after_where->end <= entry->start, + KASSERT(after_where->end <= entry->start, ("vm_map_entry_link: prev end %jx new start %jx overlap", (uintmax_t)after_where->end, (uintmax_t)entry->start)); - KASSERT(after_where->next == &map->header || - entry->end <= after_where->next->start, + KASSERT(entry->end <= after_where->next->start, ("vm_map_entry_link: new end %jx next start %jx overlap", (uintmax_t)entry->end, (uintmax_t)after_where->next->start)); @@ -1025,8 +1023,7 @@ vm_map_entry_link(vm_map_t map, entry->right = map->root; entry->left = NULL; } - entry->adj_free = (entry->next == &map->header ? map->max_offset : - entry->next->start) - entry->end; + entry->adj_free = entry->next->start - entry->end; vm_map_entry_set_max_free(entry); map->root = entry; } @@ -1045,8 +1042,7 @@ vm_map_entry_unlink(vm_map_t map, else { root = vm_map_entry_splay(entry->start, entry->left); root->right = entry->right; - root->adj_free = (entry->next == &map->header ? map->max_offset : - entry->next->start) - root->end; + root->adj_free = entry->next->start - root->end; vm_map_entry_set_max_free(root); } map->root = root; @@ -1082,8 +1078,7 @@ vm_map_entry_resize_free(vm_map_t map, vm_map_entry_t if (entry != map->root) map->root = vm_map_entry_splay(entry->start, map->root); - entry->adj_free = (entry->next == &map->header ? map->max_offset : - entry->next->start) - entry->end; + entry->adj_free = entry->next->start - entry->end; vm_map_entry_set_max_free(entry); } @@ -1213,7 +1208,7 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof /* * Assert that the next entry doesn't overlap the end point. */ - if (prev_entry->next != &map->header && prev_entry->next->start < end) + if (prev_entry->next->start < end) return (KERN_NO_SPACE); if ((cow & MAP_CREATE_GUARD) != 0 && (object != NULL || @@ -2032,8 +2027,7 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off /* * Make a first pass to check for protection violations. */ - for (current = entry; current != &map->header && current->start < end; - current = current->next) { + for (current = entry; current->start < end; current = current->next) { if ((current->eflags & MAP_ENTRY_GUARD) != 0) continue; if (current->eflags & MAP_ENTRY_IS_SUB_MAP) { @@ -2051,8 +2045,7 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off * now will do cow due to allowed write (e.g. debugger sets * breakpoint on text segment) */ - for (current = entry; current != &map->header && current->start < end; - current = current->next) { + for (current = entry; current->start < end; current = current->next) { vm_map_clip_end(map, current, end); @@ -2106,8 +2099,7 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off * Go back and fix up protections. [Note that clipping is not * necessary the second time.] */ - for (current = entry; current != &map->header && current->start < end; - current = current->next) { + for (current = entry; current->start < end; current = current->next) { if ((current->eflags & MAP_ENTRY_GUARD) != 0) continue; @@ -2216,10 +2208,8 @@ vm_map_madvise( * We clip the vm_map_entry so that behavioral changes are * limited to the specified address range. */ - for (current = entry; - (current != &map->header) && (current->start < end); - current = current->next - ) { + for (current = entry; current->start < end; + current = current->next) { if (current->eflags & MAP_ENTRY_IS_SUB_MAP) continue; @@ -2263,10 +2253,8 @@ vm_map_madvise( * Since we don't clip the vm_map_entry, we have to clip * the vm_object pindex and count. */ - for (current = entry; - (current != &map->header) && (current->start < end); - current = current->next - ) { + for (current = entry; current->start < end; + current = current->next) { vm_offset_t useEnd, useStart; if (current->eflags & MAP_ENTRY_IS_SUB_MAP) @@ -2362,7 +2350,7 @@ vm_map_inherit(vm_map_t map, vm_offset_t start, vm_off vm_map_clip_start(map, entry, start); } else entry = temp_entry->next; - while ((entry != &map->header) && (entry->start < end)) { + while (entry->start < end) { vm_map_clip_end(map, entry, end); if ((entry->eflags & MAP_ENTRY_GUARD) == 0 || new_inheritance != VM_INHERIT_ZERO) @@ -2404,7 +2392,7 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs } last_timestamp = map->timestamp; entry = first_entry; - while (entry != &map->header && entry->start < end) { + while (entry->start < end) { if (entry->eflags & MAP_ENTRY_IN_TRANSITION) { /* * We have not yet clipped the entry. @@ -2467,8 +2455,7 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs * If VM_MAP_WIRE_HOLESOK was specified, skip this check. */ if (((flags & VM_MAP_WIRE_HOLESOK) == 0) && - (entry->end < end && (entry->next == &map->header || - entry->next->start > entry->end))) { + (entry->end < end && entry->next->start > entry->end)) { end = entry->end; rv = KERN_INVALID_ADDRESS; goto done; @@ -2494,8 +2481,7 @@ done: else KASSERT(result, ("vm_map_unwire: lookup failed")); } - for (entry = first_entry; entry != &map->header && entry->start < end; - entry = entry->next) { + for (entry = first_entry; entry->start < end; entry = entry->next) { /* * If VM_MAP_WIRE_HOLESOK was specified, an empty * space in the unwired region could have been mapped @@ -2609,7 +2595,7 @@ vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset } last_timestamp = map->timestamp; entry = first_entry; - while (entry != &map->header && entry->start < end) { + while (entry->start < end) { if (entry->eflags & MAP_ENTRY_IN_TRANSITION) { /* * We have not yet clipped the entry. @@ -2746,8 +2732,7 @@ vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset */ next_entry: if ((flags & VM_MAP_WIRE_HOLESOK) == 0 && - entry->end < end && (entry->next == &map->header || - entry->next->start > entry->end)) { + entry->end < end && entry->next->start > entry->end) { end = entry->end; rv = KERN_INVALID_ADDRESS; goto done; @@ -2764,8 +2749,7 @@ done: else KASSERT(result, ("vm_map_wire: lookup failed")); } - for (entry = first_entry; entry != &map->header && entry->start < end; - entry = entry->next) { + for (entry = first_entry; entry->start < end; entry = entry->next) { /* * If VM_MAP_WIRE_HOLESOK was specified, an empty * space in the unwired region could have been mapped @@ -2869,15 +2853,13 @@ vm_map_sync( /* * Make a first pass to check for user-wired memory and holes. */ - for (current = entry; current != &map->header && current->start < end; - current = current->next) { + for (current = entry; current->start < end; current = current->next) { if (invalidate && (current->eflags & MAP_ENTRY_USER_WIRED)) { vm_map_unlock_read(map); return (KERN_INVALID_ARGUMENT); } if (end > current->end && - (current->next == &map->header || - current->end != current->next->start)) { + current->end != current->next->start) { vm_map_unlock_read(map); return (KERN_INVALID_ADDRESS); } @@ -2891,7 +2873,7 @@ vm_map_sync( * Make a second pass, cleaning/uncaching pages from the indicated * objects as we go. */ - for (current = entry; current != &map->header && current->start < end;) { + for (current = entry; current->start < end;) { offset = current->offset + (start - current->start); size = (end <= current->end ? end : current->end) - start; if (current->eflags & MAP_ENTRY_IS_SUB_MAP) { @@ -3068,7 +3050,7 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offs /* * Step through all entries in this region */ - while ((entry != &map->header) && (entry->start < end)) { + while (entry->start < end) { vm_map_entry_t next; /* @@ -3176,8 +3158,6 @@ vm_map_check_protection(vm_map_t map, vm_offset_t star entry = tmp_entry; while (start < end) { - if (entry == &map->header) - return (FALSE); /* * No holes allowed! */ @@ -3641,8 +3621,7 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, /* * If we can't accommodate max_ssize in the current mapping, no go. */ - if ((prev_entry->next != &map->header) && - (prev_entry->next->start < addrbos + max_ssize)) + if (prev_entry->next->start < addrbos + max_ssize) return (KERN_NO_SPACE); /* Modified: stable/11/sys/vm/vm_map.h ============================================================================== --- stable/11/sys/vm/vm_map.h Sat Jan 27 11:33:21 2018 (r328468) +++ stable/11/sys/vm/vm_map.h Sat Jan 27 11:40:46 2018 (r328469) @@ -172,15 +172,19 @@ vm_map_entry_system_wired_count(vm_map_entry_t entry) * A map is a set of map entries. These map entries are * organized both as a binary search tree and as a doubly-linked * list. Both structures are ordered based upon the start and - * end addresses contained within each map entry. Sleator and - * Tarjan's top-down splay algorithm is employed to control - * height imbalance in the binary search tree. + * end addresses contained within each map entry. The list + * header has max start value and min end value to act as + * sentinels for sequential search of the doubly-linked list. + * Sleator and Tarjan's top-down splay algorithm is employed to + * control height imbalance in the binary search tree. * * List of locks * (c) const until freed */ struct vm_map { struct vm_map_entry header; /* List of entries */ +#define min_offset header.end /* (c) */ +#define max_offset header.start /* (c) */ struct sx lock; /* Lock for map data */ struct mtx system_mtx; int nentries; /* Number of entries */ @@ -191,8 +195,6 @@ struct vm_map { vm_flags_t flags; /* flags for this vm_map */ vm_map_entry_t root; /* Root of a binary search tree */ pmap_t pmap; /* (c) Physical map */ -#define min_offset header.start /* (c) */ -#define max_offset header.end /* (c) */ int busy; }; Modified: stable/11/sys/vm/vm_mmap.c ============================================================================== --- stable/11/sys/vm/vm_mmap.c Sat Jan 27 11:33:21 2018 (r328468) +++ stable/11/sys/vm/vm_mmap.c Sat Jan 27 11:40:46 2018 (r328469) @@ -541,8 +541,7 @@ kern_munmap(struct thread *td, uintptr_t addr0, size_t */ pkm.pm_address = (uintptr_t) NULL; if (vm_map_lookup_entry(map, addr, &entry)) { - for (; - entry != &map->header && entry->start < addr + size; + for (; entry->start < addr + size; entry = entry->next) { if (vm_map_check_protection(map, entry->start, entry->end, VM_PROT_EXECUTE) == TRUE) { @@ -768,16 +767,12 @@ RestartScan: * up the pages elsewhere. */ lastvecindex = -1; - for (current = entry; - (current != &map->header) && (current->start < end); - current = current->next) { + for (current = entry; current->start < end; current = current->next) { /* * check for contiguity */ - if (current->end < end && - (entry->next == &map->header || - current->next->start > current->end)) { + if (current->end < end && current->next->start > current->end) { vm_map_unlock_read(map); return (ENOMEM); } From owner-svn-src-stable@freebsd.org Sat Jan 27 13:29:57 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 010E3EC15FC; Sat, 27 Jan 2018 13:29:57 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6BF568AC9; Sat, 27 Jan 2018 13:29:56 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A16E92F31; Sat, 27 Jan 2018 13:29:56 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RDTuub093853; Sat, 27 Jan 2018 13:29:56 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RDTtOM093844; Sat, 27 Jan 2018 13:29:55 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201801271329.w0RDTtOM093844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Sat, 27 Jan 2018 13:29:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328475 - stable/11/contrib/tzdata X-SVN-Group: stable-11 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/11/contrib/tzdata X-SVN-Commit-Revision: 328475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 13:29:57 -0000 Author: philip Date: Sat Jan 27 13:29:55 2018 New Revision: 328475 URL: https://svnweb.freebsd.org/changeset/base/328475 Log: MFC r328055: Import tzdata 2018a MFC r328318: Import tzdata 2018c Replaced: stable/11/contrib/tzdata/pacificnew - copied unchanged from r328318, head/contrib/tzdata/pacificnew Modified: stable/11/contrib/tzdata/Makefile stable/11/contrib/tzdata/NEWS stable/11/contrib/tzdata/README stable/11/contrib/tzdata/africa stable/11/contrib/tzdata/asia stable/11/contrib/tzdata/australasia stable/11/contrib/tzdata/backzone stable/11/contrib/tzdata/europe stable/11/contrib/tzdata/leap-seconds.list stable/11/contrib/tzdata/leapseconds stable/11/contrib/tzdata/northamerica stable/11/contrib/tzdata/southamerica stable/11/contrib/tzdata/theory.html stable/11/contrib/tzdata/version stable/11/contrib/tzdata/zishrink.awk stable/11/contrib/tzdata/zone.tab stable/11/contrib/tzdata/zone1970.tab Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/tzdata/Makefile ============================================================================== --- stable/11/contrib/tzdata/Makefile Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/Makefile Sat Jan 27 13:29:55 2018 (r328475) @@ -42,37 +42,64 @@ POSIXRULES= America/New_York # Also see TZDEFRULESTRING below, which takes effect only # if the time zone files cannot be accessed. -# Everything gets put in subdirectories of. . . -TOPDIR= /usr/local +# Installation locations. +# +# The defaults are suitable for Debian, except that if REDO is +# posix_right or right_posix then files that Debian puts under +# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead +# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, +# respectively. Problems with the Debian approach are discussed in +# the commentary for the right_posix rule (below). +# Destination directory, which can be used for staging. +# 'make DESTDIR=/stage install' installs under /stage (e.g., to +# /stage/etc/localtime instead of to /etc/localtime). Files under +# /stage are not intended to work as-is, but can be copied by hand to +# the root directory later. If DESTDIR is empty, 'make install' does +# not stage, but installs directly into production locations. +DESTDIR = + +# Everything is installed into subdirectories of TOPDIR, and used there. +# TOPDIR should be empty (meaning the root directory), +# or a directory name that does not end in "/". +# TOPDIR should be empty or an absolute name unless you're just testing. +TOPDIR = + +# The default local time zone is taken from the file TZDEFAULT. +TZDEFAULT = $(TOPDIR)/etc/localtime + +# The subdirectory containing installed program and data files, and +# likewise for installed files that can be shared among architectures. +# These should be relative file names. +USRDIR = usr +USRSHAREDIR = $(USRDIR)/share + # "Compiled" time zone information is placed in the "TZDIR" directory # (and subdirectories). -# Use an absolute path name for TZDIR unless you're just testing the software. # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. - TZDIR_BASENAME= zoneinfo -TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME) +TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) -# Types to try, as an alternative to time_t. int64_t should be first. -TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t +# The "tzselect" and (if you do "make INSTALL") "date" commands go in: +BINDIR = $(TOPDIR)/$(USRDIR)/bin -# The "tzselect", "zic", and "zdump" commands get installed in. . . +# The "zdump" command goes in: +ZDUMPDIR = $(BINDIR) -ETCDIR= $(TOPDIR)/etc +# The "zic" command goes in: +ZICDIR = $(TOPDIR)/$(USRDIR)/sbin -# If you "make INSTALL", the "date" command gets installed in. . . - -BINDIR= $(TOPDIR)/bin - # Manual pages go in subdirectories of. . . +MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man -MANDIR= $(TOPDIR)/man - # Library functions are put in an archive in LIBDIR. +LIBDIR = $(TOPDIR)/$(USRDIR)/lib -LIBDIR= $(TOPDIR)/lib +# Types to try, as an alternative to time_t. int64_t should be first. +TIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t + # If you want only POSIX time, with time values interpreted as # seconds since the epoch (not counting leap seconds), use # REDO= posix_only @@ -105,11 +132,14 @@ REDO= posix_right TZDATA_TEXT= leapseconds tzdata.zi # For backward-compatibility links for old zone names, use +# BACKWARD= backward +# If you also want the link US/Pacific-New, even though it is confusing +# and is planned to be removed from the database eventually, use # BACKWARD= backward pacificnew # To omit these links, use # BACKWARD= -BACKWARD= backward pacificnew +BACKWARD= backward # If you want out-of-scope and often-wrong data from the file 'backzone', use # PACKRATDATA= backzone @@ -313,7 +343,7 @@ ZFLAGS= # How to use zic to install tz binary files. -ZIC_INSTALL= $(ZIC) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS) +ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) # The name of a Posix-compliant 'awk' on your system. AWK= awk @@ -341,8 +371,8 @@ SGML_CATALOG_FILES= \ VALIDATE = nsgmls VALIDATE_FLAGS = -s -B -wall -wno-unused-param VALIDATE_ENV = \ - SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \ - SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \ + SGML_CATALOG_FILES='$(SGML_CATALOG_FILES)' \ + SGML_SEARCH_PATH='$(SGML_SEARCH_PATH)' \ SP_CHARSET_FIXED=YES \ SP_ENCODING=UTF-8 @@ -396,7 +426,7 @@ GZIPFLAGS= -9n #MAKE= make cc= cc -CC= $(cc) -DTZDIR=\"$(TZDIR)\" +CC= $(cc) -DTZDIR='"$(TZDIR)"' AR= ar @@ -421,18 +451,19 @@ MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.t date.1.txt COMMON= calendars CONTRIBUTING LICENSE Makefile \ NEWS README theory.html version -WEB_PAGES= tz-art.htm tz-how-to.html tz-link.htm +WEB_PAGES= tz-art.html tz-how-to.html tz-link.html DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) PRIMARY_YDATA= africa antarctica asia australasia \ europe northamerica southamerica -YDATA= $(PRIMARY_YDATA) etcetera $(BACKWARD) +YDATA= $(PRIMARY_YDATA) etcetera NDATA= systemv factory -TDATA= $(YDATA) $(NDATA) +TDATA_TO_CHECK= $(YDATA) $(NDATA) backward pacificnew +TDATA= $(YDATA) $(NDATA) $(BACKWARD) ZONETABLES= zone1970.tab zone.tab TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) LEAP_DEPS= leapseconds.awk leap-seconds.list -TZDATA_ZI_DEPS= zishrink.awk $(TDATA) $(PACKRATDATA) -DATA= $(YDATA) $(NDATA) backzone iso3166.tab leap-seconds.list \ +TZDATA_ZI_DEPS= zishrink.awk version $(TDATA) $(PACKRATDATA) +DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ leapseconds yearistype.sh $(ZONETABLES) AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk zishrink.awk MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl @@ -457,7 +488,7 @@ VERSION_DEPS= \ newctime.3 newstrftime.3 newtzset.3 northamerica \ pacificnew private.h \ southamerica strftime.c systemv theory.html \ - time2posix.3 tz-art.htm tz-how-to.html tz-link.htm \ + time2posix.3 tz-art.html tz-how-to.html tz-link.html \ tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ workman.sh yearistype.sh \ zdump.8 zdump.c zic.8 zic.c \ @@ -473,35 +504,41 @@ all: tzselect yearistype zic zdump libtz.a $(TABDATA) ALL: all date $(ENCHILADA) install: all $(DATA) $(REDO) $(MANS) - mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \ - $(DESTDIR)$(LIBDIR) \ - $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \ - $(DESTDIR)$(MANDIR)/man8 - $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) - cp -f $(TABDATA) $(DESTDIR)$(TZDIR)/. - cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/. - cp libtz.a $(DESTDIR)$(LIBDIR)/. - $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a - cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/. - cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/. - cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/. + mkdir -p '$(DESTDIR)$(BINDIR)' \ + '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ + '$(DESTDIR)$(LIBDIR)' \ + '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ + '$(DESTDIR)$(MANDIR)/man8' + $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) \ + -t '$(DESTDIR)$(TZDEFAULT)' + cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' + cp tzselect '$(DESTDIR)$(BINDIR)/.' + cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' + cp zic '$(DESTDIR)$(ZICDIR)/.' + cp libtz.a '$(DESTDIR)$(LIBDIR)/.' + $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' + cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' + cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' + cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' INSTALL: ALL install date.1 - mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 - cp date $(DESTDIR)$(BINDIR)/. - cp -f date.1 $(DESTDIR)$(MANDIR)/man1/. + mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' + cp date '$(DESTDIR)$(BINDIR)/.' + cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' version: $(VERSION_DEPS) { (type git) >/dev/null 2>&1 && \ V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ --abbrev=7 --dirty` || \ - V=$(VERSION); } && \ + V='$(VERSION)'; } && \ printf '%s\n' "$$V" >$@.out mv $@.out $@ # This file can be tailored by setting BACKWARD, PACKRATDATA, etc. tzdata.zi: $(TZDATA_ZI_DEPS) - LC_ALL=C $(AWK) -f zishrink.awk $(TDATA) $(PACKRATDATA) >$@.out + version=`sed 1q version` && \ + LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \ + $(TDATA) $(PACKRATDATA) >$@.out mv $@.out $@ version.h: version @@ -529,12 +566,13 @@ leapseconds: $(LEAP_DEPS) # Arguments to pass to submakes of install_data. # They can be overridden by later submake arguments. INSTALLARGS = \ - BACKWARD=$(BACKWARD) \ - DESTDIR=$(DESTDIR) \ + BACKWARD='$(BACKWARD)' \ + DESTDIR='$(DESTDIR)' \ LEAPSECONDS='$(LEAPSECONDS)' \ PACKRATDATA='$(PACKRATDATA)' \ - TZDIR=$(TZDIR) \ - YEARISTYPE=$(YEARISTYPE) \ + TZDEFAULT='$(TZDEFAULT)' \ + TZDIR='$(TZDIR)' \ + YEARISTYPE='$(YEARISTYPE)' \ ZIC='$(ZIC)' # 'make install_data' installs one set of tz binary files. @@ -558,16 +596,16 @@ right_only: # You must replace all of $(TZDIR) to switch from not using leap seconds # to using them, or vice versa. right_posix: right_only - rm -fr $(DESTDIR)$(TZDIR)-leaps - ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \ - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only + rm -fr '$(DESTDIR)$(TZDIR)-leaps' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only posix_right: posix_only - rm -fr $(DESTDIR)$(TZDIR)-posix - ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \ - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only + rm -fr '$(DESTDIR)$(TZDIR)-posix' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only # This obsolescent rule is present for backwards compatibility with # tz releases 2014g through 2015g. It should go away eventually. @@ -633,7 +671,7 @@ check_character_set: $(ENCHILADA) $(MISC) $(SOURCES) $(WEB_PAGES) \ CONTRIBUTING LICENSE Makefile README \ version tzdata.zi && \ - ! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ leapseconds yearistype.sh zone.tab && \ ! grep -Env $(OK_LINE) $(ENCHILADA); \ } @@ -641,14 +679,16 @@ check_character_set: $(ENCHILADA) check_white_space: $(ENCHILADA) patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ ! grep -En "$$pat" $(ENCHILADA) - ! grep -n '[[:space:]]$$' $(ENCHILADA) + ! grep -n '[[:space:]]$$' \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+ FILE_NAME_COMPONENT_TOO_LONG = \ $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15} -check_name_lengths: $(TDATA) backzone - ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' $(TDATA) backzone +check_name_lengths: $(TDATA_TO_CHECK) backzone + ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ + $(TDATA_TO_CHECK) backzone CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } @@ -662,8 +702,8 @@ check_sorted: backward backzone iso3166.tab zone.tab z $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \ LC_ALL=C sort -cu -check_links: checklinks.awk $(TDATA) - $(AWK) -f checklinks.awk $(TDATA) +check_links: checklinks.awk $(TDATA_TO_CHECK) + $(AWK) -f checklinks.awk $(TDATA_TO_CHECK) $(AWK) -f checklinks.awk tzdata.zi check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES) @@ -764,12 +804,12 @@ set-timestamps.out: $(ENCHILADA) check_public: $(MAKE) maintainer-clean - $(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL + $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL mkdir -p public.dir - for i in $(TDATA) tzdata.zi; do \ + for i in $(TDATA_TO_CHECK) tzdata.zi; do \ $(zic) -v -d public.dir $$i 2>&1 || exit; \ done - $(zic) -v -d public.dir $(TDATA) + $(zic) -v -d public.dir $(TDATA_TO_CHECK) rm -fr public.dir # Check that the code works under various alternative @@ -790,8 +830,11 @@ check_time_t_alternatives: REDO='$(REDO)' \ install && \ diff $$quiet_option -r \ - time_t.dir/int64_t/etc/zoneinfo \ - time_t.dir/$$type/etc/zoneinfo && \ + time_t.dir/int64_t/etc \ + time_t.dir/$$type/etc && \ + diff $$quiet_option -r \ + time_t.dir/int64_t/usr/share \ + time_t.dir/$$type/usr/share && \ case $$type in \ int32_t) range=-2147483648,2147483647;; \ uint32_t) range=0,4294967296;; \ @@ -800,9 +843,9 @@ check_time_t_alternatives: *) range=-10000000000,10000000000;; \ esac && \ echo checking $$type zones ... && \ - time_t.dir/int64_t/etc/zdump -V -t $$range $$zones \ + time_t.dir/int64_t/usr/bin/zdump -V -t $$range $$zones \ >time_t.dir/int64_t.out && \ - time_t.dir/$$type/etc/zdump -V -t $$range $$zones \ + time_t.dir/$$type/usr/bin/zdump -V -t $$range $$zones \ >time_t.dir/$$type.out && \ diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \ || exit; \ Modified: stable/11/contrib/tzdata/NEWS ============================================================================== --- stable/11/contrib/tzdata/NEWS Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/NEWS Sat Jan 27 13:29:55 2018 (r328475) @@ -1,5 +1,147 @@ News for the tz database +Release 2018c - 2018-01-22 23:00:44 -0800 + + Briefly: + Revert Irish changes that relied on negative DST offsets. + + Changes to tm_isdst + + Revert the 2018a change to Europe/Dublin. As before, this change + does not affect UT offsets or abbreviations; it affects only + whether timestamps are considered to be standard time or + daylight-saving time, as expressed in the tm_isdst flag of C's + struct tm type. This reversion is intended to be a temporary + workaround for problems discovered with downstream uses of + releases 2018a and 2018b, which implemented Irish time by using + negative DST offsets in the Eire rules of the 'europe' file. + Although negative DST offsets have been part of tzcode for many + years and are supported by many platforms, they were not + documented before 2018a and ICU and OpenJDK do not currently + support them. A mechanism to export data to platforms lacking + support for negative DST is planned to be developed before the + change is reapplied. (Problems reported by Deborah Goldsmith and + Stephen Colebourne.) + + Changes to past time stamps + + Japanese DST transitions (1948-1951) were Sundays at 00:00, not + Saturdays or Sundays at 02:00. (Thanks to Takayuki Nikai.) + + Changes to build procedure + + The build procedure now works around mawk 1.3.3's lack of support + for character class expressions. (Problem reported by Ohyama.) + + +Release 2018b - 2018-01-17 23:24:48 -0800 + + Briefly: + Fix a packaging problem in tz2018a, which was missing 'pacificnew'. + + Changes to build procedure + + The distribution now contains the file 'pacificnew' again. + This file was inadvertantly omitted in the 2018a distribution. + (Problem reported by Matias Fonzo.) + + +Release 2018a - 2018-01-12 22:29:21 -0800 + + Briefly: + São Tomé and Príncipe switched from +00 to +01. + Brazil's DST will now start on November's first Sunday. + Ireland's standard time is now in the summer, not the winter. + Use Debian-style installation locations, instead of 4.3BSD-style. + New zic option -t. + + Changes to past and future time stamps + + São Tomé and Príncipe switched from +00 to +01 on 2018-01-01 at + 01:00. (Thanks to Steffen Thorsen and Michael Deckers.) + + Changes to future time stamps + + Starting in 2018 southern Brazil will begin DST on November's + first Sunday instead of October's third Sunday. (Thanks to + Steffen Thorsen.) + + Changes to past time stamps + + A discrepancy of 4 s in timestamps before 1931 in South Sudan has + been corrected. The 'backzone' and 'zone.tab' files did not agree + with the 'africa' and 'zone1970.tab' files. (Problem reported by + Michael Deckers.) + + The abbreviation invented for Bolivia Summer Time (1931-2) is now + BST instead of BOST, to be more consistent with the convention + used for Latvian Summer Time (1918-9) and for British Summer Time. + + Changes to tm_isdst + + Change Europe/Dublin so that it observes Irish Standard Time (UT + +01) in summer and GMT (as negative daylight-saving) in winter, + instead of observing standard time (GMT) in winter and Irish + Summer Time (UT +01) in summer. This change does not affect UT + offsets or abbreviations; it affects only whether timestamps are + considered to be standard time or daylight-saving time, as + expressed in the tm_isdst flag of C's struct tm type. + (Discrepancy noted by Derick Rethans.) + + Changes to build procedure + + The default installation locations have been changed to mostly + match Debian circa 2017, instead of being designed as an add-on to + 4.3BSD circa 1986. This affects the Makefile macros TOPDIR, + TZDIR, MANDIR, and LIBDIR. New Makefile macros TZDEFAULT, USRDIR, + USRSHAREDIR, BINDIR, ZDUMPDIR, and ZICDIR let installers tailor + locations more precisely. (This responds to suggestions from + Brian Inglis and from Steve Summit.) + + The default installation procedure no longer creates the + backward-compatibility link US/Pacific-New, which causes + confusion during user setup (e.g., see Debian bug 815200). + Use 'make BACKWARD="backward pacificnew"' to create the link + anyway, for now. Eventually we plan to remove the link entirely. + + tzdata.zi now contains a version-number comment. + (Suggested by Tom Lane.) + + The Makefile now quotes values like BACKWARD more carefully when + passing them to the shell. (Problem reported by Zefram.) + + Builders no longer need to specify -DHAVE_SNPRINTF on platforms + that have snprintf and use pre-C99 compilers. (Problem reported + by Jon Skeet.) + + Changes to code + + zic has a new option -t FILE that specifies the location of the + file that determines local time when TZ is unset. The default for + this location can be configured via the new TZDEFAULT makefile + macro, which defaults to /etc/localtime. + + Diagnostics and commentary now distinguish UT from UTC more + carefully; see theory.html for more information about UT vs UTC. + + zic has been ported to GCC 8's -Wstringop-truncation option. + (Problem reported by Martin Sebor.) + + Changes to documentation and commentary + + The zic man page now documents the longstanding behavior that + times and years can be out of the usual range, with negative times + counting backwards from midnight and with year 0 preceding year 1. + (Problem reported by Michael Deckers.) + + The theory.html file now mentions the POSIX limit of six chars + per abbreviation, and lists alphabetic abbreviations used. + + The files tz-art.htm and tz-link.htm have been renamed to + tz-art.html and tz-link.html, respectively, for consistency with + other file names and to simplify web server configuration. + + Release 2017c - 2017-10-20 14:49:34 -0700 Briefly: @@ -895,8 +1037,8 @@ Release 2015f - 2015-08-10 18:06:56 -0700 (Thanks to Jon Skeet and Arthur David Olson.) Constraints on simultaneity are now documented. - The two characters '%z' in a zone format now stand for the UTC - offset, e.g., '-07' for seven hours behind UTC and '+0530' for + The two characters '%z' in a zone format now stand for the UT + offset, e.g., '-07' for seven hours behind UT and '+0530' for five hours and thirty minutes ahead. This better supports time zone abbreviations conforming to POSIX.1-2001 and later. @@ -1019,13 +1161,13 @@ Release 2015c - 2015-04-11 08:55:55 -0700 The spring 1988 transition was 1988-10-09, not 1988-10-02. The fall 1990 transition was 1990-03-11, not 1990-03-18. - Assume no UTC offset change for Pacific/Easter on 1890-01-01, + Assume no UT offset change for Pacific/Easter on 1890-01-01, and omit all transitions on Pacific/Easter from 1942 through 1946 since we have no data suggesting that they existed. One more zone has been turned into a link, as it differed from an existing zone only for older time stamps. As usual, - this change affects UTC offsets in pre-1970 time stamps only. + this change affects UT offsets in pre-1970 time stamps only. The zone's old contents have been moved to the 'backzone' file. The affected zone is America/Montreal. @@ -1055,7 +1197,7 @@ Release 2015b - 2015-03-19 23:28:11 -0700 Some more zones have been turned into links, when they differed from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. + these changes affect UT offsets in pre-1970 time stamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: America/Antigua, America/Cayman, Pacific/Midway, and Pacific/Saipan. @@ -1107,7 +1249,7 @@ Release 2015a - 2015-01-29 22:35:20 -0800 Some more zones have been turned into links, when they differed from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. + these changes affect UT offsets in pre-1970 time stamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Asia/Aden, Asia/Bahrain, Asia/Kuwait, and Asia/Muscat. @@ -1154,7 +1296,7 @@ Release 2014j - 2014-11-10 17:37:11 -0800 Some more zones have been turned into links, when they differed from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. + these changes affect UT offsets in pre-1970 time stamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Africa/Addis_Ababa, Africa/Asmara, Africa/Dar_es_Salaam, Africa/Djibouti, Africa/Kampala, @@ -1244,7 +1386,7 @@ Release 2014h - 2014-09-25 18:59:03 -0700 Some more zones have been turned into links, when they differed from existing zones only for older timestamps. As usual, - these changes affect UTC offsets in pre-1970 timestamps only. + these changes affect UT offsets in pre-1970 timestamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Africa/Blantyre, Africa/Bujumbura, Africa/Gaborone, Africa/Harare, Africa/Kigali, Africa/Lubumbashi, @@ -1329,7 +1471,7 @@ Release 2014g - 2014-08-28 12:31:23 -0700 Some more zones have been turned into links, when they differed from existing zones only for older timestamps. As usual, - these changes affect UTC offsets in pre-1970 timestamps only. + these changes affect UT offsets in pre-1970 timestamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Africa/Bangui, Africa/Brazzaville, Africa/Douala, Africa/Kinshasa, Africa/Libreville, Africa/Luanda, @@ -1479,7 +1621,7 @@ Release 2014f - 2014-08-05 17:42:36 -0700 standard and daylight saving time the abbreviations are AEST and AEDT instead of the former EST for both; similarly, ACST/ACDT, ACWST/ACWDT, and AWST/AWDT are now used instead of the former CST, CWST, and WST. - This change does not affect UTC offsets, only time zone abbreviations. + This change does not affect UT offsets, only time zone abbreviations. (Thanks to Rich Tibbett and many others.) Asia/Novokuznetsk shifts from NOVT to KRAT (remaining on UT +07) @@ -1516,8 +1658,8 @@ Release 2014f - 2014-08-05 17:42:36 -0700 Treindl sent helpful translations of two papers by Guo Qingsheng.) Some zones have been turned into links, when they differed from existing - zones only for older UTC offsets where data entries were likely invented. - These changes affect UTC offsets in pre-1970 timestamps only. This is + zones only for older UT offsets where data entries were likely invented. + These changes affect UT offsets in pre-1970 timestamps only. This is similar to the change in release 2013e, except this time for western Africa. The affected zones are: Africa/Bamako, Africa/Banjul, Africa/Conakry, Africa/Dakar, Africa/Freetown, Africa/Lome, Modified: stable/11/contrib/tzdata/README ============================================================================== --- stable/11/contrib/tzdata/README Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/README Sat Jan 27 13:29:55 2018 (r328475) @@ -11,14 +11,14 @@ changes made by political bodies to time zone boundari and daylight-saving rules. See or the -file tz-link.htm for how to acquire the code and data. Once acquired, +file tz-link.html for how to acquire the code and data. Once acquired, read the comments in the file 'Makefile' and make any changes needed to make things right for your system, especially if you are using some platform other than GNU/Linux. Then run the following commands, substituting your desired installation directory for "$HOME/tzdir": make TOPDIR=$HOME/tzdir install - $HOME/tzdir/etc/zdump -v America/Los_Angeles + $HOME/tzdir/usr/bin/zdump -v America/Los_Angeles Historical local time information has been included here to: Modified: stable/11/contrib/tzdata/africa ============================================================================== --- stable/11/contrib/tzdata/africa Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/africa Sat Jan 27 13:29:55 2018 (r328475) @@ -158,7 +158,6 @@ Link Africa/Abidjan Africa/Freetown # Sierra Leone Link Africa/Abidjan Africa/Lome # Togo Link Africa/Abidjan Africa/Nouakchott # Mauritania Link Africa/Abidjan Africa/Ouagadougou # Burkina Faso -Link Africa/Abidjan Africa/Sao_Tome # São Tomé and Príncipe Link Africa/Abidjan Atlantic/St_Helena # St Helena # Djibouti @@ -425,7 +424,7 @@ Link Africa/Nairobi Indian/Mayotte # # The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30. # -# In 1972 Liberia was the last country to switch from a UTC offset +# In 1972 Liberia was the last country to switch from a UT offset # that was not a multiple of 15 or 20 minutes. The 1972 change was on # 1972-01-07, according to an entry dated 1972-01-04 on p 330 of: # Presidential Papers: First year of the administration of @@ -1037,6 +1036,19 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Den # Inaccessible, Nightingale: uninhabited # São Tomé and Príncipe + +# From Steffen Thorsen (2018-01-08): +# Multiple sources tell that São Tomé changed from UTC to UTC+1 as +# they entered the year 2018. +# From Michael Deckers (2018-01-08): +# the switch is from 01:00 to 02:00 ... [Decree No. 25/2017] +# http://www.mnec.gov.st/index.php/publicacoes/documentos/file/90-decreto-lei-n-25-2017 + +Zone Africa/Sao_Tome 0:26:56 - LMT 1884 + -0:36:45 - LMT 1912 # Lisbon Mean Time + 0:00 - GMT 2018 Jan 1 01:00 + 1:00 - WAT + # Senegal # See Africa/Abidjan. Modified: stable/11/contrib/tzdata/asia ============================================================================== --- stable/11/contrib/tzdata/asia Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/asia Sat Jan 27 13:29:55 2018 (r328475) @@ -50,7 +50,7 @@ # 9:00 KST KDT Korea when at +09 # 9:30 ACST Australian Central Standard Time # Otherwise, these tables typically use numeric abbreviations like +03 -# and +0330 for integer hour and minute UTC offsets. Although earlier +# and +0330 for integer hour and minute UT offsets. Although earlier # editions invented alphabetic time zone abbreviations for every # offset, this did not reflect common practice. # @@ -647,17 +647,17 @@ Zone Asia/Hong_Kong 7:36:42 - LMT 1904 Oct 30 # time", in which abolished the adoption of Western Standard Time in # western islands (listed above), which means the whole Japan # territory, including later occupations, adopt Japan Central Time -# (UTC+9). The adoption began on Oct 1, 1937. The original text can +# (UT+9). The adoption began on Oct 1, 1937. The original text can # be found on Wikisource: # https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件 # -# That is, the time zone of Taipei switched to UTC+9 on Oct 1, 1937. +# That is, the time zone of Taipei switched to UT+9 on Oct 1, 1937. # From Yu-Cheng Chuang (2014-07-02): -# I've found more evidence about when the time zone was switched from UTC+9 -# back to UTC+8 after WW2. I believe it was on Sep 21, 1945. In a document +# I've found more evidence about when the time zone was switched from UT+9 +# back to UT+8 after WW2. I believe it was on Sep 21, 1945. In a document # during Japanese era [1] in which the officer told the staff to change time -# zone back to Western Standard Time (UTC+8) on Sep 21. And in another +# zone back to Western Standard Time (UT+8) on Sep 21. And in another # history page of National Cheng Kung University [2], on Sep 21 there is a # note "from today, switch back to Western Standard Time". From these two # materials, I believe that the time zone change happened on Sep 21. And @@ -1464,17 +1464,17 @@ Zone Asia/Jerusalem 2:20:54 - LMT 1880 # of the Japanese wanted to scrap daylight-saving time, as opposed to 30% who # wanted to keep it.) -# From Paul Eggert (2006-03-22): -# Shanks & Pottenger write that DST in Japan during those years was as follows: +# From Takayuki Nikai (2018-01-19): +# The source of information is Japanese law. +# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00219480428029.htm +# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00719500331039.htm +# ... In summary, it is written as follows. From 24:00 on the first Saturday +# in May, until 0:00 on the day after the second Saturday in September. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Japan 1948 only - May Sun>=1 2:00 1:00 D -Rule Japan 1948 1951 - Sep Sat>=8 2:00 0 S -Rule Japan 1949 only - Apr Sun>=1 2:00 1:00 D -Rule Japan 1950 1951 - May Sun>=1 2:00 1:00 D -# but the only locations using it (for birth certificates, presumably, since -# their audience is astrologers) were US military bases. For now, assume -# that for most purposes daylight-saving time was observed; otherwise, what -# would have been the point of the 1951 poll? +Rule Japan 1948 only - May Sat>=1 24:00 1:00 D +Rule Japan 1948 1951 - Sep Sun>=9 0:00 0 S +Rule Japan 1949 only - Apr Sat>=1 24:00 1:00 D +Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D # From Hideyuki Suzuki (1998-11-09): # 'Tokyo' usually stands for the former location of Tokyo Astronomical @@ -1505,7 +1505,7 @@ Rule Japan 1950 1951 - May Sun>=1 2:00 1:00 D # # ...the Showa Emperor announced Ordinance No. 529 of Showa Year 12 ... which # means the whole Japan territory, including later occupations, adopt Japan -# Central Time (UTC+9). The adoption began on Oct 1, 1937. +# Central Time (UT+9). The adoption began on Oct 1, 1937. # https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件 # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2066,8 +2066,8 @@ Zone Asia/Kuching 7:21:20 - LMT 1926 Mar # Maldives # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Maldives 4:54:00 - LMT 1880 # Male - 4:54:00 - MMT 1960 # Male Mean Time +Zone Indian/Maldives 4:54:00 - LMT 1880 # Malé + 4:54:00 - MMT 1960 # Malé Mean Time 5:00 - +05 # Mongolia Modified: stable/11/contrib/tzdata/australasia ============================================================================== --- stable/11/contrib/tzdata/australasia Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/australasia Sat Jan 27 13:29:55 2018 (r328475) @@ -683,8 +683,8 @@ Zone Pacific/Guadalcanal 10:39:48 - LMT 1912 Oct # Hon # From Steffen Thorsen (2012-07-25) # ... we double checked by calling hotels and offices based in Tokelau asking # about the time there, and they all told a time that agrees with UTC+13.... -# Shanks says UTC-10 from 1901 [but] ... there is a good chance the change -# actually was to UTC-11 back then. +# Shanks says UT-10 from 1901 [but] ... there is a good chance the change +# actually was to UT-11 back then. # # From Paul Eggert (2012-07-25) # A Google Books snippet of Appendix to the Journals of the House of @@ -1450,7 +1450,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # # From Paul Eggert (2006-03-22): # The Department of Internal Affairs (DIA) maintains a brief history, -# as does Carol Squires; see tz-link.htm for the full references. +# as does Carol Squires; see tz-link.html for the full references. # Use these sources in preference to Shanks & Pottenger. # # For Chatham, IATA SSIM (1991/1999) gives the NZ rules but with Modified: stable/11/contrib/tzdata/backzone ============================================================================== --- stable/11/contrib/tzdata/backzone Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/backzone Sat Jan 27 13:29:55 2018 (r328475) @@ -145,11 +145,6 @@ Zone Africa/Gaborone 1:43:40 - LMT 1885 Zone Africa/Harare 2:04:12 - LMT 1903 Mar 2:00 - CAT -# South Sudan -Zone Africa/Juba 2:06:24 - LMT 1931 - 2:00 Sudan CA%sT 2000 Jan 15 12:00 - 3:00 - EAT - # Uganda Zone Africa/Kampala 2:09:40 - LMT 1928 Jul 3:00 - EAT 1930 @@ -241,11 +236,6 @@ Zone Africa/Ouagadougou -0:06:04 - LMT 1912 Zone Africa/Porto-Novo 0:10:28 - LMT 1912 Jan 1 0:00 - GMT 1934 Feb 26 1:00 - WAT - -# São Tomé and Príncipe -Zone Africa/Sao_Tome 0:26:56 - LMT 1884 - -0:36:32 - LMT 1912 # Lisbon Mean Time - 0:00 - GMT # Mali (northern) Zone Africa/Timbuktu -0:12:04 - LMT 1912 Modified: stable/11/contrib/tzdata/europe ============================================================================== --- stable/11/contrib/tzdata/europe Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/europe Sat Jan 27 13:29:55 2018 (r328475) @@ -68,14 +68,15 @@ # 0:00 WET WEST WEMT Western Europe # 0:19:32.13 AMT* NST* Amsterdam, Netherlands Summer (1835-1937) # 1:00 BST British Standard (1968-1971) +# 1:00 IST GMT Irish Standard (1968-) with winter DST # 1:00 CET CEST CEMT Central Europe # 1:00:14 SET Swedish (1879-1899) # 1:36:34 RMT* LST* Riga, Latvian Summer (1880-1926)* # 2:00 EET EEST Eastern Europe # 3:00 MSK MSD MDST* Moscow -# From Peter Ilieve (1994-12-04), -# The original six [EU members]: Belgium, France, (West) Germany, Italy, +# From Peter Ilieve (1994-12-04), re EEC/EC/EU members: +# The original six: Belgium, France, (West) Germany, Italy, # Luxembourg, the Netherlands. # Plus, from 1 Jan 73: Denmark, Ireland, United Kingdom. # Plus, from 1 Jan 81: Greece. @@ -278,16 +279,31 @@ # The following claim by Shanks & Pottenger is possible though doubtful; # we'll ignore it for now. # * Dublin's 1971-10-31 switch was at 02:00, even though London's was 03:00. + +# From Paul Eggert (2017-12-04): # +# Dunsink Observatory (8 km NW of Dublin's center) was to Dublin as +# Greenwich was to London. For example: # -# Whitman says Dublin Mean Time was -0:25:21, which is more precise than -# Shanks & Pottenger. -# Perhaps this was Dunsink Observatory Time, as Dunsink Observatory -# (8 km NW of Dublin's center) seemingly was to Dublin as Greenwich was -# to London. For example: -# # "Timeball on the ballast office is down. Dunsink time." # -- James Joyce, Ulysses +# +# The abbreviation DMT stood for "Dublin Mean Time" or "Dunsink Mean Time"; +# this being Ireland, opinions differed. +# +# Whitman says Dublin/Dunsink Mean Time was UT-00:25:21, which agrees +# with measurements of recent visitors to the Meridian Room of Dunsink +# Observatory; see Malone D. Dunsink and timekeeping. 2016-01-24. +# . Malone +# writes that the Nautical Almanac listed UT-00:25:22 until 1896, when +# it moved to UT-00:25:21.1 (I confirmed that the 1893 edition used +# the former and the 1896 edition used the latter). Evidently the +# news of this change propagated slowly, as Milne 1899 still lists +# UT-00:25:22 and cites the International Telegraph Bureau. As it is +# not clear that there was any practical significance to the change +# from UT-00:25:22 to UT-00:25:21.1 in civil timekeeping, omit this +# transition for now and just use the latter value, omitting its +# fraction since our format cannot represent fractions. # "Countess Markievicz ... claimed that the [1916] abolition of Dublin Mean Time # was among various actions undertaken by the 'English' government that @@ -347,12 +363,28 @@ # regulations. I spoke this morning with the Secretary of the Department of # Justice (tel +353 1 678 9711) who confirmed to me that the correct name is # "Irish Summer Time", abbreviated to "IST". +# +# From Paul Eggert (2017-12-07): +# The 1996 anonymous contributor's goal was to determine the correct +# abbreviation for summer time in Dublin and so the contributor +# focused on the "IST", not on the "Irish Summer Time". Though the +# "IST" was correct, the "Irish Summer Time" appears to have been an +# error, as Ireland's Standard Time (Amendment) Act, 1971 states that +# standard time in Ireland remains at UT +01 and is observed in +# summer, and that Greenwich mean time is observed in winter. (Thanks +# to Derick Rethans for pointing out the error.) That is, when +# Ireland amended the 1968 act that established UT +01 as Irish +# Standard Time, it left standard time unchanged and established GMT +# as a negative daylight saving time in winter. So, in this database +# IST stands for Irish Summer Time for timestamps before 1968, and for +# Irish Standard Time after that. See: +# http://www.irishstatutebook.ie/eli/1971/act/17/enacted/en/print # Michael Deckers (2017-06-01) gave the following URLs for Ireland's # Summer Time Act, 1925 and Summer Time Orders, 1926 and 1947: -# http://www.irishstatutebook.ie/eli/1925/act/8/enacted/en/print.html -# http://www.irishstatutebook.ie/eli/1926/sro/919/made/en/print.html -# http://www.irishstatutebook.ie/eli/1947/sro/71/made/en/print.html +# http://www.irishstatutebook.ie/eli/1925/act/8/enacted/en/print +# http://www.irishstatutebook.ie/eli/1926/sro/919/made/en/print +# http://www.irishstatutebook.ie/eli/1947/sro/71/made/en/print # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Summer Time Act, 1916 @@ -476,9 +508,23 @@ Link Europe/London Europe/Jersey Link Europe/London Europe/Guernsey Link Europe/London Europe/Isle_of_Man +# From Paul Eggert (2018-01-19): +# The following is like GB-Eire and EU, except with standard time in +# summer and negative daylight saving time in winter. +# Although currently commented out, this will need to become uncommented +# once the ICU/OpenJDK workaround is removed; see below. +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +#Rule Eire 1971 only - Oct 31 2:00u -1:00 GMT +#Rule Eire 1972 1980 - Mar Sun>=16 2:00u 0 IST +#Rule Eire 1972 1980 - Oct Sun>=23 2:00u -1:00 GMT +#Rule Eire 1981 max - Mar lastSun 1:00u 0 IST +#Rule Eire 1981 1989 - Oct Sun>=23 1:00u -1:00 GMT +#Rule Eire 1990 1995 - Oct Sun>=22 1:00u -1:00 GMT +#Rule Eire 1996 max - Oct lastSun 1:00u -1:00 GMT + # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 - -0:25:21 - DMT 1916 May 21 2:00s # Dublin MT + -0:25:21 - DMT 1916 May 21 2:00s -0:25:21 1:00 IST 1916 Oct 1 2:00s 0:00 GB-Eire %s 1921 Dec 6 # independence 0:00 GB-Eire GMT/IST 1940 Feb 25 2:00s @@ -487,16 +533,33 @@ Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 0:00 1:00 IST 1947 Nov 2 2:00s 0:00 - GMT 1948 Apr 18 2:00s 0:00 GB-Eire GMT/IST 1968 Oct 27 +# From Paul Eggert (2018-01-18): +# The next line should look like this: +# 1:00 Eire IST/GMT +# However, in January 2018 we discovered that the Eire rules cause +# problems with tests for ICU: +# https://mm.icann.org/pipermail/tz/2018-January/025825.html +# and with tests for OpenJDK: +# https://mm.icann.org/pipermail/tz/2018-January/025822.html +# To work around this problem, use a traditional approximation for +# time stamps after 1971-10-31 02:00 UTC, to give ICU and OpenJDK +# developers breathing room to fix bugs. This approximation has +# correct UTC offsets, but results in tm_isdst flags are the reverse +# of what they should be. This workaround is temporary and should be +# removed reasonably soon. 1:00 - IST 1971 Oct 31 2:00u 0:00 GB-Eire GMT/IST 1996 0:00 EU GMT/IST +# End of workaround for ICU and OpenJDK bugs. + ############################################################################### # Europe -# EU rules are for the European Union, previously known as the EC, EEC, -# Common Market, etc. +# The following rules are for the European Union and for its +# predecessor organization, the European Communities. +# For brevity they are called "EU rules" elsewhere in this file. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EU 1977 1980 - Apr Sun>=1 1:00u 1:00 S @@ -929,7 +992,7 @@ Zone Europe/Prague 0:57:44 - LMT 1850 # The page http://www.retsinfo.dk/_GETDOCI_/ACCN/A18930008330-REGL # confirms this, and states that the law was put forth 1893-03-29. # -# The EU treaty with effect from 1973: +# The EU [actually, EEC and Euratom] treaty with effect from 1973: # http://www.retsinfo.dk/_GETDOCI_/ACCN/A19722110030-REGL # # This provoked a new law from 1974 to make possible summer time changes @@ -985,9 +1048,10 @@ Zone Atlantic/Faroe -0:27:04 - LMT 1908 Jan 11 # Tórs # East Greenland and Franz Josef Land, but we don't know their time zones. # My source for this is Wilhelm Dege's book mentioned under Svalbard. # -# From Paul Eggert (2006-03-22): -# Greenland joined the EU as part of Denmark, obtained home rule on 1979-05-01, -# and left the EU on 1985-02-01. It therefore should have been using EU +# From Paul Eggert (2017-12-10): +# Greenland joined the European Communities as part of Denmark, +# obtained home rule on 1979-05-01, and left the European Communities +# on 1985-02-01. It therefore should have been using EU # rules at least through 1984. Shanks & Pottenger say Scoresbysund and Godthåb # used C-Eur rules after 1980, but IATA SSIM (1991/1996) says they use EU # rules since at least 1991. Assume EU rules since 1980. @@ -1301,7 +1365,7 @@ Zone Europe/Paris 0:09:21 - LMT 1891 Mar 15 0:01 # From Markus Kuhn (1998-09-29): # The German time zone web site by the Physikalisch-Technische # Bundesanstalt contains DST information back to 1916. -# [See tz-link.htm for the URL.] +# [See tz-link.html for the URL.] # From Jörg Schilling (2002-10-23): # In 1945, Berlin was switched to Moscow Summer time (GMT+4) by @@ -1398,7 +1462,7 @@ Zone Europe/Athens 1:34:52 - LMT 1895 Sep 14 1:00 Greece CE%sT 1944 Apr 4 2:00 Greece EE%sT 1981 # Shanks & Pottenger say it switched to C-Eur in 1981; - # go with EU instead, since Greece joined it on Jan 1. + # go with EU rules instead, since Greece joined Jan 1. 2:00 EU EE%sT # Hungary @@ -2097,7 +2161,7 @@ Zone Europe/Warsaw 1:24:00 - LMT 1880 # IATA SSIM (1991/1992) reports that the Azores were at -1:00. # IATA SSIM (1993-02) says +0:00; later issues (through 1996-09) say -1:00. # Guess that the Azores changed to EU rules in 1992 (since that's when Portugal -# harmonized with the EU), and that they stayed +0:00 that winter. +# harmonized with EU rules), and that they stayed +0:00 that winter. # # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # DSH writes that despite Decree 1,469 (1915), the change to the clocks was not @@ -2772,9 +2836,9 @@ Zone Asia/Omsk 4:53:30 - LMT 1919 Nov 14 # # https://regnum.ru/news/society/1957270.html # has some historical data for Altai Krai: -# before 1957: west part on UTC+6, east on UTC+7 -# after 1957: UTC+7 -# since 1995: UTC+6 +# before 1957: west part on UT+6, east on UT+7 +# after 1957: UT+7 +# since 1995: UT+6 # http://barnaul.rusplt.ru/index/pochemu_altajskij_kraj_okazalsja_v_neprivychnom_chasovom_pojase-17648.html # confirms that and provides more details including 1995-05-28 transition date. @@ -3581,6 +3645,17 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See abo # From Paul Eggert (2016-09-07): # The change is permanent, so this is the new standard time in Turkey. # It takes effect today, which is not much notice. + +# From Kıvanç Yazan (2017-10-28): +# Turkey will go back to Daylight Saving Time starting 2018-10. +# http://www.resmigazete.gov.tr/eskiler/2017/10/20171028-5.pdf +# +# From Even Scharning (2017-11-08): *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Sat Jan 27 13:34: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 5061AEC1B2F; Sat, 27 Jan 2018 13:34:16 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E249469005; Sat, 27 Jan 2018 13:34:15 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCE9330C1; Sat, 27 Jan 2018 13:34:15 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RDYFR2098697; Sat, 27 Jan 2018 13:34:15 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RDYFVX098688; Sat, 27 Jan 2018 13:34:15 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201801271334.w0RDYFVX098688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Sat, 27 Jan 2018 13:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328476 - stable/10/contrib/tzdata X-SVN-Group: stable-10 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/10/contrib/tzdata X-SVN-Commit-Revision: 328476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 13:34:16 -0000 Author: philip Date: Sat Jan 27 13:34:14 2018 New Revision: 328476 URL: https://svnweb.freebsd.org/changeset/base/328476 Log: MFC r328055: Import tzdata 2018a MFC r328318: Import tzdata 2018c Replaced: stable/10/contrib/tzdata/pacificnew - copied unchanged from r328318, head/contrib/tzdata/pacificnew Modified: stable/10/contrib/tzdata/Makefile stable/10/contrib/tzdata/NEWS stable/10/contrib/tzdata/README stable/10/contrib/tzdata/africa stable/10/contrib/tzdata/asia stable/10/contrib/tzdata/australasia stable/10/contrib/tzdata/backzone stable/10/contrib/tzdata/europe stable/10/contrib/tzdata/leap-seconds.list stable/10/contrib/tzdata/leapseconds stable/10/contrib/tzdata/northamerica stable/10/contrib/tzdata/southamerica stable/10/contrib/tzdata/theory.html stable/10/contrib/tzdata/version stable/10/contrib/tzdata/zishrink.awk stable/10/contrib/tzdata/zone.tab stable/10/contrib/tzdata/zone1970.tab Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/tzdata/Makefile ============================================================================== --- stable/10/contrib/tzdata/Makefile Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/Makefile Sat Jan 27 13:34:14 2018 (r328476) @@ -42,37 +42,64 @@ POSIXRULES= America/New_York # Also see TZDEFRULESTRING below, which takes effect only # if the time zone files cannot be accessed. -# Everything gets put in subdirectories of. . . -TOPDIR= /usr/local +# Installation locations. +# +# The defaults are suitable for Debian, except that if REDO is +# posix_right or right_posix then files that Debian puts under +# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead +# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, +# respectively. Problems with the Debian approach are discussed in +# the commentary for the right_posix rule (below). +# Destination directory, which can be used for staging. +# 'make DESTDIR=/stage install' installs under /stage (e.g., to +# /stage/etc/localtime instead of to /etc/localtime). Files under +# /stage are not intended to work as-is, but can be copied by hand to +# the root directory later. If DESTDIR is empty, 'make install' does +# not stage, but installs directly into production locations. +DESTDIR = + +# Everything is installed into subdirectories of TOPDIR, and used there. +# TOPDIR should be empty (meaning the root directory), +# or a directory name that does not end in "/". +# TOPDIR should be empty or an absolute name unless you're just testing. +TOPDIR = + +# The default local time zone is taken from the file TZDEFAULT. +TZDEFAULT = $(TOPDIR)/etc/localtime + +# The subdirectory containing installed program and data files, and +# likewise for installed files that can be shared among architectures. +# These should be relative file names. +USRDIR = usr +USRSHAREDIR = $(USRDIR)/share + # "Compiled" time zone information is placed in the "TZDIR" directory # (and subdirectories). -# Use an absolute path name for TZDIR unless you're just testing the software. # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. - TZDIR_BASENAME= zoneinfo -TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME) +TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) -# Types to try, as an alternative to time_t. int64_t should be first. -TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t +# The "tzselect" and (if you do "make INSTALL") "date" commands go in: +BINDIR = $(TOPDIR)/$(USRDIR)/bin -# The "tzselect", "zic", and "zdump" commands get installed in. . . +# The "zdump" command goes in: +ZDUMPDIR = $(BINDIR) -ETCDIR= $(TOPDIR)/etc +# The "zic" command goes in: +ZICDIR = $(TOPDIR)/$(USRDIR)/sbin -# If you "make INSTALL", the "date" command gets installed in. . . - -BINDIR= $(TOPDIR)/bin - # Manual pages go in subdirectories of. . . +MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man -MANDIR= $(TOPDIR)/man - # Library functions are put in an archive in LIBDIR. +LIBDIR = $(TOPDIR)/$(USRDIR)/lib -LIBDIR= $(TOPDIR)/lib +# Types to try, as an alternative to time_t. int64_t should be first. +TIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t + # If you want only POSIX time, with time values interpreted as # seconds since the epoch (not counting leap seconds), use # REDO= posix_only @@ -105,11 +132,14 @@ REDO= posix_right TZDATA_TEXT= leapseconds tzdata.zi # For backward-compatibility links for old zone names, use +# BACKWARD= backward +# If you also want the link US/Pacific-New, even though it is confusing +# and is planned to be removed from the database eventually, use # BACKWARD= backward pacificnew # To omit these links, use # BACKWARD= -BACKWARD= backward pacificnew +BACKWARD= backward # If you want out-of-scope and often-wrong data from the file 'backzone', use # PACKRATDATA= backzone @@ -313,7 +343,7 @@ ZFLAGS= # How to use zic to install tz binary files. -ZIC_INSTALL= $(ZIC) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS) +ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) # The name of a Posix-compliant 'awk' on your system. AWK= awk @@ -341,8 +371,8 @@ SGML_CATALOG_FILES= \ VALIDATE = nsgmls VALIDATE_FLAGS = -s -B -wall -wno-unused-param VALIDATE_ENV = \ - SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \ - SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \ + SGML_CATALOG_FILES='$(SGML_CATALOG_FILES)' \ + SGML_SEARCH_PATH='$(SGML_SEARCH_PATH)' \ SP_CHARSET_FIXED=YES \ SP_ENCODING=UTF-8 @@ -396,7 +426,7 @@ GZIPFLAGS= -9n #MAKE= make cc= cc -CC= $(cc) -DTZDIR=\"$(TZDIR)\" +CC= $(cc) -DTZDIR='"$(TZDIR)"' AR= ar @@ -421,18 +451,19 @@ MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.t date.1.txt COMMON= calendars CONTRIBUTING LICENSE Makefile \ NEWS README theory.html version -WEB_PAGES= tz-art.htm tz-how-to.html tz-link.htm +WEB_PAGES= tz-art.html tz-how-to.html tz-link.html DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) PRIMARY_YDATA= africa antarctica asia australasia \ europe northamerica southamerica -YDATA= $(PRIMARY_YDATA) etcetera $(BACKWARD) +YDATA= $(PRIMARY_YDATA) etcetera NDATA= systemv factory -TDATA= $(YDATA) $(NDATA) +TDATA_TO_CHECK= $(YDATA) $(NDATA) backward pacificnew +TDATA= $(YDATA) $(NDATA) $(BACKWARD) ZONETABLES= zone1970.tab zone.tab TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) LEAP_DEPS= leapseconds.awk leap-seconds.list -TZDATA_ZI_DEPS= zishrink.awk $(TDATA) $(PACKRATDATA) -DATA= $(YDATA) $(NDATA) backzone iso3166.tab leap-seconds.list \ +TZDATA_ZI_DEPS= zishrink.awk version $(TDATA) $(PACKRATDATA) +DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ leapseconds yearistype.sh $(ZONETABLES) AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk zishrink.awk MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl @@ -457,7 +488,7 @@ VERSION_DEPS= \ newctime.3 newstrftime.3 newtzset.3 northamerica \ pacificnew private.h \ southamerica strftime.c systemv theory.html \ - time2posix.3 tz-art.htm tz-how-to.html tz-link.htm \ + time2posix.3 tz-art.html tz-how-to.html tz-link.html \ tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ workman.sh yearistype.sh \ zdump.8 zdump.c zic.8 zic.c \ @@ -473,35 +504,41 @@ all: tzselect yearistype zic zdump libtz.a $(TABDATA) ALL: all date $(ENCHILADA) install: all $(DATA) $(REDO) $(MANS) - mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \ - $(DESTDIR)$(LIBDIR) \ - $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \ - $(DESTDIR)$(MANDIR)/man8 - $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) - cp -f $(TABDATA) $(DESTDIR)$(TZDIR)/. - cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/. - cp libtz.a $(DESTDIR)$(LIBDIR)/. - $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a - cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/. - cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/. - cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/. + mkdir -p '$(DESTDIR)$(BINDIR)' \ + '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ + '$(DESTDIR)$(LIBDIR)' \ + '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ + '$(DESTDIR)$(MANDIR)/man8' + $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) \ + -t '$(DESTDIR)$(TZDEFAULT)' + cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' + cp tzselect '$(DESTDIR)$(BINDIR)/.' + cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' + cp zic '$(DESTDIR)$(ZICDIR)/.' + cp libtz.a '$(DESTDIR)$(LIBDIR)/.' + $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' + cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' + cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' + cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' INSTALL: ALL install date.1 - mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 - cp date $(DESTDIR)$(BINDIR)/. - cp -f date.1 $(DESTDIR)$(MANDIR)/man1/. + mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' + cp date '$(DESTDIR)$(BINDIR)/.' + cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' version: $(VERSION_DEPS) { (type git) >/dev/null 2>&1 && \ V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ --abbrev=7 --dirty` || \ - V=$(VERSION); } && \ + V='$(VERSION)'; } && \ printf '%s\n' "$$V" >$@.out mv $@.out $@ # This file can be tailored by setting BACKWARD, PACKRATDATA, etc. tzdata.zi: $(TZDATA_ZI_DEPS) - LC_ALL=C $(AWK) -f zishrink.awk $(TDATA) $(PACKRATDATA) >$@.out + version=`sed 1q version` && \ + LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \ + $(TDATA) $(PACKRATDATA) >$@.out mv $@.out $@ version.h: version @@ -529,12 +566,13 @@ leapseconds: $(LEAP_DEPS) # Arguments to pass to submakes of install_data. # They can be overridden by later submake arguments. INSTALLARGS = \ - BACKWARD=$(BACKWARD) \ - DESTDIR=$(DESTDIR) \ + BACKWARD='$(BACKWARD)' \ + DESTDIR='$(DESTDIR)' \ LEAPSECONDS='$(LEAPSECONDS)' \ PACKRATDATA='$(PACKRATDATA)' \ - TZDIR=$(TZDIR) \ - YEARISTYPE=$(YEARISTYPE) \ + TZDEFAULT='$(TZDEFAULT)' \ + TZDIR='$(TZDIR)' \ + YEARISTYPE='$(YEARISTYPE)' \ ZIC='$(ZIC)' # 'make install_data' installs one set of tz binary files. @@ -558,16 +596,16 @@ right_only: # You must replace all of $(TZDIR) to switch from not using leap seconds # to using them, or vice versa. right_posix: right_only - rm -fr $(DESTDIR)$(TZDIR)-leaps - ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \ - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only + rm -fr '$(DESTDIR)$(TZDIR)-leaps' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only posix_right: posix_only - rm -fr $(DESTDIR)$(TZDIR)-posix - ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \ - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only + rm -fr '$(DESTDIR)$(TZDIR)-posix' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only # This obsolescent rule is present for backwards compatibility with # tz releases 2014g through 2015g. It should go away eventually. @@ -633,7 +671,7 @@ check_character_set: $(ENCHILADA) $(MISC) $(SOURCES) $(WEB_PAGES) \ CONTRIBUTING LICENSE Makefile README \ version tzdata.zi && \ - ! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ leapseconds yearistype.sh zone.tab && \ ! grep -Env $(OK_LINE) $(ENCHILADA); \ } @@ -641,14 +679,16 @@ check_character_set: $(ENCHILADA) check_white_space: $(ENCHILADA) patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ ! grep -En "$$pat" $(ENCHILADA) - ! grep -n '[[:space:]]$$' $(ENCHILADA) + ! grep -n '[[:space:]]$$' \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+ FILE_NAME_COMPONENT_TOO_LONG = \ $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15} -check_name_lengths: $(TDATA) backzone - ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' $(TDATA) backzone +check_name_lengths: $(TDATA_TO_CHECK) backzone + ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ + $(TDATA_TO_CHECK) backzone CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } @@ -662,8 +702,8 @@ check_sorted: backward backzone iso3166.tab zone.tab z $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \ LC_ALL=C sort -cu -check_links: checklinks.awk $(TDATA) - $(AWK) -f checklinks.awk $(TDATA) +check_links: checklinks.awk $(TDATA_TO_CHECK) + $(AWK) -f checklinks.awk $(TDATA_TO_CHECK) $(AWK) -f checklinks.awk tzdata.zi check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES) @@ -764,12 +804,12 @@ set-timestamps.out: $(ENCHILADA) check_public: $(MAKE) maintainer-clean - $(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL + $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL mkdir -p public.dir - for i in $(TDATA) tzdata.zi; do \ + for i in $(TDATA_TO_CHECK) tzdata.zi; do \ $(zic) -v -d public.dir $$i 2>&1 || exit; \ done - $(zic) -v -d public.dir $(TDATA) + $(zic) -v -d public.dir $(TDATA_TO_CHECK) rm -fr public.dir # Check that the code works under various alternative @@ -790,8 +830,11 @@ check_time_t_alternatives: REDO='$(REDO)' \ install && \ diff $$quiet_option -r \ - time_t.dir/int64_t/etc/zoneinfo \ - time_t.dir/$$type/etc/zoneinfo && \ + time_t.dir/int64_t/etc \ + time_t.dir/$$type/etc && \ + diff $$quiet_option -r \ + time_t.dir/int64_t/usr/share \ + time_t.dir/$$type/usr/share && \ case $$type in \ int32_t) range=-2147483648,2147483647;; \ uint32_t) range=0,4294967296;; \ @@ -800,9 +843,9 @@ check_time_t_alternatives: *) range=-10000000000,10000000000;; \ esac && \ echo checking $$type zones ... && \ - time_t.dir/int64_t/etc/zdump -V -t $$range $$zones \ + time_t.dir/int64_t/usr/bin/zdump -V -t $$range $$zones \ >time_t.dir/int64_t.out && \ - time_t.dir/$$type/etc/zdump -V -t $$range $$zones \ + time_t.dir/$$type/usr/bin/zdump -V -t $$range $$zones \ >time_t.dir/$$type.out && \ diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \ || exit; \ Modified: stable/10/contrib/tzdata/NEWS ============================================================================== --- stable/10/contrib/tzdata/NEWS Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/NEWS Sat Jan 27 13:34:14 2018 (r328476) @@ -1,5 +1,147 @@ News for the tz database +Release 2018c - 2018-01-22 23:00:44 -0800 + + Briefly: + Revert Irish changes that relied on negative DST offsets. + + Changes to tm_isdst + + Revert the 2018a change to Europe/Dublin. As before, this change + does not affect UT offsets or abbreviations; it affects only + whether timestamps are considered to be standard time or + daylight-saving time, as expressed in the tm_isdst flag of C's + struct tm type. This reversion is intended to be a temporary + workaround for problems discovered with downstream uses of + releases 2018a and 2018b, which implemented Irish time by using + negative DST offsets in the Eire rules of the 'europe' file. + Although negative DST offsets have been part of tzcode for many + years and are supported by many platforms, they were not + documented before 2018a and ICU and OpenJDK do not currently + support them. A mechanism to export data to platforms lacking + support for negative DST is planned to be developed before the + change is reapplied. (Problems reported by Deborah Goldsmith and + Stephen Colebourne.) + + Changes to past time stamps + + Japanese DST transitions (1948-1951) were Sundays at 00:00, not + Saturdays or Sundays at 02:00. (Thanks to Takayuki Nikai.) + + Changes to build procedure + + The build procedure now works around mawk 1.3.3's lack of support + for character class expressions. (Problem reported by Ohyama.) + + +Release 2018b - 2018-01-17 23:24:48 -0800 + + Briefly: + Fix a packaging problem in tz2018a, which was missing 'pacificnew'. + + Changes to build procedure + + The distribution now contains the file 'pacificnew' again. + This file was inadvertantly omitted in the 2018a distribution. + (Problem reported by Matias Fonzo.) + + +Release 2018a - 2018-01-12 22:29:21 -0800 + + Briefly: + São Tomé and Príncipe switched from +00 to +01. + Brazil's DST will now start on November's first Sunday. + Ireland's standard time is now in the summer, not the winter. + Use Debian-style installation locations, instead of 4.3BSD-style. + New zic option -t. + + Changes to past and future time stamps + + São Tomé and Príncipe switched from +00 to +01 on 2018-01-01 at + 01:00. (Thanks to Steffen Thorsen and Michael Deckers.) + + Changes to future time stamps + + Starting in 2018 southern Brazil will begin DST on November's + first Sunday instead of October's third Sunday. (Thanks to + Steffen Thorsen.) + + Changes to past time stamps + + A discrepancy of 4 s in timestamps before 1931 in South Sudan has + been corrected. The 'backzone' and 'zone.tab' files did not agree + with the 'africa' and 'zone1970.tab' files. (Problem reported by + Michael Deckers.) + + The abbreviation invented for Bolivia Summer Time (1931-2) is now + BST instead of BOST, to be more consistent with the convention + used for Latvian Summer Time (1918-9) and for British Summer Time. + + Changes to tm_isdst + + Change Europe/Dublin so that it observes Irish Standard Time (UT + +01) in summer and GMT (as negative daylight-saving) in winter, + instead of observing standard time (GMT) in winter and Irish + Summer Time (UT +01) in summer. This change does not affect UT + offsets or abbreviations; it affects only whether timestamps are + considered to be standard time or daylight-saving time, as + expressed in the tm_isdst flag of C's struct tm type. + (Discrepancy noted by Derick Rethans.) + + Changes to build procedure + + The default installation locations have been changed to mostly + match Debian circa 2017, instead of being designed as an add-on to + 4.3BSD circa 1986. This affects the Makefile macros TOPDIR, + TZDIR, MANDIR, and LIBDIR. New Makefile macros TZDEFAULT, USRDIR, + USRSHAREDIR, BINDIR, ZDUMPDIR, and ZICDIR let installers tailor + locations more precisely. (This responds to suggestions from + Brian Inglis and from Steve Summit.) + + The default installation procedure no longer creates the + backward-compatibility link US/Pacific-New, which causes + confusion during user setup (e.g., see Debian bug 815200). + Use 'make BACKWARD="backward pacificnew"' to create the link + anyway, for now. Eventually we plan to remove the link entirely. + + tzdata.zi now contains a version-number comment. + (Suggested by Tom Lane.) + + The Makefile now quotes values like BACKWARD more carefully when + passing them to the shell. (Problem reported by Zefram.) + + Builders no longer need to specify -DHAVE_SNPRINTF on platforms + that have snprintf and use pre-C99 compilers. (Problem reported + by Jon Skeet.) + + Changes to code + + zic has a new option -t FILE that specifies the location of the + file that determines local time when TZ is unset. The default for + this location can be configured via the new TZDEFAULT makefile + macro, which defaults to /etc/localtime. + + Diagnostics and commentary now distinguish UT from UTC more + carefully; see theory.html for more information about UT vs UTC. + + zic has been ported to GCC 8's -Wstringop-truncation option. + (Problem reported by Martin Sebor.) + + Changes to documentation and commentary + + The zic man page now documents the longstanding behavior that + times and years can be out of the usual range, with negative times + counting backwards from midnight and with year 0 preceding year 1. + (Problem reported by Michael Deckers.) + + The theory.html file now mentions the POSIX limit of six chars + per abbreviation, and lists alphabetic abbreviations used. + + The files tz-art.htm and tz-link.htm have been renamed to + tz-art.html and tz-link.html, respectively, for consistency with + other file names and to simplify web server configuration. + + Release 2017c - 2017-10-20 14:49:34 -0700 Briefly: @@ -895,8 +1037,8 @@ Release 2015f - 2015-08-10 18:06:56 -0700 (Thanks to Jon Skeet and Arthur David Olson.) Constraints on simultaneity are now documented. - The two characters '%z' in a zone format now stand for the UTC - offset, e.g., '-07' for seven hours behind UTC and '+0530' for + The two characters '%z' in a zone format now stand for the UT + offset, e.g., '-07' for seven hours behind UT and '+0530' for five hours and thirty minutes ahead. This better supports time zone abbreviations conforming to POSIX.1-2001 and later. @@ -1019,13 +1161,13 @@ Release 2015c - 2015-04-11 08:55:55 -0700 The spring 1988 transition was 1988-10-09, not 1988-10-02. The fall 1990 transition was 1990-03-11, not 1990-03-18. - Assume no UTC offset change for Pacific/Easter on 1890-01-01, + Assume no UT offset change for Pacific/Easter on 1890-01-01, and omit all transitions on Pacific/Easter from 1942 through 1946 since we have no data suggesting that they existed. One more zone has been turned into a link, as it differed from an existing zone only for older time stamps. As usual, - this change affects UTC offsets in pre-1970 time stamps only. + this change affects UT offsets in pre-1970 time stamps only. The zone's old contents have been moved to the 'backzone' file. The affected zone is America/Montreal. @@ -1055,7 +1197,7 @@ Release 2015b - 2015-03-19 23:28:11 -0700 Some more zones have been turned into links, when they differed from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. + these changes affect UT offsets in pre-1970 time stamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: America/Antigua, America/Cayman, Pacific/Midway, and Pacific/Saipan. @@ -1107,7 +1249,7 @@ Release 2015a - 2015-01-29 22:35:20 -0800 Some more zones have been turned into links, when they differed from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. + these changes affect UT offsets in pre-1970 time stamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Asia/Aden, Asia/Bahrain, Asia/Kuwait, and Asia/Muscat. @@ -1154,7 +1296,7 @@ Release 2014j - 2014-11-10 17:37:11 -0800 Some more zones have been turned into links, when they differed from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. + these changes affect UT offsets in pre-1970 time stamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Africa/Addis_Ababa, Africa/Asmara, Africa/Dar_es_Salaam, Africa/Djibouti, Africa/Kampala, @@ -1244,7 +1386,7 @@ Release 2014h - 2014-09-25 18:59:03 -0700 Some more zones have been turned into links, when they differed from existing zones only for older timestamps. As usual, - these changes affect UTC offsets in pre-1970 timestamps only. + these changes affect UT offsets in pre-1970 timestamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Africa/Blantyre, Africa/Bujumbura, Africa/Gaborone, Africa/Harare, Africa/Kigali, Africa/Lubumbashi, @@ -1329,7 +1471,7 @@ Release 2014g - 2014-08-28 12:31:23 -0700 Some more zones have been turned into links, when they differed from existing zones only for older timestamps. As usual, - these changes affect UTC offsets in pre-1970 timestamps only. + these changes affect UT offsets in pre-1970 timestamps only. Their old contents have been moved to the 'backzone' file. The affected zones are: Africa/Bangui, Africa/Brazzaville, Africa/Douala, Africa/Kinshasa, Africa/Libreville, Africa/Luanda, @@ -1479,7 +1621,7 @@ Release 2014f - 2014-08-05 17:42:36 -0700 standard and daylight saving time the abbreviations are AEST and AEDT instead of the former EST for both; similarly, ACST/ACDT, ACWST/ACWDT, and AWST/AWDT are now used instead of the former CST, CWST, and WST. - This change does not affect UTC offsets, only time zone abbreviations. + This change does not affect UT offsets, only time zone abbreviations. (Thanks to Rich Tibbett and many others.) Asia/Novokuznetsk shifts from NOVT to KRAT (remaining on UT +07) @@ -1516,8 +1658,8 @@ Release 2014f - 2014-08-05 17:42:36 -0700 Treindl sent helpful translations of two papers by Guo Qingsheng.) Some zones have been turned into links, when they differed from existing - zones only for older UTC offsets where data entries were likely invented. - These changes affect UTC offsets in pre-1970 timestamps only. This is + zones only for older UT offsets where data entries were likely invented. + These changes affect UT offsets in pre-1970 timestamps only. This is similar to the change in release 2013e, except this time for western Africa. The affected zones are: Africa/Bamako, Africa/Banjul, Africa/Conakry, Africa/Dakar, Africa/Freetown, Africa/Lome, Modified: stable/10/contrib/tzdata/README ============================================================================== --- stable/10/contrib/tzdata/README Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/README Sat Jan 27 13:34:14 2018 (r328476) @@ -11,14 +11,14 @@ changes made by political bodies to time zone boundari and daylight-saving rules. See or the -file tz-link.htm for how to acquire the code and data. Once acquired, +file tz-link.html for how to acquire the code and data. Once acquired, read the comments in the file 'Makefile' and make any changes needed to make things right for your system, especially if you are using some platform other than GNU/Linux. Then run the following commands, substituting your desired installation directory for "$HOME/tzdir": make TOPDIR=$HOME/tzdir install - $HOME/tzdir/etc/zdump -v America/Los_Angeles + $HOME/tzdir/usr/bin/zdump -v America/Los_Angeles Historical local time information has been included here to: Modified: stable/10/contrib/tzdata/africa ============================================================================== --- stable/10/contrib/tzdata/africa Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/africa Sat Jan 27 13:34:14 2018 (r328476) @@ -158,7 +158,6 @@ Link Africa/Abidjan Africa/Freetown # Sierra Leone Link Africa/Abidjan Africa/Lome # Togo Link Africa/Abidjan Africa/Nouakchott # Mauritania Link Africa/Abidjan Africa/Ouagadougou # Burkina Faso -Link Africa/Abidjan Africa/Sao_Tome # São Tomé and Príncipe Link Africa/Abidjan Atlantic/St_Helena # St Helena # Djibouti @@ -425,7 +424,7 @@ Link Africa/Nairobi Indian/Mayotte # # The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30. # -# In 1972 Liberia was the last country to switch from a UTC offset +# In 1972 Liberia was the last country to switch from a UT offset # that was not a multiple of 15 or 20 minutes. The 1972 change was on # 1972-01-07, according to an entry dated 1972-01-04 on p 330 of: # Presidential Papers: First year of the administration of @@ -1037,6 +1036,19 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Den # Inaccessible, Nightingale: uninhabited # São Tomé and Príncipe + +# From Steffen Thorsen (2018-01-08): +# Multiple sources tell that São Tomé changed from UTC to UTC+1 as +# they entered the year 2018. +# From Michael Deckers (2018-01-08): +# the switch is from 01:00 to 02:00 ... [Decree No. 25/2017] +# http://www.mnec.gov.st/index.php/publicacoes/documentos/file/90-decreto-lei-n-25-2017 + +Zone Africa/Sao_Tome 0:26:56 - LMT 1884 + -0:36:45 - LMT 1912 # Lisbon Mean Time + 0:00 - GMT 2018 Jan 1 01:00 + 1:00 - WAT + # Senegal # See Africa/Abidjan. Modified: stable/10/contrib/tzdata/asia ============================================================================== --- stable/10/contrib/tzdata/asia Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/asia Sat Jan 27 13:34:14 2018 (r328476) @@ -50,7 +50,7 @@ # 9:00 KST KDT Korea when at +09 # 9:30 ACST Australian Central Standard Time # Otherwise, these tables typically use numeric abbreviations like +03 -# and +0330 for integer hour and minute UTC offsets. Although earlier +# and +0330 for integer hour and minute UT offsets. Although earlier # editions invented alphabetic time zone abbreviations for every # offset, this did not reflect common practice. # @@ -647,17 +647,17 @@ Zone Asia/Hong_Kong 7:36:42 - LMT 1904 Oct 30 # time", in which abolished the adoption of Western Standard Time in # western islands (listed above), which means the whole Japan # territory, including later occupations, adopt Japan Central Time -# (UTC+9). The adoption began on Oct 1, 1937. The original text can +# (UT+9). The adoption began on Oct 1, 1937. The original text can # be found on Wikisource: # https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件 # -# That is, the time zone of Taipei switched to UTC+9 on Oct 1, 1937. +# That is, the time zone of Taipei switched to UT+9 on Oct 1, 1937. # From Yu-Cheng Chuang (2014-07-02): -# I've found more evidence about when the time zone was switched from UTC+9 -# back to UTC+8 after WW2. I believe it was on Sep 21, 1945. In a document +# I've found more evidence about when the time zone was switched from UT+9 +# back to UT+8 after WW2. I believe it was on Sep 21, 1945. In a document # during Japanese era [1] in which the officer told the staff to change time -# zone back to Western Standard Time (UTC+8) on Sep 21. And in another +# zone back to Western Standard Time (UT+8) on Sep 21. And in another # history page of National Cheng Kung University [2], on Sep 21 there is a # note "from today, switch back to Western Standard Time". From these two # materials, I believe that the time zone change happened on Sep 21. And @@ -1464,17 +1464,17 @@ Zone Asia/Jerusalem 2:20:54 - LMT 1880 # of the Japanese wanted to scrap daylight-saving time, as opposed to 30% who # wanted to keep it.) -# From Paul Eggert (2006-03-22): -# Shanks & Pottenger write that DST in Japan during those years was as follows: +# From Takayuki Nikai (2018-01-19): +# The source of information is Japanese law. +# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00219480428029.htm +# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00719500331039.htm +# ... In summary, it is written as follows. From 24:00 on the first Saturday +# in May, until 0:00 on the day after the second Saturday in September. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Japan 1948 only - May Sun>=1 2:00 1:00 D -Rule Japan 1948 1951 - Sep Sat>=8 2:00 0 S -Rule Japan 1949 only - Apr Sun>=1 2:00 1:00 D -Rule Japan 1950 1951 - May Sun>=1 2:00 1:00 D -# but the only locations using it (for birth certificates, presumably, since -# their audience is astrologers) were US military bases. For now, assume -# that for most purposes daylight-saving time was observed; otherwise, what -# would have been the point of the 1951 poll? +Rule Japan 1948 only - May Sat>=1 24:00 1:00 D +Rule Japan 1948 1951 - Sep Sun>=9 0:00 0 S +Rule Japan 1949 only - Apr Sat>=1 24:00 1:00 D +Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D # From Hideyuki Suzuki (1998-11-09): # 'Tokyo' usually stands for the former location of Tokyo Astronomical @@ -1505,7 +1505,7 @@ Rule Japan 1950 1951 - May Sun>=1 2:00 1:00 D # # ...the Showa Emperor announced Ordinance No. 529 of Showa Year 12 ... which # means the whole Japan territory, including later occupations, adopt Japan -# Central Time (UTC+9). The adoption began on Oct 1, 1937. +# Central Time (UT+9). The adoption began on Oct 1, 1937. # https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件 # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2066,8 +2066,8 @@ Zone Asia/Kuching 7:21:20 - LMT 1926 Mar # Maldives # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Maldives 4:54:00 - LMT 1880 # Male - 4:54:00 - MMT 1960 # Male Mean Time +Zone Indian/Maldives 4:54:00 - LMT 1880 # Malé + 4:54:00 - MMT 1960 # Malé Mean Time 5:00 - +05 # Mongolia Modified: stable/10/contrib/tzdata/australasia ============================================================================== --- stable/10/contrib/tzdata/australasia Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/australasia Sat Jan 27 13:34:14 2018 (r328476) @@ -683,8 +683,8 @@ Zone Pacific/Guadalcanal 10:39:48 - LMT 1912 Oct # Hon # From Steffen Thorsen (2012-07-25) # ... we double checked by calling hotels and offices based in Tokelau asking # about the time there, and they all told a time that agrees with UTC+13.... -# Shanks says UTC-10 from 1901 [but] ... there is a good chance the change -# actually was to UTC-11 back then. +# Shanks says UT-10 from 1901 [but] ... there is a good chance the change +# actually was to UT-11 back then. # # From Paul Eggert (2012-07-25) # A Google Books snippet of Appendix to the Journals of the House of @@ -1450,7 +1450,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # # From Paul Eggert (2006-03-22): # The Department of Internal Affairs (DIA) maintains a brief history, -# as does Carol Squires; see tz-link.htm for the full references. +# as does Carol Squires; see tz-link.html for the full references. # Use these sources in preference to Shanks & Pottenger. # # For Chatham, IATA SSIM (1991/1999) gives the NZ rules but with Modified: stable/10/contrib/tzdata/backzone ============================================================================== --- stable/10/contrib/tzdata/backzone Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/backzone Sat Jan 27 13:34:14 2018 (r328476) @@ -145,11 +145,6 @@ Zone Africa/Gaborone 1:43:40 - LMT 1885 Zone Africa/Harare 2:04:12 - LMT 1903 Mar 2:00 - CAT -# South Sudan -Zone Africa/Juba 2:06:24 - LMT 1931 - 2:00 Sudan CA%sT 2000 Jan 15 12:00 - 3:00 - EAT - # Uganda Zone Africa/Kampala 2:09:40 - LMT 1928 Jul 3:00 - EAT 1930 @@ -241,11 +236,6 @@ Zone Africa/Ouagadougou -0:06:04 - LMT 1912 Zone Africa/Porto-Novo 0:10:28 - LMT 1912 Jan 1 0:00 - GMT 1934 Feb 26 1:00 - WAT - -# São Tomé and Príncipe -Zone Africa/Sao_Tome 0:26:56 - LMT 1884 - -0:36:32 - LMT 1912 # Lisbon Mean Time - 0:00 - GMT # Mali (northern) Zone Africa/Timbuktu -0:12:04 - LMT 1912 Modified: stable/10/contrib/tzdata/europe ============================================================================== --- stable/10/contrib/tzdata/europe Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/europe Sat Jan 27 13:34:14 2018 (r328476) @@ -68,14 +68,15 @@ # 0:00 WET WEST WEMT Western Europe # 0:19:32.13 AMT* NST* Amsterdam, Netherlands Summer (1835-1937) # 1:00 BST British Standard (1968-1971) +# 1:00 IST GMT Irish Standard (1968-) with winter DST # 1:00 CET CEST CEMT Central Europe # 1:00:14 SET Swedish (1879-1899) # 1:36:34 RMT* LST* Riga, Latvian Summer (1880-1926)* # 2:00 EET EEST Eastern Europe # 3:00 MSK MSD MDST* Moscow -# From Peter Ilieve (1994-12-04), -# The original six [EU members]: Belgium, France, (West) Germany, Italy, +# From Peter Ilieve (1994-12-04), re EEC/EC/EU members: +# The original six: Belgium, France, (West) Germany, Italy, # Luxembourg, the Netherlands. # Plus, from 1 Jan 73: Denmark, Ireland, United Kingdom. # Plus, from 1 Jan 81: Greece. @@ -278,16 +279,31 @@ # The following claim by Shanks & Pottenger is possible though doubtful; # we'll ignore it for now. # * Dublin's 1971-10-31 switch was at 02:00, even though London's was 03:00. + +# From Paul Eggert (2017-12-04): # +# Dunsink Observatory (8 km NW of Dublin's center) was to Dublin as +# Greenwich was to London. For example: # -# Whitman says Dublin Mean Time was -0:25:21, which is more precise than -# Shanks & Pottenger. -# Perhaps this was Dunsink Observatory Time, as Dunsink Observatory -# (8 km NW of Dublin's center) seemingly was to Dublin as Greenwich was -# to London. For example: -# # "Timeball on the ballast office is down. Dunsink time." # -- James Joyce, Ulysses +# +# The abbreviation DMT stood for "Dublin Mean Time" or "Dunsink Mean Time"; +# this being Ireland, opinions differed. +# +# Whitman says Dublin/Dunsink Mean Time was UT-00:25:21, which agrees +# with measurements of recent visitors to the Meridian Room of Dunsink +# Observatory; see Malone D. Dunsink and timekeeping. 2016-01-24. +# . Malone +# writes that the Nautical Almanac listed UT-00:25:22 until 1896, when +# it moved to UT-00:25:21.1 (I confirmed that the 1893 edition used +# the former and the 1896 edition used the latter). Evidently the +# news of this change propagated slowly, as Milne 1899 still lists +# UT-00:25:22 and cites the International Telegraph Bureau. As it is +# not clear that there was any practical significance to the change +# from UT-00:25:22 to UT-00:25:21.1 in civil timekeeping, omit this +# transition for now and just use the latter value, omitting its +# fraction since our format cannot represent fractions. # "Countess Markievicz ... claimed that the [1916] abolition of Dublin Mean Time # was among various actions undertaken by the 'English' government that @@ -347,12 +363,28 @@ # regulations. I spoke this morning with the Secretary of the Department of # Justice (tel +353 1 678 9711) who confirmed to me that the correct name is # "Irish Summer Time", abbreviated to "IST". +# +# From Paul Eggert (2017-12-07): +# The 1996 anonymous contributor's goal was to determine the correct +# abbreviation for summer time in Dublin and so the contributor +# focused on the "IST", not on the "Irish Summer Time". Though the +# "IST" was correct, the "Irish Summer Time" appears to have been an +# error, as Ireland's Standard Time (Amendment) Act, 1971 states that +# standard time in Ireland remains at UT +01 and is observed in +# summer, and that Greenwich mean time is observed in winter. (Thanks +# to Derick Rethans for pointing out the error.) That is, when +# Ireland amended the 1968 act that established UT +01 as Irish +# Standard Time, it left standard time unchanged and established GMT +# as a negative daylight saving time in winter. So, in this database +# IST stands for Irish Summer Time for timestamps before 1968, and for +# Irish Standard Time after that. See: +# http://www.irishstatutebook.ie/eli/1971/act/17/enacted/en/print # Michael Deckers (2017-06-01) gave the following URLs for Ireland's # Summer Time Act, 1925 and Summer Time Orders, 1926 and 1947: -# http://www.irishstatutebook.ie/eli/1925/act/8/enacted/en/print.html -# http://www.irishstatutebook.ie/eli/1926/sro/919/made/en/print.html -# http://www.irishstatutebook.ie/eli/1947/sro/71/made/en/print.html +# http://www.irishstatutebook.ie/eli/1925/act/8/enacted/en/print +# http://www.irishstatutebook.ie/eli/1926/sro/919/made/en/print +# http://www.irishstatutebook.ie/eli/1947/sro/71/made/en/print # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Summer Time Act, 1916 @@ -476,9 +508,23 @@ Link Europe/London Europe/Jersey Link Europe/London Europe/Guernsey Link Europe/London Europe/Isle_of_Man +# From Paul Eggert (2018-01-19): +# The following is like GB-Eire and EU, except with standard time in +# summer and negative daylight saving time in winter. +# Although currently commented out, this will need to become uncommented +# once the ICU/OpenJDK workaround is removed; see below. +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +#Rule Eire 1971 only - Oct 31 2:00u -1:00 GMT +#Rule Eire 1972 1980 - Mar Sun>=16 2:00u 0 IST +#Rule Eire 1972 1980 - Oct Sun>=23 2:00u -1:00 GMT +#Rule Eire 1981 max - Mar lastSun 1:00u 0 IST +#Rule Eire 1981 1989 - Oct Sun>=23 1:00u -1:00 GMT +#Rule Eire 1990 1995 - Oct Sun>=22 1:00u -1:00 GMT +#Rule Eire 1996 max - Oct lastSun 1:00u -1:00 GMT + # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 - -0:25:21 - DMT 1916 May 21 2:00s # Dublin MT + -0:25:21 - DMT 1916 May 21 2:00s -0:25:21 1:00 IST 1916 Oct 1 2:00s 0:00 GB-Eire %s 1921 Dec 6 # independence 0:00 GB-Eire GMT/IST 1940 Feb 25 2:00s @@ -487,16 +533,33 @@ Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2 0:00 1:00 IST 1947 Nov 2 2:00s 0:00 - GMT 1948 Apr 18 2:00s 0:00 GB-Eire GMT/IST 1968 Oct 27 +# From Paul Eggert (2018-01-18): +# The next line should look like this: +# 1:00 Eire IST/GMT +# However, in January 2018 we discovered that the Eire rules cause +# problems with tests for ICU: +# https://mm.icann.org/pipermail/tz/2018-January/025825.html +# and with tests for OpenJDK: +# https://mm.icann.org/pipermail/tz/2018-January/025822.html +# To work around this problem, use a traditional approximation for +# time stamps after 1971-10-31 02:00 UTC, to give ICU and OpenJDK +# developers breathing room to fix bugs. This approximation has +# correct UTC offsets, but results in tm_isdst flags are the reverse +# of what they should be. This workaround is temporary and should be +# removed reasonably soon. 1:00 - IST 1971 Oct 31 2:00u 0:00 GB-Eire GMT/IST 1996 0:00 EU GMT/IST +# End of workaround for ICU and OpenJDK bugs. + ############################################################################### # Europe -# EU rules are for the European Union, previously known as the EC, EEC, -# Common Market, etc. +# The following rules are for the European Union and for its +# predecessor organization, the European Communities. +# For brevity they are called "EU rules" elsewhere in this file. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EU 1977 1980 - Apr Sun>=1 1:00u 1:00 S @@ -929,7 +992,7 @@ Zone Europe/Prague 0:57:44 - LMT 1850 # The page http://www.retsinfo.dk/_GETDOCI_/ACCN/A18930008330-REGL # confirms this, and states that the law was put forth 1893-03-29. # -# The EU treaty with effect from 1973: +# The EU [actually, EEC and Euratom] treaty with effect from 1973: # http://www.retsinfo.dk/_GETDOCI_/ACCN/A19722110030-REGL # # This provoked a new law from 1974 to make possible summer time changes @@ -985,9 +1048,10 @@ Zone Atlantic/Faroe -0:27:04 - LMT 1908 Jan 11 # Tórs # East Greenland and Franz Josef Land, but we don't know their time zones. # My source for this is Wilhelm Dege's book mentioned under Svalbard. # -# From Paul Eggert (2006-03-22): -# Greenland joined the EU as part of Denmark, obtained home rule on 1979-05-01, -# and left the EU on 1985-02-01. It therefore should have been using EU +# From Paul Eggert (2017-12-10): +# Greenland joined the European Communities as part of Denmark, +# obtained home rule on 1979-05-01, and left the European Communities +# on 1985-02-01. It therefore should have been using EU # rules at least through 1984. Shanks & Pottenger say Scoresbysund and Godthåb # used C-Eur rules after 1980, but IATA SSIM (1991/1996) says they use EU # rules since at least 1991. Assume EU rules since 1980. @@ -1301,7 +1365,7 @@ Zone Europe/Paris 0:09:21 - LMT 1891 Mar 15 0:01 # From Markus Kuhn (1998-09-29): # The German time zone web site by the Physikalisch-Technische # Bundesanstalt contains DST information back to 1916. -# [See tz-link.htm for the URL.] +# [See tz-link.html for the URL.] # From Jörg Schilling (2002-10-23): # In 1945, Berlin was switched to Moscow Summer time (GMT+4) by @@ -1398,7 +1462,7 @@ Zone Europe/Athens 1:34:52 - LMT 1895 Sep 14 1:00 Greece CE%sT 1944 Apr 4 2:00 Greece EE%sT 1981 # Shanks & Pottenger say it switched to C-Eur in 1981; - # go with EU instead, since Greece joined it on Jan 1. + # go with EU rules instead, since Greece joined Jan 1. 2:00 EU EE%sT # Hungary @@ -2097,7 +2161,7 @@ Zone Europe/Warsaw 1:24:00 - LMT 1880 # IATA SSIM (1991/1992) reports that the Azores were at -1:00. # IATA SSIM (1993-02) says +0:00; later issues (through 1996-09) say -1:00. # Guess that the Azores changed to EU rules in 1992 (since that's when Portugal -# harmonized with the EU), and that they stayed +0:00 that winter. +# harmonized with EU rules), and that they stayed +0:00 that winter. # # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # DSH writes that despite Decree 1,469 (1915), the change to the clocks was not @@ -2772,9 +2836,9 @@ Zone Asia/Omsk 4:53:30 - LMT 1919 Nov 14 # # https://regnum.ru/news/society/1957270.html # has some historical data for Altai Krai: -# before 1957: west part on UTC+6, east on UTC+7 -# after 1957: UTC+7 -# since 1995: UTC+6 +# before 1957: west part on UT+6, east on UT+7 +# after 1957: UT+7 +# since 1995: UT+6 # http://barnaul.rusplt.ru/index/pochemu_altajskij_kraj_okazalsja_v_neprivychnom_chasovom_pojase-17648.html # confirms that and provides more details including 1995-05-28 transition date. @@ -3581,6 +3645,17 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See abo # From Paul Eggert (2016-09-07): # The change is permanent, so this is the new standard time in Turkey. # It takes effect today, which is not much notice. + +# From Kıvanç Yazan (2017-10-28): +# Turkey will go back to Daylight Saving Time starting 2018-10. +# http://www.resmigazete.gov.tr/eskiler/2017/10/20171028-5.pdf +# +# From Even Scharning (2017-11-08): *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Sat Jan 27 16:36: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 AAE44ECA6F7; Sat, 27 Jan 2018 16:36:07 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C5896F592; Sat, 27 Jan 2018 16:36:07 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CCF5523B; Sat, 27 Jan 2018 16:36:07 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RGa7BF087686; Sat, 27 Jan 2018 16:36:07 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RGa7lc087685; Sat, 27 Jan 2018 16:36:07 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201801271636.w0RGa7lc087685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Date: Sat, 27 Jan 2018 16:36:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328481 - stable/11/sys/dev/atkbdc X-SVN-Group: stable-11 X-SVN-Commit-Author: dumbbell X-SVN-Commit-Paths: stable/11/sys/dev/atkbdc X-SVN-Commit-Revision: 328481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 16:36:08 -0000 Author: dumbbell Date: Sat Jan 27 16:36:06 2018 New Revision: 328481 URL: https://svnweb.freebsd.org/changeset/base/328481 Log: psm: Skip sync check when `PSM_CONFIG_NOCHECKSYNC` is set In psmprobe(), we set the initial `syncmask` to the vendor default value if the `PSM_CONFIG_NOCHECKSYNC` bit is unset. However, we currently only set it for the Elantech touchpad later in psmattach(), thus `syncmask` is always configured. Now, we check `PSM_CONFIG_NOCHECKSYNC` and skip sync check if it is set. This fixes Elantech touchpad support for units which have `hascrc` set. To clarify that, when we log the `syncmask` and `syncbits` fields, also mention if they are actually used. Finally, when we set `PSM_CONFIG_NOCHECKSYNC`, clear `PSM_NEED_SYNCBITS` flag. PR: 225338 MFC of: r328190 Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:34:00 2018 (r328480) +++ stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:36:06 2018 (r328481) @@ -1947,8 +1947,10 @@ psmattach(device_t dev) /* Elantech trackpad`s sync bit differs from touchpad`s one */ if (sc->hw.model == MOUSE_MODEL_ELANTECH && - (sc->elanhw.hascrc || sc->elanhw.hastrackpoint)) + (sc->elanhw.hascrc || sc->elanhw.hastrackpoint)) { sc->config |= PSM_CONFIG_NOCHECKSYNC; + sc->flags &= ~PSM_NEED_SYNCBITS; + } if (!verbose) printf("psm%d: model %s, device ID %d\n", @@ -1959,8 +1961,9 @@ psmattach(device_t dev) sc->hw.hwid >> 8, sc->hw.buttons); printf("psm%d: config:%08x, flags:%08x, packet size:%d\n", unit, sc->config, sc->flags, sc->mode.packetsize); - printf("psm%d: syncmask:%02x, syncbits:%02x\n", - unit, sc->mode.syncmask[0], sc->mode.syncmask[1]); + printf("psm%d: syncmask:%02x, syncbits:%02x%s\n", + unit, sc->mode.syncmask[0], sc->mode.syncmask[1], + sc->config & PSM_CONFIG_NOCHECKSYNC ? " (sync not checked)" : ""); } if (bootverbose) @@ -2976,7 +2979,8 @@ psmintr(void *arg) VLOG(2, (LOG_DEBUG, "psmintr: Sync bytes now %04x,%04x\n", sc->mode.syncmask[0], sc->mode.syncmask[0])); - } else if ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { + } else if ((sc->config & PSM_CONFIG_NOCHECKSYNC) == 0 && + (c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { VLOG(3, (LOG_DEBUG, "psmintr: out of sync " "(%04x != %04x) %d cmds since last error.\n", c & sc->mode.syncmask[0], sc->mode.syncmask[1], From owner-svn-src-stable@freebsd.org Sat Jan 27 16:48: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 98858ECAEB5; Sat, 27 Jan 2018 16:48:30 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4827B6FC07; Sat, 27 Jan 2018 16:48:30 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 418F253CE; Sat, 27 Jan 2018 16:48:30 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RGmUmf092724; Sat, 27 Jan 2018 16:48:30 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RGmUCL092723; Sat, 27 Jan 2018 16:48:30 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201801271648.w0RGmUCL092723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Date: Sat, 27 Jan 2018 16:48:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328482 - stable/11/sys/dev/atkbdc X-SVN-Group: stable-11 X-SVN-Commit-Author: dumbbell X-SVN-Commit-Paths: stable/11/sys/dev/atkbdc X-SVN-Commit-Revision: 328482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 16:48:30 -0000 Author: dumbbell Date: Sat Jan 27 16:48:29 2018 New Revision: 328482 URL: https://svnweb.freebsd.org/changeset/base/328482 Log: psm: Don't try to detect trackpoint packets if the Elantech device has none This fixes a panic when `EVDEV_SUPPORT` is enabled: if a trackpoint packet was detected but there was no trackpoint, we still tried to emit an evdev event even though the associated relative evdev device (`evdev_r`) was not initialized. PR: 225339 MFC of: r328191 Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:36:06 2018 (r328481) +++ stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:48:29 2018 (r328482) @@ -4187,7 +4187,7 @@ proc_elantech(struct psm_softc *sc, packetbuf_t *pb, m /* Determine packet format and do a sanity check for out of sync packets. */ if (ELANTECH_PKT_IS_DEBOUNCE(pb, sc->elanhw.hwversion)) pkt = ELANTECH_PKT_NOP; - else if (ELANTECH_PKT_IS_TRACKPOINT(pb)) + else if (sc->elanhw.hastrackpoint && ELANTECH_PKT_IS_TRACKPOINT(pb)) pkt = ELANTECH_PKT_TRACKPOINT; else switch (sc->elanhw.hwversion) { From owner-svn-src-stable@freebsd.org Sat Jan 27 16:56: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 5E981ECB6DB; Sat, 27 Jan 2018 16:56:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 117D970522; Sat, 27 Jan 2018 16:56:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A9DA5567; Sat, 27 Jan 2018 16:56:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RGusGB097698; Sat, 27 Jan 2018 16:56:54 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RGuslR097697; Sat, 27 Jan 2018 16:56:54 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801271656.w0RGuslR097697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 27 Jan 2018 16:56:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328483 - stable/11/share/termcap X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/share/termcap X-SVN-Commit-Revision: 328483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 16:56:55 -0000 Author: eadler Date: Sat Jan 27 16:56:54 2018 New Revision: 328483 URL: https://svnweb.freebsd.org/changeset/base/328483 Log: MFC r328209: termcap: add xterm-termite Modified: stable/11/share/termcap/termcap Directory Properties: stable/11/ (props changed) Modified: stable/11/share/termcap/termcap ============================================================================== --- stable/11/share/termcap/termcap Sat Jan 27 16:48:29 2018 (r328482) +++ stable/11/share/termcap/termcap Sat Jan 27 16:56:54 2018 (r328483) @@ -4662,6 +4662,27 @@ Eterm|Eterm Terminal Emulator (X11 Window System):\ :us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:\ :ac=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~: +# Termcap for xterm-termite +xterm-termite|VTE-based terminal:\ + :NP:am:hs:mi:ms:ut:xn:\ + :Co#256:co#80:it#8:li#24:pa#32767:\ + :@7=\EOF:@8=\EOM:AB=\E[48;5;%dm:AF=\E[38;5;%dm:AL=\E[%dL:\ + :DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:F1=\E[23~:F2=\E[24~:\ + :IC=\E[%d@:K2=\EOE:Km=\E[M:LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:\ + :SA=\E[?7h:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ZH=\E[3m:\ + :ZR=\E[23m:al=\E[L:bl=^G:bt=\E[Z:cb=\E[1K:cd=\E[J:ce=\E[K:\ + :ch=\E[%i%dG:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ + :cs=\E[%i%d;%dr:cv=\E[%i%dd:dc=\E[P:dl=\E[M:do=^J:\ + :ds=\E]2;\007:ec=\E[%dX:ei=\E[4l:fs=^G:ho=\E[H:im=\E[4h:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\ + :k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:kB=\E[Z:kD=\E[3~:\ + :kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:kd=\EOB:ke=\E[?1l:\ + :kh=\EOH:kl=\EOD:kr=\EOC:ks=\E[?1h:ku=\EOA:le=^H:md=\E[1m:\ + :me=\E[m:mr=\E[7m:nd=\E[C:op=\E[39;49m:r1=\Ec:rc=\E8:\ + :sc=\E7:se=\E[27m:sf=^J:so=\E[7m:sr=\EM:ta=^I:te=\E[?1049l:\ + :ti=\E[?1049h:ts=\E]2;:u6=\E[%i%d;%dR:u7=\E[6n:ue=\E[24m:\ + :up=\E[A:us=\E[4m:ve=\E[?25h:vi=\E[?25l: + # # END OF TERMCAP # ------------------------ From owner-svn-src-stable@freebsd.org Sat Jan 27 17:24: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 8337BECCDB4; Sat, 27 Jan 2018 17:24:28 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3533271653; Sat, 27 Jan 2018 17:24:28 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 301DA5A40; Sat, 27 Jan 2018 17:24:28 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RHOS2U012544; Sat, 27 Jan 2018 17:24:28 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RHOSmc012543; Sat, 27 Jan 2018 17:24:28 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201801271724.w0RHOSmc012543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Date: Sat, 27 Jan 2018 17:24:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328484 - stable/11/sys/dev/atkbdc X-SVN-Group: stable-11 X-SVN-Commit-Author: dumbbell X-SVN-Commit-Paths: stable/11/sys/dev/atkbdc X-SVN-Commit-Revision: 328484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 17:24:28 -0000 Author: dumbbell Date: Sat Jan 27 17:24:27 2018 New Revision: 328484 URL: https://svnweb.freebsd.org/changeset/base/328484 Log: psm: Log syncmask[1], not syncmask[0] twice MFC of: r328208 Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:56:54 2018 (r328483) +++ stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 17:24:27 2018 (r328484) @@ -2978,7 +2978,7 @@ psmintr(void *arg) sc->flags &= ~PSM_NEED_SYNCBITS; VLOG(2, (LOG_DEBUG, "psmintr: Sync bytes now %04x,%04x\n", - sc->mode.syncmask[0], sc->mode.syncmask[0])); + sc->mode.syncmask[0], sc->mode.syncmask[1])); } else if ((sc->config & PSM_CONFIG_NOCHECKSYNC) == 0 && (c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { VLOG(3, (LOG_DEBUG, "psmintr: out of sync " From owner-svn-src-stable@freebsd.org Sat Jan 27 17:25: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 460B4ECCE22; Sat, 27 Jan 2018 17:25:00 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E608F71770; Sat, 27 Jan 2018 17:24:59 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0DE95A42; Sat, 27 Jan 2018 17:24:59 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RHOxKu012604; Sat, 27 Jan 2018 17:24:59 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RHOxog012603; Sat, 27 Jan 2018 17:24:59 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201801271724.w0RHOxog012603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Date: Sat, 27 Jan 2018 17:24:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r328485 - stable/10/sys/dev/atkbdc X-SVN-Group: stable-10 X-SVN-Commit-Author: dumbbell X-SVN-Commit-Paths: stable/10/sys/dev/atkbdc X-SVN-Commit-Revision: 328485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 17:25:00 -0000 Author: dumbbell Date: Sat Jan 27 17:24:59 2018 New Revision: 328485 URL: https://svnweb.freebsd.org/changeset/base/328485 Log: psm: Log syncmask[1], not syncmask[0] twice MFC of: r328208 Modified: stable/10/sys/dev/atkbdc/psm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/atkbdc/psm.c ============================================================================== --- stable/10/sys/dev/atkbdc/psm.c Sat Jan 27 17:24:27 2018 (r328484) +++ stable/10/sys/dev/atkbdc/psm.c Sat Jan 27 17:24:59 2018 (r328485) @@ -2411,7 +2411,7 @@ psmintr(void *arg) sc->flags &= ~PSM_NEED_SYNCBITS; VLOG(2, (LOG_DEBUG, "psmintr: Sync bytes now %04x,%04x\n", - sc->mode.syncmask[0], sc->mode.syncmask[0])); + sc->mode.syncmask[0], sc->mode.syncmask[1])); } else if ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { VLOG(3, (LOG_DEBUG, "psmintr: out of sync " "(%04x != %04x) %d cmds since last error.\n", From owner-svn-src-stable@freebsd.org Sat Jan 27 22:50: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 8E082EC7F54; Sat, 27 Jan 2018 22:50:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40E347DC4A; Sat, 27 Jan 2018 22:50:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B84C10E76; Sat, 27 Jan 2018 22:50:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RMoRUr072515; Sat, 27 Jan 2018 22:50:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RMoQk3072508; Sat, 27 Jan 2018 22:50:26 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801272250.w0RMoQk3072508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 22:50:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328495 - stable/11/usr.bin/dtc X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/dtc X-SVN-Commit-Revision: 328495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 22:50:28 -0000 Author: kevans Date: Sat Jan 27 22:50:26 2018 New Revision: 328495 URL: https://svnweb.freebsd.org/changeset/base/328495 Log: MFC r320296, r328173: Update dtc(1) MFC r320296 (manu): dtc: Update to upstream 9ce35ff8 - Add "compatible with gpl dtc X.Y.Z" to version output so U-Boot doesn't complain - Fix cross reference node This fixes some Allwinner DTS (and probably others). MFC r328173: dtc(1): Update to upstream ea3c233 Highlights of this update: - /__local_fixups__ is now generated to be GPL dtc and libfdt compliant - Compiling with -@ will now cause dtc to assign phandles to all labelled nodes - /include/ and /incbin/ now handle absolute paths correctly - The manpage now has information about overlays, including how to apply them and how to generate them - Syntactic sugar for overlays is now supported, allowing an overlay DTS like: = /dts-v1/; /plugin/; &foo { foo,status = "okay"; }; = to generate a fragment targetting <&foo>. Modified: stable/11/usr.bin/dtc/Makefile stable/11/usr.bin/dtc/dtc.1 stable/11/usr.bin/dtc/dtc.cc stable/11/usr.bin/dtc/fdt.cc stable/11/usr.bin/dtc/fdt.hh stable/11/usr.bin/dtc/input_buffer.cc stable/11/usr.bin/dtc/input_buffer.hh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/dtc/Makefile ============================================================================== --- stable/11/usr.bin/dtc/Makefile Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/Makefile Sat Jan 27 22:50:26 2018 (r328495) @@ -4,8 +4,6 @@ PROG_CXX=dtc SRCS= dtc.cc input_buffer.cc string.cc dtb.cc fdt.cc checking.cc MAN= dtc.1 -WARNS?= 3 - CXXFLAGS+= -std=c++11 -fno-rtti -fno-exceptions NO_SHARED?=NO Modified: stable/11/usr.bin/dtc/dtc.1 ============================================================================== --- stable/11/usr.bin/dtc/dtc.1 Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/dtc.1 Sat Jan 27 22:50:26 2018 (r328495) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd January 1, 2013 +.Dd January 17, 2018 .Dt DTC 1 .Os .Sh NAME @@ -57,7 +57,7 @@ The .Nm utility converts flattened device tree (FDT) representations. - It is most commonly used to generate device tree blobs (DTB), the binary +It is most commonly used to generate device tree blobs (DTB), the binary representation of an FDT, from device tree sources (DTS), the ASCII text source representation. .Pp @@ -153,9 +153,9 @@ format for property values. These allow property value to be specified on the command line. .It Fl R Ar entries The number of empty reservation table entries to pad the table with. -This is -useful if you are generating a device tree blob for bootloader or similar that -needs to reserve some memory before passing control to the operating system. +This is useful if you are generating a device tree blob for bootloader or +similar that needs to reserve some memory before passing control to the +operating system. .It Fl S Ar bytes The minimum size in bytes of the blob. The blob will be padded after the strings table to ensure that it is the @@ -244,6 +244,54 @@ Checks that all .Va /delete-node/ statements refer to nodes that are merged. .El +.Sh OVERLAYS +The utility provides support for generating overlays, also known as plugins. +Overlays are a method of patching a base device tree that has been compiled with +the +.Fl @ +flag, with some limited support for patching device trees that were not compiled +with the +.Fl @ +flag. +.Pp +To denote that a DTS is intended to be used as an overlay, +.Va /plugin/; +should be included in the header, following any applicable +.Va /dts-v1/; +tag. +.Pp +Conventional overlays are crafted by creating +.Va fragment +nodes in a root. +Each fragment node must have either a +.Va target +property set to a label reference, or a +.Va target-path +string property set to a path. +It must then have an +.Va __overlay__ +child node, whose properties and child nodes are merged into the base device +tree when the overlay is applied. +.Pp +Much simpler syntactic sugar was later invented to simplify generating overlays. +Instead of creating targetted fragments manually, one can instead create a root +node that targets a label in the base node using the +.Va &label +syntax supported in conventional DTS. +This will indicate that a fragment should be generated for the node, with the +given +.Va label +being the target, and the properties and child nodes will be used as the +__overlay__. +.Pp +Both conventional overlays and the later-added syntactic sugar are supported. +.Pp +Overlay blobs can be applied at boot time by setting +.Va fdt_overlays +in +.Xr loader.conf 5 . +Multiple overlays may be specified, and they will be applied in the order given. +.El .Sh EXAMPLES The command: .Pp @@ -254,8 +302,7 @@ will generate a file from the device tree source .Pa device.dts and print errors if any occur during parsing or property checking. -The -resulting file can be assembled and linked into a binary. +The resulting file can be assembled and linked into a binary. .Pp The command: .Pp @@ -265,6 +312,33 @@ will write the device tree source for the device tree .Pa device.dtb to the standard output. This is useful when debugging device trees. +.Pp +The command: +.Pp +.Dl "dtc -@ -O dtb -I dts -o device.dtb device.dts" +.Pp +will generate a +.Pa device.dtb +file from the device tree source +.Pa device.dts +with a __symbols__ node included so that overlays may be applied to it. +.Pp +The command: +.Pp +.Dl "dtc -@ -O dtb -I dts -o device_overlay.dtbo device_overlay.dts" +.Pp +will generate a +.Pa device_overlay.dtbo +file, using the standard extension for a device tree overlay, from the device +tree source +.Pa device_overlay.dts . +A __symbols__ node will be included so that overlays may be applied to it. +The presence of a +.Va /plugin/; +directive in +.Pa device_overlay.dts +will indicate to the utility that it should also generate the underlying +metadata required in overlays. .Sh COMPATIBILITY This utility is intended to be compatible with the device tree compiler provided by elinux.org. Modified: stable/11/usr.bin/dtc/dtc.cc ============================================================================== --- stable/11/usr.bin/dtc/dtc.cc Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/dtc.cc Sat Jan 27 22:50:26 2018 (r328495) @@ -47,20 +47,25 @@ using namespace dtc; using std::string; +namespace { + /** * The current major version of the tool. */ int version_major = 0; +int version_major_compatible = 1; /** * The current minor version of the tool. */ int version_minor = 5; +int version_minor_compatible = 4; /** * The current patch level of the tool. */ int version_patch = 0; +int version_patch_compatible = 0; -static void usage(const string &argv0) +void usage(const string &argv0) { fprintf(stderr, "Usage:\n" "\t%s\t[-fhsv@] [-b boot_cpu_id] [-d dependency_file]" @@ -75,11 +80,15 @@ static void usage(const string &argv0) /** * Prints the current version of this program.. */ -static void version(const char* progname) +void version(const char* progname) { - fprintf(stderr, "Version: %s %d.%d.%d\n", progname, version_major, - version_minor, version_patch); + fprintf(stdout, "Version: %s %d.%d.%d compatible with gpl dtc %d.%d.%d\n", progname, + version_major, version_minor, version_patch, + version_major_compatible, version_minor_compatible, + version_patch_compatible); } + +} // Anonymous namespace using fdt::device_tree; Modified: stable/11/usr.bin/dtc/fdt.cc ============================================================================== --- stable/11/usr.bin/dtc/fdt.cc Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/fdt.cc Sat Jan 27 22:50:26 2018 (r328495) @@ -495,6 +495,29 @@ property::property(text_input_buffer &input, return; case '/': { + if (input.consume("/incbin/(\"")) + { + auto loc = input.location(); + std::string filename = input.parse_to('"'); + if (!(valid = input.consume('"'))) + { + loc.report_error("Syntax error, expected '\"' to terminate /incbin/("); + return; + } + property_value v; + if (!(valid = input.read_binary_file(filename, v.byte_data))) + { + input.parse_error("Cannot open binary include file"); + return; + } + if (!(valid &= input.consume(')'))) + { + input.parse_error("Syntax error, expected ')' to terminate /incbin/("); + return; + } + values.push_back(v); + break; + } unsigned long long bits = 0; valid = input.consume("/bits/"); input.next_token(); @@ -997,7 +1020,7 @@ node::get_property(const string &key) } void -node::merge_node(node_ptr other) +node::merge_node(node_ptr &other) { for (auto &l : other->labels) { @@ -1032,7 +1055,7 @@ node::merge_node(node_ptr other) { if (i->name == c->name && i->unit_address == c->unit_address) { - i->merge_node(std::move(c)); + i->merge_node(c); found = true; break; } @@ -1205,9 +1228,68 @@ device_tree::collect_names() collect_names_recursive(root, p); } +property_ptr +device_tree::assign_phandle(node *n, uint32_t &phandle) +{ + // If there is an existing phandle, use it + property_ptr p = n->get_property("phandle"); + if (p == 0) + { + p = n->get_property("linux,phandle"); + } + if (p == 0) + { + // Otherwise insert a new phandle node + property_value v; + while (used_phandles.find(phandle) != used_phandles.end()) + { + // Note that we only don't need to + // store this phandle in the set, + // because we are monotonically + // increasing the value of phandle and + // so will only ever revisit this value + // if we have used 2^32 phandles, at + // which point our blob won't fit in + // any 32-bit system and we've done + // something badly wrong elsewhere + // already. + phandle++; + } + push_big_endian(v.byte_data, phandle++); + if (phandle_node_name == BOTH || phandle_node_name == LINUX) + { + p.reset(new property("linux,phandle")); + p->add_value(v); + n->add_property(p); + } + if (phandle_node_name == BOTH || phandle_node_name == EPAPR) + { + p.reset(new property("phandle")); + p->add_value(v); + n->add_property(p); + } + } + + return (p); +} + void -device_tree::resolve_cross_references() +device_tree::assign_phandles(node_ptr &n, uint32_t &next) { + if (!n->labels.empty()) + { + assign_phandle(n.get(), next); + } + + for (auto &c : n->child_nodes()) + { + assign_phandles(c, next); + } +} + +void +device_tree::resolve_cross_references(uint32_t &phandle) +{ for (auto *pv : cross_references) { node_path path = node_paths[pv->string_data]; @@ -1224,9 +1306,9 @@ device_tree::resolve_cross_references() { pv->byte_data.push_back('@'); push_string(pv->byte_data, p->second); - pv->byte_data.push_back(0); } } + pv->byte_data.push_back(0); } } std::unordered_map phandle_set; @@ -1250,7 +1332,6 @@ device_tree::resolve_cross_references() }); assert(sorted_phandles.size() == fixups.size()); - uint32_t phandle = 1; for (auto &i : sorted_phandles) { string target_name = i.get().val.string_data; @@ -1332,43 +1413,7 @@ device_tree::resolve_cross_references() } } // If there is an existing phandle, use it - property_ptr p = target->get_property("phandle"); - if (p == 0) - { - p = target->get_property("linux,phandle"); - } - if (p == 0) - { - // Otherwise insert a new phandle node - property_value v; - while (used_phandles.find(phandle) != used_phandles.end()) - { - // Note that we only don't need to - // store this phandle in the set, - // because we are monotonically - // increasing the value of phandle and - // so will only ever revisit this value - // if we have used 2^32 phandles, at - // which point our blob won't fit in - // any 32-bit system and we've done - // something badly wrong elsewhere - // already. - phandle++; - } - push_big_endian(v.byte_data, phandle++); - if (phandle_node_name == BOTH || phandle_node_name == LINUX) - { - p.reset(new property("linux,phandle")); - p->add_value(v); - target->add_property(p); - } - if (phandle_node_name == BOTH || phandle_node_name == EPAPR) - { - p.reset(new property("phandle")); - p->add_value(v); - target->add_property(p); - } - } + property_ptr p = assign_phandle(target, phandle); p->begin()->push_to_buffer(i.get().val.byte_data); assert(i.get().val.byte_data.size() == 4); } @@ -1642,7 +1687,73 @@ device_tree::node_path::to_string() const return path; } +node_ptr +device_tree::create_fragment_wrapper(node_ptr &node, int &fragnum) +{ + // In a plugin, we can massage these non-/ root nodes into into a fragment + std::string fragment_address = "fragment@" + std::to_string(fragnum); + ++fragnum; + + std::vector symbols; + + // Intentionally left empty + node_ptr newroot = node::create_special_node("", symbols); + node_ptr wrapper = node::create_special_node("__overlay__", symbols); + + // Generate the fragment with target = <&name> + property_value v; + v.string_data = node->name; + v.type = property_value::PHANDLE; + auto prop = std::make_shared(std::string("target")); + prop->add_value(v); + symbols.push_back(prop); + + node_ptr fragment = node::create_special_node(fragment_address, symbols); + + wrapper->merge_node(node); + fragment->add_child(std::move(wrapper)); + newroot->add_child(std::move(fragment)); + return newroot; +} + +node_ptr +device_tree::generate_root(node_ptr &node, int &fragnum) +{ + + string name = node->name; + if (name == string()) + { + return std::move(node); + } + else if (!is_plugin) + { + return nullptr; + } + + return create_fragment_wrapper(node, fragnum); +} + void +device_tree::reassign_fragment_numbers(node_ptr &node, int &delta) +{ + + for (auto &c : node->child_nodes()) + { + if (c->name == std::string("fragment")) + { + int current_address = std::stoi(c->unit_address, nullptr, 16); + std::ostringstream new_address; + current_address += delta; + // It's possible that we hopped more than one somewhere, so just reset + // delta to the next in sequence. + delta = current_address + 1; + new_address << std::hex << current_address; + c->unit_address = new_address.str(); + } + } +} + +void device_tree::parse_dts(const string &fn, FILE *depfile) { auto in = input_buffer::buffer_for_file(fn); @@ -1663,6 +1774,7 @@ device_tree::parse_dts(const string &fn, FILE *depfile dirname(fn), depfile); bool read_header = false; + int fragnum = 0; parse_file(input, roots, read_header); switch (roots.size()) { @@ -1671,18 +1783,36 @@ device_tree::parse_dts(const string &fn, FILE *depfile input.parse_error("Failed to find root node /."); return; case 1: - root = std::move(roots[0]); + root = generate_root(roots[0], fragnum); + if (!root) + { + valid = false; + input.parse_error("Failed to find root node /."); + return; + } break; default: { - root = std::move(roots[0]); + root = generate_root(roots[0], fragnum); + if (!root) + { + valid = false; + input.parse_error("Failed to find root node /."); + return; + } for (auto i=++(roots.begin()), e=roots.end() ; i!=e ; ++i) { auto &node = *i; string name = node->name; if (name == string()) { - root->merge_node(std::move(node)); + if (is_plugin) + { + // Re-assign any fragment numbers based on a delta of + // fragnum before we merge it + reassign_fragment_numbers(node, fragnum); + } + root->merge_node(node); } else { @@ -1694,20 +1824,36 @@ device_tree::parse_dts(const string &fn, FILE *depfile } if (existing == node_names.end()) { - fprintf(stderr, "Unable to merge node: %s\n", name.c_str()); + if (is_plugin) + { + auto fragment = create_fragment_wrapper(node, fragnum); + root->merge_node(fragment); + } + else + { + fprintf(stderr, "Unable to merge node: %s\n", name.c_str()); + } } else { - existing->second->merge_node(std::move(node)); + existing->second->merge_node(node); } } } } } collect_names(); - resolve_cross_references(); + uint32_t phandle = 1; + // If we're writing symbols, go ahead and assign phandles to the entire + // tree. We'll do this before we resolve cross references, just to keep + // order semi-predictable and stable. if (write_symbols) { + assign_phandles(root, phandle); + } + resolve_cross_references(phandle); + if (write_symbols) + { std::vector symbols; // Create a symbol table. Each label in this device tree may be // referenced by other plugins, so we create a __symbols__ node inside @@ -1767,21 +1913,72 @@ device_tree::parse_dts(const string &fn, FILE *depfile } symbols.clear(); // If we have any resolved phandle references in this plugin, then - // we must leave a property in the /__local_fixups__ node whose key - // is 'fixup' and whose value is as described above. + // we must create a child in the __local_fixups__ node whose path + // matches the node path from the root and whose value contains the + // location of the reference within a property. + + // Create a local_fixups node that is initially empty. + node_ptr local_fixups = node::create_special_node("__local_fixups__", symbols); for (auto &i : fixups) { if (!i.val.is_phandle()) { continue; } - symbols.push_back(create_fixup_entry(i, "fixup")); + node *n = local_fixups.get(); + for (auto &p : i.path) + { + // Skip the implicit root + if (p.first.empty()) + { + continue; + } + bool found = false; + for (auto &c : n->child_nodes()) + { + if (c->name == p.first) + { + n = c.get(); + found = true; + break; + } + } + if (!found) + { + n->add_child(node::create_special_node(p.first, symbols)); + n = (--n->child_end())->get(); + } + } + assert(n); + property_value pv; + push_big_endian(pv.byte_data, static_cast(i.prop->offset_of_value(i.val))); + pv.type = property_value::BINARY; + auto key = i.prop->get_key(); + property_ptr prop = n->get_property(key); + // If we don't have an existing property then create one and + // use this property value + if (!prop) + { + prop = std::make_shared(std::move(key)); + n->add_property(prop); + prop->add_value(pv); + } + else + { + // If we do have an existing property value, try to append + // this value. + property_value &old_val = *(--prop->end()); + if (!old_val.try_to_merge(pv)) + { + prop->add_value(pv); + } + } } // We've iterated over all fixups, but only emit the // __local_fixups__ if we found some that were resolved internally. - if (!symbols.empty()) + if (local_fixups->child_begin() != local_fixups->child_end()) { - root->add_child(node::create_special_node("__local_fixups__", symbols)); + root->add_child(std::move(local_fixups)); } } } Modified: stable/11/usr.bin/dtc/fdt.hh ============================================================================== --- stable/11/usr.bin/dtc/fdt.hh Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/fdt.hh Sat Jan 27 22:50:26 2018 (r328495) @@ -368,7 +368,7 @@ class property /** * Returns the key for this property. */ - inline std::string get_key() + inline const std::string &get_key() { return key; } @@ -618,7 +618,7 @@ class node * Merges a node into this one. Any properties present in both are * overridden, any properties present in only one are preserved. */ - void merge_node(node_ptr other); + void merge_node(node_ptr &other); /** * Write this node to the specified output. Although nodes do not * refer to a string table directly, their properties do. The string @@ -674,12 +674,12 @@ class device_tree /** * The format that we should use for writing phandles. */ - phandle_format phandle_node_name; + phandle_format phandle_node_name = EPAPR; /** * Flag indicating that this tree is valid. This will be set to false * on parse errors. */ - bool valid; + bool valid = true; /** * Type used for memory reservations. A reservation is two 64-bit * values indicating a base address and length in memory that the @@ -773,23 +773,23 @@ class device_tree /** * The default boot CPU, specified in the device tree header. */ - uint32_t boot_cpu; + uint32_t boot_cpu = 0; /** * The number of empty reserve map entries to generate in the blob. */ - uint32_t spare_reserve_map_entries; + uint32_t spare_reserve_map_entries = 0; /** * The minimum size in bytes of the blob. */ - uint32_t minimum_blob_size; + uint32_t minimum_blob_size = 0; /** * The number of bytes of padding to add to the end of the blob. */ - uint32_t blob_padding; + uint32_t blob_padding = 0; /** * Is this tree a plugin? */ - bool is_plugin; + bool is_plugin = false; /** * Visit all of the nodes recursively, and if they have labels then add * them to the node_paths and node_names vectors so that they can be @@ -798,6 +798,12 @@ class device_tree */ void collect_names_recursive(node_ptr &n, node_path &path); /** + * Assign a phandle property to a single node. The next parameter + * holds the phandle to be assigned, and will be incremented upon + * assignment. + */ + property_ptr assign_phandle(node *n, uint32_t &next); + /** * Assign phandle properties to all nodes that have been referenced and * require one. This method will recursively visit the tree starting at * the node that it is passed. @@ -810,9 +816,11 @@ class device_tree /** * Resolves all cross references. Any properties that refer to another * node must have their values replaced by either the node path or - * phandle value. + * phandle value. The phandle parameter holds the next phandle to be + * assigned, should the need arise. It will be incremented upon each + * assignment of a phandle. */ - void resolve_cross_references(); + void resolve_cross_references(uint32_t &phandle); /** * Parses a dts file in the given buffer and adds the roots to the parsed * set. The `read_header` argument indicates whether the header has @@ -857,15 +865,33 @@ class device_tree /** * Default constructor. Creates a valid, but empty FDT. */ - device_tree() : phandle_node_name(EPAPR), valid(true), - boot_cpu(0), spare_reserve_map_entries(0), - minimum_blob_size(0), blob_padding(0) {} + device_tree() {} /** * Constructs a device tree from the specified file name, referring to * a file that contains a device tree blob. */ void parse_dtb(const std::string &fn, FILE *depfile); /** + * Construct a fragment wrapper around node. This will assume that node's + * name may be used as the target of the fragment, and the contents are to + * be wrapped in an __overlay__ node. The fragment wrapper will be assigned + * fragnumas its fragment number, and fragment number will be incremented. + */ + node_ptr create_fragment_wrapper(node_ptr &node, int &fragnum); + /** + * Generate a root node from the node passed in. This is sensitive to + * whether we're in a plugin context or not, so that if we're in a plugin we + * can circumvent any errors that might normally arise from a non-/ root. + * fragnum will be assigned to any fragment wrapper generated as a result + * of the call, and fragnum will be incremented. + */ + node_ptr generate_root(node_ptr &node, int &fragnum); + /** + * Reassign any fragment numbers from this new node, based on the given + * delta. + */ + void reassign_fragment_numbers(node_ptr &node, int &delta); + /* * Constructs a device tree from the specified file name, referring to * a file that contains device tree source. */ @@ -904,7 +930,10 @@ class device_tree */ void sort() { - root->sort(); + if (root) + { + root->sort(); + } } /** * Adds a path to search for include files. The argument must be a Modified: stable/11/usr.bin/dtc/input_buffer.cc ============================================================================== --- stable/11/usr.bin/dtc/input_buffer.cc Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/input_buffer.cc Sat Jan 27 22:50:26 2018 (r328495) @@ -204,9 +204,9 @@ text_input_buffer::handle_include() { next_token(); string name = parse_property_name(); - if (defines.count(name) > 0) + if (defines.count(name) == 0) { - reallyInclude = true; + reallyInclude = false; } consume('/'); } @@ -248,6 +248,48 @@ text_input_buffer::handle_include() return; } input_stack.push(std::move(include_buffer)); +} + +bool text_input_buffer::read_binary_file(const std::string &filename, byte_buffer &b) +{ + bool try_include_paths = true; + string include_file; + if (filename[0] == '/') + { + include_file = filename; + // Don't try include paths if we're given an absolute path. + // Failing is better so that we don't accidentally do the wrong thing, + // but make it seem like everything is alright. + try_include_paths = false; + } + else + { + include_file = dir + '/' + filename; + } + auto include_buffer = input_buffer::buffer_for_file(include_file, false); + if (include_buffer == 0 && try_include_paths) + { + for (auto i : include_paths) + { + include_file = i + '/' + filename; + include_buffer = input_buffer::buffer_for_file(include_file, false); + if (include_buffer != 0) + { + break; + } + } + } + if (!include_buffer) + { + return false; + } + if (depfile) + { + putc(' ', depfile); + fputs(include_file.c_str(), depfile); + } + b.insert(b.begin(), include_buffer->begin(), include_buffer->end()); + return true; } input_buffer Modified: stable/11/usr.bin/dtc/input_buffer.hh ============================================================================== --- stable/11/usr.bin/dtc/input_buffer.hh Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/input_buffer.hh Sat Jan 27 22:50:26 2018 (r328495) @@ -164,6 +164,14 @@ class input_buffer cursor++; return *this; } + const char *begin() + { + return buffer; + } + const char *end() + { + return buffer + size; + } /** * Consumes a character. Moves the cursor one character forward if the * next character matches the argument, returning true. If the current @@ -523,6 +531,13 @@ class text_input_buffer * Prints a message indicating the location of a parse error. */ void parse_error(const char *msg); + /** + * Reads the contents of a binary file into `b`. The file name is assumed + * to be relative to one of the include paths. + * + * Returns true if the file exists and can be read, false otherwise. + */ + bool read_binary_file(const std::string &filename, byte_buffer &b); private: /** * Prints a message indicating the location of a parse error, given a From owner-svn-src-stable@freebsd.org Sat Jan 27 23:13: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 C20BBEC97AC; Sat, 27 Jan 2018 23:13:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 76F507F3F0; Sat, 27 Jan 2018 23:13:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71E1C1137D; Sat, 27 Jan 2018 23:13:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RNDZxg087006; Sat, 27 Jan 2018 23:13:35 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RNDZMQ087002; Sat, 27 Jan 2018 23:13:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801272313.w0RNDZMQ087002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 23:13:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328499 - in stable/11: etc/mtree share/man/man7 sys/boot/arm/uboot sys/boot/mips/uboot X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: etc/mtree share/man/man7 sys/boot/arm/uboot sys/boot/mips/uboot X-SVN-Commit-Revision: 328499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 23:13:36 -0000 Author: kevans Date: Sat Jan 27 23:13:34 2018 New Revision: 328499 URL: https://svnweb.freebsd.org/changeset/base/328499 Log: MFC (conceptually) r328107: Add /boot/overlays This is a direct commit to stable/11, due to path changes in HEAD. Diffs have been applied on top of stable/11, with exception to the change to forth/loader.conf. forth/loader.conf has seen additional changes in HEAD mthat are not being MFC'd to stable/11, so the addition of /boot/overlays to its module_path is not necessary. MFC r328107: stand: Add /boot/overlays for separation of overlays from DTB This matches directory structure used commonly in Linux-land, and it's cleaner than mixing overlays into the existing module paths. Overlays are still mixed in by specifying fdt_overlays in loader.conf(5). Modified: stable/11/etc/mtree/BSD.root.dist stable/11/share/man/man7/hier.7 stable/11/sys/boot/arm/uboot/loader.conf stable/11/sys/boot/mips/uboot/loader.conf Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.root.dist ============================================================================== --- stable/11/etc/mtree/BSD.root.dist Sat Jan 27 22:57:06 2018 (r328498) +++ stable/11/etc/mtree/BSD.root.dist Sat Jan 27 23:13:34 2018 (r328499) @@ -18,6 +18,8 @@ .. modules .. + overlays + .. zfs .. .. Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sat Jan 27 22:57:06 2018 (r328498) +++ stable/11/share/man/man7/hier.7 Sat Jan 27 23:13:34 2018 (r328499) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd April 6, 2017 +.Dd January 15, 2018 .Dt HIER 7 .Os .Sh NAME @@ -63,6 +63,11 @@ at boot time) and kernel modules third-party loadable kernel modules; see .Xr kldstat 8 +.It Pa overlays/ +Compiled flattened device tree (FDT) overlays; see +.Xr fdt 4 +and +.Xr dtc 1 .It Pa zfs/ .Xr zfs 8 zpool cache files Modified: stable/11/sys/boot/arm/uboot/loader.conf ============================================================================== --- stable/11/sys/boot/arm/uboot/loader.conf Sat Jan 27 22:57:06 2018 (r328498) +++ stable/11/sys/boot/arm/uboot/loader.conf Sat Jan 27 23:13:34 2018 (r328499) @@ -7,7 +7,7 @@ autoboot_delay=10 bootfile="kernel" # Kernel name (possibly absolute path) kernel="kernel" # /boot sub-directory containing kernel and modules loader_conf_files="/boot/loader.conf /boot/loader.conf.local" -module_path="/boot/kernel;/boot/modules;/boot/dtb" +module_path="/boot/kernel;/boot/modules;/boot/dtb;/boot/overlays" nextboot_conf="/boot/nextboot.conf" nextboot_enable="NO" verbose_loading="NO" Modified: stable/11/sys/boot/mips/uboot/loader.conf ============================================================================== --- stable/11/sys/boot/mips/uboot/loader.conf Sat Jan 27 22:57:06 2018 (r328498) +++ stable/11/sys/boot/mips/uboot/loader.conf Sat Jan 27 23:13:34 2018 (r328499) @@ -7,7 +7,7 @@ autoboot_delay=10 bootfile="kernel" # Kernel name (possibly absolute path) kernel="kernel" # /boot sub-directory containing kernel and modules loader_conf_files="/boot/loader.conf /boot/loader.conf.local" -module_path="/boot/kernel;/boot/modules;/boot/dtb" +module_path="/boot/kernel;/boot/modules;/boot/dtb;/boot/overlays" nextboot_conf="/boot/nextboot.conf" nextboot_enable="NO" verbose_loading="NO" From owner-svn-src-stable@freebsd.org Sat Jan 27 23:20: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 AC725EC9CD0; Sat, 27 Jan 2018 23:20:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5B7177F79A; Sat, 27 Jan 2018 23:20:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5642111389; Sat, 27 Jan 2018 23:20:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RNK2MB087306; Sat, 27 Jan 2018 23:20:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RNK1PL087298; Sat, 27 Jan 2018 23:20:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801272320.w0RNK1PL087298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 27 Jan 2018 23:20:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328500 - in stable/11/usr.bin/hexdump: . tests X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/usr.bin/hexdump: . tests X-SVN-Commit-Revision: 328500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 23:20:02 -0000 Author: kevans Date: Sat Jan 27 23:20:01 2018 New Revision: 328500 URL: https://svnweb.freebsd.org/changeset/base/328500 Log: MFC r328188,r328189,r328200: Fix wrong output for multibyte corner cases MFC r328188: od(1): Fix wrong output for corner cases in multibyte locales. Restore the original character to print if we used the look-ahead buffer, but that didn't help -- we either got an illegal sequence or still can't complete. MFC r328189: od(1): Fix mis-patch from r328188 od_test.sh got duplicated erroneously when it was added in r328188. Dedup. MFC r328200: Silence the gcc warning: 'op' may be used uninitialized in this function PR: 224552 Added: stable/11/usr.bin/hexdump/tests/d_od_cflag_a.out - copied unchanged from r328188, head/usr.bin/hexdump/tests/d_od_cflag_a.out stable/11/usr.bin/hexdump/tests/d_od_cflag_b.out - copied unchanged from r328188, head/usr.bin/hexdump/tests/d_od_cflag_b.out stable/11/usr.bin/hexdump/tests/od_test.sh - copied, changed from r328188, head/usr.bin/hexdump/tests/od_test.sh Modified: stable/11/usr.bin/hexdump/conv.c stable/11/usr.bin/hexdump/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/hexdump/conv.c ============================================================================== --- stable/11/usr.bin/hexdump/conv.c Sat Jan 27 23:13:34 2018 (r328499) +++ stable/11/usr.bin/hexdump/conv.c Sat Jan 27 23:20:01 2018 (r328500) @@ -54,7 +54,10 @@ conv_c(PR *pr, u_char *p, size_t bufsize) size_t clen, oclen; int converr, pad, width; u_char peekbuf[MB_LEN_MAX]; + u_char *op; + op = NULL; + if (pr->mbleft > 0) { str = "**"; pr->mbleft--; @@ -105,6 +108,15 @@ retry: else if (clen == (size_t)-1 || (clen == (size_t)-2 && p == peekbuf)) { memset(&pr->mbstate, 0, sizeof(pr->mbstate)); + if (p == peekbuf) { + /* + * We peeked ahead, but that didn't help -- + * we either got an illegal sequence or still + * can't complete; restore original character. + */ + oclen = 0; + p = op; + } wc = *p; clen = 1; converr = 1; @@ -114,6 +126,7 @@ retry: * can complete it. */ oclen = bufsize; + op = p; bufsize = peek(p = peekbuf, MB_CUR_MAX); goto retry; } @@ -126,7 +139,7 @@ retry: if (!odmode) { *pr->cchar = 'c'; (void)printf(pr->fmt, (int)wc); - } else { + } else { *pr->cchar = 'C'; assert(strcmp(pr->fmt, "%3C") == 0); width = wcwidth(wc); Modified: stable/11/usr.bin/hexdump/tests/Makefile ============================================================================== --- stable/11/usr.bin/hexdump/tests/Makefile Sat Jan 27 23:13:34 2018 (r328499) +++ stable/11/usr.bin/hexdump/tests/Makefile Sat Jan 27 23:20:01 2018 (r328500) @@ -2,7 +2,7 @@ PACKAGE= tests -ATF_TESTS_SH= hexdump_test +ATF_TESTS_SH= hexdump_test od_test ${PACKAGE}FILES+= d_hexdump_a.in ${PACKAGE}FILES+= d_hexdump_b.in @@ -27,5 +27,7 @@ ${PACKAGE}FILES+= d_hexdump_UCflag_c.out ${PACKAGE}FILES+= d_hexdump_xflag_a.out ${PACKAGE}FILES+= d_hexdump_xflag_b.out ${PACKAGE}FILES+= d_hexdump_xflag_c.out +${PACKAGE}FILES+= d_od_cflag_a.out +${PACKAGE}FILES+= d_od_cflag_b.out .include Copied: stable/11/usr.bin/hexdump/tests/d_od_cflag_a.out (from r328188, head/usr.bin/hexdump/tests/d_od_cflag_a.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/usr.bin/hexdump/tests/d_od_cflag_a.out Sat Jan 27 23:20:01 2018 (r328500, copy of r328188, head/usr.bin/hexdump/tests/d_od_cflag_a.out) @@ -0,0 +1,3 @@ +0000000 T e s t T e s t T e s t T e s 345 +0000020 T e s t 345 +0000025 Copied: stable/11/usr.bin/hexdump/tests/d_od_cflag_b.out (from r328188, head/usr.bin/hexdump/tests/d_od_cflag_b.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/usr.bin/hexdump/tests/d_od_cflag_b.out Sat Jan 27 23:20:01 2018 (r328500, copy of r328188, head/usr.bin/hexdump/tests/d_od_cflag_b.out) @@ -0,0 +1,3 @@ +0000000 T e s t T e s t T e s t T e s т +0000020 ** Т ** е ** с ** т ** +0000031 Copied and modified: stable/11/usr.bin/hexdump/tests/od_test.sh (from r328188, head/usr.bin/hexdump/tests/od_test.sh) ============================================================================== --- head/usr.bin/hexdump/tests/od_test.sh Sat Jan 20 02:49:32 2018 (r328188, copy source) +++ stable/11/usr.bin/hexdump/tests/od_test.sh Sat Jan 27 23:20:01 2018 (r328500) @@ -47,48 +47,3 @@ atf_init_test_cases() { atf_add_test_case c_flag } -# -# Copyright 2018 The FreeBSD Project -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ - -atf_test_case c_flag -c_flag_head() -{ - atf_set "descr" "Verify -c output" -} -c_flag_body() -{ - printf 'TestTestTestTes\345Test\345' > d_od_cflag.in - atf_check -o file:"$(atf_get_srcdir)/d_od_cflag_a.out" \ - env LC_CTYPE="en_US.UTF-8" od -c "d_od_cflag.in" - printf 'TestTestTestTesтТест' > d_od_cflag.in - atf_check -o file:"$(atf_get_srcdir)/d_od_cflag_b.out" \ - env LC_CTYPE="en_US.UTF-8" od -c "d_od_cflag.in" -} - -atf_init_test_cases() -{ - atf_add_test_case c_flag -} From owner-svn-src-stable@freebsd.org Sat Jan 27 23:40: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 0CC44ECAEE6; Sat, 27 Jan 2018 23:40:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AAB4B80438; Sat, 27 Jan 2018 23:40:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5903116E0; Sat, 27 Jan 2018 23:40:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RNef6o097226; Sat, 27 Jan 2018 23:40:41 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RNef44097225; Sat, 27 Jan 2018 23:40:41 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801272340.w0RNef44097225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 27 Jan 2018 23:40:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328501 - stable/11/usr.bin/limits X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/limits X-SVN-Commit-Revision: 328501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-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, 27 Jan 2018 23:40:42 -0000 Author: eadler Date: Sat Jan 27 23:40:41 2018 New Revision: 328501 URL: https://svnweb.freebsd.org/changeset/base/328501 Log: MFC r328206: limits(1): add missing break Modified: stable/11/usr.bin/limits/limits.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/limits/limits.c ============================================================================== --- stable/11/usr.bin/limits/limits.c Sat Jan 27 23:20:01 2018 (r328500) +++ stable/11/usr.bin/limits/limits.c Sat Jan 27 23:40:41 2018 (r328501) @@ -608,6 +608,7 @@ resource_num(int which, int ch, const char *str) break; case 'w': case 'W': /* weeks */ tim *= (60L * 60L * 24L * 7L); + break; case 'y': case 'Y': /* Years */ tim *= (60L * 60L * 24L * 365L); }