From owner-svn-src-all@freebsd.org Sun Sep 2 10:51:33 2018 Return-Path: Delivered-To: svn-src-all@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 8B3D7FEBDDF; Sun, 2 Sep 2018 10:51:33 +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 3F9FB74208; Sun, 2 Sep 2018 10:51:33 +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 3A9DE184A4; Sun, 2 Sep 2018 10:51:33 +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 w82ApXtF012456; Sun, 2 Sep 2018 10:51:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w82ApVE0012450; Sun, 2 Sep 2018 10:51:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809021051.w82ApVE0012450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 2 Sep 2018 10:51: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: r338427 - in stable/11/sys/amd64: amd64 include vmm/intel X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys/amd64: amd64 include vmm/intel X-SVN-Commit-Revision: 338427 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 10:51:33 -0000 Author: kib Date: Sun Sep 2 10:51:31 2018 New Revision: 338427 URL: https://svnweb.freebsd.org/changeset/base/338427 Log: MFC r338068, r338113: Update L1TF workaround to sustain L1D pollution from NMI. Modified: stable/11/sys/amd64/amd64/exception.S stable/11/sys/amd64/amd64/support.S stable/11/sys/amd64/amd64/trap.c stable/11/sys/amd64/include/md_var.h stable/11/sys/amd64/vmm/intel/vmx.c stable/11/sys/amd64/vmm/intel/vmx_support.S Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/exception.S ============================================================================== --- stable/11/sys/amd64/amd64/exception.S Sat Sep 1 16:16:40 2018 (r338426) +++ stable/11/sys/amd64/amd64/exception.S Sun Sep 2 10:51:31 2018 (r338427) @@ -848,7 +848,10 @@ nocallchain: movl %edx,%eax shrq $32,%rdx wrmsr - movq %r13,%cr3 + cmpb $0, nmi_flush_l1d_sw(%rip) + je 2f + call flush_l1d_sw /* bhyve L1TF assist */ +2: movq %r13,%cr3 RESTORE_REGS addq $TF_RIP,%rsp jmp doreti_iret Modified: stable/11/sys/amd64/amd64/support.S ============================================================================== --- stable/11/sys/amd64/amd64/support.S Sat Sep 1 16:16:40 2018 (r338426) +++ stable/11/sys/amd64/amd64/support.S Sun Sep 2 10:51:31 2018 (r338427) @@ -892,3 +892,36 @@ ENTRY(handle_ibrs_exit_rs) END(handle_ibrs_exit_rs) .noaltmacro + +/* + * Flush L1D cache. Load enough of the data from the kernel text + * to flush existing L1D content. + * + * N.B. The function does not follow ABI calling conventions, it corrupts %rbx. + * The vmm.ko caller expects that only %rax, %rdx, %rbx, %rcx, %r9, and %rflags + * registers are clobbered. The NMI handler caller only needs %r13 preserved. + */ +ENTRY(flush_l1d_sw) +#define L1D_FLUSH_SIZE (64 * 1024) + movq $KERNBASE, %r9 + movq $-L1D_FLUSH_SIZE, %rcx + /* + * pass 1: Preload TLB. + * Kernel text is mapped using superpages. TLB preload is + * done for the benefit of older CPUs which split 2M page + * into 4k TLB entries. + */ +1: movb L1D_FLUSH_SIZE(%r9, %rcx), %al + addq $PAGE_SIZE, %rcx + jne 1b + xorl %eax, %eax + cpuid + movq $-L1D_FLUSH_SIZE, %rcx + /* pass 2: Read each cache line. */ +2: movb L1D_FLUSH_SIZE(%r9, %rcx), %al + addq $64, %rcx + jne 2b + lfence + ret +#undef L1D_FLUSH_SIZE +END(flush_l1d_sw) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Sat Sep 1 16:16:40 2018 (r338426) +++ stable/11/sys/amd64/amd64/trap.c Sun Sep 2 10:51:31 2018 (r338427) @@ -158,6 +158,20 @@ SYSCTL_INT(_machdep, OID_AUTO, uprintf_signal, CTLFLAG "Print debugging information on trap signal to ctty"); /* + * Control L1D flush on return from NMI. + * + * Tunable can be set to the following values: + * 0 - only enable flush on return from NMI if required by vmm.ko (default) + * >1 - always flush on return from NMI. + * + * Post-boot, the sysctl indicates if flushing is currently enabled. + */ +int nmi_flush_l1d_sw; +SYSCTL_INT(_machdep, OID_AUTO, nmi_flush_l1d_sw, CTLFLAG_RWTUN, + &nmi_flush_l1d_sw, 0, + "Flush L1 Data Cache on NMI exit, software bhyve L1TF mitigation assist"); + +/* * Exception, fault, and trap interface to the FreeBSD kernel. * This common code is called from assembly language IDT gate entry * routines that prepare a suitable stack frame, and restore this Modified: stable/11/sys/amd64/include/md_var.h ============================================================================== --- stable/11/sys/amd64/include/md_var.h Sat Sep 1 16:16:40 2018 (r338426) +++ stable/11/sys/amd64/include/md_var.h Sun Sep 2 10:51:31 2018 (r338427) @@ -38,6 +38,7 @@ extern uint64_t *vm_page_dump; extern int hw_lower_amd64_sharedpage; extern int hw_ibrs_disable; extern int hw_ssb_disable; +extern int nmi_flush_l1d_sw; /* * The file "conf/ldscript.amd64" defines the symbol "kernphys". Its Modified: stable/11/sys/amd64/vmm/intel/vmx.c ============================================================================== --- stable/11/sys/amd64/vmm/intel/vmx.c Sat Sep 1 16:16:40 2018 (r338426) +++ stable/11/sys/amd64/vmm/intel/vmx.c Sun Sep 2 10:51:31 2018 (r338427) @@ -188,8 +188,11 @@ SYSCTL_UINT(_hw_vmm_vmx, OID_AUTO, vpid_alloc_failed, static int guest_l1d_flush; SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, l1d_flush, CTLFLAG_RD, &guest_l1d_flush, 0, NULL); +static int guest_l1d_flush_sw; +SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, l1d_flush_sw, CTLFLAG_RD, + &guest_l1d_flush_sw, 0, NULL); -uint64_t vmx_msr_flush_cmd; +static struct msr_entry msr_load_list[1] __aligned(16); /* * Use the last page below 4GB as the APIC access address. This address is @@ -500,6 +503,9 @@ vmx_cleanup(void) vpid_unr = NULL; } + if (nmi_flush_l1d_sw == 1) + nmi_flush_l1d_sw = 0; + smp_rendezvous(NULL, vmx_disable, NULL, NULL); return (0); @@ -728,11 +734,30 @@ vmx_init(int ipinum) guest_l1d_flush = (cpu_ia32_arch_caps & IA32_ARCH_CAP_RDCL_NO) == 0; TUNABLE_INT_FETCH("hw.vmm.l1d_flush", &guest_l1d_flush); - if (guest_l1d_flush && - (cpu_stdext_feature3 & CPUID_STDEXT3_L1D_FLUSH) != 0) - vmx_msr_flush_cmd = IA32_FLUSH_CMD_L1D; /* + * L1D cache flush is enabled. Use IA32_FLUSH_CMD MSR when + * available. Otherwise fall back to the software flush + * method which loads enough data from the kernel text to + * flush existing L1D content, both on VMX entry and on NMI + * return. + */ + if (guest_l1d_flush) { + if ((cpu_stdext_feature3 & CPUID_STDEXT3_L1D_FLUSH) == 0) { + guest_l1d_flush_sw = 1; + TUNABLE_INT_FETCH("hw.vmm.l1d_flush_sw", + &guest_l1d_flush_sw); + } + if (guest_l1d_flush_sw) { + if (nmi_flush_l1d_sw <= 1) + nmi_flush_l1d_sw = 1; + } else { + msr_load_list[0].index = MSR_IA32_FLUSH_CMD; + msr_load_list[0].val = IA32_FLUSH_CMD_L1D; + } + } + + /* * Stash the cr0 and cr4 bits that must be fixed to 0 or 1 */ fixed0 = rdmsr(MSR_VMX_CR0_FIXED0); @@ -920,6 +945,15 @@ vmx_vminit(struct vm *vm, pmap_t pmap) error += vmwrite(VMCS_ENTRY_CTLS, entry_ctls); error += vmwrite(VMCS_MSR_BITMAP, vtophys(vmx->msr_bitmap)); error += vmwrite(VMCS_VPID, vpid[i]); + + if (guest_l1d_flush && !guest_l1d_flush_sw) { + vmcs_write(VMCS_ENTRY_MSR_LOAD, pmap_kextract( + (vm_offset_t)&msr_load_list[0])); + vmcs_write(VMCS_ENTRY_MSR_LOAD_COUNT, + nitems(msr_load_list)); + vmcs_write(VMCS_EXIT_MSR_STORE, 0); + vmcs_write(VMCS_EXIT_MSR_STORE_COUNT, 0); + } /* exception bitmap */ if (vcpu_trace_exceptions(vm, i)) Modified: stable/11/sys/amd64/vmm/intel/vmx_support.S ============================================================================== --- stable/11/sys/amd64/vmm/intel/vmx_support.S Sat Sep 1 16:16:40 2018 (r338426) +++ stable/11/sys/amd64/vmm/intel/vmx_support.S Sun Sep 2 10:51:31 2018 (r338427) @@ -176,44 +176,10 @@ ENTRY(vmx_enter_guest) jbe invept_error /* Check invept instruction error */ guest_restore: - - /* - * Flush L1D cache if requested. Use IA32_FLUSH_CMD MSR if available, - * otherwise load enough of the data from the zero_region to flush - * existing L1D content. - */ -#define L1D_FLUSH_SIZE (64 * 1024) movl %edx, %r8d - cmpb $0, guest_l1d_flush(%rip) + cmpb $0, guest_l1d_flush_sw(%rip) je after_l1d - movq vmx_msr_flush_cmd(%rip), %rax - testq %rax, %rax - jz 1f - movq %rax, %rdx - shrq $32, %rdx - movl $MSR_IA32_FLUSH_CMD, %ecx - wrmsr - jmp after_l1d -1: movq $KERNBASE, %r9 - movq $-L1D_FLUSH_SIZE, %rcx - /* - * pass 1: Preload TLB. - * Kernel text is mapped using superpages. TLB preload is - * done for the benefit of older CPUs which split 2M page - * into 4k TLB entries. - */ -2: movb L1D_FLUSH_SIZE(%r9, %rcx), %al - addq $PAGE_SIZE, %rcx - jne 2b - xorl %eax, %eax - cpuid - movq $-L1D_FLUSH_SIZE, %rcx - /* pass 2: Read each cache line */ -3: movb L1D_FLUSH_SIZE(%r9, %rcx), %al - addq $64, %rcx - jne 3b - lfence -#undef L1D_FLUSH_SIZE + call flush_l1d_sw after_l1d: cmpl $0, %r8d je do_launch From owner-svn-src-all@freebsd.org Sun Sep 2 14:16:11 2018 Return-Path: Delivered-To: svn-src-all@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 F14F9FF086A; Sun, 2 Sep 2018 14:16:10 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5F157A78B; Sun, 2 Sep 2018 14:16:10 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1354) id 9B4D54D2D; Sun, 2 Sep 2018 14:16:10 +0000 (UTC) From: Jan Beich To: Michal Meloun Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r324815 - in head: lib/libc/gen sys/sys References: <201710211206.v9LC6INJ032680@repo.freebsd.org> Date: Sun, 02 Sep 2018 16:16:05 +0200 Message-ID: <5zzo-vvbu-wny@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 14:16:11 -0000 Michal Meloun writes: > Author: mmel > Date: Sat Oct 21 12:06:18 2017 > New Revision: 324815 > URL: https://svnweb.freebsd.org/changeset/base/324815 > > Log: > Make elf_aux_info() as public libc function. > - Teach elf aux vector functions about newly added AT_HWCAP and AT_HWCAP2 > vectors. > - Export _elf_aux_info() as new public libc function elf_aux_info(3) > > The elf_aux_info(3) should be considered as FreeBSD counterpart of glibc > getauxval() with more robust interface. Can you back it out? I've reported sys/auxv.h breaks existing consumers and the function is yet to be documented. 12.0-RELEASE is approaching but there's no fix in sight, and by the time it lands there maybe not enough time to test. http://docs.freebsd.org/cgi/mid.cgi?03a31eff-34e8-be4c-c008-528824fea261 From owner-svn-src-all@freebsd.org Sun Sep 2 15:42:38 2018 Return-Path: Delivered-To: svn-src-all@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 C03EAFF2891; Sun, 2 Sep 2018 15:42:37 +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 793BC7D25A; Sun, 2 Sep 2018 15:42:37 +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 743211B49B; Sun, 2 Sep 2018 15:42:37 +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 w82Fgb0K064455; Sun, 2 Sep 2018 15:42:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w82FgbKD064454; Sun, 2 Sep 2018 15:42:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809021542.w82FgbKD064454@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 2 Sep 2018 15:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338428 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 338428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 15:42:38 -0000 Author: kib Date: Sun Sep 2 15:42:37 2018 New Revision: 338428 URL: https://svnweb.freebsd.org/changeset/base/338428 Log: Style cleanup. No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 3 days Approved by: re (rgrimes) Modified: head/libexec/rtld-elf/libmap.c Modified: head/libexec/rtld-elf/libmap.c ============================================================================== --- head/libexec/rtld-elf/libmap.c Sun Sep 2 10:51:31 2018 (r338427) +++ head/libexec/rtld-elf/libmap.c Sun Sep 2 15:42:37 2018 (r338428) @@ -99,10 +99,10 @@ static void lmc_parse_file(char *path) { struct lmc *p; + char *lm_map; struct stat st; ssize_t retval; int fd; - char *lm_map; TAILQ_FOREACH(p, &lmc_head, next) { if (strcmp(p->path, path) == 0) @@ -222,17 +222,20 @@ lmc_parse(char *lm_p, size_t lm_len) t = f = c = NULL; /* Skip over leading space */ - while (rtld_isspace(*cp)) cp++; + while (rtld_isspace(*cp)) + cp++; /* Found a comment or EOL */ - if (iseol(*cp)) continue; + if (iseol(*cp)) + continue; /* Found a constraint selector */ if (*cp == '[') { cp++; /* Skip leading space */ - while (rtld_isspace(*cp)) cp++; + while (rtld_isspace(*cp)) + cp++; /* Found comment, EOL or end of selector */ if (iseol(*cp) || *cp == ']') @@ -244,10 +247,12 @@ lmc_parse(char *lm_p, size_t lm_len) cp++; /* Skip and zero out trailing space */ - while (rtld_isspace(*cp)) *cp++ = '\0'; + while (rtld_isspace(*cp)) + *cp++ = '\0'; /* Check if there is a closing brace */ - if (*cp != ']') continue; + if (*cp != ']') + continue; /* Terminate string if there was no trailing space */ *cp++ = '\0'; @@ -256,8 +261,10 @@ lmc_parse(char *lm_p, size_t lm_len) * There should be nothing except whitespace or comment from this point to the end of the line. */ - while(rtld_isspace(*cp)) cp++; - if (!iseol(*cp)) continue; + while (rtld_isspace(*cp)) + cp++; + if (!iseol(*cp)) + continue; if (strlcpy(prog, c, sizeof prog) >= sizeof prog) continue; @@ -267,23 +274,29 @@ lmc_parse(char *lm_p, size_t lm_len) /* Parse the 'from' candidate. */ f = cp++; - while (!rtld_isspace(*cp) && !iseol(*cp)) cp++; + while (!rtld_isspace(*cp) && !iseol(*cp)) + cp++; /* Skip and zero out the trailing whitespace */ - while (rtld_isspace(*cp)) *cp++ = '\0'; + while (rtld_isspace(*cp)) + *cp++ = '\0'; /* Found a comment or EOL */ - if (iseol(*cp)) continue; + if (iseol(*cp)) + continue; /* Parse 'to' mapping */ t = cp++; - while (!rtld_isspace(*cp) && !iseol(*cp)) cp++; + while (!rtld_isspace(*cp) && !iseol(*cp)) + cp++; /* Skip and zero out the trailing whitespace */ - while (rtld_isspace(*cp)) *cp++ = '\0'; + while (rtld_isspace(*cp)) + *cp++ = '\0'; /* Should be no extra tokens at this point */ - if (!iseol(*cp)) continue; + if (!iseol(*cp)) + continue; *cp = '\0'; if (strcmp(f, "includedir") == 0) @@ -296,7 +309,7 @@ lmc_parse(char *lm_p, size_t lm_len) } static void -lm_free (struct lm_list *lml) +lm_free(struct lm_list *lml) { struct lm *lm; @@ -309,11 +322,10 @@ lm_free (struct lm_list *lml) free(lm->t); free(lm); } - return; } void -lm_fini (void) +lm_fini(void) { struct lmp *lmp; struct lmc *p; @@ -334,11 +346,10 @@ lm_fini (void) lm_free(&lmp->lml); free(lmp); } - return; } static void -lm_add (const char *p, const char *f, const char *t) +lm_add(const char *p, const char *f, const char *t) { struct lm_list *lml; struct lm *lm; @@ -359,7 +370,7 @@ lm_add (const char *p, const char *f, const char *t) } char * -lm_find (const char *p, const char *f) +lm_find(const char *p, const char *f) { struct lm_list *lml; char *t; @@ -380,14 +391,15 @@ lm_find (const char *p, const char *f) lml = lmp_find("$DEFAULT$"); if (lml != NULL) return (lml_find(lml, f)); - else - return (NULL); + return (NULL); } -/* Given a libmap translation list and a library name, return the - replacement library, or NULL */ +/* + * Given a libmap translation list and a library name, return the + * replacement library, or NULL. + */ char * -lm_findn (const char *p, const char *f, const int n) +lm_findn(const char *p, const char *f, const int n) { char pathbuf[64], *s, *t; @@ -404,37 +416,43 @@ lm_findn (const char *p, const char *f, const int n) } static char * -lml_find (struct lm_list *lmh, const char *f) +lml_find(struct lm_list *lmh, const char *f) { struct lm *lm; dbg("%s(%p, \"%s\")", __func__, lmh, f); - TAILQ_FOREACH(lm, lmh, lm_link) + TAILQ_FOREACH(lm, lmh, lm_link) { if (strcmp(f, lm->f) == 0) return (lm->t); + } return (NULL); } -/* Given an executable name, return a pointer to the translation list or - NULL if no matches */ +/* + * Given an executable name, return a pointer to the translation list or + * NULL if no matches. + */ static struct lm_list * -lmp_find (const char *n) +lmp_find(const char *n) { struct lmp *lmp; dbg("%s(\"%s\")", __func__, n); - TAILQ_FOREACH(lmp, &lmp_head, lmp_link) + TAILQ_FOREACH(lmp, &lmp_head, lmp_link) { if ((lmp->type == T_EXACT && strcmp(n, lmp->p) == 0) || - (lmp->type == T_DIRECTORY && strncmp(n, lmp->p, strlen(lmp->p)) == 0) || - (lmp->type == T_BASENAME && strcmp(quickbasename(n), lmp->p) == 0)) + (lmp->type == T_DIRECTORY && strncmp(n, lmp->p, + strlen(lmp->p)) == 0) || + (lmp->type == T_BASENAME && strcmp(quickbasename(n), + lmp->p) == 0)) return (&lmp->lml); + } return (NULL); } static struct lm_list * -lmp_init (char *n) +lmp_init(char *n) { struct lmp *lmp; @@ -442,7 +460,7 @@ lmp_init (char *n) lmp = xmalloc(sizeof(struct lmp)); lmp->p = n; - if (n[strlen(n)-1] == '/') + if (n[strlen(n) - 1] == '/') lmp->type = T_DIRECTORY; else if (strchr(n,'/') == NULL) lmp->type = T_BASENAME; @@ -454,15 +472,18 @@ lmp_init (char *n) return (&lmp->lml); } -/* libc basename is overkill. Return a pointer to the character after the - last /, or the original string if there are no slashes. */ +/* + * libc basename is overkill. Return a pointer to the character after + * the last /, or the original string if there are no slashes. + */ static const char * -quickbasename (const char *path) +quickbasename(const char *path) { - const char *p = path; - for (; *path; path++) { + const char *p; + + for (p = path; *path != '\0'; path++) { if (*path == '/') - p = path+1; + p = path + 1; } return (p); } From owner-svn-src-all@freebsd.org Sun Sep 2 15:53:57 2018 Return-Path: Delivered-To: svn-src-all@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 E936FFF2C92; Sun, 2 Sep 2018 15:53:56 +0000 (UTC) (envelope-from brd@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 912267DA15; Sun, 2 Sep 2018 15:53:56 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 865FF1B64C; Sun, 2 Sep 2018 15:53:56 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w82FrubR069959; Sun, 2 Sep 2018 15:53:56 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w82FruQo069958; Sun, 2 Sep 2018 15:53:56 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201809021553.w82FruQo069958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Sun, 2 Sep 2018 15:53:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338429 - head/usr.sbin/periodic X-SVN-Group: head X-SVN-Commit-Author: brd X-SVN-Commit-Paths: head/usr.sbin/periodic X-SVN-Commit-Revision: 338429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 15:53:57 -0000 Author: brd Date: Sun Sep 2 15:53:56 2018 New Revision: 338429 URL: https://svnweb.freebsd.org/changeset/base/338429 Log: Move defaults/periodic.conf back to a config file. Ths prevents etcupdate and mergemaster from deleting it for now. Approved by: re (rgrimes), will (mentor) Differential Revision: https://reviews.freebsd.org/D16975 Modified: head/usr.sbin/periodic/Makefile Modified: head/usr.sbin/periodic/Makefile ============================================================================== --- head/usr.sbin/periodic/Makefile Sun Sep 2 15:42:37 2018 (r338428) +++ head/usr.sbin/periodic/Makefile Sun Sep 2 15:53:56 2018 (r338429) @@ -1,7 +1,7 @@ # $FreeBSD$ -FILES= periodic.conf -FILESDIR= /etc/defaults +CONFS= periodic.conf +CONFSDIR= /etc/defaults SCRIPTS=periodic.sh MAN= periodic.8 From owner-svn-src-all@freebsd.org Sun Sep 2 16:44:51 2018 Return-Path: Delivered-To: svn-src-all@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 D4E74FF3F5B for ; Sun, 2 Sep 2018 16:44:51 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 592B27FB86 for ; Sun, 2 Sep 2018 16:44:51 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-RoutePath: aGlwcGll X-MHO-User: 7ec26eb5-aecf-11e8-a747-09a40681ccbf X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound1.eu.mailhop.org (Halon) with ESMTPSA id 7ec26eb5-aecf-11e8-a747-09a40681ccbf; Sun, 02 Sep 2018 16:44:45 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w82GiinU024923; Sun, 2 Sep 2018 10:44:44 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1535906683.9486.20.camel@freebsd.org> Subject: Re: svn commit: r324815 - in head: lib/libc/gen sys/sys From: Ian Lepore To: Jan Beich , Michal Meloun Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 02 Sep 2018 10:44:43 -0600 In-Reply-To: <5zzo-vvbu-wny@FreeBSD.org> References: <201710211206.v9LC6INJ032680@repo.freebsd.org> <5zzo-vvbu-wny@FreeBSD.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 16:44:52 -0000 On Sun, 2018-09-02 at 16:16 +0200, Jan Beich wrote: > Michal Meloun writes: > > > > > Author: mmel > > Date: Sat Oct 21 12:06:18 2017 > > New Revision: 324815 > > URL: https://svnweb.freebsd.org/changeset/base/324815 > > > > Log: > >   Make elf_aux_info() as public libc function. > >   - Teach elf aux vector functions about newly added AT_HWCAP and > > AT_HWCAP2 > >     vectors. > >   - Export _elf_aux_info() as new public libc function > > elf_aux_info(3) > >    > >   The elf_aux_info(3) should be considered as FreeBSD counterpart > > of glibc > >   getauxval() with more robust interface. > Can you back it out? I've reported sys/auxv.h breaks existing > consumers > and the function is yet to be documented. 12.0-RELEASE is approaching > but there's no fix in sight, and by the time it lands there maybe > not enough time to test. > > http://docs.freebsd.org/cgi/mid.cgi?03a31eff-34e8-be4c-c008-528824fea > 261 > Are you seriously suggesting that freebsd is forbidden to add a system header file of any name it chooses, just because some port's autotools stuff mistakenly assumes the presence of that name implies something linux-specific? If the port is broken, fix it. -- Ian From owner-svn-src-all@freebsd.org Sun Sep 2 17:02:14 2018 Return-Path: Delivered-To: svn-src-all@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 9D14BFF447C; Sun, 2 Sep 2018 17:02:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 57E648029E; Sun, 2 Sep 2018 17:02:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5303E1C193; Sun, 2 Sep 2018 17:02:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w82H2EBT005134; Sun, 2 Sep 2018 17:02:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w82H2EqG005133; Sun, 2 Sep 2018 17:02:14 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809021702.w82H2EqG005133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 2 Sep 2018 17:02:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338430 - head/sys/cddl/dev/fbt X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/cddl/dev/fbt X-SVN-Commit-Revision: 338430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 17:02:14 -0000 Author: markj Date: Sun Sep 2 17:02:13 2018 New Revision: 338430 URL: https://svnweb.freebsd.org/changeset/base/338430 Log: Fix the hash table lookup in fbt_destroy(). Reported and tested by: pho Approved by: re (kib) X-MFC with: r338359 Modified: head/sys/cddl/dev/fbt/fbt.c Modified: head/sys/cddl/dev/fbt/fbt.c ============================================================================== --- head/sys/cddl/dev/fbt/fbt.c Sun Sep 2 15:53:56 2018 (r338429) +++ head/sys/cddl/dev/fbt/fbt.c Sun Sep 2 17:02:13 2018 (r338430) @@ -212,7 +212,7 @@ fbt_destroy_one(fbt_probe_t *fbt) ndx = FBT_ADDR2NDX(fbt->fbtp_patchpoint); for (hash = fbt_probetab[ndx], hashprev = NULL; hash != NULL; - hash = hash->fbtp_hashnext, hashprev = hash) { + hashprev = hash, hash = hash->fbtp_hashnext) { if (hash == fbt) { if ((next = fbt->fbtp_tracenext) != NULL) next->fbtp_hashnext = hash->fbtp_hashnext; From owner-svn-src-all@freebsd.org Sun Sep 2 18:29:39 2018 Return-Path: Delivered-To: svn-src-all@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 C1C25FF5ED4; Sun, 2 Sep 2018 18:29:39 +0000 (UTC) (envelope-from alc@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 7B181825B1; Sun, 2 Sep 2018 18:29:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 5BF151CE87; Sun, 2 Sep 2018 18:29:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w82ITdxi047688; Sun, 2 Sep 2018 18:29:39 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w82ITdvi047687; Sun, 2 Sep 2018 18:29:39 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201809021829.w82ITdvi047687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 2 Sep 2018 18:29:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338431 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 338431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 18:29:39 -0000 Author: alc Date: Sun Sep 2 18:29:38 2018 New Revision: 338431 URL: https://svnweb.freebsd.org/changeset/base/338431 Log: Recent changes have created, for the first time, physical memory segments that can be coalesced. To be clear, fragmentation of phys_avail[] is not the cause. This fragmentation of vm_phys_segs[] arises from the "special" calls to vm_phys_add_seg(), in other words, not those that derive directly from phys_avail[], but those that we create for the initial kernel page table pages and now for the kernel and modules loaded at boot time. Since we sometimes iterate over the physical memory segments, coalescing these segments at initialization time is a worthwhile change. Reviewed by: kib, markj Approved by: re (rgrimes) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D16976 Modified: head/sys/vm/vm_phys.c Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Sun Sep 2 17:02:13 2018 (r338430) +++ head/sys/vm/vm_phys.c Sun Sep 2 18:29:38 2018 (r338431) @@ -460,7 +460,7 @@ void vm_phys_init(void) { struct vm_freelist *fl; - struct vm_phys_seg *seg; + struct vm_phys_seg *end_seg, *prev_seg, *seg, *tmp_seg; u_long npages; int dom, flind, freelist, oind, pind, segind; @@ -544,6 +544,29 @@ vm_phys_init(void) ("vm_phys_init: DEFAULT flind < 0")); } seg->free_queues = &vm_phys_free_queues[seg->domain][flind]; + } + + /* + * Coalesce physical memory segments that are contiguous and share the + * same per-domain free queues. + */ + prev_seg = vm_phys_segs; + seg = &vm_phys_segs[1]; + end_seg = &vm_phys_segs[vm_phys_nsegs]; + while (seg < end_seg) { + if (prev_seg->end == seg->start && + prev_seg->free_queues == seg->free_queues) { + prev_seg->end = seg->end; + KASSERT(prev_seg->domain == seg->domain, + ("vm_phys_init: free queues cannot span domains")); + vm_phys_nsegs--; + end_seg--; + for (tmp_seg = seg; tmp_seg < end_seg; tmp_seg++) + *tmp_seg = *(tmp_seg + 1); + } else { + prev_seg = seg; + seg++; + } } /* From owner-svn-src-all@freebsd.org Sun Sep 2 18:40:19 2018 Return-Path: Delivered-To: svn-src-all@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 317A9FF66A5; Sun, 2 Sep 2018 18:40:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E14AF82CAF; Sun, 2 Sep 2018 18:40:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D82B61D03D; Sun, 2 Sep 2018 18:40:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w82IeIq3052732; Sun, 2 Sep 2018 18:40:18 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w82IeIAL052731; Sun, 2 Sep 2018 18:40:18 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201809021840.w82IeIAL052731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 2 Sep 2018 18:40:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338432 - head/usr.sbin/efibootmgr X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.sbin/efibootmgr X-SVN-Commit-Revision: 338432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 18:40:19 -0000 Author: imp Date: Sun Sep 2 18:40:18 2018 New Revision: 338432 URL: https://svnweb.freebsd.org/changeset/base/338432 Log: Make -a (to make the entry active) apply to creation of a new boot variable. Approved by: re@ (rgrimes) PR: 231013 Differential Revision: https://reviews.freebsd.org/D16977 Modified: head/usr.sbin/efibootmgr/efibootmgr.c Modified: head/usr.sbin/efibootmgr/efibootmgr.c ============================================================================== --- head/usr.sbin/efibootmgr/efibootmgr.c Sun Sep 2 18:29:38 2018 (r338431) +++ head/usr.sbin/efibootmgr/efibootmgr.c Sun Sep 2 18:40:18 2018 (r338432) @@ -622,7 +622,7 @@ create_loadopt(uint8_t *buf, size_t bufmax, uint32_t a static int make_boot_var(const char *label, const char *loader, const char *kernel, const char *env, bool dry_run, - int bootnum) + int bootnum, bool activate) { struct entry *new_ent; uint32_t load_attrs = 0; @@ -665,6 +665,8 @@ make_boot_var(const char *label, const char *loader, c /* don't make the new bootvar active by default, use the -a option later */ load_attrs = LOAD_OPTION_CATEGORY_BOOT; + if (activate) + load_attrs |= LOAD_OPTION_ACTIVE; load_opt_buf = malloc(MAX_LOADOPT_LEN); if (load_opt_buf == NULL) err(1, "malloc"); @@ -915,7 +917,7 @@ main(int argc, char *argv[]) */ make_boot_var(opts.label ? opts.label : "", opts.loader, opts.kernel, opts.env, opts.dry_run, - opts.has_bootnum ? opts.bootnum : -1); + opts.has_bootnum ? opts.bootnum : -1, opts.set_active); else if (opts.set_active || opts.set_inactive ) handle_activity(opts.bootnum, opts.set_active); else if (opts.order != NULL) From owner-svn-src-all@freebsd.org Sun Sep 2 19:48:43 2018 Return-Path: Delivered-To: svn-src-all@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 017B1FF8135; Sun, 2 Sep 2018 19:48:43 +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 A08D284C92; Sun, 2 Sep 2018 19:48:42 +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 95C981DB77; Sun, 2 Sep 2018 19:48:42 +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 w82JmglW089148; Sun, 2 Sep 2018 19:48:42 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w82JmgT1089146; Sun, 2 Sep 2018 19:48:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809021948.w82JmgT1089146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 2 Sep 2018 19:48:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338433 - in head/sys: amd64/include dev/efidev X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/include dev/efidev X-SVN-Commit-Revision: 338433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 19:48:43 -0000 Author: kib Date: Sun Sep 2 19:48:41 2018 New Revision: 338433 URL: https://svnweb.freebsd.org/changeset/base/338433 Log: Normalize use of semicolon with EFI_TIME_LOCK macros. Reviewed by: kevans Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (rgrimes) Differential revision: https://reviews.freebsd.org/D16972 Modified: head/sys/amd64/include/efi.h head/sys/dev/efidev/efirt.c Modified: head/sys/amd64/include/efi.h ============================================================================== --- head/sys/amd64/include/efi.h Sun Sep 2 18:40:18 2018 (r338432) +++ head/sys/amd64/include/efi.h Sun Sep 2 19:48:41 2018 (r338433) @@ -48,9 +48,9 @@ #ifdef _KERNEL #include -#define EFI_TIME_LOCK() mtx_lock(&atrtc_time_lock); -#define EFI_TIME_UNLOCK() mtx_unlock(&atrtc_time_lock); -#define EFI_TIME_OWNED() mtx_assert(&atrtc_time_lock, MA_OWNED); +#define EFI_TIME_LOCK() mtx_lock(&atrtc_time_lock) +#define EFI_TIME_UNLOCK() mtx_unlock(&atrtc_time_lock) +#define EFI_TIME_OWNED() mtx_assert(&atrtc_time_lock, MA_OWNED) #endif #endif /* __AMD64_INCLUDE_EFI_H_ */ Modified: head/sys/dev/efidev/efirt.c ============================================================================== --- head/sys/dev/efidev/efirt.c Sun Sep 2 18:40:18 2018 (r338432) +++ head/sys/dev/efidev/efirt.c Sun Sep 2 19:48:41 2018 (r338433) @@ -299,7 +299,7 @@ efi_get_time_locked(struct efi_tm *tm, struct efi_tmca efi_status status; int error; - EFI_TIME_OWNED() + EFI_TIME_OWNED(); error = efi_enter(); if (error != 0) return (error); @@ -317,7 +317,7 @@ efi_get_time(struct efi_tm *tm) if (efi_runtime == NULL) return (ENXIO); - EFI_TIME_LOCK() + EFI_TIME_LOCK(); /* * UEFI spec states that the Capabilities argument to GetTime is * optional, but some UEFI implementations choke when passed a NULL @@ -325,7 +325,7 @@ efi_get_time(struct efi_tm *tm) * to workaround such implementations. */ error = efi_get_time_locked(tm, &dummy); - EFI_TIME_UNLOCK() + EFI_TIME_UNLOCK(); return (error); } @@ -337,9 +337,9 @@ efi_get_time_capabilities(struct efi_tmcap *tmcap) if (efi_runtime == NULL) return (ENXIO); - EFI_TIME_LOCK() + EFI_TIME_LOCK(); error = efi_get_time_locked(&dummy, tmcap); - EFI_TIME_UNLOCK() + EFI_TIME_UNLOCK(); return (error); } @@ -379,9 +379,9 @@ efi_set_time(struct efi_tm *tm) if (efi_runtime == NULL) return (ENXIO); - EFI_TIME_LOCK() + EFI_TIME_LOCK(); error = efi_set_time_locked(tm); - EFI_TIME_UNLOCK() + EFI_TIME_UNLOCK(); return (error); } From owner-svn-src-all@freebsd.org Sun Sep 2 20:07:37 2018 Return-Path: Delivered-To: svn-src-all@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 84A1BFF880F; Sun, 2 Sep 2018 20:07:37 +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 3ACED85808; Sun, 2 Sep 2018 20:07:37 +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 2D53C1DEC6; Sun, 2 Sep 2018 20:07:37 +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 w82K7aYn099274; Sun, 2 Sep 2018 20:07:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w82K7alM099273; Sun, 2 Sep 2018 20:07:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809022007.w82K7alM099273@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 2 Sep 2018 20:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338434 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 338434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 20:07:37 -0000 Author: kib Date: Sun Sep 2 20:07:36 2018 New Revision: 338434 URL: https://svnweb.freebsd.org/changeset/base/338434 Log: Swap order of dererencing PCPU curpmap and checking for usermode in trap_pfault() KPTI violation check. EFI RT may set curpmap to NULL for the duration of the call for some machines (PCID but no INVPCID). Since apparently EFI RT code must be ready for exceptions from the calls, avoid dereferencing curpmap until we know that this call does not come from usermode. Reviewed by: kevans Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (rgrimes) Differential revision: https://reviews.freebsd.org/D16972 Modified: head/sys/amd64/amd64/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Sun Sep 2 19:48:41 2018 (r338433) +++ head/sys/amd64/amd64/trap.c Sun Sep 2 20:07:36 2018 (r338434) @@ -806,7 +806,7 @@ trap_pfault(struct trapframe *frame, int usermode) * If nx protection of the usermode portion of kernel page * tables caused trap, panic. */ - if (PCPU_GET(curpmap)->pm_ucr3 != PMAP_NO_CR3 && usermode && + if (usermode && PCPU_GET(curpmap)->pm_ucr3 != PMAP_NO_CR3 && pg_nx != 0 && (frame->tf_err & (PGEX_P | PGEX_W | PGEX_U | PGEX_I)) == (PGEX_P | PGEX_U | PGEX_I) && (curpcb->pcb_saved_ucr3 & ~CR3_PCID_MASK)== From owner-svn-src-all@freebsd.org Sun Sep 2 20:17:53 2018 Return-Path: Delivered-To: svn-src-all@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 009A5FF8B95; Sun, 2 Sep 2018 20:17:52 +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 A9DCC85EB6; Sun, 2 Sep 2018 20:17:52 +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 A0B691E06B; Sun, 2 Sep 2018 20:17:52 +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 w82KHqVZ004646; Sun, 2 Sep 2018 20:17:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w82KHqwb004644; Sun, 2 Sep 2018 20:17:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809022017.w82KHqwb004644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 2 Sep 2018 20:17:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338435 - in head/sys: dev/efidev kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: dev/efidev kern X-SVN-Commit-Revision: 338435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 20:17:53 -0000 Author: kib Date: Sun Sep 2 20:17:51 2018 New Revision: 338435 URL: https://svnweb.freebsd.org/changeset/base/338435 Log: Improve error messages from clock_if.m method failures. Print error message in verbose mode when CLOCK_SETTIME() clock_if.m method failed. For EFIRT RTC clock, add error code for the failure of CLOCK_GETTIME() report. Reviewed by: kevans Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (rgrimes) Differential revision: https://reviews.freebsd.org/D16972 Modified: head/sys/dev/efidev/efirtc.c head/sys/kern/subr_rtc.c Modified: head/sys/dev/efidev/efirtc.c ============================================================================== --- head/sys/dev/efidev/efirtc.c Sun Sep 2 20:07:36 2018 (r338434) +++ head/sys/dev/efidev/efirtc.c Sun Sep 2 20:17:51 2018 (r338435) @@ -74,7 +74,8 @@ efirtc_probe(device_t dev) */ if ((error = efi_get_time(&tm)) != 0) { if (bootverbose) - device_printf(dev, "cannot read EFI realtime clock\n"); + device_printf(dev, "cannot read EFI realtime clock, " + "error %d\n", error); return (error); } device_set_desc(dev, "EFI Realtime Clock"); Modified: head/sys/kern/subr_rtc.c ============================================================================== --- head/sys/kern/subr_rtc.c Sun Sep 2 20:07:36 2018 (r338434) +++ head/sys/kern/subr_rtc.c Sun Sep 2 20:17:51 2018 (r338435) @@ -138,6 +138,7 @@ settime_task_func(void *arg, int pending) { struct timespec ts; struct rtc_instance *rtc; + int error; rtc = arg; if (!(rtc->flags & CLOCKF_SETTIME_NO_TS)) { @@ -150,7 +151,9 @@ settime_task_func(void *arg, int pending) ts.tv_sec = 0; ts.tv_nsec = 0; } - CLOCK_SETTIME(rtc->clockdev, &ts); + error = CLOCK_SETTIME(rtc->clockdev, &ts); + if (error != 0 && bootverbose) + device_printf(rtc->clockdev, "CLOCK_SETTIME error %d\n", error); } static void From owner-svn-src-all@freebsd.org Sun Sep 2 21:16:44 2018 Return-Path: Delivered-To: svn-src-all@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 944EDFFAB37; Sun, 2 Sep 2018 21:16: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 5183A88FEF; Sun, 2 Sep 2018 21:16: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 4C8EF1EA21; Sun, 2 Sep 2018 21:16: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 w82LGiWm035828; Sun, 2 Sep 2018 21:16:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w82LGht4035827; Sun, 2 Sep 2018 21:16:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809022116.w82LGht4035827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 2 Sep 2018 21:16:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338436 - in head/sys: amd64/include kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/include kern X-SVN-Commit-Revision: 338436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 21:16:44 -0000 Author: kib Date: Sun Sep 2 21:16:43 2018 New Revision: 338436 URL: https://svnweb.freebsd.org/changeset/base/338436 Log: Add amd64 mdthread fields needed for the upcoming EFI RT exception handling. This is split into a separate commit from the main change to make it easier to handle possible revert after upcoming KBI freeze. Reviewed by: kevans Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (rgrimes) Differential revision: https://reviews.freebsd.org/D16972 Modified: head/sys/amd64/include/proc.h head/sys/kern/kern_thread.c Modified: head/sys/amd64/include/proc.h ============================================================================== --- head/sys/amd64/include/proc.h Sun Sep 2 20:17:51 2018 (r338435) +++ head/sys/amd64/include/proc.h Sun Sep 2 21:16:43 2018 (r338436) @@ -62,6 +62,8 @@ struct mdthread { register_t md_saved_flags; /* (k) */ register_t md_spurflt_addr; /* (k) Spurious page fault address. */ struct pmap_invl_gen md_invl_gen; + register_t md_efirt_tmp; /* (k) */ + int md_efirt_dis_pf; /* (k) */ }; struct mdproc { Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sun Sep 2 20:17:51 2018 (r338435) +++ head/sys/kern/kern_thread.c Sun Sep 2 21:16:43 2018 (r338436) @@ -83,7 +83,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == 0 "struct thread KBI td_pflags"); _Static_assert(offsetof(struct thread, td_frame) == 0x470, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x518, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x528, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0xb0, "struct proc KBI p_flag"); From owner-svn-src-all@freebsd.org Sun Sep 2 21:37:08 2018 Return-Path: Delivered-To: svn-src-all@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 EBAF2FFB082; Sun, 2 Sep 2018 21:37:07 +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 A908689930; Sun, 2 Sep 2018 21:37:07 +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 9F6631ED6C; Sun, 2 Sep 2018 21:37:07 +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 w82Lb7xl046201; Sun, 2 Sep 2018 21:37:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w82Lb5FK046191; Sun, 2 Sep 2018 21:37:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809022137.w82Lb5FK046191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 2 Sep 2018 21:37:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338437 - in head/sys: amd64/amd64 amd64/include arm64/arm64 arm64/include conf dev/efidev modules/efirt sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include arm64/arm64 arm64/include conf dev/efidev modules/efirt sys X-SVN-Commit-Revision: 338437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 21:37:08 -0000 Author: kib Date: Sun Sep 2 21:37:05 2018 New Revision: 338437 URL: https://svnweb.freebsd.org/changeset/base/338437 Log: Catch exceptions during EFI RT calls on amd64. This appeared to be required to have EFI RT support and EFI RTC enabled by default, because there are too many reports of faulting calls on many different machines. The knob is added to leave the exceptions unhandled to allow to debug the actual bugs. Reviewed by: kevans Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (rgrimes) Differential revision: https://reviews.freebsd.org/D16972 Added: head/sys/amd64/amd64/efirt_support.S (contents, props changed) Modified: head/sys/amd64/amd64/efirt_machdep.c head/sys/amd64/amd64/genassym.c head/sys/amd64/include/efi.h head/sys/arm64/arm64/efirt_machdep.c head/sys/arm64/include/efi.h head/sys/conf/files.amd64 head/sys/dev/efidev/efirt.c head/sys/modules/efirt/Makefile head/sys/sys/efi.h Modified: head/sys/amd64/amd64/efirt_machdep.c ============================================================================== --- head/sys/amd64/amd64/efirt_machdep.c Sun Sep 2 21:16:43 2018 (r338436) +++ head/sys/amd64/amd64/efirt_machdep.c Sun Sep 2 21:37:05 2018 (r338437) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -266,6 +267,7 @@ efi_arch_enter(void) curpmap = PCPU_GET(curpmap); PMAP_LOCK_ASSERT(curpmap, MA_OWNED); + curthread->td_md.md_efirt_dis_pf = vm_fault_disable_pagefaults(); /* * IPI TLB shootdown handler invltlb_pcid_handler() reloads @@ -300,6 +302,7 @@ efi_arch_leave(void) curpmap->pm_pcids[PCPU_GET(cpuid)].pm_pcid : 0)); if (!pmap_pcid_enabled) invltlb(); + vm_fault_enable_pagefaults(curthread->td_md.md_efirt_dis_pf); } /* XXX debug stuff */ Added: head/sys/amd64/amd64/efirt_support.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/amd64/efirt_support.S Sun Sep 2 21:37:05 2018 (r338437) @@ -0,0 +1,116 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 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$ + */ + +#include + +#include "assym.inc" + + .text +ENTRY(efi_rt_arch_call) + pushq %rbp + movq %rsp, %rbp + + movq %rbx, EC_RBX(%rdi) + movq %rsp, EC_RSP(%rdi) + movq %rbp, EC_RBP(%rdi) + movq %r12, EC_R12(%rdi) + movq %r13, EC_R13(%rdi) + movq %r14, EC_R14(%rdi) + movq %r15, EC_R15(%rdi) + movq PCPU(CURTHREAD), %rax + movq %rdi, TD_MD+MD_EFIRT_TMP(%rax) + movq PCPU(CURPCB), %rsi + + movl EC_ARGCNT(%rdi), %ecx + movl %ecx, %ebx + movl $4, %eax + cmpl %eax, %ecx + cmovbl %eax, %ecx + shll $3, %ecx + subq %rcx, %rsp + + cmpl $0, %ebx + jz 1f + movq EC_ARG1(%rdi), %rcx + decl %ebx + jz 1f + movq EC_ARG2(%rdi), %rdx + decl %ebx + jz 1f + movq EC_ARG3(%rdi), %r8 + decl %ebx + jz 1f + movq EC_ARG4(%rdi), %r9 + decl %ebx + jz 1f + movq EC_ARG5(%rdi), %rax + movq %rax, 4*8(%rsp) + decl %ebx + jz 1f + movq $efi_rt_panic_str, %rdi + call panic +1: movq EC_FPTR(%rdi), %rax + movq $efi_rt_fault, PCB_ONFAULT(%rsi) + callq *%rax + + movq PCPU(CURTHREAD), %rbx + movq TD_MD+MD_EFIRT_TMP(%rbx), %rdi + movq %rax, EC_EFI_STATUS(%rdi) + movq PCPU(CURPCB), %rsi + xorl %eax, %eax + movq %rax, PCB_ONFAULT(%rsi) + +efi_rt_arch_call_tail: + movq EC_R15(%rdi), %r15 + movq EC_R14(%rdi), %r14 + movq EC_R13(%rdi), %r13 + movq EC_R12(%rdi), %r12 + movq EC_RBP(%rdi), %rbp + movq EC_RSP(%rdi), %rsp + movq EC_RBX(%rdi), %rbx + + popq %rbp + ret +END(efi_rt_arch_call) + +ENTRY(efi_rt_fault) + xorl %eax, %eax + movq PCPU(CURPCB), %rsi + movq %rax, PCB_ONFAULT(%rsi) + movl $EFAULT, %eax + movq PCPU(CURTHREAD), %rbx + movq TD_MD+MD_EFIRT_TMP(%rbx), %rdi + jmp efi_rt_arch_call_tail +END(efi_rt_fault) + +efi_rt_panic_str: .asciz "efi_rt_arch_call: too many args" Modified: head/sys/amd64/amd64/genassym.c ============================================================================== --- head/sys/amd64/amd64/genassym.c Sun Sep 2 21:16:43 2018 (r338436) +++ head/sys/amd64/amd64/genassym.c Sun Sep 2 21:37:05 2018 (r338437) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap)); @@ -77,12 +78,15 @@ ASSYM(P_MD, offsetof(struct proc, p_md)); ASSYM(MD_LDT, offsetof(struct mdproc, md_ldt)); ASSYM(MD_LDT_SD, offsetof(struct mdproc, md_ldt_sd)); +ASSYM(MD_EFIRT_TMP, offsetof(struct mdthread, md_efirt_tmp)); + ASSYM(TD_LOCK, offsetof(struct thread, td_lock)); ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); ASSYM(TD_PFLAGS, offsetof(struct thread, td_pflags)); ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_FRAME, offsetof(struct thread, td_frame)); +ASSYM(TD_MD, offsetof(struct thread, td_md)); ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); @@ -249,3 +253,19 @@ ASSYM(__FreeBSD_version, __FreeBSD_version); #ifdef HWPMC_HOOKS ASSYM(PMC_FN_USER_CALLCHAIN, PMC_FN_USER_CALLCHAIN); #endif + +ASSYM(EC_EFI_STATUS, offsetof(struct efirt_callinfo, ec_efi_status)); +ASSYM(EC_FPTR, offsetof(struct efirt_callinfo, ec_fptr)); +ASSYM(EC_ARGCNT, offsetof(struct efirt_callinfo, ec_argcnt)); +ASSYM(EC_ARG1, offsetof(struct efirt_callinfo, ec_arg1)); +ASSYM(EC_ARG2, offsetof(struct efirt_callinfo, ec_arg2)); +ASSYM(EC_ARG3, offsetof(struct efirt_callinfo, ec_arg3)); +ASSYM(EC_ARG4, offsetof(struct efirt_callinfo, ec_arg4)); +ASSYM(EC_ARG5, offsetof(struct efirt_callinfo, ec_arg5)); +ASSYM(EC_RBX, offsetof(struct efirt_callinfo, ec_rbx)); +ASSYM(EC_RSP, offsetof(struct efirt_callinfo, ec_rsp)); +ASSYM(EC_RBP, offsetof(struct efirt_callinfo, ec_rbp)); +ASSYM(EC_R12, offsetof(struct efirt_callinfo, ec_r12)); +ASSYM(EC_R13, offsetof(struct efirt_callinfo, ec_r13)); +ASSYM(EC_R14, offsetof(struct efirt_callinfo, ec_r14)); +ASSYM(EC_R15, offsetof(struct efirt_callinfo, ec_r15)); Modified: head/sys/amd64/include/efi.h ============================================================================== --- head/sys/amd64/include/efi.h Sun Sep 2 21:16:43 2018 (r338436) +++ head/sys/amd64/include/efi.h Sun Sep 2 21:37:05 2018 (r338437) @@ -51,6 +51,27 @@ #define EFI_TIME_LOCK() mtx_lock(&atrtc_time_lock) #define EFI_TIME_UNLOCK() mtx_unlock(&atrtc_time_lock) #define EFI_TIME_OWNED() mtx_assert(&atrtc_time_lock, MA_OWNED) + +#define EFI_RT_HANDLE_FAULTS_DEFAULT 1 #endif + +struct efirt_callinfo { + const char *ec_name; + register_t ec_efi_status; + register_t ec_fptr; + register_t ec_argcnt; + register_t ec_arg1; + register_t ec_arg2; + register_t ec_arg3; + register_t ec_arg4; + register_t ec_arg5; + register_t ec_rbx; + register_t ec_rsp; + register_t ec_rbp; + register_t ec_r12; + register_t ec_r13; + register_t ec_r14; + register_t ec_r15; +}; #endif /* __AMD64_INCLUDE_EFI_H_ */ Modified: head/sys/arm64/arm64/efirt_machdep.c ============================================================================== --- head/sys/arm64/arm64/efirt_machdep.c Sun Sep 2 21:16:43 2018 (r338436) +++ head/sys/arm64/arm64/efirt_machdep.c Sun Sep 2 21:37:05 2018 (r338437) @@ -268,3 +268,10 @@ efi_arch_leave(void) "isb \n" : : "r"(td->td_proc->p_md.md_l0addr)); } + +int +efi_rt_arch_call(struct efirt_callinfo *ec) +{ + + panic("not implemented"); +} Modified: head/sys/arm64/include/efi.h ============================================================================== --- head/sys/arm64/include/efi.h Sun Sep 2 21:16:43 2018 (r338436) +++ head/sys/arm64/include/efi.h Sun Sep 2 21:37:05 2018 (r338437) @@ -39,6 +39,20 @@ #define EFI_TIME_LOCK() #define EFI_TIME_UNLOCK() #define EFI_TIME_OWNED() + +#define EFI_RT_HANDLE_FAULTS_DEFAULT 0 #endif + +struct efirt_callinfo { + const char *ec_name; + register_t ec_efi_status; + register_t ec_fptr; + register_t ec_argcnt; + register_t ec_arg1; + register_t ec_arg2; + register_t ec_arg3; + register_t ec_arg4; + register_t ec_arg5; +}; #endif /* __ARM64_INCLUDE_EFI_H_ */ Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Sun Sep 2 21:16:43 2018 (r338436) +++ head/sys/conf/files.amd64 Sun Sep 2 21:37:05 2018 (r338437) @@ -134,6 +134,7 @@ amd64/amd64/db_disasm.c optional ddb amd64/amd64/db_interface.c optional ddb amd64/amd64/db_trace.c optional ddb amd64/amd64/efirt_machdep.c optional efirt +amd64/amd64/efirt_support.S optional efirt amd64/amd64/elf_machdep.c standard amd64/amd64/exception.S standard amd64/amd64/fpu.c standard Modified: head/sys/dev/efidev/efirt.c ============================================================================== --- head/sys/dev/efidev/efirt.c Sun Sep 2 21:16:43 2018 (r338436) +++ head/sys/dev/efidev/efirt.c Sun Sep 2 21:37:05 2018 (r338437) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2004 Marcel Moolenaar * Copyright (c) 2001 Doug Rabson - * Copyright (c) 2016 The FreeBSD Foundation + * Copyright (c) 2016, 2018 The FreeBSD Foundation * All rights reserved. * * Portions of this software were developed by Konstantin Belousov @@ -293,22 +293,89 @@ efi_get_table(struct uuid *uuid, void **ptr) return (ENOENT); } +static int efi_rt_handle_faults = EFI_RT_HANDLE_FAULTS_DEFAULT; +SYSCTL_INT(_machdep, OID_AUTO, efi_rt_handle_faults, CTLFLAG_RWTUN, + &efi_rt_handle_faults, 0, + "Call EFI RT methods with fault handler wrapper around"); + static int -efi_get_time_locked(struct efi_tm *tm, struct efi_tmcap *tmcap) +efi_rt_arch_call_nofault(struct efirt_callinfo *ec) { - efi_status status; + + switch (ec->ec_argcnt) { + case 0: + ec->ec_efi_status = ((register_t (*)(void))ec->ec_fptr)(); + break; + case 1: + ec->ec_efi_status = ((register_t (*)(register_t))ec->ec_fptr) + (ec->ec_arg1); + break; + case 2: + ec->ec_efi_status = ((register_t (*)(register_t, register_t)) + ec->ec_fptr)(ec->ec_arg1, ec->ec_arg2); + break; + case 3: + ec->ec_efi_status = ((register_t (*)(register_t, register_t, + register_t))ec->ec_fptr)(ec->ec_arg1, ec->ec_arg2, + ec->ec_arg3); + break; + case 4: + ec->ec_efi_status = ((register_t (*)(register_t, register_t, + register_t, register_t))ec->ec_fptr)(ec->ec_arg1, + ec->ec_arg2, ec->ec_arg3, ec->ec_arg4); + break; + case 5: + ec->ec_efi_status = ((register_t (*)(register_t, register_t, + register_t, register_t, register_t))ec->ec_fptr)( + ec->ec_arg1, ec->ec_arg2, ec->ec_arg3, ec->ec_arg4, + ec->ec_arg5); + break; + default: + panic("efi_rt_arch_call: %d args", (int)ec->ec_argcnt); + } + + return (0); +} + +static int +efi_call(struct efirt_callinfo *ecp) +{ int error; - EFI_TIME_OWNED(); error = efi_enter(); if (error != 0) return (error); - status = efi_runtime->rt_gettime(tm, tmcap); + error = efi_rt_handle_faults ? efi_rt_arch_call(ecp) : + efi_rt_arch_call_nofault(ecp); efi_leave(); - error = efi_status_to_errno(status); + if (error == 0) + error = efi_status_to_errno(ecp->ec_efi_status); + else if (bootverbose) + printf("EFI %s call faulted, error %d\n", ecp->ec_name, error); return (error); } +#define EFI_RT_METHOD_PA(method) \ + ((uintptr_t)((struct efi_rt *)efi_phys_to_kva((uintptr_t) \ + efi_runtime))->method) + +static int +efi_get_time_locked(struct efi_tm *tm, struct efi_tmcap *tmcap) +{ + struct efirt_callinfo ec; + + EFI_TIME_OWNED(); + if (efi_runtime == NULL) + return (ENXIO); + bzero(&ec, sizeof(ec)); + ec.ec_name = "rt_gettime"; + ec.ec_argcnt = 2; + ec.ec_arg1 = (uintptr_t)tm; + ec.ec_arg2 = (uintptr_t)tmcap; + ec.ec_fptr = EFI_RT_METHOD_PA(rt_gettime); + return (efi_call(&ec)); +} + int efi_get_time(struct efi_tm *tm) { @@ -346,30 +413,35 @@ efi_get_time_capabilities(struct efi_tmcap *tmcap) int efi_reset_system(void) { - int error; + struct efirt_callinfo ec; - error = efi_enter(); - if (error != 0) - return (error); - efi_runtime->rt_reset(EFI_RESET_WARM, 0, 0, NULL); - efi_leave(); - return (EIO); + if (efi_runtime == NULL) + return (ENXIO); + bzero(&ec, sizeof(ec)); + ec.ec_name = "rt_reset"; + ec.ec_argcnt = 4; + ec.ec_arg1 = (uintptr_t)EFI_RESET_WARM; + ec.ec_arg1 = (uintptr_t)0; + ec.ec_arg1 = (uintptr_t)0; + ec.ec_arg1 = (uintptr_t)NULL; + ec.ec_fptr = EFI_RT_METHOD_PA(rt_reset); + return (efi_call(&ec)); } static int efi_set_time_locked(struct efi_tm *tm) { - efi_status status; - int error; + struct efirt_callinfo ec; EFI_TIME_OWNED(); - error = efi_enter(); - if (error != 0) - return (error); - status = efi_runtime->rt_settime(tm); - efi_leave(); - error = efi_status_to_errno(status); - return (error); + if (efi_runtime == NULL) + return (ENXIO); + bzero(&ec, sizeof(ec)); + ec.ec_name = "rt_settime"; + ec.ec_argcnt = 1; + ec.ec_arg1 = (uintptr_t)tm; + ec.ec_fptr = EFI_RT_METHOD_PA(rt_settime); + return (efi_call(&ec)); } int @@ -389,47 +461,57 @@ int efi_var_get(efi_char *name, struct uuid *vendor, uint32_t *attrib, size_t *datasize, void *data) { - efi_status status; - int error; + struct efirt_callinfo ec; - error = efi_enter(); - if (error != 0) - return (error); - status = efi_runtime->rt_getvar(name, vendor, attrib, datasize, data); - efi_leave(); - error = efi_status_to_errno(status); - return (error); + if (efi_runtime == NULL) + return (ENXIO); + bzero(&ec, sizeof(ec)); + ec.ec_argcnt = 5; + ec.ec_name = "rt_getvar"; + ec.ec_arg1 = (uintptr_t)name; + ec.ec_arg2 = (uintptr_t)vendor; + ec.ec_arg3 = (uintptr_t)attrib; + ec.ec_arg4 = (uintptr_t)datasize; + ec.ec_arg5 = (uintptr_t)data; + ec.ec_fptr = EFI_RT_METHOD_PA(rt_getvar); + return (efi_call(&ec)); } int efi_var_nextname(size_t *namesize, efi_char *name, struct uuid *vendor) { - efi_status status; - int error; + struct efirt_callinfo ec; - error = efi_enter(); - if (error != 0) - return (error); - status = efi_runtime->rt_scanvar(namesize, name, vendor); - efi_leave(); - error = efi_status_to_errno(status); - return (error); + if (efi_runtime == NULL) + return (ENXIO); + bzero(&ec, sizeof(ec)); + ec.ec_argcnt = 3; + ec.ec_name = "rt_scanvar"; + ec.ec_arg1 = (uintptr_t)namesize; + ec.ec_arg2 = (uintptr_t)name; + ec.ec_arg3 = (uintptr_t)vendor; + ec.ec_fptr = EFI_RT_METHOD_PA(rt_scanvar); + return (efi_call(&ec)); } int efi_var_set(efi_char *name, struct uuid *vendor, uint32_t attrib, size_t datasize, void *data) { - efi_status status; - int error; + struct efirt_callinfo ec; - error = efi_enter(); - if (error != 0) - return (error); - status = efi_runtime->rt_setvar(name, vendor, attrib, datasize, data); - efi_leave(); - error = efi_status_to_errno(status); - return (error); + if (efi_runtime == NULL) + return (ENXIO); + bzero(&ec, sizeof(ec)); + ec.ec_argcnt = 5; + ec.ec_name = "rt_setvar"; + ec.ec_arg1 = (uintptr_t)name; + ec.ec_arg2 = (uintptr_t)vendor; + ec.ec_arg3 = (uintptr_t)attrib; + ec.ec_arg4 = (uintptr_t)datasize; + ec.ec_arg5 = (uintptr_t)data; + ec.ec_fptr = EFI_RT_METHOD_PA(rt_setvar); + return (efi_call(&ec)); } static int Modified: head/sys/modules/efirt/Makefile ============================================================================== --- head/sys/modules/efirt/Makefile Sun Sep 2 21:16:43 2018 (r338436) +++ head/sys/modules/efirt/Makefile Sun Sep 2 21:37:05 2018 (r338437) @@ -8,4 +8,11 @@ SRCS= efirt.c efirt_machdep.c efidev.c SRCS+= efirtc.c SRCS+= device_if.h bus_if.h clock_if.h +.if ${MACHINE_CPUARCH} == "amd64" +SRCS+= efirt_support.S +efirt_support.o: efirt_support.S assym.inc + ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ + ${.IMPSRC} -o ${.TARGET} +.endif + .include Modified: head/sys/sys/efi.h ============================================================================== --- head/sys/sys/efi.h Sun Sep 2 21:16:43 2018 (r338436) +++ head/sys/sys/efi.h Sun Sep 2 21:37:05 2018 (r338437) @@ -169,10 +169,13 @@ struct efi_systbl { extern vm_paddr_t efi_systbl_phys; +struct efirt_callinfo; + /* Internal MD EFI functions */ int efi_arch_enter(void); void efi_arch_leave(void); vm_offset_t efi_phys_to_kva(vm_paddr_t); +int efi_rt_arch_call(struct efirt_callinfo *); bool efi_create_1t1_map(struct efi_md *, int, int); void efi_destroy_1t1_map(void); From owner-svn-src-all@freebsd.org Mon Sep 3 03:23:10 2018 Return-Path: Delivered-To: svn-src-all@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 92860FD50D5; Mon, 3 Sep 2018 03:23:10 +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 477E672A6A; Mon, 3 Sep 2018 03:23:10 +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 426E722611; Mon, 3 Sep 2018 03:23:10 +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 w833NAXd028687; Mon, 3 Sep 2018 03:23:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w833NAFC028686; Mon, 3 Sep 2018 03:23:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201809030323.w833NAFC028686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 3 Sep 2018 03:23:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338438 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 338438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 03:23:10 -0000 Author: kevans Date: Mon Sep 3 03:23:09 2018 New Revision: 338438 URL: https://svnweb.freebsd.org/changeset/base/338438 Log: lualoader: Handle comma-separated kernels as well The format for kernels is documented as being space-delimited, but forthloader was more lenient on this and so people began to depend on it. A later pass will be made to document all of the fun features that forthloader allowed that may not be immediately obvious. Reported by: mmacy Approved by: re (kib) Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Sun Sep 2 21:37:05 2018 (r338437) +++ head/stand/lua/core.lua Mon Sep 3 03:23:09 2018 (r338438) @@ -185,7 +185,7 @@ function core.kernelList() end if v ~= nil then - for n in v:gmatch("([^; ]+)[; ]?") do + for n in v:gmatch("([^;, ]+)[;, ]?") do if unique[n] == nil then i = i + 1 kernels[i] = n From owner-svn-src-all@freebsd.org Mon Sep 3 06:36:29 2018 Return-Path: Delivered-To: svn-src-all@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 56C1AFDFAF5; Mon, 3 Sep 2018 06:36:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 111EC773BB; Mon, 3 Sep 2018 06:36:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07BF22452B; Mon, 3 Sep 2018 06:36:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w836aSXJ025632; Mon, 3 Sep 2018 06:36:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w836aSfx025630; Mon, 3 Sep 2018 06:36:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201809030636.w836aSfx025630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 3 Sep 2018 06:36: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: r338439 - in stable/11/usr.bin/diff: . tests X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/11/usr.bin/diff: . tests X-SVN-Commit-Revision: 338439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 06:36:29 -0000 Author: delphij Date: Mon Sep 3 06:36:28 2018 New Revision: 338439 URL: https://svnweb.freebsd.org/changeset/base/338439 Log: MFC r336754: Improve --strip-trailing-cr handling. Modified: stable/11/usr.bin/diff/diffreg.c stable/11/usr.bin/diff/tests/diff_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/diff/diffreg.c ============================================================================== --- stable/11/usr.bin/diff/diffreg.c Mon Sep 3 03:23:09 2018 (r338438) +++ stable/11/usr.bin/diff/diffreg.c Mon Sep 3 06:36:28 2018 (r338439) @@ -792,19 +792,22 @@ check(FILE *f1, FILE *f2, int flags) } ctold++; ctnew++; - if (flags & D_STRIPCR) { + if (flags & D_STRIPCR && (c == '\r' || d == '\r')) { if (c == '\r') { if ((c = getc(f1)) == '\n') { - ctnew++; - break; + ctold++; + } else { + ungetc(c, f1); } } if (d == '\r') { if ((d = getc(f2)) == '\n') { - ctold++; - break; + ctnew++; + } else { + ungetc(d, f2); } } + break; } if ((flags & D_FOLDBLANKS) && isspace(c) && isspace(d)) { Modified: stable/11/usr.bin/diff/tests/diff_test.sh ============================================================================== --- stable/11/usr.bin/diff/tests/diff_test.sh Mon Sep 3 03:23:09 2018 (r338438) +++ stable/11/usr.bin/diff/tests/diff_test.sh Mon Sep 3 06:36:28 2018 (r338439) @@ -8,6 +8,7 @@ atf_test_case ifdef atf_test_case group_format atf_test_case side_by_side atf_test_case brief_format +atf_test_case b230049 simple_body() { @@ -52,6 +53,15 @@ unified_body() diff -u9999 -L input_c1.in -L input_c2.in "$(atf_get_srcdir)/input_c1.in" "$(atf_get_srcdir)/input_c2.in" } +b230049_body() +{ + printf 'a\nb\r\nc\n' > b230049_a.in + printf 'a\r\nb\r\nc\r\n' > b230049_b.in + atf_check -o empty -s eq:0 \ + diff -up --strip-trailing-cr -L b230049_a.in -L b230049_b.in \ + b230049_a.in b230049_b.in +} + header_body() { export TZ=UTC @@ -150,4 +160,5 @@ atf_init_test_cases() atf_add_test_case group_format atf_add_test_case side_by_side atf_add_test_case brief_format + atf_add_test_case b230049 } From owner-svn-src-all@freebsd.org Mon Sep 3 06:55:39 2018 Return-Path: Delivered-To: svn-src-all@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 42602FE0106; Mon, 3 Sep 2018 06:55:39 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 F01A777B6B; Mon, 3 Sep 2018 06:55:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAF872487C; Mon, 3 Sep 2018 06:55:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w836tcxH035685; Mon, 3 Sep 2018 06:55:38 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w836tcQH035684; Mon, 3 Sep 2018 06:55:38 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201809030655.w836tcQH035684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 3 Sep 2018 06:55: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: r338440 - stable/11/usr.sbin/tzsetup X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/usr.sbin/tzsetup X-SVN-Commit-Revision: 338440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 06:55:39 -0000 Author: delphij Date: Mon Sep 3 06:55:38 2018 New Revision: 338440 URL: https://svnweb.freebsd.org/changeset/base/338440 Log: MFC r337522: In read_zones(), check if the file name actually fit in the buffer and make sure it would terminate with nul with strlcpy(). Reviewed by: imp (earlier revision) Differential Revision: https://reviews.freebsd.org/D16595 Modified: stable/11/usr.sbin/tzsetup/tzsetup.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/11/usr.sbin/tzsetup/tzsetup.c Mon Sep 3 06:36:28 2018 (r338439) +++ stable/11/usr.sbin/tzsetup/tzsetup.c Mon Sep 3 06:55:38 2018 (r338440) @@ -481,7 +481,7 @@ read_zones(void) char contbuf[16]; FILE *fp; struct continent *cont; - size_t len; + size_t len, contlen; char *line, *tlc, *file, *descr, *p; int lineno; @@ -504,12 +504,16 @@ read_zones(void) path_zonetab, lineno, tlc); /* coord = */ strsep(&line, "\t"); /* Unused */ file = strsep(&line, "\t"); + /* get continent portion from continent/country */ p = strchr(file, '/'); if (p == NULL) errx(1, "%s:%d: invalid zone name `%s'", path_zonetab, lineno, file); - contbuf[0] = '\0'; - strncat(contbuf, file, p - file); + contlen = p - file + 1; /* trailing nul */ + if (contlen > sizeof(contbuf)) + errx(1, "%s:%d: continent name in zone name `%s' too long", + path_zonetab, lineno, file); + strlcpy(contbuf, file, contlen); cont = find_continent(contbuf); if (!cont) errx(1, "%s:%d: invalid region `%s'", path_zonetab, From owner-svn-src-all@freebsd.org Mon Sep 3 06:57:25 2018 Return-Path: Delivered-To: svn-src-all@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 E06CAFE01B1; Mon, 3 Sep 2018 06:57:25 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 9C90677CCD; Mon, 3 Sep 2018 06:57:25 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9781B24880; Mon, 3 Sep 2018 06:57:25 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w836vPZS035809; Mon, 3 Sep 2018 06:57:25 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w836vPKx035808; Mon, 3 Sep 2018 06:57:25 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201809030657.w836vPKx035808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 3 Sep 2018 06:57:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r338441 - stable/10/usr.sbin/tzsetup X-SVN-Group: stable-10 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/10/usr.sbin/tzsetup X-SVN-Commit-Revision: 338441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 06:57:26 -0000 Author: delphij Date: Mon Sep 3 06:57:25 2018 New Revision: 338441 URL: https://svnweb.freebsd.org/changeset/base/338441 Log: MFC r337522: In read_zones(), check if the file name actually fit in the buffer and make sure it would terminate with nul with strlcpy(). Reviewed by: imp (earlier revision) Differential Revision: https://reviews.freebsd.org/D16595 Modified: stable/10/usr.sbin/tzsetup/tzsetup.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/10/usr.sbin/tzsetup/tzsetup.c Mon Sep 3 06:55:38 2018 (r338440) +++ stable/10/usr.sbin/tzsetup/tzsetup.c Mon Sep 3 06:57:25 2018 (r338441) @@ -481,7 +481,7 @@ read_zones(void) char contbuf[16]; FILE *fp; struct continent *cont; - size_t len; + size_t len, contlen; char *line, *tlc, *file, *descr, *p; int lineno; @@ -504,12 +504,16 @@ read_zones(void) path_zonetab, lineno, tlc); /* coord = */ strsep(&line, "\t"); /* Unused */ file = strsep(&line, "\t"); + /* get continent portion from continent/country */ p = strchr(file, '/'); if (p == NULL) errx(1, "%s:%d: invalid zone name `%s'", path_zonetab, lineno, file); - contbuf[0] = '\0'; - strncat(contbuf, file, p - file); + contlen = p - file + 1; /* trailing nul */ + if (contlen > sizeof(contbuf)) + errx(1, "%s:%d: continent name in zone name `%s' too long", + path_zonetab, lineno, file); + strlcpy(contbuf, file, contlen); cont = find_continent(contbuf); if (!cont) errx(1, "%s:%d: invalid region `%s'", path_zonetab, From owner-svn-src-all@freebsd.org Mon Sep 3 08:57:10 2018 Return-Path: Delivered-To: svn-src-all@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 F0E89FE2FA6; Mon, 3 Sep 2018 08:57:09 +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 B2FD67BCDA; Mon, 3 Sep 2018 08:57:09 +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 A9B6B25BDF; Mon, 3 Sep 2018 08:57:09 +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 w838v9AT097477; Mon, 3 Sep 2018 08:57:09 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w838v9Ip097476; Mon, 3 Sep 2018 08:57:09 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201809030857.w838v9Ip097476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Mon, 3 Sep 2018 08:57:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338442 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 338442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 08:57:10 -0000 Author: kp Date: Mon Sep 3 08:57:09 2018 New Revision: 338442 URL: https://svnweb.freebsd.org/changeset/base/338442 Log: MFC r338406: frag6: Fix fragment reassembly r337776 started hashing the fragments into buckets for faster lookup. The hashkey is larger than intended. This results in random stack data being included in the hashed data, which in turn means that fragments of the same packet might end up in different buckets, causing the reassembly to fail. Set the correct size for hashkey. PR: 231045 Modified: stable/11/sys/netinet6/frag6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/frag6.c ============================================================================== --- stable/11/sys/netinet6/frag6.c Mon Sep 3 06:57:25 2018 (r338441) +++ stable/11/sys/netinet6/frag6.c Mon Sep 3 08:57:09 2018 (r338442) @@ -216,7 +216,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) int offset = *offp, nxt, i, next; int first_frag = 0; int fragoff, frgpartlen; /* must be larger than u_int16_t */ - uint32_t hash, hashkey[sizeof(struct in6_addr) * 2 + 1], *hashkeyp; + uint32_t hashkey[(sizeof(struct in6_addr) * 2 + + sizeof(ip6f->ip6f_ident)) / sizeof(uint32_t)]; + uint32_t hash, *hashkeyp; struct ifnet *dstifp; u_int8_t ecn, ecn0; #ifdef RSS From owner-svn-src-all@freebsd.org Mon Sep 3 14:26:45 2018 Return-Path: Delivered-To: svn-src-all@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 E3590FEB5AB; Mon, 3 Sep 2018 14:26:44 +0000 (UTC) (envelope-from rwatson@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 9340586A17; Mon, 3 Sep 2018 14:26:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 8986C11EE; Mon, 3 Sep 2018 14:26:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w83EQiKx077207; Mon, 3 Sep 2018 14:26:44 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w83EQihF077205; Mon, 3 Sep 2018 14:26:44 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201809031426.w83EQihF077205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Mon, 3 Sep 2018 14:26:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338443 - in head: stand/defaults sys/security/audit X-SVN-Group: head X-SVN-Commit-Author: rwatson X-SVN-Commit-Paths: in head: stand/defaults sys/security/audit X-SVN-Commit-Revision: 338443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 14:26:45 -0000 Author: rwatson Date: Mon Sep 3 14:26:43 2018 New Revision: 338443 URL: https://svnweb.freebsd.org/changeset/base/338443 Log: The kernel DTrace audit provider (dtaudit) relies on auditd(8) to load /etc/security/audit_event to provide a list of audit event-number <-> name mappings. However, this occurs too late for anonymous tracing. With this change, adding 'audit_event_load="YES"' to /boot/loader.conf will cause the boot loader to preload the file, and then the kernel audit code will parse it to register an initial set of audit event-number <-> name mappings. Those mappings can later be updated by auditd(8) if the configuration file changes. Reviewed by: gnn, asomers, markj, allanjude Discussed with: jhb Approved by: re (kib) MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16589 Modified: head/stand/defaults/loader.conf head/sys/security/audit/audit_bsm_db.c Modified: head/stand/defaults/loader.conf ============================================================================== --- head/stand/defaults/loader.conf Mon Sep 3 08:57:09 2018 (r338442) +++ head/stand/defaults/loader.conf Mon Sep 3 14:26:43 2018 (r338443) @@ -67,6 +67,11 @@ acpi_dsdt_name="/boot/acpi_dsdt.aml" # Override DSDT in BIOS by this file acpi_video_load="NO" # Load the ACPI video extension driver +### Audit settings ######################################### +audit_event_load="NO" # Preload audit_event config +audit_event_name="/etc/security/audit_event" +audit_event_type="etc_security_audit_event" + ### Initial memory disk settings ########################### #mdroot_load="YES" # The "mdroot" prefix is arbitrary. #mdroot_type="md_image" # Create md(4) disk at boot. Modified: head/sys/security/audit/audit_bsm_db.c ============================================================================== --- head/sys/security/audit/audit_bsm_db.c Mon Sep 3 08:57:09 2018 (r338442) +++ head/sys/security/audit/audit_bsm_db.c Mon Sep 3 14:26:43 2018 (r338443) @@ -1,6 +1,6 @@ /* * Copyright (c) 1999-2009 Apple Inc. - * Copyright (c) 2005, 2016-2017 Robert N. M. Watson + * Copyright (c) 2005, 2016-2018 Robert N. M. Watson * All rights reserved. * * Portions of this software were developed by BAE Systems, the University of @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -91,6 +92,7 @@ static struct evclass_list evclass_hash[EVCLASSMAP_HAS * struct evname_elem is defined in audit_private.h so that audit_dtrace.c can * use the definition. */ +#define EVNAMEMAP_HASH_TABLE_MODULE "etc_security_audit_event" #define EVNAMEMAP_HASH_TABLE_SIZE 251 struct evname_list { LIST_HEAD(, evname_elem) enl_head; @@ -261,6 +263,85 @@ au_evnamemap_insert(au_event_t event, const char *name EVNAMEMAP_WUNLOCK(); } +/* + * If /etc/security/audit_event has been preloaded by the boot loader, parse + * it to build an initial set of event number<->name mappings. + */ +static void +au_evnamemap_init_preload(void) +{ + caddr_t kmdp; + char *endptr, *line, *nextline, *ptr; + const char *evnum_str, *evname; + size_t size; + long evnum; + u_int lineno; + + kmdp = preload_search_by_type(EVNAMEMAP_HASH_TABLE_MODULE); + if (kmdp == NULL) + return; + ptr = preload_fetch_addr(kmdp); + size = preload_fetch_size(kmdp); + + /* + * Parse preloaded configuration file "in place". Assume that the + * last character is a new line, meaning that we can replace it with a + * nul byte safely. We can then use strsep(3) to process the full + * buffer. + */ + ptr[size - 1] = '\0'; + + /* + * Process line by line. + */ + nextline = ptr; + lineno = 0; + while ((line = strsep(&nextline, "\n")) != NULL) { + /* + * Skip any leading white space. + */ + while (line[0] == ' ' || line[0] == '\t') + line++; + + /* + * Skip blank lines and comment lines. + */ + if (line[0] == '\0' || line[0] == '#') { + lineno++; + continue; + } + + /* + * Parse each line -- ":"-separated tuple of event number, + * event name, and other material we are less interested in. + */ + evnum_str = strsep(&line, ":"); + if (evnum_str == NULL || *evnum_str == '\0') { + printf("%s: Invalid line %u - evnum strsep\n", + __func__, lineno); + lineno++; + continue; + } + evnum = strtol(evnum_str, &endptr, 10); + if (*evnum_str == '\0' || *endptr != '\0' || + evnum <= 0 || evnum > UINT16_MAX) { + printf("%s: Invalid line %u - evnum strtol\n", + __func__, lineno); + lineno++; + continue; + } + evname = strsep(&line, ":"); + if (evname == NULL || *evname == '\0') { + printf("%s: Invalid line %u - evname strsp\n", + __func__, lineno); + lineno++; + continue; + } + au_evnamemap_insert(evnum, evname); + lineno++; + } +} + void au_evnamemap_init(void) { @@ -269,13 +350,7 @@ au_evnamemap_init(void) EVNAMEMAP_LOCK_INIT(); for (i = 0; i < EVNAMEMAP_HASH_TABLE_SIZE; i++) LIST_INIT(&evnamemap_hash[i].enl_head); - - /* - * XXXRW: Unlike the event-to-class mapping, we don't attempt to - * pre-populate the list. Perhaps we should...? But not sure we - * really want to duplicate /etc/security/audit_event in the kernel - * -- and we'd need a way to remove names? - */ + au_evnamemap_init_preload(); } /* From owner-svn-src-all@freebsd.org Mon Sep 3 14:34:11 2018 Return-Path: Delivered-To: svn-src-all@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 72BAEFEBAA3; Mon, 3 Sep 2018 14:34:11 +0000 (UTC) (envelope-from br@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 2493F8712D; Mon, 3 Sep 2018 14:34:11 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 1F80413C2; Mon, 3 Sep 2018 14:34:11 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w83EYBgl082188; Mon, 3 Sep 2018 14:34:11 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w83EYAsJ082184; Mon, 3 Sep 2018 14:34:10 GMT (envelope-from br@FreeBSD.org) Message-Id: <201809031434.w83EYAsJ082184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 3 Sep 2018 14:34:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338444 - in head/sys: cddl/contrib/opensolaris/uts/common/sys cddl/dev/dtrace/riscv cddl/dev/fbt/riscv riscv/conf riscv/include X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: cddl/contrib/opensolaris/uts/common/sys cddl/dev/dtrace/riscv cddl/dev/fbt/riscv riscv/conf riscv/include X-SVN-Commit-Revision: 338444 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 14:34:11 -0000 Author: br Date: Mon Sep 3 14:34:09 2018 New Revision: 338444 URL: https://svnweb.freebsd.org/changeset/base/338444 Log: Add support for 'C'-compressed ISA extension to DTrace FBT provider. Approved by: re (kib) Sponsored by: DARPA, AFRL Deleted: head/sys/riscv/include/riscv_opcode.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c head/sys/cddl/dev/fbt/riscv/fbt_isa.c head/sys/riscv/conf/GENERIC head/sys/riscv/include/riscvreg.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Mon Sep 3 14:26:43 2018 (r338443) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Mon Sep 3 14:34:09 2018 (r338444) @@ -2496,12 +2496,11 @@ extern void dtrace_helpers_destroy(proc_t *); #elif defined(__riscv) -#define SD_RA_SP_MASK 0x01fff07f -#define SD_RA_SP 0x00113023 - #define DTRACE_INVOP_SD 1 -#define DTRACE_INVOP_RET 2 -#define DTRACE_INVOP_NOP 3 +#define DTRACE_INVOP_C_SDSP 2 +#define DTRACE_INVOP_RET 3 +#define DTRACE_INVOP_C_RET 4 +#define DTRACE_INVOP_NOP 5 #endif Modified: head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Mon Sep 3 14:26:43 2018 (r338443) +++ head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Mon Sep 3 14:34:09 2018 (r338444) @@ -19,7 +19,7 @@ * * CDDL HEADER END * - * Portions Copyright 2016 Ruslan Bukin + * Portions Copyright 2016-2018 Ruslan Bukin * * $FreeBSD$ * @@ -42,8 +42,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include -#include #include #include #include @@ -77,7 +77,6 @@ dtrace_invop(uintptr_t addr, struct trapframe *frame, return (0); } - void dtrace_invop_add(int (*func)(uintptr_t, struct trapframe *, uintptr_t)) { @@ -238,29 +237,58 @@ dtrace_probe_error(dtrace_state_t *state, dtrace_epid_ } static int +match_opcode(uint32_t insn, int match, int mask) +{ + + if (((insn ^ match) & mask) == 0) + return (1); + + return (0); +} + +static int dtrace_invop_start(struct trapframe *frame) { - int data, invop, reg, update_sp; - register_t arg1, arg2; register_t *sp; + uint32_t uimm; uint32_t imm; - InstFmt i; - int offs; - int tmp; + int invop; invop = dtrace_invop(frame->tf_sepc, frame, frame->tf_sepc); - if (invop == RISCV_INSN_RET) { + if (match_opcode(invop, (MATCH_SD | RS2_RA | RS1_SP), + (MASK_SD | RS2_MASK | RS1_MASK))) { + /* Non-compressed store of ra to sp */ + imm = (invop >> 7) & 0x1f; + imm |= ((invop >> 25) & 0x7f) << 5; + sp = (register_t *)((uint8_t *)frame->tf_sp + imm); + *sp = frame->tf_ra; + frame->tf_sepc += INSN_SIZE; + return (0); + } + + if (match_opcode(invop, (MATCH_JALR | (X_RA << RS1_SHIFT)), + (MASK_JALR | RD_MASK | RS1_MASK | IMM_MASK))) { + /* Non-compressed ret */ frame->tf_sepc = frame->tf_ra; return (0); } - if ((invop & SD_RA_SP_MASK) == SD_RA_SP) { - i.word = invop; - imm = i.SType.imm0_4 | (i.SType.imm5_11 << 5); - sp = (register_t *)((uint8_t *)frame->tf_sp + imm); + if (match_opcode(invop, (MATCH_C_SDSP | RS2_C_RA), + (MASK_C_SDSP | RS2_C_MASK))) { + /* 'C'-compressed store of ra to sp */ + uimm = ((invop >> 10) & 0x7) << 3; + uimm |= ((invop >> 7) & 0x7) << 6; + sp = (register_t *)((uint8_t *)frame->tf_sp + uimm); *sp = frame->tf_ra; - frame->tf_sepc += INSN_SIZE; + frame->tf_sepc += INSN_C_SIZE; + return (0); + } + + if (match_opcode(invop, (MATCH_C_JR | (X_RA << RD_SHIFT)), + (MASK_C_JR | RD_MASK))) { + /* 'C'-compressed ret */ + frame->tf_sepc = frame->tf_ra; return (0); } Modified: head/sys/cddl/dev/fbt/riscv/fbt_isa.c ============================================================================== --- head/sys/cddl/dev/fbt/riscv/fbt_isa.c Mon Sep 3 14:26:43 2018 (r338443) +++ head/sys/cddl/dev/fbt/riscv/fbt_isa.c Mon Sep 3 14:34:09 2018 (r338444) @@ -21,7 +21,7 @@ * Portions Copyright 2006-2008 John Birrell jb@freebsd.org * Portions Copyright 2013 Justin Hibbits jhibbits@freebsd.org * Portions Copyright 2013 Howard Su howardsu@freebsd.org - * Portions Copyright 2016 Ruslan Bukin + * Portions Copyright 2016-2018 Ruslan Bukin * * $FreeBSD$ */ @@ -37,10 +37,12 @@ #include #include +#include #include "fbt.h" -#define FBT_PATCHVAL (RISCV_INSN_BREAK) +#define FBT_C_PATCHVAL MATCH_C_EBREAK +#define FBT_PATCHVAL MATCH_EBREAK #define FBT_ENTRY "entry" #define FBT_RETURN "return" @@ -73,10 +75,64 @@ void fbt_patch_tracepoint(fbt_probe_t *fbt, fbt_patchval_t val) { - *fbt->fbtp_patchpoint = val; - cpu_icache_sync_range((vm_offset_t)fbt->fbtp_patchpoint, 4); + switch(fbt->fbtp_patchval) { + case FBT_C_PATCHVAL: + *(uint16_t *)fbt->fbtp_patchpoint = (uint16_t)val; + cpu_icache_sync_range((vm_offset_t)fbt->fbtp_patchpoint, 2); + break; + case FBT_PATCHVAL: + *fbt->fbtp_patchpoint = val; + cpu_icache_sync_range((vm_offset_t)fbt->fbtp_patchpoint, 4); + break; + }; } +static int +match_opcode(uint32_t insn, int match, int mask) +{ + + if (((insn ^ match) & mask) == 0) + return (1); + + return (0); +} + +static int +check_c_ret(uint32_t **instr) +{ + uint16_t *instr1; + int i; + + for (i = 0; i < 2; i++) { + instr1 = (uint16_t *)(*instr) + i; + if (match_opcode(*instr1, (MATCH_C_JR | (X_RA << RD_SHIFT)), + (MASK_C_JR | RD_MASK))) { + *instr = (uint32_t *)instr1; + return (1); + } + } + + return (0); +} + +static int +check_c_sdsp(uint32_t **instr) +{ + uint16_t *instr1; + int i; + + for (i = 0; i < 2; i++) { + instr1 = (uint16_t *)(*instr) + i; + if (match_opcode(*instr1, (MATCH_C_SDSP | RS2_C_RA), + (MASK_C_SDSP | RS2_C_MASK))) { + *instr = (uint32_t *)instr1; + return (1); + } + } + + return (0); +} + int fbt_provide_module_function(linker_file_t lf, int symindx, linker_symval_t *symval, void *opaque) @@ -85,6 +141,8 @@ fbt_provide_module_function(linker_file_t lf, int symi uint32_t *instr, *limit; const char *name; char *modname; + int patchval; + int rval; modname = opaque; name = symval->name; @@ -98,8 +156,20 @@ fbt_provide_module_function(linker_file_t lf, int symi /* Look for sd operation */ for (; instr < limit; instr++) { - if ((*instr & SD_RA_SP_MASK) == SD_RA_SP) + /* Look for a non-compressed store of ra to sp */ + if (match_opcode(*instr, (MATCH_SD | RS2_RA | RS1_SP), + (MASK_SD | RS2_MASK | RS1_MASK))) { + rval = DTRACE_INVOP_SD; + patchval = FBT_PATCHVAL; break; + } + + /* Look for a 'C'-compressed store of ra to sp. */ + if (check_c_sdsp(&instr)) { + rval = DTRACE_INVOP_C_SDSP; + patchval = FBT_C_PATCHVAL; + break; + } } if (instr >= limit) @@ -113,8 +183,8 @@ fbt_provide_module_function(linker_file_t lf, int symi fbt->fbtp_ctl = lf; fbt->fbtp_loadcnt = lf->loadcnt; fbt->fbtp_savedval = *instr; - fbt->fbtp_patchval = FBT_PATCHVAL; - fbt->fbtp_rval = DTRACE_INVOP_SD; + fbt->fbtp_patchval = patchval; + fbt->fbtp_rval = rval; fbt->fbtp_symindx = symindx; fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)]; @@ -125,8 +195,20 @@ fbt_provide_module_function(linker_file_t lf, int symi retfbt = NULL; again: for (; instr < limit; instr++) { - if (*instr == RISCV_INSN_RET) + /* Look for non-compressed return */ + if (match_opcode(*instr, (MATCH_JALR | (X_RA << RS1_SHIFT)), + (MASK_JALR | RD_MASK | RS1_MASK | IMM_MASK))) { + rval = DTRACE_INVOP_RET; + patchval = FBT_PATCHVAL; break; + } + + /* Look for 'C'-compressed return */ + if (check_c_ret(&instr)) { + rval = DTRACE_INVOP_C_RET; + patchval = FBT_C_PATCHVAL; + break; + } } if (instr >= limit) @@ -150,9 +232,9 @@ again: fbt->fbtp_ctl = lf; fbt->fbtp_loadcnt = lf->loadcnt; fbt->fbtp_symindx = symindx; - fbt->fbtp_rval = DTRACE_INVOP_RET; + fbt->fbtp_rval = rval; fbt->fbtp_savedval = *instr; - fbt->fbtp_patchval = FBT_PATCHVAL; + fbt->fbtp_patchval = patchval; fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)]; fbt_probetab[FBT_ADDR2NDX(instr)] = fbt; Modified: head/sys/riscv/conf/GENERIC ============================================================================== --- head/sys/riscv/conf/GENERIC Mon Sep 3 14:26:43 2018 (r338443) +++ head/sys/riscv/conf/GENERIC Mon Sep 3 14:34:09 2018 (r338444) @@ -88,6 +88,15 @@ device vtnet # VirtIO Ethernet device device virtio_blk # VirtIO Block device device virtio_mmio # VirtIO MMIO bus +# DTrace support +# device dtrace +# device dtrace_profile +# device dtrace_sdt +# device dtrace_fbt +# device dtrace_systrace +# device dtrace_prototype +# device dtraceall + # Serial (COM) ports device uart # Generic UART driver device uart_ns8250 # ns8250-type UART driver Modified: head/sys/riscv/include/riscvreg.h ============================================================================== --- head/sys/riscv/include/riscvreg.h Mon Sep 3 14:26:43 2018 (r338443) +++ head/sys/riscv/include/riscvreg.h Mon Sep 3 14:34:09 2018 (r338444) @@ -157,10 +157,31 @@ #define XLEN 8 #define INSN_SIZE 4 +#define INSN_C_SIZE 2 -#define RISCV_INSN_NOP 0x00000013 -#define RISCV_INSN_BREAK 0x00100073 -#define RISCV_INSN_RET 0x00008067 +#define X_RA 1 +#define X_SP 2 +#define X_GP 3 +#define X_TP 4 +#define X_T0 5 +#define X_T1 6 +#define X_T2 7 +#define X_T3 28 + +#define RD_SHIFT 7 +#define RD_MASK (0x1f << RD_SHIFT) +#define RS1_SHIFT 15 +#define RS1_MASK (0x1f << RS1_SHIFT) +#define RS1_SP (X_SP << RS1_SHIFT) +#define RS2_SHIFT 20 +#define RS2_MASK (0x1f << RS2_SHIFT) +#define RS2_RA (X_RA << RS2_SHIFT) +#define IMM_SHIFT 20 +#define IMM_MASK (0xfff << IMM_SHIFT) + +#define RS2_C_SHIFT 2 +#define RS2_C_MASK (0x1f << RS2_C_SHIFT) +#define RS2_C_RA (X_RA << RS2_C_SHIFT) #define CSR_ZIMM(val) \ (__builtin_constant_p(val) && ((u_long)(val) < 32)) From owner-svn-src-all@freebsd.org Mon Sep 3 14:43:18 2018 Return-Path: Delivered-To: svn-src-all@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 1F96FFEC03C; Mon, 3 Sep 2018 14:43:18 +0000 (UTC) (envelope-from br@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 C8235880E8; Mon, 3 Sep 2018 14:43:17 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A8EB31556; Mon, 3 Sep 2018 14:43:17 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w83EhHTV087282; Mon, 3 Sep 2018 14:43:17 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w83EhH4O087279; Mon, 3 Sep 2018 14:43:17 GMT (envelope-from br@FreeBSD.org) Message-Id: <201809031443.w83EhH4O087279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 3 Sep 2018 14:43:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338445 - in head: share/mk stand sys/conf X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head: share/mk stand sys/conf X-SVN-Commit-Revision: 338445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 14:43:18 -0000 Author: br Date: Mon Sep 3 14:43:16 2018 New Revision: 338445 URL: https://svnweb.freebsd.org/changeset/base/338445 Log: Enable 'C'-compressed ISA extension. This was disabled recently due to lack of support in KDB disassembler and DTrace FBT provider. Support for 'C'-extension to both of these was added, so we can now enable 'C'-extension. This reduces size of the kernel important for low-end embedded devices, and saves cache footprint for high perfomance machines. Approved by: re (kib) Sponsored by: DARPA, AFRL Modified: head/share/mk/bsd.cpu.mk head/stand/defs.mk head/sys/conf/kern.mk Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Mon Sep 3 14:34:09 2018 (r338444) +++ head/share/mk/bsd.cpu.mk Mon Sep 3 14:43:16 2018 (r338445) @@ -367,9 +367,9 @@ CFLAGS += -mcpu=8540 -Wa,-me500 -mspe=yes -mabi=spe -m .if ${MACHINE_CPUARCH} == "riscv" .if ${MACHINE_ARCH:Mriscv*sf} -CFLAGS += -march=rv64ima -mabi=lp64 +CFLAGS += -march=rv64imac -mabi=lp64 .else -CFLAGS += -march=rv64imafd -mabi=lp64d +CFLAGS += -march=rv64imafdc -mabi=lp64d .endif .endif Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Mon Sep 3 14:34:09 2018 (r338444) +++ head/stand/defs.mk Mon Sep 3 14:43:16 2018 (r338445) @@ -108,7 +108,7 @@ CFLAGS+= -ffreestanding ${CFLAGS_NO_SIMD} .if ${MACHINE_CPUARCH} == "aarch64" CFLAGS+= -mgeneral-regs-only -fPIC .elif ${MACHINE_CPUARCH} == "riscv" -CFLAGS+= -march=rv64ima -mabi=lp64 +CFLAGS+= -march=rv64imac -mabi=lp64 .else CFLAGS+= -msoft-float .endif Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Mon Sep 3 14:34:09 2018 (r338444) +++ head/sys/conf/kern.mk Mon Sep 3 14:43:16 2018 (r338445) @@ -131,7 +131,7 @@ INLINE_LIMIT?= 8000 .endif .if ${MACHINE_CPUARCH} == "riscv" -CFLAGS.gcc+= -mcmodel=medany -march=rv64imafd -mabi=lp64 +CFLAGS.gcc+= -mcmodel=medany -march=rv64imafdc -mabi=lp64 INLINE_LIMIT?= 8000 .endif From owner-svn-src-all@freebsd.org Mon Sep 3 16:07:10 2018 Return-Path: Delivered-To: svn-src-all@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 1E236FED994; Mon, 3 Sep 2018 16:07:10 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B247F8A87D; Mon, 3 Sep 2018 16:07:09 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 667E58D4A14C; Mon, 3 Sep 2018 16:07:01 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id C2ED3D1F83A; Mon, 3 Sep 2018 16:07:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id aK8-cdZEIEPt; Mon, 3 Sep 2018 16:06:59 +0000 (UTC) Received: from [128.232.18.112] (fresh-ayiya.sbone.de [IPv6:fde9:577b:c1a9:f001::2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 4632BD1F833; Mon, 3 Sep 2018 16:06:59 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Matt Macy" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r335919 - head/sys/netinet6 Date: Mon, 03 Sep 2018 16:06:57 +0000 X-Mailer: MailMate (2.0BETAr6116) Message-ID: <7C27CD20-FDDD-4048-9EC1-A88C148C4D65@lists.zabbadoz.net> In-Reply-To: <201807032330.w63NUr6P074115@repo.freebsd.org> References: <201807032330.w63NUr6P074115@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 16:07:10 -0000 On 3 Jul 2018, at 23:30, Matt Macy wrote: > Author: mmacy > Date: Tue Jul 3 23:30:53 2018 > New Revision: 335919 > URL: https://svnweb.freebsd.org/changeset/base/335919 > > Log: > udp6_input: validate inpcb before use > > When traversing pcbinfo lists (rather than calling lookup) we need > to > explicitly validate an inpcb before use. > > Modified: > head/sys/netinet6/udp6_usrreq.c > why is this needed in udp6 and not for udp where the code looks familiarly similar? /bz From owner-svn-src-all@freebsd.org Mon Sep 3 17:39:10 2018 Return-Path: Delivered-To: svn-src-all@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 86E0EFEF74C; Mon, 3 Sep 2018 17:39:10 +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 487628D59A; Mon, 3 Sep 2018 17:39:10 +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 3F5AD3106; Mon, 3 Sep 2018 17:39:10 +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 w83HdAK4074902; Mon, 3 Sep 2018 17:39:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w83HdAB9074901; Mon, 3 Sep 2018 17:39:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809031739.w83HdAB9074901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 3 Sep 2018 17:39:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338446 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 338446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 17:39:10 -0000 Author: markj Date: Mon Sep 3 17:39:09 2018 New Revision: 338446 URL: https://svnweb.freebsd.org/changeset/base/338446 Log: Use the correct malloc type in in_pcblbgroup_free(). Approved by: re (kib) Sponsored by: The FreeBSD Foundation Modified: head/sys/netinet/in_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Mon Sep 3 14:43:16 2018 (r338445) +++ head/sys/netinet/in_pcb.c Mon Sep 3 17:39:09 2018 (r338446) @@ -244,7 +244,7 @@ in_pcblbgroup_free(struct inpcblbgroup *grp) { LIST_REMOVE(grp, il_list); - free(grp, M_TEMP); + free(grp, M_PCB); } static struct inpcblbgroup * From owner-svn-src-all@freebsd.org Mon Sep 3 22:10:50 2018 Return-Path: Delivered-To: svn-src-all@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 76AEDFF7F9E; Mon, 3 Sep 2018 22:10:50 +0000 (UTC) (envelope-from bz@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 2F4D07869D; Mon, 3 Sep 2018 22:10:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 2A46860EC; Mon, 3 Sep 2018 22:10:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w83MAoFU018429; Mon, 3 Sep 2018 22:10:50 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w83MAo0S018428; Mon, 3 Sep 2018 22:10:50 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201809032210.w83MAo0S018428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 3 Sep 2018 22:10:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338447 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 338447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 22:10:50 -0000 Author: bz Date: Mon Sep 3 22:10:49 2018 New Revision: 338447 URL: https://svnweb.freebsd.org/changeset/base/338447 Log: Rather than duplicating the functionality of a macro after r322866 use the already existing one. No functional changes. Reviewed by: karels, ae Approved by: re (rgrimes) Differential Revision: https://reviews.freebsd.org/D17004 Modified: head/sys/net/route.h Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Mon Sep 3 17:39:09 2018 (r338446) +++ head/sys/net/route.h Mon Sep 3 22:10:49 2018 (r338447) @@ -410,10 +410,8 @@ struct rt_addrinfo { } while (0) #define RO_RTFREE(_ro) do { \ - if ((_ro)->ro_rt) { \ - RT_LOCK((_ro)->ro_rt); \ - RTFREE_LOCKED((_ro)->ro_rt); \ - } \ + if ((_ro)->ro_rt) \ + RTFREE((_ro)->ro_rt); \ } while (0) #define RO_INVALIDATE_CACHE(ro) do { \ From owner-svn-src-all@freebsd.org Mon Sep 3 22:12:49 2018 Return-Path: Delivered-To: svn-src-all@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 7945BFF81CF; Mon, 3 Sep 2018 22:12:49 +0000 (UTC) (envelope-from bz@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 2FEDC78EBD; Mon, 3 Sep 2018 22:12:49 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 2AEDC6268; Mon, 3 Sep 2018 22:12:49 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w83MCnpb022271; Mon, 3 Sep 2018 22:12:49 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w83MCnC6022270; Mon, 3 Sep 2018 22:12:49 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201809032212.w83MCnC6022270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 3 Sep 2018 22:12:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338448 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 338448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 22:12:49 -0000 Author: bz Date: Mon Sep 3 22:12:48 2018 New Revision: 338448 URL: https://svnweb.freebsd.org/changeset/base/338448 Log: As discussed in D6262 post-commit review, change inp_route to inp_route6 for IPv6 code after r301217. This was most likely a c&p error from the legacy IP code, which did not matter as it is a union and both structures have the same layout at the beginning. No functional changes. Reviewed by: karels, ae Approved by: re (rgrimes) Differential Revision: https://reviews.freebsd.org/D17005 Modified: head/sys/netinet6/in6_pcb.c Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Mon Sep 3 22:10:49 2018 (r338447) +++ head/sys/netinet6/in6_pcb.c Mon Sep 3 22:12:48 2018 (r338448) @@ -853,8 +853,8 @@ in6_losing(struct inpcb *in6p) RTFREE(in6p->inp_route6.ro_rt); in6p->inp_route6.ro_rt = (struct rtentry *)NULL; } - if (in6p->inp_route.ro_lle) - LLE_FREE(in6p->inp_route.ro_lle); /* zeros ro_lle */ + if (in6p->inp_route6.ro_lle) + LLE_FREE(in6p->inp_route6.ro_lle); /* zeros ro_lle */ return; } @@ -870,8 +870,8 @@ in6_rtchange(struct inpcb *inp, int errno) RTFREE(inp->inp_route6.ro_rt); inp->inp_route6.ro_rt = (struct rtentry *)NULL; } - if (inp->inp_route.ro_lle) - LLE_FREE(inp->inp_route.ro_lle); /* zeros ro_lle */ + if (inp->inp_route6.ro_lle) + LLE_FREE(inp->inp_route6.ro_lle); /* zeros ro_lle */ return inp; } From owner-svn-src-all@freebsd.org Mon Sep 3 22:14:38 2018 Return-Path: Delivered-To: svn-src-all@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 1A9E2FF82B2; Mon, 3 Sep 2018 22:14:38 +0000 (UTC) (envelope-from bz@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 C08257907D; Mon, 3 Sep 2018 22:14:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B9EF46271; Mon, 3 Sep 2018 22:14:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w83MEbiD022388; Mon, 3 Sep 2018 22:14:37 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w83MEbTa022387; Mon, 3 Sep 2018 22:14:37 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201809032214.w83MEbTa022387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 3 Sep 2018 22:14:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338449 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 338449 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 22:14:38 -0000 Author: bz Date: Mon Sep 3 22:14:37 2018 New Revision: 338449 URL: https://svnweb.freebsd.org/changeset/base/338449 Log: Replicate r307234 from legacy IP to IPv6 code, using the RO_RTFREE() macro rather than hand crafted code. No functional changes. Reviewed by: karels Approved by: re (rgrimes) Differential Revision: https://reviews.freebsd.org/D17006 Modified: head/sys/netinet6/in6_pcb.c Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Mon Sep 3 22:12:48 2018 (r338448) +++ head/sys/netinet6/in6_pcb.c Mon Sep 3 22:14:37 2018 (r338449) @@ -849,10 +849,7 @@ void in6_losing(struct inpcb *in6p) { - if (in6p->inp_route6.ro_rt) { - RTFREE(in6p->inp_route6.ro_rt); - in6p->inp_route6.ro_rt = (struct rtentry *)NULL; - } + RO_RTFREE(&in6p->inp_route6); if (in6p->inp_route6.ro_lle) LLE_FREE(in6p->inp_route6.ro_lle); /* zeros ro_lle */ return; @@ -866,10 +863,7 @@ struct inpcb * in6_rtchange(struct inpcb *inp, int errno) { - if (inp->inp_route6.ro_rt) { - RTFREE(inp->inp_route6.ro_rt); - inp->inp_route6.ro_rt = (struct rtentry *)NULL; - } + RO_RTFREE(&in6p->inp_route6); if (inp->inp_route6.ro_lle) LLE_FREE(inp->inp_route6.ro_lle); /* zeros ro_lle */ return inp; From owner-svn-src-all@freebsd.org Mon Sep 3 22:27:29 2018 Return-Path: Delivered-To: svn-src-all@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 03977FF85DF; Mon, 3 Sep 2018 22:27:29 +0000 (UTC) (envelope-from bz@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 AB69F79589; Mon, 3 Sep 2018 22:27:28 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A075C6423; Mon, 3 Sep 2018 22:27:28 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w83MRSPc027507; Mon, 3 Sep 2018 22:27:28 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w83MRSq1027505; Mon, 3 Sep 2018 22:27:28 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201809032227.w83MRSq1027505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 3 Sep 2018 22:27:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338450 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 338450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 22:27:29 -0000 Author: bz Date: Mon Sep 3 22:27:27 2018 New Revision: 338450 URL: https://svnweb.freebsd.org/changeset/base/338450 Log: Replicate r328271 from legacy IP to IPv6 using a single macro to clear L2 and L3 route caches. Also mark one function argument as __unused. Reviewed by: karels, ae Approved by: re (rgrimes) Differential Revision: https://reviews.freebsd.org/D17007 Modified: head/sys/netinet6/in6_pcb.c head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Mon Sep 3 22:14:37 2018 (r338449) +++ head/sys/netinet6/in6_pcb.c Mon Sep 3 22:27:27 2018 (r338450) @@ -846,13 +846,10 @@ in6_pcbpurgeif0(struct inpcbinfo *pcbinfo, struct ifne * (by a redirect), time to try a default gateway again. */ void -in6_losing(struct inpcb *in6p) +in6_losing(struct inpcb *inp) { - RO_RTFREE(&in6p->inp_route6); - if (in6p->inp_route6.ro_lle) - LLE_FREE(in6p->inp_route6.ro_lle); /* zeros ro_lle */ - return; + RO_INVALIDATE_CACHE(&inp->inp_route6); } /* @@ -860,12 +857,10 @@ in6_losing(struct inpcb *in6p) * and allocate a (hopefully) better one. */ struct inpcb * -in6_rtchange(struct inpcb *inp, int errno) +in6_rtchange(struct inpcb *inp, int errno __unused) { - RO_RTFREE(&in6p->inp_route6); - if (inp->inp_route6.ro_lle) - LLE_FREE(inp->inp_route6.ro_lle); /* zeros ro_lle */ + RO_INVALIDATE_CACHE(&inp->inp_route6); return inp; } Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Mon Sep 3 22:14:37 2018 (r338449) +++ head/sys/netinet6/ip6_output.c Mon Sep 3 22:27:27 2018 (r338450) @@ -804,22 +804,16 @@ again: error = netisr_queue(NETISR_IPV6, m); goto done; } else { - RO_RTFREE(ro); + RO_INVALIDATE_CACHE(ro); needfiblookup = 1; /* Redo the routing table lookup. */ - if (ro->ro_lle) - LLE_FREE(ro->ro_lle); /* zeros ro_lle */ - ro->ro_lle = NULL; } } /* See if fib was changed by packet filter. */ if (fibnum != M_GETFIB(m)) { m->m_flags |= M_SKIP_FIREWALL; fibnum = M_GETFIB(m); - RO_RTFREE(ro); + RO_INVALIDATE_CACHE(ro); needfiblookup = 1; - if (ro->ro_lle) - LLE_FREE(ro->ro_lle); /* zeros ro_lle */ - ro->ro_lle = NULL; } if (needfiblookup) goto again; From owner-svn-src-all@freebsd.org Tue Sep 4 09:17:30 2018 Return-Path: Delivered-To: svn-src-all@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 A3CE8FE854D; Tue, 4 Sep 2018 09:17:30 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 11C018EE39; Tue, 4 Sep 2018 09:17:29 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from hermann ([141.89.154.175]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MHoWj-1fu53K0ybd-003gAf; Tue, 04 Sep 2018 11:17:19 +0200 Date: Tue, 4 Sep 2018 11:17:16 +0200 From: "Hartmann, O." To: Brad Davis Cc: "O. Hartmann" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r338374 - in head: bin/csh bin/sh etc etc/root Message-ID: <20180904111716.7947af64@hermann> In-Reply-To: <1535643487.1731188.1491479248.1AC042E6@webmail.messagingengine.com> References: <201808291659.w7TGxJqF096282@repo.freebsd.org> <20180830133947.5e68bea3@thor.intern.walstatt.dynvpn.de> <1535643487.1731188.1491479248.1AC042E6@webmail.messagingengine.com> Organization: walstatt.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:6Pljp00pcZCOip33T4j1qvyBPqycqP5jMBsOZfi/pIJljd+ItsW hyPeNAI+Uaj7PijGK9r/vR/MaaeT4jagcsxLPUZnaQ6eScdEgVanMfYpjjJ76IKfbekCG04 hHMsB97ylW+6/VPtWm16LAMiGq5ft0jm5E7gwUiTuZs56v2ovX7KrI0c4a5JP7pVHhB6mRl 8UWc0Vu8IzQKpKa7JoZTg== X-UI-Out-Filterresults: notjunk:1;V01:K0:vvB1mKDBcw0=:Jkh1s6INGEJ2phV88PrqRD ZEPfk+u4Es2hHcDsR57aVRa0OsPffGi2sMcmG6AK/WJJCyvtQHGDUKO/caE+Jw0wBufbHR2xf Nd/P7990bieznHqVQzn2rUffBCRfeFu96I1o16XMAqj+n2iHIx5jTHp5N6qHRt/BnqmzS1YtR k0xQU+h8xW52meMu6v9ZkqwUM/tFi2PVo22kAMSyVJ5ix5TktlKcud7ZB9tnvFsYe14MY0MVy AKw957+ceDouWRhhFuA0J556wE4atGe/FzB2eLW0Xd4k2RyQftP+989cYheJkMX/frsAU76N3 DewUyP27DJ8ynGXZx2jjjcWeuG2dWG3sXih+ta4S7CVlADBygBG//ChV2ld0DIBcaK01I6e+m qr/0Hqv/Ht5vthLLujsRyoJgoTVoUux4R9yFirbRp6Oo42J6ahrjVNYNndc+LeMpwZ1ZZhXH3 TdFaS7zU0TRIhbw9XeJ4uDRGtVy3dTM1EyrWaYIbpnmhctQvmccLm8U4+v1QQZ2btWfX9ZLPU 36oNCQzDbnZewvGv2/Uzf+pkQg9wZ3IG0b9t928WDcPGk/flTNBdENpc4PJLRecjlRHWtlZHQ G1jQm4gmOJ4bzJWHAQ9wHnq3dsE1En4N3JtLbvx6bBVUpnyvnCG4Jc9JYk5pNBLh5ap7u7K1G 7PtOoojl0knLtf4GfKwdbyFLlQaU0uo19bBBiaX+1K41B4KB7U87bvupJa10adSF47FvvhooQ fBDsJrRVOziH24jz8FVVZ9kjnVPfs66GfAjB8C254GTIU+PaoSPWJSS3OgAMRJXYxFH8KF2N7 8I7BUui X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 09:17:30 -0000 On Thu, 30 Aug 2018 09:38:07 -0600 Brad Davis wrote: > On Thu, Aug 30, 2018, at 5:39 AM, O. Hartmann wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA512 > > > > Am Wed, 29 Aug 2018 16:59:19 +0000 (UTC) > > Brad Davis schrieb: > > > > > Author: brd > > > Date: Wed Aug 29 16:59:19 2018 > > > New Revision: 338374 > > > URL: https://svnweb.freebsd.org/changeset/base/338374 > > > > > > Log: > > > Finish moving dot.cshrc and dot.profile to bin/csh/ and bin/sh/. > > > > > > Approved by: re (gjb), will (mentor) > > > Differential Revision: https://reviews.freebsd.org/D16770 > > > > > > Added: > > > head/bin/csh/dot.cshrc > > > - copied unchanged from r338373, head/etc/root/dot.cshrc > > > head/bin/sh/dot.profile > > > - copied unchanged from r338373, head/etc/root/dot.profile > > > Deleted: > > > head/etc/root/dot.cshrc > > > head/etc/root/dot.profile > > > Modified: > > > head/bin/csh/Makefile > > > head/bin/sh/Makefile > > > head/etc/Makefile > > > > > > Modified: head/bin/csh/Makefile > > > ============================================================================== > > > --- head/bin/csh/Makefile Wed Aug 29 16:21:34 2018 > > > (r338373) +++ head/bin/csh/Makefile Wed Aug 29 16:59:19 > > > 2018 (r338374) @@ -10,8 +10,9 @@ > > > > > > CONFGROUPS= ETC ROOT > > > ETC= csh.cshrc csh.login csh.logout > > > -ROOT= dot.login > > > +ROOT= dot.cshrc dot.login > > > ROOTDIR= /root > > > +ROOTNAME_dot.cshrc= .cshrc > > > ROOTNAME_dot.login= .login > > > PACKAGE=runtime > > > TCSHDIR= ${SRCTOP}/contrib/tcsh > > > @@ -152,5 +153,11 @@ tc.const.h: tc.const.c sh.char.h config.h > > > config_f.h s sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char > > > \1[];/' | \ sort >> ${.TARGET} > > > @echo '#endif /* _h_tc_const */' >> ${.TARGET} > > > + > > > +beforeinstallconfig: > > > + rm -f ${DESTDIR}/.cshrc > > > + > > > +afterinstallconfig: > > > + ${INSTALL_LINK} ${TAG_ARGS} ${DESTDIR}/root/.cshrc > > > ${DESTDIR}/.cshrc > > > .include > > > > > > Copied: head/bin/csh/dot.cshrc (from r338373, > > > head/etc/root/dot.cshrc) > > > ============================================================================== > > > --- /dev/null 00:00:00 1970 (empty, because file is > > > newly added) +++ head/bin/csh/dot.cshrc Wed Aug 29 > > > 16:59:19 2018 (r338374, copy of r338373, > > > head/etc/root/dot.cshrc) @@ -0,0 +1,43 @@ +# $FreeBSD$ +# > > > +# .cshrc - csh resource script, read at beginning of execution > > > by each shell +# > > > +# see also csh(1), environ(7). > > > +# more examples available at /usr/share/examples/csh/ > > > +# > > > + > > > +alias h history 25 > > > +alias j jobs -l > > > +alias la ls -aF > > > +alias lf ls -FA > > > +alias ll ls -lAF > > > + > > > +# A righteous umask > > > +umask 22 > > > + > > > +set path = > > > (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin > > > $HOME/bin) + +setenv EDITOR vi > > > +setenv PAGER less > > > +setenv BLOCKSIZE K > > > + > > > +if ($?prompt) then > > > + # An interactive shell -- set some stuff up > > > + set prompt = "%N@%m:%~ %# " > > > + set promptchars = "%#" > > > + > > > + set filec > > > + set history = 1000 > > > + set savehist = (1000 merge) > > > + set autolist = ambiguous > > > + # Use history to aid expansion > > > + set autoexpand > > > + set autorehash > > > + set mail = (/var/mail/$USER) > > > + if ( $?tcsh ) then > > > + bindkey "^W" backward-delete-word > > > + bindkey -k up history-search-backward > > > + bindkey -k down history-search-forward > > > + endif > > > + > > > +endif > > > > > > Modified: head/bin/sh/Makefile > > > ============================================================================== > > > --- head/bin/sh/Makefile Wed Aug 29 16:21:34 2018 > > > (r338373) +++ head/bin/sh/Makefile Wed Aug 29 16:59:19 > > > 2018 (r338374) @@ -3,7 +3,9 @@ > > > > > > .include > > > > > > -CONFS= profile > > > +CONFS= dot.profile profile > > > +CONFSDIR_dot.profile= /root > > > +CONFSNAME_dot.profile= .profile > > > PACKAGE=runtime > > > PROG= sh > > > INSTALLFLAGS= -S > > > @@ -60,5 +62,11 @@ token.h: mktokens > > > > > > HAS_TESTS= > > > SUBDIR.${MK_TESTS}+= tests > > > + > > > +beforeinstallconfig: > > > + rm -f ${DESTDIR}/.profile > > > + > > > +afterinstallconfig: > > > + ${INSTALL_LINK} ${TAG_ARGS} ${DESTDIR}/root/.profile > > > ${DESTDIR}/.profile > > > .include > > > > > > Copied: head/bin/sh/dot.profile (from r338373, > > > head/etc/root/dot.profile) > > > ============================================================================== > > > --- /dev/null 00:00:00 1970 (empty, because file is > > > newly added) +++ head/bin/sh/dot.profile Wed Aug 29 > > > 16:59:19 2018 (r338374, copy of r338373, > > > head/etc/root/dot.profile) @@ -0,0 +1,16 @@ +# $FreeBSD$ +# > > > +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin > > > +export PATH > > > +HOME=/root > > > +export HOME > > > +TERM=${TERM:-xterm} > > > +export TERM > > > +PAGER=less > > > +export PAGER > > > + > > > +# Query terminal size; useful for serial lines. > > > +if [ -x /usr/bin/resizewin ] ; then /usr/bin/resizewin -z ; fi > > > + > > > +# Uncomment to display a random cookie on each login. > > > +# if [ -x /usr/bin/fortune ] ; then /usr/bin/fortune -s ; fi > > > > > > Modified: head/etc/Makefile > > > ============================================================================== > > > --- head/etc/Makefile Wed Aug 29 16:21:34 2018 > > > (r338373) +++ head/etc/Makefile Wed Aug 29 16:59:19 > > > 2018 (r338374) @@ -155,18 +155,6 @@ distribution: > > > ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ > > > dot.k5login ${DESTDIR}/root/.k5login; > > > .endif > > > - cd ${.CURDIR}/root; \ > > > - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ > > > - dot.profile ${DESTDIR}/root/.profile; \ > > > - rm -f ${DESTDIR}/.profile; \ > > > - ${INSTALL_LINK} ${DESTDIR}/root/.profile > > > ${DESTDIR}/.profile -.if ${MK_TCSH} != "no" > > > - cd ${.CURDIR}/root; \ > > > - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ > > > - dot.cshrc ${DESTDIR}/root/.cshrc; \ > > > - rm -f ${DESTDIR}/.cshrc; \ > > > - ${INSTALL_LINK} ${DESTDIR}/root/.cshrc > > > ${DESTDIR}/.cshrc -.endif > > > > > > .if ${MK_MAIL} != "no" > > > cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} > > > -m 644 \ _______________________________________________ > > > svn-src-head@freebsd.org mailing list > > > https://lists.freebsd.org/mailman/listinfo/svn-src-head > > > To unsubscribe, send any mail to > > > "svn-src-head-unsubscribe@freebsd.org" > > > > This commit breaks "make package", at least for me with an obscure > > "Error 70" in the > > make process. > > Thanks for the report. > > The error is above that: > > 09:15:27 pkg: Plist error, @config /root/.cshrc: not a regular file > 09:15:27 pkg: Plist error, @config /root/.profile: not a regular file > > Which is interesting.. I will think about how to solve this. > > > Regards, > Brad Davis Is there a (temporarily) workaround? The problem seems still to be present in r338450. Kind regards, oh From owner-svn-src-all@freebsd.org Tue Sep 4 09:53:46 2018 Return-Path: Delivered-To: svn-src-all@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 8F010FE9690; Tue, 4 Sep 2018 09:53:46 +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 4367590572; Tue, 4 Sep 2018 09:53:46 +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 3E1E8157D3; Tue, 4 Sep 2018 09:53:46 +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 w849rkXW082298; Tue, 4 Sep 2018 09:53:46 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w849rj4j082295; Tue, 4 Sep 2018 09:53:45 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201809040953.w849rj4j082295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Tue, 4 Sep 2018 09:53:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338451 - stable/11/usr.bin/last X-SVN-Group: stable-11 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/11/usr.bin/last X-SVN-Commit-Revision: 338451 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 09:53:46 -0000 Author: philip Date: Tue Sep 4 09:53:45 2018 New Revision: 338451 URL: https://svnweb.freebsd.org/changeset/base/338451 Log: MFC r319508: Fix a memory leak with last free memory allocated to 'buf' Submitted by: Thomas Rix MFC r338352: Add libxo(3) support to last(1). Modified: stable/11/usr.bin/last/Makefile stable/11/usr.bin/last/last.1 stable/11/usr.bin/last/last.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/last/Makefile ============================================================================== --- stable/11/usr.bin/last/Makefile Mon Sep 3 22:27:27 2018 (r338450) +++ stable/11/usr.bin/last/Makefile Tue Sep 4 09:53:45 2018 (r338451) @@ -2,6 +2,7 @@ # $FreeBSD$ PROG= last +LIBADD= xo NO_WFORMAT= Modified: stable/11/usr.bin/last/last.1 ============================================================================== --- stable/11/usr.bin/last/last.1 Mon Sep 3 22:27:27 2018 (r338450) +++ stable/11/usr.bin/last/last.1 Tue Sep 4 09:53:45 2018 (r338451) @@ -28,7 +28,7 @@ .\" @(#)last.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 6, 2015 +.Dd August 28, 2018 .Dt LAST 1 .Os .Sh NAME @@ -36,6 +36,7 @@ .Nd indicate last logins of users and ttys .Sh SYNOPSIS .Nm +.Op Fl -libxo .Op Fl swy .Oo .Fl d @@ -72,6 +73,13 @@ will so indicate. .Pp The following options are available: .Bl -tag -width indent-two +.It Fl -libxo +Generate output via +.Xr libxo 3 +in a selection of different human and machine readable formats. +See +.Xr xo_parse_args 3 +for details on command line arguments. .It Fl d Ar date Specify the snapshot date and time. All users logged in at the snapshot date and time will @@ -201,6 +209,8 @@ login data base .Xr getutxent 3 , .Xr ac 8 , .Xr lastlogin 8 +.Xr libxo 3 , +.Xr xo_parse_args 3 .Sh HISTORY .Nm utility first appeared in @@ -211,6 +221,10 @@ The original version was written by .An Howard P. Katseff ; .An Keith Bostic rewrote it in 1986/87 to add functionality and to improve code quality. +.An Philip Paeps +added +.Xr libxo 3 +support in August 2018. .Sh BUGS If a login shell should terminate abnormally for some reason, it is likely that a logout record will not be written to the Modified: stable/11/usr.bin/last/last.c ============================================================================== --- stable/11/usr.bin/last/last.c Mon Sep 3 22:27:27 2018 (r338450) +++ stable/11/usr.bin/last/last.c Tue Sep 4 09:53:45 2018 (r338451) @@ -1,6 +1,7 @@ /* * Copyright (c) 1987, 1993, 1994 * The Regents of the University of California. All rights reserved. + * Copyright (c) 2018 Philip Paeps * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -58,6 +59,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #define NO 0 /* false/no */ #define YES 1 /* true/yes */ #define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2; @@ -108,7 +111,7 @@ static void wtmp(void); static void usage(void) { - (void)fprintf(stderr, + xo_error( "usage: last [-swy] [-d [[CC]YY][MMDD]hhmm[.SS]] [-f file] [-h host]\n" " [-n maxrec] [-t tty] [user ...]\n"); exit(1); @@ -123,6 +126,11 @@ main(int argc, char *argv[]) (void) setlocale(LC_TIME, ""); d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); + argc = xo_parse_args(argc, argv); + if (argc < 0) + exit(1); + atexit(xo_finish_atexit); + maxrec = -1; snaptime = 0; while ((ch = getopt(argc, argv, "0123456789d:f:h:n:st:wy")) != -1) @@ -157,7 +165,7 @@ main(int argc, char *argv[]) maxrec = strtol(optarg, &p, 10); if (p == optarg || *p != '\0' || errno != 0 || maxrec <= 0) - errx(1, "%s: bad line count", optarg); + xo_errx(1, "%s: bad line count", optarg); break; case 's': sflag++; /* Show delta as seconds */ @@ -212,14 +220,16 @@ wtmp(void) SLIST_INIT(&idlist); (void)time(&t); + xo_open_container("last-information"); + /* Load the last entries from the file. */ if (setutxdb(UTXDB_LOG, file) != 0) - err(1, "%s", file); + xo_err(1, "%s", file); while ((ut = getutxent()) != NULL) { if (amount % 128 == 0) { buf = realloc(buf, (amount + 128) * sizeof *ut); if (buf == NULL) - err(1, "realloc"); + xo_err(1, "realloc"); } memcpy(&buf[amount++], ut, sizeof *ut); if (t > ut->ut_tv.tv_sec) @@ -228,12 +238,17 @@ wtmp(void) endutxent(); /* Display them in reverse order. */ + xo_open_list("last"); while (amount > 0) doentry(&buf[--amount]); - + xo_close_list("last"); + free(buf); tm = localtime(&t); (void) strftime(ct, sizeof(ct), "%+", tm); - printf("\n%s begins %s\n", ((file == NULL) ? "utx.log" : file), ct); + xo_emit("\n{:utxdb/%s}", (file == NULL) ? "utx.log" : file); + xo_attr("seconds", "%lu", (unsigned long) t); + xo_emit(" begins {:begins/%s}\n", ct); + xo_close_container("last-information"); } /* @@ -288,7 +303,7 @@ doentry(struct utmpx *bp) /* add new one */ tt = malloc(sizeof(struct idtab)); if (tt == NULL) - errx(1, "malloc failure"); + xo_errx(1, "malloc failure"); tt->logout = currentout; memcpy(tt->id, bp->ut_id, sizeof bp->ut_id); SLIST_INSERT_HEAD(&idlist, tt, list); @@ -324,6 +339,7 @@ printentry(struct utmpx *bp, struct idtab *tt) if (maxrec != -1 && !maxrec--) exit(0); + xo_open_instance("last"); t = bp->ut_tv.tv_sec; tm = localtime(&t); (void) strftime(ct, sizeof(ct), d_first ? @@ -331,48 +347,55 @@ printentry(struct utmpx *bp, struct idtab *tt) (yflag ? "%a %b %e %Y %R" : "%a %b %e %R"), tm); switch (bp->ut_type) { case BOOT_TIME: - printf("%-42s", "boot time"); + xo_emit("{:user/%-42s/%s}", "boot time"); break; case SHUTDOWN_TIME: - printf("%-42s", "shutdown time"); + xo_emit("{:user/%-42s/%s}", "shutdown time"); break; case OLD_TIME: - printf("%-42s", "old time"); + xo_emit("{:user/%-42s/%s}", "old time"); break; case NEW_TIME: - printf("%-42s", "new time"); + xo_emit("{:user/%-42s/%s}", "new time"); break; case USER_PROCESS: - printf("%-10s %-8s %-22.22s", + xo_emit("{:user/%-10s/%s} {:tty/%-8s/%s} {:from/%-22.22s/%s}", bp->ut_user, bp->ut_line, bp->ut_host); break; } - printf(" %s%c", ct, tt == NULL ? '\n' : ' '); + xo_attr("seconds", "%lu", (unsigned long)t); + xo_emit(" {:login-time/%s%c/%s}", ct, tt == NULL ? '\n' : ' '); if (tt == NULL) - return; + goto end; if (!tt->logout) { - puts(" still logged in"); - return; + xo_emit(" {:logout-time/still logged in}\n"); + goto end; } if (tt->logout < 0) { tt->logout = -tt->logout; - printf("- %s", crmsg); + xo_emit("- {:logout-reason/%s}", crmsg); } else { tm = localtime(&tt->logout); (void) strftime(ct, sizeof(ct), "%R", tm); - printf("- %s", ct); + xo_attr("seconds", "%lu", (unsigned long)tt->logout); + xo_emit("- {:logout-time/%s}", ct); } delta = tt->logout - bp->ut_tv.tv_sec; + xo_attr("seconds", "%ld", (long)delta); if (sflag) { - printf(" (%8ld)\n", (long)delta); + xo_emit(" ({:session-length/%8ld})\n", (long)delta); } else { tm = gmtime(&delta); (void) strftime(ct, sizeof(ct), width >= 8 ? "%T" : "%R", tm); if (delta < 86400) - printf(" (%s)\n", ct); + xo_emit(" ({:session-length/%s})\n", ct); else - printf(" (%ld+%s)\n", (long)delta / 86400, ct); + xo_emit(" ({:session-length/%ld+%s})\n", + (long)delta / 86400, ct); } + +end: + xo_close_instance("last"); } /* @@ -423,7 +446,7 @@ addarg(int type, char *arg) ARG *cur; if ((cur = malloc(sizeof(ARG))) == NULL) - errx(1, "malloc failure"); + xo_errx(1, "malloc failure"); cur->next = arglist; cur->type = type; cur->name = arg; @@ -448,7 +471,7 @@ hostconv(char *arg) if (first) { first = 0; if (gethostname(name, sizeof(name))) - err(1, "gethostname"); + xo_err(1, "gethostname"); hostdot = strchr(name, '.'); } if (hostdot && !strcasecmp(hostdot, argdot)) @@ -471,7 +494,7 @@ ttyconv(char *arg) if (strlen(arg) == 2) { /* either 6 for "ttyxx" or 8 for "console" */ if ((mval = malloc(8)) == NULL) - errx(1, "malloc failure"); + xo_errx(1, "malloc failure"); if (!strcmp(arg, "co")) (void)strcpy(mval, "console"); else { @@ -501,9 +524,9 @@ dateconv(char *arg) /* Start with the current time. */ if (time(&timet) < 0) - err(1, "time"); + xo_err(1, "time"); if ((t = localtime(&timet)) == NULL) - err(1, "localtime"); + xo_err(1, "localtime"); /* [[CC]YY]MMDDhhmm[.SS] */ if ((p = strchr(arg, '.')) == NULL) @@ -552,7 +575,7 @@ dateconv(char *arg) t->tm_isdst = -1; /* Figure out DST. */ timet = mktime(t); if (timet == -1) -terr: errx(1, +terr: xo_errx(1, "out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]"); return timet; } From owner-svn-src-all@freebsd.org Tue Sep 4 09:58:15 2018 Return-Path: Delivered-To: svn-src-all@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 E663CFE98CE; Tue, 4 Sep 2018 09:58:14 +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 9ACDC90A2F; Tue, 4 Sep 2018 09:58:14 +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 8E319157D8; Tue, 4 Sep 2018 09:58:14 +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 w849wEmO082812; Tue, 4 Sep 2018 09:58:14 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w849wDuF082810; Tue, 4 Sep 2018 09:58:13 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201809040958.w849wDuF082810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Tue, 4 Sep 2018 09:58: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: r338452 - stable/11/usr.sbin/lastlogin X-SVN-Group: stable-11 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/11/usr.sbin/lastlogin X-SVN-Commit-Revision: 338452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 09:58:15 -0000 Author: philip Date: Tue Sep 4 09:58:13 2018 New Revision: 338452 URL: https://svnweb.freebsd.org/changeset/base/338452 Log: MFC r338353: Add libxo(3) support to lastlogin(8). Modified: stable/11/usr.sbin/lastlogin/Makefile stable/11/usr.sbin/lastlogin/lastlogin.8 stable/11/usr.sbin/lastlogin/lastlogin.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/lastlogin/Makefile ============================================================================== --- stable/11/usr.sbin/lastlogin/Makefile Tue Sep 4 09:53:45 2018 (r338451) +++ stable/11/usr.sbin/lastlogin/Makefile Tue Sep 4 09:58:13 2018 (r338452) @@ -2,5 +2,6 @@ PROG= lastlogin MAN= lastlogin.8 +LIBADD= xo .include Modified: stable/11/usr.sbin/lastlogin/lastlogin.8 ============================================================================== --- stable/11/usr.sbin/lastlogin/lastlogin.8 Tue Sep 4 09:53:45 2018 (r338451) +++ stable/11/usr.sbin/lastlogin/lastlogin.8 Tue Sep 4 09:58:13 2018 (r338452) @@ -31,7 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 6, 2011 +.Dd August 28, 2018 .Dt LASTLOGIN 8 .Os .Sh NAME @@ -39,6 +39,7 @@ .Nd indicate last login time of users .Sh SYNOPSIS .Nm +.Op Fl -libxo .Op Fl f Ar file .Op Fl rt .Op Ar user ... @@ -68,6 +69,13 @@ The last login database is never turned over or delete .Pp The following options are available: .Bl -tag -width indent +.It Fl -libxo +Generate output via +.Xr libxo 3 +in a selection of different human and machine readable formats. +See +.Xr xo_parse_args 3 +for details on command line arguments. .It Fl f Ar file Open last login database .Ar file @@ -86,9 +94,15 @@ last login database .Xr last 1 , .Xr getutxent 3 , .Xr ac 8 +.Xr libxo 3 , +.Xr xo_parse_args 3 .Sh AUTHORS +.An -nosplit .An John M. Vinopal wrote this program in January 1996 and contributed it to the .Nx project. +.An Philip Paeps added +.Xr libxo 3 +support in August 2018. Modified: stable/11/usr.sbin/lastlogin/lastlogin.c ============================================================================== --- stable/11/usr.sbin/lastlogin/lastlogin.c Tue Sep 4 09:53:45 2018 (r338451) +++ stable/11/usr.sbin/lastlogin/lastlogin.c Tue Sep 4 09:58:13 2018 (r338452) @@ -2,6 +2,7 @@ * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1996 John M. Vinopal + * Copyright (c) 2018 Philip Paeps * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,6 +47,8 @@ __RCSID("$NetBSD: lastlogin.c,v 1.4 1998/02/03 04:45:3 #include #include +#include + int main(int, char **); static void output(struct utmpx *); static void usage(void); @@ -79,6 +82,10 @@ main(int argc, char *argv[]) int ch, i, ulistsize; struct utmpx *u, *ulist; + argc = xo_parse_args(argc, argv); + if (argc < 0) + exit(1); + while ((ch = getopt(argc, argv, "f:rt")) != -1) { switch (ch) { case 'f': @@ -97,13 +104,16 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + xo_open_container("lastlogin-information"); + xo_open_list("lastlogin"); + if (argc > 0) { /* Process usernames given on the command line. */ for (i = 0; i < argc; i++) { if (setutxdb(UTXDB_LASTLOGIN, file) != 0) - err(1, "failed to open lastlog database"); + xo_err(1, "failed to open lastlog database"); if ((u = getutxuser(argv[i])) == NULL) { - warnx("user '%s' not found", argv[i]); + xo_warnx("user '%s' not found", argv[i]); continue; } output(u); @@ -112,7 +122,7 @@ main(int argc, char *argv[]) } else { /* Read all lastlog entries, looking for active ones. */ if (setutxdb(UTXDB_LASTLOGIN, file) != 0) - err(1, "failed to open lastlog database"); + xo_err(1, "failed to open lastlog database"); ulist = NULL; ulistsize = 0; while ((u = getutxent()) != NULL) { @@ -122,7 +132,7 @@ main(int argc, char *argv[]) ulist = realloc(ulist, (ulistsize + 16) * sizeof(struct utmpx)); if (ulist == NULL) - err(1, "malloc"); + xo_err(1, "malloc"); } ulist[ulistsize++] = *u; } @@ -133,6 +143,10 @@ main(int argc, char *argv[]) output(&ulist[i]); } + xo_close_list("lastlogin"); + xo_close_container("lastlogin-information"); + xo_finish(); + exit(0); } @@ -142,13 +156,18 @@ output(struct utmpx *u) { time_t t = u->ut_tv.tv_sec; - printf("%-10s %-8s %-22.22s %s", - u->ut_user, u->ut_line, u->ut_host, ctime(&t)); + xo_open_instance("lastlogin"); + xo_emit("{:user/%-10s/%s} {:tty/%-8s/%s} {:from/%-22.22s/%s}", + u->ut_user, u->ut_line, u->ut_host); + xo_attr("seconds", "%lu", (unsigned long)t); + xo_emit(" {:login-time/%.24s/%.24s}\n", ctime(&t)); + xo_close_instance("lastlogin"); } static void usage(void) { - fprintf(stderr, "usage: lastlogin [-f file] [-rt] [user ...]\n"); + xo_error("usage: lastlogin [-f file] [-rt] [user ...]\n"); + xo_finish(); exit(1); } From owner-svn-src-all@freebsd.org Tue Sep 4 09:59:33 2018 Return-Path: Delivered-To: svn-src-all@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 2163CFE9990; Tue, 4 Sep 2018 09:59:33 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C49F90B9A; Tue, 4 Sep 2018 09:59:32 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-lf1-x142.google.com with SMTP id h64-v6so2429846lfi.10; Tue, 04 Sep 2018 02:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc; bh=6a1shjHvDEmKJ26KED68MPUpiwGhzJBvAcBqVysIKXE=; b=SncvS/7HByHHt10bfWkR/IDUXqn/vrblgkBmH8BQWT9RrGHIbiQv2BLEZISNgFdBon lxClMt5NR2B8fDSeBeY8E0VDdwtLEAr6g8T7IVrfjeeryV1F2VPSTuN8HnDwfHi72LQn d4+y8JZP2XZAdaFbuKexUnA8mNw/wxKIlF6aelg5LjfgcVzTwVfCK259SKYc6Vl4qLRD V1cB9/irfQ+GSbgTAtupbN+91+jf9FDQ4ToRgWFSSoFEE33HvTMKakXCGShpmqXXxIWf RnGhsgu9QmzupAlOg9XnXjC8IJDLuBuPjReXAo1Ca3ag1KtkCJnAOFEroU74q3+6sjeB hRRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=6a1shjHvDEmKJ26KED68MPUpiwGhzJBvAcBqVysIKXE=; b=Mywr1+50rH3qQhfjUXuWdl1yswmxRKtQCjDWS0/YySR9e1CkLvOa/u5spkplZxV6Z8 uJMxgUEs8B9SzbqYgGnvn1VLyjDFieDlwsVLavhU7wFtczBqLugRr3iurBCd9PBeFkqf Q1qKe3tYDME61xrCO0nmBHnLeBRHnHxTXAb5hGJzQPhzNckBpryomUojJ3cpq5pCwiKP zXhMAzRHIQJ2UJ4luDAE96X0vp5gLaAf9mZ+caFNRaX1jwwn10xoNZ/0qD7N+n7oYKWU 4YJ9g7TsX9eLbMQndoj6unJ42920K7+UG7ckvOVsDaOI1Z4xwB/m0auOURxSt+1UcTIz UKTw== X-Gm-Message-State: APzg51DZMNrfwJ6AaJ63PwrEfIIuq1woImJHCVCH/5mlr5BA1uDowZOt 2G+Y2lp9KTJDpmv8g6VcPJIRVYaHnZ+9I6ae4eEr/Q== X-Google-Smtp-Source: ANB0VdbD8I5etAakMETAHkEKeRmFRgpwNi7iz7CQYKm4w6wuXbtZnB1TbAu2vgnV3/L1OuVw9hqKniKVpLaYtfbA/3w= X-Received: by 2002:a19:4b15:: with SMTP id y21-v6mr19708690lfa.118.1536055170997; Tue, 04 Sep 2018 02:59:30 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a19:db4b:0:0:0:0:0 with HTTP; Tue, 4 Sep 2018 02:59:30 -0700 (PDT) Reply-To: araujo@freebsd.org In-Reply-To: <201809040953.w849rj4j082295@repo.freebsd.org> References: <201809040953.w849rj4j082295@repo.freebsd.org> From: Marcelo Araujo Date: Tue, 4 Sep 2018 17:59:30 +0800 Message-ID: Subject: Re: svn commit: r338451 - stable/11/usr.bin/last To: Philip Paeps Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 09:59:33 -0000 2018-09-04 17:53 GMT+08:00 Philip Paeps : > Author: philip > Date: Tue Sep 4 09:53:45 2018 > New Revision: 338451 > URL: https://svnweb.freebsd.org/changeset/base/338451 > > Log: > MFC r319508: > Fix a memory leak with last > free memory allocated to 'buf' > Is that the right patch? Or the commit message missed adding support to libxo(3)? > > Submitted by: Thomas Rix > > MFC r338352: > Add libxo(3) support to last(1). > > Modified: > stable/11/usr.bin/last/Makefile > stable/11/usr.bin/last/last.1 > stable/11/usr.bin/last/last.c > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/usr.bin/last/Makefile > ============================================================ > ================== > --- stable/11/usr.bin/last/Makefile Mon Sep 3 22:27:27 2018 > (r338450) > +++ stable/11/usr.bin/last/Makefile Tue Sep 4 09:53:45 2018 > (r338451) > @@ -2,6 +2,7 @@ > # $FreeBSD$ > > PROG= last > +LIBADD= xo > > NO_WFORMAT= > > > Modified: stable/11/usr.bin/last/last.1 > ============================================================ > ================== > --- stable/11/usr.bin/last/last.1 Mon Sep 3 22:27:27 2018 > (r338450) > +++ stable/11/usr.bin/last/last.1 Tue Sep 4 09:53:45 2018 > (r338451) > @@ -28,7 +28,7 @@ > .\" @(#)last.1 8.1 (Berkeley) 6/6/93 > .\" $FreeBSD$ > .\" > -.Dd June 6, 2015 > +.Dd August 28, 2018 > .Dt LAST 1 > .Os > .Sh NAME > @@ -36,6 +36,7 @@ > .Nd indicate last logins of users and ttys > .Sh SYNOPSIS > .Nm > +.Op Fl -libxo > .Op Fl swy > .Oo > .Fl d > @@ -72,6 +73,13 @@ will so indicate. > .Pp > The following options are available: > .Bl -tag -width indent-two > +.It Fl -libxo > +Generate output via > +.Xr libxo 3 > +in a selection of different human and machine readable formats. > +See > +.Xr xo_parse_args 3 > +for details on command line arguments. > .It Fl d Ar date > Specify the snapshot date and time. > All users logged in at the snapshot date and time will > @@ -201,6 +209,8 @@ login data base > .Xr getutxent 3 , > .Xr ac 8 , > .Xr lastlogin 8 > +.Xr libxo 3 , > +.Xr xo_parse_args 3 > .Sh HISTORY > .Nm > utility first appeared in > @@ -211,6 +221,10 @@ The original version was written by > .An Howard P. Katseff ; > .An Keith Bostic > rewrote it in 1986/87 to add functionality and to improve code quality. > +.An Philip Paeps > +added > +.Xr libxo 3 > +support in August 2018. > .Sh BUGS > If a login shell should terminate abnormally for some reason, it is likely > that a logout record will not be written to the > > Modified: stable/11/usr.bin/last/last.c > ============================================================ > ================== > --- stable/11/usr.bin/last/last.c Mon Sep 3 22:27:27 2018 > (r338450) > +++ stable/11/usr.bin/last/last.c Tue Sep 4 09:53:45 2018 > (r338451) > @@ -1,6 +1,7 @@ > /* > * Copyright (c) 1987, 1993, 1994 > * The Regents of the University of California. All rights reserved. > + * Copyright (c) 2018 Philip Paeps > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > @@ -58,6 +59,8 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#include > + > #define NO 0 /* false/no */ > #define YES 1 /* true/yes */ > #define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); > (ar) += 2; > @@ -108,7 +111,7 @@ static void wtmp(void); > static void > usage(void) > { > - (void)fprintf(stderr, > + xo_error( > "usage: last [-swy] [-d [[CC]YY][MMDD]hhmm[.SS]] [-f file] [-h host]\n" > " [-n maxrec] [-t tty] [user ...]\n"); > exit(1); > @@ -123,6 +126,11 @@ main(int argc, char *argv[]) > (void) setlocale(LC_TIME, ""); > d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); > > + argc = xo_parse_args(argc, argv); > + if (argc < 0) > + exit(1); > + atexit(xo_finish_atexit); > + > maxrec = -1; > snaptime = 0; > while ((ch = getopt(argc, argv, "0123456789d:f:h:n:st:wy")) != -1) > @@ -157,7 +165,7 @@ main(int argc, char *argv[]) > maxrec = strtol(optarg, &p, 10); > if (p == optarg || *p != '\0' || errno != 0 || > maxrec <= 0) > - errx(1, "%s: bad line count", optarg); > + xo_errx(1, "%s: bad line count", optarg); > break; > case 's': > sflag++; /* Show delta as seconds */ > @@ -212,14 +220,16 @@ wtmp(void) > SLIST_INIT(&idlist); > (void)time(&t); > > + xo_open_container("last-information"); > + > /* Load the last entries from the file. */ > if (setutxdb(UTXDB_LOG, file) != 0) > - err(1, "%s", file); > + xo_err(1, "%s", file); > while ((ut = getutxent()) != NULL) { > if (amount % 128 == 0) { > buf = realloc(buf, (amount + 128) * sizeof *ut); > if (buf == NULL) > - err(1, "realloc"); > + xo_err(1, "realloc"); > } > memcpy(&buf[amount++], ut, sizeof *ut); > if (t > ut->ut_tv.tv_sec) > @@ -228,12 +238,17 @@ wtmp(void) > endutxent(); > > /* Display them in reverse order. */ > + xo_open_list("last"); > while (amount > 0) > doentry(&buf[--amount]); > - > + xo_close_list("last"); > + free(buf); > tm = localtime(&t); > (void) strftime(ct, sizeof(ct), "%+", tm); > - printf("\n%s begins %s\n", ((file == NULL) ? "utx.log" : file), > ct); > + xo_emit("\n{:utxdb/%s}", (file == NULL) ? "utx.log" : file); > + xo_attr("seconds", "%lu", (unsigned long) t); > + xo_emit(" begins {:begins/%s}\n", ct); > + xo_close_container("last-information"); > } > > /* > @@ -288,7 +303,7 @@ doentry(struct utmpx *bp) > /* add new one */ > tt = malloc(sizeof(struct idtab)); > if (tt == NULL) > - errx(1, "malloc failure"); > + xo_errx(1, "malloc failure"); > tt->logout = currentout; > memcpy(tt->id, bp->ut_id, sizeof bp->ut_id); > SLIST_INSERT_HEAD(&idlist, tt, list); > @@ -324,6 +339,7 @@ printentry(struct utmpx *bp, struct idtab *tt) > > if (maxrec != -1 && !maxrec--) > exit(0); > + xo_open_instance("last"); > t = bp->ut_tv.tv_sec; > tm = localtime(&t); > (void) strftime(ct, sizeof(ct), d_first ? > @@ -331,48 +347,55 @@ printentry(struct utmpx *bp, struct idtab *tt) > (yflag ? "%a %b %e %Y %R" : "%a %b %e %R"), tm); > switch (bp->ut_type) { > case BOOT_TIME: > - printf("%-42s", "boot time"); > + xo_emit("{:user/%-42s/%s}", "boot time"); > break; > case SHUTDOWN_TIME: > - printf("%-42s", "shutdown time"); > + xo_emit("{:user/%-42s/%s}", "shutdown time"); > break; > case OLD_TIME: > - printf("%-42s", "old time"); > + xo_emit("{:user/%-42s/%s}", "old time"); > break; > case NEW_TIME: > - printf("%-42s", "new time"); > + xo_emit("{:user/%-42s/%s}", "new time"); > break; > case USER_PROCESS: > - printf("%-10s %-8s %-22.22s", > + xo_emit("{:user/%-10s/%s} {:tty/%-8s/%s} > {:from/%-22.22s/%s}", > bp->ut_user, bp->ut_line, bp->ut_host); > break; > } > - printf(" %s%c", ct, tt == NULL ? '\n' : ' '); > + xo_attr("seconds", "%lu", (unsigned long)t); > + xo_emit(" {:login-time/%s%c/%s}", ct, tt == NULL ? '\n' : ' '); > if (tt == NULL) > - return; > + goto end; > if (!tt->logout) { > - puts(" still logged in"); > - return; > + xo_emit(" {:logout-time/still logged in}\n"); > + goto end; > } > if (tt->logout < 0) { > tt->logout = -tt->logout; > - printf("- %s", crmsg); > + xo_emit("- {:logout-reason/%s}", crmsg); > } else { > tm = localtime(&tt->logout); > (void) strftime(ct, sizeof(ct), "%R", tm); > - printf("- %s", ct); > + xo_attr("seconds", "%lu", (unsigned long)tt->logout); > + xo_emit("- {:logout-time/%s}", ct); > } > delta = tt->logout - bp->ut_tv.tv_sec; > + xo_attr("seconds", "%ld", (long)delta); > if (sflag) { > - printf(" (%8ld)\n", (long)delta); > + xo_emit(" ({:session-length/%8ld})\n", (long)delta); > } else { > tm = gmtime(&delta); > (void) strftime(ct, sizeof(ct), width >= 8 ? "%T" : "%R", > tm); > if (delta < 86400) > - printf(" (%s)\n", ct); > + xo_emit(" ({:session-length/%s})\n", ct); > else > - printf(" (%ld+%s)\n", (long)delta / 86400, ct); > + xo_emit(" ({:session-length/%ld+%s})\n", > + (long)delta / 86400, ct); > } > + > +end: > + xo_close_instance("last"); > } > > /* > @@ -423,7 +446,7 @@ addarg(int type, char *arg) > ARG *cur; > > if ((cur = malloc(sizeof(ARG))) == NULL) > - errx(1, "malloc failure"); > + xo_errx(1, "malloc failure"); > cur->next = arglist; > cur->type = type; > cur->name = arg; > @@ -448,7 +471,7 @@ hostconv(char *arg) > if (first) { > first = 0; > if (gethostname(name, sizeof(name))) > - err(1, "gethostname"); > + xo_err(1, "gethostname"); > hostdot = strchr(name, '.'); > } > if (hostdot && !strcasecmp(hostdot, argdot)) > @@ -471,7 +494,7 @@ ttyconv(char *arg) > if (strlen(arg) == 2) { > /* either 6 for "ttyxx" or 8 for "console" */ > if ((mval = malloc(8)) == NULL) > - errx(1, "malloc failure"); > + xo_errx(1, "malloc failure"); > if (!strcmp(arg, "co")) > (void)strcpy(mval, "console"); > else { > @@ -501,9 +524,9 @@ dateconv(char *arg) > > /* Start with the current time. */ > if (time(&timet) < 0) > - err(1, "time"); > + xo_err(1, "time"); > if ((t = localtime(&timet)) == NULL) > - err(1, "localtime"); > + xo_err(1, "localtime"); > > /* [[CC]YY]MMDDhhmm[.SS] */ > if ((p = strchr(arg, '.')) == NULL) > @@ -552,7 +575,7 @@ dateconv(char *arg) > t->tm_isdst = -1; /* Figure out DST. */ > timet = mktime(t); > if (timet == -1) > -terr: errx(1, > +terr: xo_errx(1, > "out of range or illegal time specification: > [[CC]YY]MMDDhhmm[.SS]"); > return timet; > } > > -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_) From owner-svn-src-all@freebsd.org Tue Sep 4 10:09:38 2018 Return-Path: Delivered-To: svn-src-all@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 1F535FEA00F; Tue, 4 Sep 2018 10:09:38 +0000 (UTC) (envelope-from philip@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B273F910F5; Tue, 4 Sep 2018 10:09:37 +0000 (UTC) (envelope-from philip@freebsd.org) Received: from weatherwax.trouble.is (weatherwax.trouble.is [176.58.93.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "weatherwax.trouble.is", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: philip/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 8AD3A9E2D; Tue, 4 Sep 2018 10:09:37 +0000 (UTC) (envelope-from philip@freebsd.org) Received: from rincewind.trouble.is (rincewind.trouble.is [IPv6:2a01:4f8:a0:10e6::1:1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "rincewind.trouble.is", Issuer "Let's Encrypt Authority X3" (verified OK)) by weatherwax.trouble.is (Postfix) with ESMTPS id 424My74fVcz3C25; Tue, 4 Sep 2018 10:09:35 +0000 (UTC) Received: by rincewind.trouble.is (Postfix, from userid 1001) id 424My70nthzJcZ; Tue, 4 Sep 2018 10:09:35 +0000 (UTC) Date: Tue, 4 Sep 2018 12:09:35 +0200 From: Philip Paeps To: araujo@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r338451 - stable/11/usr.bin/last Message-ID: <20180904100934.GC27236@rincewind.trouble.is> Mail-Followup-To: araujo@freebsd.org, src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org References: <201809040953.w849rj4j082295@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-PGP-Fingerprint: 2CD1 92C2 6EE7 B7D1 F552 6619 31AE B9B5 FDBB CB0E X-Date: Today is Boomtime, the 28th day of Bureaucracy in the YOLD 3184 X-Phase-of-Moon: The Moon is Waning Crescent (36% of Full) X-Clacks-Overhead: GNU Terry Pratchett Organization: Happily Disorganized User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 10:09:38 -0000 On 2018-09-04 17:59:30 (+0800), Marcelo Araujo wrote: >2018-09-04 17:53 GMT+08:00 Philip Paeps : > >> Author: philip >> Date: Tue Sep 4 09:53:45 2018 >> New Revision: 338451 >> URL: https://svnweb.freebsd.org/changeset/base/338451 >> >> Log: >> MFC r319508: >> Fix a memory leak with last >> free memory allocated to 'buf' > >Is that the right patch? Or the commit message missed adding support to >libxo(3)? I merged two changes: * r319508 plugs a memory leak. This was originally committed by stevek in June 2017 but apparently never MFCed. * rr338352 adds libxo support. I mentioned both changes in the commit message. I'm not sure what's unclear. Philip -- Philip Paeps Senior Reality Engineer Ministry of Information From owner-svn-src-all@freebsd.org Tue Sep 4 10:15:17 2018 Return-Path: Delivered-To: svn-src-all@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 35C94FEA533; Tue, 4 Sep 2018 10:15:17 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A12149151E; Tue, 4 Sep 2018 10:15:16 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-lf1-x142.google.com with SMTP id h64-v6so2466553lfi.10; Tue, 04 Sep 2018 03:15:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to; bh=3gsYFROSo1KnB/kKgOezoS4tW4fgx+vXrLW+Itclj4s=; b=Oo4wEd2OvCeuUYh50vbV9RKfUpOBjZlUmXy4aOUYx/tYwrQodhNjRgv69CLBoukFsz poGNWFxjmjUcHEa1frDcd2z+Ryd6bH3TnMnEJ9/xFFPEzaIUAy83LZw8UtsPPsVkXaJQ eTqcEa1ccbatvq/9KGA826mr8mCkCTox6mEEF7d/6Eo4dcTf2WYTcWuDWKafYK5ZwzQI fsGSTmA/hgMyFHpy7kkVTAYkOgpXtszlg8Av/MdNM6//6GVD67HFOshITjJKKY+jisHt 2KsRXcwzoa5JU0vUXjyANiXLB5KBlmMrBspH7vdS7PgPfiHv9eLo5LZXOnLtiI6DB05f GuVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to; bh=3gsYFROSo1KnB/kKgOezoS4tW4fgx+vXrLW+Itclj4s=; b=JxP09qLnxQmYyMLPzUicqMmUN0sU7UGlzBxPBQuxwTVHQu3Fr0DOHT7gIIfE6AeYkz V2lequCMLReDlxt4D6F1r4QFwBQaGFtbVpmS9/01ywIINysdPEo1qFBY5RhqokyHC4HX PrDDKjAOqLxLtZL4cphm2mhTs1JVMSCjbZlyqtIgrzCvvDBKzfMCr95AmKelhiEXfDTV Hm6tFA+54TqQTv/EuM1ZqnLtbotZz6OqjwwmH0vWu+g0mKzNLq3i84wMlLbdwqIrqtc4 5UyGl5LWsIosIHbeNlDvCplRK5Led7B7QtlM72NTi5BiF9TK8Eiyu/xfTHUVwJB38e5j R1fQ== X-Gm-Message-State: APzg51DfcEnWFJZ2mQyMrKFxqpMH8oII62g5y7CGS6k9o2TjTFB6Pfkb w0Afj4dMakxFqtjsJ6/DhtkcslkyfyW9zgbz3euAww== X-Google-Smtp-Source: ANB0VdapOBGDcQMeYsJU9JCfecpZa2H/RBjgxabR6+PnDlj1VjVN+V/hisUtI0K0D+aTbvQQGblJYSyAjyLKSe2VApw= X-Received: by 2002:a19:11d1:: with SMTP id 78-v6mr19761257lfr.25.1536056115158; Tue, 04 Sep 2018 03:15:15 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a19:db4b:0:0:0:0:0 with HTTP; Tue, 4 Sep 2018 03:15:14 -0700 (PDT) Reply-To: araujo@freebsd.org In-Reply-To: <20180904100934.GC27236@rincewind.trouble.is> References: <201809040953.w849rj4j082295@repo.freebsd.org> <20180904100934.GC27236@rincewind.trouble.is> From: Marcelo Araujo Date: Tue, 4 Sep 2018 18:15:14 +0800 Message-ID: Subject: Re: svn commit: r338451 - stable/11/usr.bin/last To: Marcelo Araujo , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 10:15:17 -0000 2018-09-04 18:09 GMT+08:00 Philip Paeps : > On 2018-09-04 17:59:30 (+0800), Marcelo Araujo wrote: > >> 2018-09-04 17:53 GMT+08:00 Philip Paeps : >> >> Author: philip >>> Date: Tue Sep 4 09:53:45 2018 >>> New Revision: 338451 >>> URL: https://svnweb.freebsd.org/changeset/base/338451 >>> >>> Log: >>> MFC r319508: >>> Fix a memory leak with last >>> free memory allocated to 'buf' >>> >> >> Is that the right patch? Or the commit message missed adding support to >> libxo(3)? >> > > I merged two changes: > > * r319508 plugs a memory leak. This was originally committed by stevek in > June 2017 but apparently never MFCed. > > * rr338352 adds libxo support. > > I mentioned both changes in the commit message. I'm not sure what's > unclear. > Ops, my bad! I just read the first MFC! Sorry for the noise! > > Philip > > -- > Philip Paeps > Senior Reality Engineer > Ministry of Information > -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_) From owner-svn-src-all@freebsd.org Tue Sep 4 10:51:42 2018 Return-Path: Delivered-To: svn-src-all@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 C2A2AFEB3E9; Tue, 4 Sep 2018 10:51:42 +0000 (UTC) (envelope-from des@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 77D0A92783; Tue, 4 Sep 2018 10:51:42 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 72C0616133; Tue, 4 Sep 2018 10:51:42 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w84ApgIw012478; Tue, 4 Sep 2018 10:51:42 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w84ApgC8012476; Tue, 4 Sep 2018 10:51:42 GMT (envelope-from des@FreeBSD.org) Message-Id: <201809041051.w84ApgC8012476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Tue, 4 Sep 2018 10:51:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338453 - head/lib/libpam/modules/pam_exec X-SVN-Group: head X-SVN-Commit-Author: des X-SVN-Commit-Paths: head/lib/libpam/modules/pam_exec X-SVN-Commit-Revision: 338453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 10:51:42 -0000 Author: des Date: Tue Sep 4 10:51:41 2018 New Revision: 338453 URL: https://svnweb.freebsd.org/changeset/base/338453 Log: For full Linux-PAM compatibility, add a trailing NUL character when passing the authentication token to the external program. Approved by: re (kib) Submitted by: Thomas Munro MFC after: 1 week Differential Revision: D16950 Modified: head/lib/libpam/modules/pam_exec/pam_exec.8 head/lib/libpam/modules/pam_exec/pam_exec.c Modified: head/lib/libpam/modules/pam_exec/pam_exec.8 ============================================================================== --- head/lib/libpam/modules/pam_exec/pam_exec.8 Tue Sep 4 09:58:13 2018 (r338452) +++ head/lib/libpam/modules/pam_exec/pam_exec.8 Tue Sep 4 10:51:41 2018 (r338453) @@ -74,7 +74,8 @@ Ignored for compatibility reasons. Use the program exit status as the return code of the pam_sm_* function. It must be a valid return value for this function. .It Cm expose_authtok -Write the authentication token to the program's standard input stream. +Write the authentication token to the program's standard input stream, +followed by a NUL character. .It Cm -- Stop options parsing; program and its arguments follow. Modified: head/lib/libpam/modules/pam_exec/pam_exec.c ============================================================================== --- head/lib/libpam/modules/pam_exec/pam_exec.c Tue Sep 4 09:58:13 2018 (r338452) +++ head/lib/libpam/modules/pam_exec/pam_exec.c Tue Sep 4 10:51:41 2018 (r338453) @@ -254,7 +254,8 @@ _pam_exec(pam_handle_t *pamh, } rc = pam_get_authtok(pamh, PAM_AUTHTOK, &authtok, NULL); if (rc == PAM_SUCCESS) { - authtok_size = strlen(authtok); + /* We include the trailing NUL-terminator. */ + authtok_size = strlen(authtok) + 1; } else { openpam_log(PAM_LOG_ERROR, "%s: pam_get_authtok(): %s", func, pam_strerror(pamh, rc)); From owner-svn-src-all@freebsd.org Tue Sep 4 15:48:16 2018 Return-Path: Delivered-To: svn-src-all@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 672AFFF2FF4; Tue, 4 Sep 2018 15:48:16 +0000 (UTC) (envelope-from brd@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 165BF747A0; Tue, 4 Sep 2018 15:48:16 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 101CB19066; Tue, 4 Sep 2018 15:48:16 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w84FmGkk063102; Tue, 4 Sep 2018 15:48:16 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w84FmD2V063091; Tue, 4 Sep 2018 15:48:13 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201809041548.w84FmD2V063091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Tue, 4 Sep 2018 15:48:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338454 - in head: etc etc/etc.aarch64 etc/etc.amd64 etc/etc.arm etc/etc.i386 etc/etc.mips etc/etc.powerpc etc/etc.riscv etc/etc.sparc64 sbin/init X-SVN-Group: head X-SVN-Commit-Author: brd X-SVN-Commit-Paths: in head: etc etc/etc.aarch64 etc/etc.amd64 etc/etc.arm etc/etc.i386 etc/etc.mips etc/etc.powerpc etc/etc.riscv etc/etc.sparc64 sbin/init X-SVN-Commit-Revision: 338454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 15:48:16 -0000 Author: brd Date: Tue Sep 4 15:48:13 2018 New Revision: 338454 URL: https://svnweb.freebsd.org/changeset/base/338454 Log: Move etc/ttys to sbin/init/. And simplify this a little by flattening the directory structure. Approved by: re (gjb), will (mentor) Differential Revision: https://reviews.freebsd.org/D16955 Added: head/sbin/init/ttys.aarch64 - copied unchanged from r338453, head/etc/etc.aarch64/ttys head/sbin/init/ttys.amd64 - copied unchanged from r338453, head/etc/etc.amd64/ttys head/sbin/init/ttys.arm - copied unchanged from r338453, head/etc/etc.arm/ttys head/sbin/init/ttys.i386 - copied unchanged from r338453, head/etc/etc.i386/ttys head/sbin/init/ttys.mips - copied unchanged from r338453, head/etc/etc.mips/ttys head/sbin/init/ttys.powerpc - copied unchanged from r338453, head/etc/etc.powerpc/ttys head/sbin/init/ttys.riscv - copied unchanged from r338453, head/etc/etc.riscv/ttys head/sbin/init/ttys.sparc64 - copied unchanged from r338453, head/etc/etc.sparc64/ttys Deleted: head/etc/etc.aarch64/ head/etc/etc.amd64/ head/etc/etc.arm/ head/etc/etc.i386/ head/etc/etc.mips/ head/etc/etc.powerpc/ head/etc/etc.riscv/ head/etc/etc.sparc64/ Modified: head/etc/Makefile head/sbin/init/Makefile Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Tue Sep 4 10:51:41 2018 (r338453) +++ head/etc/Makefile Tue Sep 4 15:48:13 2018 (r338454) @@ -35,16 +35,6 @@ BIN1= crontab \ rpc \ termcap.small -.if exists(${.CURDIR}/etc.${MACHINE}/ttys) -BIN1+= etc.${MACHINE}/ttys -.elif exists(${.CURDIR}/etc.${MACHINE_ARCH}/ttys) -BIN1+= etc.${MACHINE_ARCH}/ttys -.elif exists(${.CURDIR}/etc.${MACHINE_CPUARCH}/ttys) -BIN1+= etc.${MACHINE_CPUARCH}/ttys -.else -.error etc.MACHINE/ttys missing -.endif - # NB: keep these sorted by MK_* knobs .if ${MK_AMD} != "no" Modified: head/sbin/init/Makefile ============================================================================== --- head/sbin/init/Makefile Tue Sep 4 10:51:41 2018 (r338453) +++ head/sbin/init/Makefile Tue Sep 4 15:48:13 2018 (r338454) @@ -1,7 +1,7 @@ # @(#)Makefile 8.1 (Berkeley) 7/19/93 # $FreeBSD$ -CONFGROUPS= CONFETC CONFETCEXEC CONFETCDEFAULTS +CONFGROUPS= CONFETC CONFETCEXEC CONFETCDEFAULTS CONFTTYS CONFETCDIR= /etc CONFETC= network.subr rc rc.initdiskless rc.subr rc.shutdown CONFETCMODE= 644 @@ -18,6 +18,17 @@ PRECIOUSPROG= INSTALLFLAGS=-b -B.bak CFLAGS+=-DDEBUGSHELL -DSECURE -DLOGIN_CAP -DCOMPAT_SYSV_INIT LIBADD= util crypt + +CONFTTYSNAME= ttys +.if exists(${.CURDIR}/ttys.${MACHINE}) +CONFTTYS+= ttys.${MACHINE} +.elif exists(${.CURDIR}/ttys.${MACHINE_ARCH}) +CONFTTYS+= ttys.${MACHINE_ARCH} +.elif exists(${.CURDIR}/ttys.${MACHINE_CPUARCH}) +CONFTTYS+= ttys.${MACHINE_CPUARCH} +.else +.error MACHINE.ttys missing +.endif # Needed for getmntopts.c MOUNT= ${SRCTOP}/sbin/mount Copied: head/sbin/init/ttys.aarch64 (from r338453, head/etc/etc.aarch64/ttys) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/init/ttys.aarch64 Tue Sep 4 15:48:13 2018 (r338454, copy of r338453, head/etc/etc.aarch64/ttys) @@ -0,0 +1,49 @@ +# +# $FreeBSD$ +# @(#)ttys 5.1 (Berkeley) 4/17/89 +# +# This file specifies various information about terminals on the system. +# It is used by several different programs. Common entries for the +# various columns include: +# +# name The name of the terminal device. +# +# getty The program to start running on the terminal. Typically a +# getty program, as the name implies. Other common entries +# include none, when no getty is needed, and xdm, to start the +# X Window System. +# +# type The initial terminal type for this port. For hardwired +# terminal lines, this will contain the type of terminal used. +# For virtual consoles, the correct type is typically xterm. +# Other common values include dialup for incoming modem ports, and +# unknown when the terminal type cannot be predetermined. +# +# status Must be on or off. If on, init will run the getty program on +# the specified port. If the word "secure" appears, this tty +# allows root login. +# +# name getty type status comments +# +# If console is marked "insecure", then init will ask for the root password +# when going to single-user mode. +console none unknown off secure +# +ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure +# Virtual terminals +ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure +#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm onifexists secure +# Serial terminals +# The 'dialup' keyword identifies dialin lines to login, fingerd etc. +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure +# Dumb console +dcons "/usr/libexec/getty std.9600" vt100 off secure Copied: head/sbin/init/ttys.amd64 (from r338453, head/etc/etc.amd64/ttys) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/init/ttys.amd64 Tue Sep 4 15:48:13 2018 (r338454, copy of r338453, head/etc/etc.amd64/ttys) @@ -0,0 +1,49 @@ +# +# $FreeBSD$ +# @(#)ttys 5.1 (Berkeley) 4/17/89 +# +# This file specifies various information about terminals on the system. +# It is used by several different programs. Common entries for the +# various columns include: +# +# name The name of the terminal device. +# +# getty The program to start running on the terminal. Typically a +# getty program, as the name implies. Other common entries +# include none, when no getty is needed, and xdm, to start the +# X Window System. +# +# type The initial terminal type for this port. For hardwired +# terminal lines, this will contain the type of terminal used. +# For virtual consoles, the correct type is typically xterm. +# Other common values include dialup for incoming modem ports, and +# unknown when the terminal type cannot be predetermined. +# +# status Must be on or off. If on, init will run the getty program on +# the specified port. If the word "secure" appears, this tty +# allows root login. +# +# name getty type status comments +# +# If console is marked "insecure", then init will ask for the root password +# when going to single-user mode. +console none unknown off secure +# +ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure +# Virtual terminals +ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure +# Serial terminals +# The 'dialup' keyword identifies dialin lines to login, fingerd etc. +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure +# Dumb console +dcons "/usr/libexec/getty std.9600" vt100 off secure Copied: head/sbin/init/ttys.arm (from r338453, head/etc/etc.arm/ttys) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/init/ttys.arm Tue Sep 4 15:48:13 2018 (r338454, copy of r338453, head/etc/etc.arm/ttys) @@ -0,0 +1,49 @@ +# +# $FreeBSD$ +# @(#)ttys 5.1 (Berkeley) 4/17/89 +# +# This file specifies various information about terminals on the system. +# It is used by several different programs. Common entries for the +# various columns include: +# +# name The name of the terminal device. +# +# getty The program to start running on the terminal. Typically a +# getty program, as the name implies. Other common entries +# include none, when no getty is needed, and xdm, to start the +# X Window System. +# +# type The initial terminal type for this port. For hardwired +# terminal lines, this will contain the type of terminal used. +# For virtual consoles, the correct type is typically xterm. +# Other common values include dialup for incoming modem ports, and +# unknown when the terminal type cannot be predetermined. +# +# status Must be on or off. If on, init will run the getty program on +# the specified port. If the word "secure" appears, this tty +# allows root login. +# +# name getty type status comments +# +# If console is marked "insecure", then init will ask for the root password +# when going to single-user mode. +console none unknown off secure +# +ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure +# Virtual terminals +ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure +#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure +# Serial terminals +# The 'dialup' keyword identifies dialin lines to login, fingerd etc. +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure +# Dumb console +dcons "/usr/libexec/getty std.9600" vt100 off secure Copied: head/sbin/init/ttys.i386 (from r338453, head/etc/etc.i386/ttys) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/init/ttys.i386 Tue Sep 4 15:48:13 2018 (r338454, copy of r338453, head/etc/etc.i386/ttys) @@ -0,0 +1,49 @@ +# +# $FreeBSD$ +# @(#)ttys 5.1 (Berkeley) 4/17/89 +# +# This file specifies various information about terminals on the system. +# It is used by several different programs. Common entries for the +# various columns include: +# +# name The name of the terminal device. +# +# getty The program to start running on the terminal. Typically a +# getty program, as the name implies. Other common entries +# include none, when no getty is needed, and xdm, to start the +# X Window System. +# +# type The initial terminal type for this port. For hardwired +# terminal lines, this will contain the type of terminal used. +# For virtual consoles, the correct type is typically xterm. +# Other common values include dialup for incoming modem ports, and +# unknown when the terminal type cannot be predetermined. +# +# status Must be on or off. If on, init will run the getty program on +# the specified port. If the word "secure" appears, this tty +# allows root login. +# +# name getty type status comments +# +# If console is marked "insecure", then init will ask for the root password +# when going to single-user mode. +console none unknown off secure +# +ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure +# Virtual terminals +ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure +# Serial terminals +# The 'dialup' keyword identifies dialin lines to login, fingerd etc. +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure +# Dumb console +dcons "/usr/libexec/getty std.9600" vt100 off secure Copied: head/sbin/init/ttys.mips (from r338453, head/etc/etc.mips/ttys) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/init/ttys.mips Tue Sep 4 15:48:13 2018 (r338454, copy of r338453, head/etc/etc.mips/ttys) @@ -0,0 +1,36 @@ +# +# $FreeBSD$ +# @(#)ttys 5.1 (Berkeley) 4/17/89 +# +# This file specifies various information about terminals on the system. +# It is used by several different programs. Common entries for the +# various columns include: +# +# name The name of the terminal device. +# +# getty The program to start running on the terminal. Typically a +# getty program, as the name implies. Other common entries +# include none, when no getty is needed, and xdm, to start the +# X Window System. +# +# type The initial terminal type for this port. For hardwired +# terminal lines, this will contain the type of terminal used. +# For virtual consoles, the correct type is typically xterm. +# Other common values include dialup for incoming modem ports, and +# unknown when the terminal type cannot be predetermined. +# +# status Must be on or off. If on, init will run the getty program on +# the specified port. If the word "secure" appears, this tty +# allows root login. +# +# name getty type status comments +# +# If console is marked "insecure", then init will ask for the root password +# when going to single-user mode. +console none unknown off secure +# Serial terminals +# The 'dialup' keyword identifies dialin lines to login, fingerd etc. +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure Copied: head/sbin/init/ttys.powerpc (from r338453, head/etc/etc.powerpc/ttys) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/init/ttys.powerpc Tue Sep 4 15:48:13 2018 (r338454, copy of r338453, head/etc/etc.powerpc/ttys) @@ -0,0 +1,49 @@ +# +# $FreeBSD$ +# @(#)ttys 5.1 (Berkeley) 4/17/89 +# +# This file specifies various information about terminals on the system. +# It is used by several different programs. Common entries for the +# various columns include: +# +# name The name of the terminal device. +# +# getty The program to start running on the terminal. Typically a +# getty program, as the name implies. Other common entries +# include none, when no getty is needed, and xdm, to start the +# X Window System. +# +# type The initial terminal type for this port. For hardwired +# terminal lines, this will contain the type of terminal used. +# For virtual consoles, the correct type is typically xterm. +# Other common values include dialup for incoming modem ports, and +# unknown when the terminal type cannot be predetermined. +# +# status Must be on or off. If on, init will run the getty program on +# the specified port. If the word "secure" appears, this tty +# allows root login. +# +# name getty type status comments +# +# If console is marked "insecure", then init will ask for the root password +# when going to single-user mode. +console none unknown off secure +# +ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure +# Virtual terminals +ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure +#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure +# Serial terminals +# The 'dialup' keyword identifies dialin lines to login, fingerd etc. +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure +# Dumb console +dcons "/usr/libexec/getty std.9600" vt100 off secure Copied: head/sbin/init/ttys.riscv (from r338453, head/etc/etc.riscv/ttys) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/init/ttys.riscv Tue Sep 4 15:48:13 2018 (r338454, copy of r338453, head/etc/etc.riscv/ttys) @@ -0,0 +1,51 @@ +# +# $FreeBSD$ +# @(#)ttys 5.1 (Berkeley) 4/17/89 +# +# This file specifies various information about terminals on the system. +# It is used by several different programs. Common entries for the +# various columns include: +# +# name The name of the terminal device. +# +# getty The program to start running on the terminal. Typically a +# getty program, as the name implies. Other common entries +# include none, when no getty is needed, and xdm, to start the +# X Window System. +# +# type The initial terminal type for this port. For hardwired +# terminal lines, this will contain the type of terminal used. +# For virtual consoles, the correct type is typically xterm. +# Other common values include dialup for incoming modem ports, and +# unknown when the terminal type cannot be predetermined. +# +# status Must be on or off. If on, init will run the getty program on +# the specified port. If the word "secure" appears, this tty +# allows root login. +# +# name getty type status comments +# +# If console is marked "insecure", then init will ask for the root password +# when going to single-user mode. +console none unknown off secure +# +ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure +# Virtual terminals +ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure +#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm onifexists secure +# Serial terminals +# The 'dialup' keyword identifies dialin lines to login, fingerd etc. +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure +# Dumb console +dcons "/usr/libexec/getty std.9600" vt100 off secure +# RISC-V HTIF console +rcons "/usr/libexec/getty std.9600" vt100 onifconsole secure Copied: head/sbin/init/ttys.sparc64 (from r338453, head/etc/etc.sparc64/ttys) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/init/ttys.sparc64 Tue Sep 4 15:48:13 2018 (r338454, copy of r338453, head/etc/etc.sparc64/ttys) @@ -0,0 +1,54 @@ +# +# $FreeBSD$ +# @(#)ttys 5.1 (Berkeley) 4/17/89 +# +# This file specifies various information about terminals on the system. +# It is used by several different programs. Common entries for the +# various columns include: +# +# name The name of the terminal device. +# +# getty The program to start running on the terminal. Typically a +# getty program, as the name implies. Other common entries +# include none, when no getty is needed, and xdm, to start the +# X Window System. +# +# type The initial terminal type for this port. For hardwired +# terminal lines, this will contain the type of terminal used. +# For virtual consoles, the correct type is typically xterm. +# Other common values include dialup for incoming modem ports, and +# unknown when the terminal type cannot be predetermined. +# +# status Must be on or off. If on, init will run the getty program on +# the specified port. If the word "secure" appears, this tty +# allows root login. +# +# name getty type status comments +# +# If console is marked "insecure", then init will ask for the root password +# when going to single-user mode. +console none unknown off secure +# ofw_console(4) +screen "/usr/libexec/getty Pc" vt100 off secure +ttya "/usr/libexec/getty 3wire.9600" vt100 off secure +ttyb "/usr/libexec/getty 3wire.9600" vt100 off secure +# syscons(4) +ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure +# Virtual terminals +ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure +ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure +# Serial terminals +# The 'dialup' keyword identifies dialin lines to login, fingerd etc. +# uart(4) +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure +# Dumb console +dcons "/usr/libexec/getty std.9600" vt100 off secure From owner-svn-src-all@freebsd.org Tue Sep 4 16:45:09 2018 Return-Path: Delivered-To: svn-src-all@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 6ABF8FF4B83; Tue, 4 Sep 2018 16:45:09 +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 15AE876A1A; Tue, 4 Sep 2018 16:45:09 +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 0AB2919A47; Tue, 4 Sep 2018 16:45:09 +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 w84Gj8CG093483; Tue, 4 Sep 2018 16:45:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w84Gj88I093482; Tue, 4 Sep 2018 16:45:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809041645.w84Gj88I093482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 4 Sep 2018 16:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338455 - stable/11/usr.sbin/nfsuserd X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/usr.sbin/nfsuserd X-SVN-Commit-Revision: 338455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 16:45:09 -0000 Author: markj Date: Tue Sep 4 16:45:08 2018 New Revision: 338455 URL: https://svnweb.freebsd.org/changeset/base/338455 Log: MFC r338350: Add missing endpwent() and endgrent() calls to nfsuserd(8). PR: 230937 Modified: stable/11/usr.sbin/nfsuserd/nfsuserd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/nfsuserd/nfsuserd.c ============================================================================== --- stable/11/usr.sbin/nfsuserd/nfsuserd.c Tue Sep 4 15:48:13 2018 (r338454) +++ stable/11/usr.sbin/nfsuserd/nfsuserd.c Tue Sep 4 16:45:08 2018 (r338455) @@ -334,6 +334,7 @@ main(int argc, char *argv[]) #endif i++; } + endgrent(); /* * Loop around adding all users. @@ -382,6 +383,7 @@ main(int argc, char *argv[]) #endif i++; } + endpwent(); /* * I should feel guilty for not calling this for all the above exit() From owner-svn-src-all@freebsd.org Tue Sep 4 16:47:10 2018 Return-Path: Delivered-To: svn-src-all@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 D2B79FF4C75; Tue, 4 Sep 2018 16:47:10 +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 3066976C76; Tue, 4 Sep 2018 16:47:08 +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 A0E3919A4B; Tue, 4 Sep 2018 16:47:08 +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 w84Gl8ES093752; Tue, 4 Sep 2018 16:47:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w84Gl8MI093751; Tue, 4 Sep 2018 16:47:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809041647.w84Gl8MI093751@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 4 Sep 2018 16:47:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338456 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 338456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 16:47:11 -0000 Author: markj Date: Tue Sep 4 16:47:08 2018 New Revision: 338456 URL: https://svnweb.freebsd.org/changeset/base/338456 Log: MFC r338416: Re-compute the ARC size before computing the MFU target. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Sep 4 16:45:08 2018 (r338455) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Sep 4 16:47:08 2018 (r338456) @@ -4119,6 +4119,12 @@ arc_adjust(void) } /* + * Re-sum ARC stats after the first round of evictions. + */ + asize = aggsum_value(&arc_size); + ameta = aggsum_value(&arc_meta_used); + + /* * Adjust MFU size * * Now that we've tried to evict enough from the MRU to get its From owner-svn-src-all@freebsd.org Tue Sep 4 16:50:13 2018 Return-Path: Delivered-To: svn-src-all@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 57656FF4E88; Tue, 4 Sep 2018 16:50:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03E4076EE5; Tue, 4 Sep 2018 16:50:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 62EFA10B476; Tue, 4 Sep 2018 12:50:11 -0400 (EDT) Subject: Re: svn commit: r338451 - stable/11/usr.bin/last To: araujo@freebsd.org, src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org References: <201809040953.w849rj4j082295@repo.freebsd.org> <20180904100934.GC27236@rincewind.trouble.is> From: John Baldwin Message-ID: <3781df8e-57a0-feb8-9c6a-83a3a760e0d3@FreeBSD.org> Date: Tue, 4 Sep 2018 09:39:40 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180904100934.GC27236@rincewind.trouble.is> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Tue, 04 Sep 2018 12:50:12 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 16:50:13 -0000 On 9/4/18 3:09 AM, Philip Paeps wrote: > On 2018-09-04 17:59:30 (+0800), Marcelo Araujo wrote: >> 2018-09-04 17:53 GMT+08:00 Philip Paeps : >> >>> Author: philip >>> Date: Tue Sep 4 09:53:45 2018 >>> New Revision: 338451 >>> URL: https://svnweb.freebsd.org/changeset/base/338451 >>> >>> Log: >>> MFC r319508: >>> Fix a memory leak with last >>> free memory allocated to 'buf' >> >> Is that the right patch? Or the commit message missed adding support to >> libxo(3)? > > I merged two changes: > > * r319508 plugs a memory leak. This was originally committed by stevek > in June 2017 but apparently never MFCed. > > * rr338352 adds libxo support. > > I mentioned both changes in the commit message. I'm not sure what's > unclear. Most MFC commits list a summary of merged changes first (and perhaps a brief summary of the effective MFC if it is using several commits from HEAD to merge a single feature) before including logs from individual changes. This ensures that the first line of a commit is still a useful overall summary of the entire change. -- John Baldwin                                                                              From owner-svn-src-all@freebsd.org Tue Sep 4 16:53:33 2018 Return-Path: Delivered-To: svn-src-all@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 D3AF2FF5146; Tue, 4 Sep 2018 16:53:32 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f174.google.com (mail-io0-f174.google.com [209.85.223.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 767CB77390; Tue, 4 Sep 2018 16:53:32 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f174.google.com with SMTP id r196-v6so3597018iod.0; Tue, 04 Sep 2018 09:53:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=A0oQw45QlYd8IJ3/3QlHnCPDByJ98sXPikPIhRsQP6U=; b=OzoXci1H+kf1ASD0ZBCp9useIZuT0GGZsu6mpo6ArSll75gqsLQr9lsf9xe5cLCzAW nBs+9+5114RAHQ8jjZzNsaDNCpB9rSBYUgkm8QZfa3IJIdnZ2Y2PqU3CFS8AlOW7fanl 51zRj5G7eFhZFlqJr1t8UOyiyKyK1kU0rbofFOWWXUQEiuwqCyq53bj8oQTn6mY+x+1J M+3bPrTFP1nH3mlg+LywcgNuYvvwUyiaGIOvNfoX76m2fKPV0Xnz2DKZR/vDt/yIx/kB CmZ6t8fmZAsxdwYabYUE7IPv0iO70pEmssu+Z3/JirYg9dPblR0fsW81YkYZnXVgsuNy +jPw== X-Gm-Message-State: APzg51CUVMDzNto7tQpMrXtJhEGKBzHsSbxfQqyrnOtB2Vi3FVwEijkh v/CbnEfxRhIaE5Dytjqg7f2V15s3 X-Google-Smtp-Source: ANB0VdYkYYBzJmFxwAt+q5fGjvYFR95Y3xmN23SX/SF0uZhRBCPqvNpSPmaubu82pJOgfLdLLuKd0A== X-Received: by 2002:a6b:2b51:: with SMTP id r78-v6mr21722619ior.279.1536076096440; Tue, 04 Sep 2018 08:48:16 -0700 (PDT) Received: from mail-it0-f49.google.com (mail-it0-f49.google.com. [209.85.214.49]) by smtp.gmail.com with ESMTPSA id g129-v6sm7120936itg.16.2018.09.04.08.48.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 08:48:16 -0700 (PDT) Received: by mail-it0-f49.google.com with SMTP id e14-v6so5646560itf.1; Tue, 04 Sep 2018 08:48:16 -0700 (PDT) X-Received: by 2002:a24:44d7:: with SMTP id o206-v6mr715569ita.66.1536076096192; Tue, 04 Sep 2018 08:48:16 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 2002:a02:4f1b:0:0:0:0:0 with HTTP; Tue, 4 Sep 2018 08:48:15 -0700 (PDT) In-Reply-To: <201809022137.w82Lb5FK046191@repo.freebsd.org> References: <201809022137.w82Lb5FK046191@repo.freebsd.org> From: Conrad Meyer Date: Tue, 4 Sep 2018 08:48:15 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r338437 - in head/sys: amd64/amd64 amd64/include arm64/arm64 arm64/include conf dev/efidev modules/efirt sys To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 16:53:33 -0000 Hi Konstantin, On Sun, Sep 2, 2018 at 2:37 PM, Konstantin Belousov wrote= : > Author: kib > Date: Sun Sep 2 21:37:05 2018 > New Revision: 338437 > URL: https://svnweb.freebsd.org/changeset/base/338437 > > Log: > Catch exceptions during EFI RT calls on amd64. > > This appeared to be required to have EFI RT support and EFI RTC > enabled by default, because there are too many reports of faulting > calls on many different machines. The knob is added to leave the > exceptions unhandled to allow to debug the actual bugs. > ... > > Modified: head/sys/dev/efidev/efirt.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/efidev/efirt.c Sun Sep 2 21:16:43 2018 (r338436) > +++ head/sys/dev/efidev/efirt.c Sun Sep 2 21:37:05 2018 (r338437) > ... > @@ -346,30 +413,35 @@ efi_get_time_capabilities(struct efi_tmcap *tmcap) > int > efi_reset_system(void) > { > - int error; > + struct efirt_callinfo ec; > > - error =3D efi_enter(); > - if (error !=3D 0) > - return (error); > - efi_runtime->rt_reset(EFI_RESET_WARM, 0, 0, NULL); > - efi_leave(); > - return (EIO); > + if (efi_runtime =3D=3D NULL) > + return (ENXIO); > + bzero(&ec, sizeof(ec)); > + ec.ec_name =3D "rt_reset"; > + ec.ec_argcnt =3D 4; > + ec.ec_arg1 =3D (uintptr_t)EFI_RESET_WARM; > + ec.ec_arg1 =3D (uintptr_t)0; > + ec.ec_arg1 =3D (uintptr_t)0; > + ec.ec_arg1 =3D (uintptr_t)NULL; Coverity warns about ec_arg1 being overwritten before use =E2=80=94 should these be ec_arg2, 3, 4? CID 1395456. > + ec.ec_fptr =3D EFI_RT_METHOD_PA(rt_reset); > + return (efi_call(&ec)); > } Best, Conrad From owner-svn-src-all@freebsd.org Tue Sep 4 17:23:38 2018 Return-Path: Delivered-To: svn-src-all@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 0D3C1FF5F59; Tue, 4 Sep 2018 17:23:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5BD63784C0; Tue, 4 Sep 2018 17:23:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w84HNLsH015066 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 4 Sep 2018 20:23:25 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w84HNLsH015066 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w84HNLmM015065; Tue, 4 Sep 2018 20:23:21 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 4 Sep 2018 20:23:21 +0300 From: Konstantin Belousov To: Conrad Meyer Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r338437 - in head/sys: amd64/amd64 amd64/include arm64/arm64 arm64/include conf dev/efidev modules/efirt sys Message-ID: <20180904172321.GE2340@kib.kiev.ua> References: <201809022137.w82Lb5FK046191@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 17:23:38 -0000 On Tue, Sep 04, 2018 at 08:48:15AM -0700, Conrad Meyer wrote: > Hi Konstantin, > > On Sun, Sep 2, 2018 at 2:37 PM, Konstantin Belousov wrote: > > Author: kib > > Date: Sun Sep 2 21:37:05 2018 > > New Revision: 338437 > > URL: https://svnweb.freebsd.org/changeset/base/338437 > > > > Log: > > Catch exceptions during EFI RT calls on amd64. > > > > This appeared to be required to have EFI RT support and EFI RTC > > enabled by default, because there are too many reports of faulting > > calls on many different machines. The knob is added to leave the > > exceptions unhandled to allow to debug the actual bugs. > > ... > > > > Modified: head/sys/dev/efidev/efirt.c > > ============================================================================== > > --- head/sys/dev/efidev/efirt.c Sun Sep 2 21:16:43 2018 (r338436) > > +++ head/sys/dev/efidev/efirt.c Sun Sep 2 21:37:05 2018 (r338437) > > ... > > @@ -346,30 +413,35 @@ efi_get_time_capabilities(struct efi_tmcap *tmcap) > > int > > efi_reset_system(void) > > { > > - int error; > > + struct efirt_callinfo ec; > > > > - error = efi_enter(); > > - if (error != 0) > > - return (error); > > - efi_runtime->rt_reset(EFI_RESET_WARM, 0, 0, NULL); > > - efi_leave(); > > - return (EIO); > > + if (efi_runtime == NULL) > > + return (ENXIO); > > + bzero(&ec, sizeof(ec)); > > + ec.ec_name = "rt_reset"; > > + ec.ec_argcnt = 4; > > + ec.ec_arg1 = (uintptr_t)EFI_RESET_WARM; > > + ec.ec_arg1 = (uintptr_t)0; > > + ec.ec_arg1 = (uintptr_t)0; > > + ec.ec_arg1 = (uintptr_t)NULL; > > Coverity warns about ec_arg1 being overwritten before use ??? should > these be ec_arg2, 3, 4? CID 1395456. Indeed, thank you for reporting. Amusingly it is innocent. From owner-svn-src-all@freebsd.org Tue Sep 4 19:18:56 2018 Return-Path: Delivered-To: svn-src-all@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 98FC4FF9260; Tue, 4 Sep 2018 19:18:56 +0000 (UTC) (envelope-from manu@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 475A47D245; Tue, 4 Sep 2018 19:18:56 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 385E01B36B; Tue, 4 Sep 2018 19:18:56 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w84JIus9072677; Tue, 4 Sep 2018 19:18:56 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w84JIuYn072676; Tue, 4 Sep 2018 19:18:56 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201809041918.w84JIuYn072676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 4 Sep 2018 19:18:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338457 - head/sys/dev/extres/regulator X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/extres/regulator X-SVN-Commit-Revision: 338457 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 19:18:56 -0000 Author: manu Date: Tue Sep 4 19:18:55 2018 New Revision: 338457 URL: https://svnweb.freebsd.org/changeset/base/338457 Log: regulator: Use bool values instead of 0/1 While here do not attempt to disable regulators if they are meant to be always on. Reviewed by: mmel Approved by: re (kib) Modified: head/sys/dev/extres/regulator/regulator.c Modified: head/sys/dev/extres/regulator/regulator.c ============================================================================== --- head/sys/dev/extres/regulator/regulator.c Tue Sep 4 16:47:08 2018 (r338456) +++ head/sys/dev/extres/regulator/regulator.c Tue Sep 4 19:18:55 2018 (r338457) @@ -172,7 +172,7 @@ regulator_shutdown(void *dummy) REG_TOPO_SLOCK(); TUNABLE_INT_FETCH("hw.regulator.disable_unused", &disable); TAILQ_FOREACH(entry, ®node_list, reglist_link) { - if (entry->std_param.always_on == 0 && disable) { + if (!entry->std_param.always_on && disable) { if (bootverbose) printf("regulator: shutting down %s\n", entry->name); @@ -595,8 +595,9 @@ regnode_disable(struct regnode *regnode) REGNODE_XLOCK(regnode); /* Disable regulator for each node in chain, starting from consumer. */ - if ((regnode->enable_cnt == 1) && - ((regnode->flags & REGULATOR_FLAGS_NOT_DISABLE) == 0)) { + if (regnode->enable_cnt == 1 && + (regnode->flags & REGULATOR_FLAGS_NOT_DISABLE) == 0 && + !regnode->std_param.always_on) { rv = REGNODE_ENABLE(regnode, false, &udelay); if (rv != 0) { REGNODE_UNLOCK(regnode); @@ -1048,10 +1049,10 @@ regulator_parse_ofw_stdparam(device_t pdev, phandle_t par->enable_delay = 0; if (OF_hasprop(node, "regulator-boot-on")) - par->boot_on = 1; + par->boot_on = true; if (OF_hasprop(node, "regulator-always-on")) - par->always_on = 1; + par->always_on = true; if (OF_hasprop(node, "enable-active-high")) par->enable_active_high = 1; From owner-svn-src-all@freebsd.org Tue Sep 4 19:22:32 2018 Return-Path: Delivered-To: svn-src-all@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 5075CFF94AD; Tue, 4 Sep 2018 19:22:32 +0000 (UTC) (envelope-from wulf@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 06C757D64B; Tue, 4 Sep 2018 19:22:32 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 01B321B4FB; Tue, 4 Sep 2018 19:22:32 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w84JMVga077320; Tue, 4 Sep 2018 19:22:31 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w84JMVOb077319; Tue, 4 Sep 2018 19:22:31 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201809041922.w84JMVOb077319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Tue, 4 Sep 2018 19:22:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338458 - head/sys/dev/usb/input X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/usb/input X-SVN-Commit-Revision: 338458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 19:22:32 -0000 Author: wulf Date: Tue Sep 4 19:22:31 2018 New Revision: 338458 URL: https://svnweb.freebsd.org/changeset/base/338458 Log: wmt(4): Fix regression introduced in r337289 r337289 has a side effect of reducing usb frame 0 buffer size down to touch report size. That broke some devices e.g. "Raydium Touch System" which are capable of generating non-touch frames of bigger length. Fix it with enlarging frame 0 buffer up to internal wmt(4) buffer size. Reported by: Roberto Fernandez Cueto Tested by: Roberto Fernandez Cueto Approved by: re (gjb) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D16772 Modified: head/sys/dev/usb/input/wmt.c Modified: head/sys/dev/usb/input/wmt.c ============================================================================== --- head/sys/dev/usb/input/wmt.c Tue Sep 4 19:18:55 2018 (r338457) +++ head/sys/dev/usb/input/wmt.c Tue Sep 4 19:22:31 2018 (r338458) @@ -521,7 +521,7 @@ tr_ignore: case USB_ST_SETUP: tr_setup: - usbd_xfer_set_frame_len(xfer, 0, sc->isize); + usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); break; default: From owner-svn-src-all@freebsd.org Tue Sep 4 19:26:55 2018 Return-Path: Delivered-To: svn-src-all@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 34975FF969E; Tue, 4 Sep 2018 19:26:55 +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 CEB147D9A7; Tue, 4 Sep 2018 19:26:54 +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 C3EF01B50A; Tue, 4 Sep 2018 19:26:54 +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 w84JQs7o077720; Tue, 4 Sep 2018 19:26:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w84JQsun077719; Tue, 4 Sep 2018 19:26:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809041926.w84JQsun077719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 4 Sep 2018 19:26:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338459 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 338459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 19:26:55 -0000 Author: kib Date: Tue Sep 4 19:26:54 2018 New Revision: 338459 URL: https://svnweb.freebsd.org/changeset/base/338459 Log: amd64: For non-PTI mode, do not initialize PCPU kcr3 to KPML4phys. Non-PTI mode does not switch kcr3, which means that kcr3 is almost always stale. This is important for the NMI handler, which reloads %cr3 with PCPU(kcr3) if the value is different from PMAP_NO_CR3. The end result is that curpmap in NMI handler does not match the page table loaded into hardware. The manifestation was copyin(9) looping forever when a usermode access page fault cannot be resolved by vm_fault() updating a different page table. Reported by: mmacy Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 3 days Approved by: re (gjb) Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Sep 4 19:22:31 2018 (r338458) +++ head/sys/amd64/amd64/pmap.c Tue Sep 4 19:26:54 2018 (r338459) @@ -7582,9 +7582,13 @@ pmap_activate_boot(pmap_t pmap) CPU_SET(cpuid, &pmap->pm_active); #endif PCPU_SET(curpmap, pmap); - kcr3 = pmap->pm_cr3; - if (pmap_pcid_enabled) - kcr3 |= pmap->pm_pcids[cpuid].pm_pcid | CR3_PCID_SAVE; + if (pti) { + kcr3 = pmap->pm_cr3; + if (pmap_pcid_enabled) + kcr3 |= pmap->pm_pcids[cpuid].pm_pcid | CR3_PCID_SAVE; + } else { + kcr3 = PMAP_NO_CR3; + } PCPU_SET(kcr3, kcr3); PCPU_SET(ucr3, PMAP_NO_CR3); } From owner-svn-src-all@freebsd.org Tue Sep 4 19:27:54 2018 Return-Path: Delivered-To: svn-src-all@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 AC748FF970B; Tue, 4 Sep 2018 19:27:54 +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 5F0D17DB04; Tue, 4 Sep 2018 19:27:54 +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 58C4B1B50B; Tue, 4 Sep 2018 19:27:54 +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 w84JRsux077817; Tue, 4 Sep 2018 19:27:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w84JRsWZ077816; Tue, 4 Sep 2018 19:27:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809041927.w84JRsWZ077816@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 4 Sep 2018 19:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338460 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 338460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 19:27:54 -0000 Author: kib Date: Tue Sep 4 19:27:53 2018 New Revision: 338460 URL: https://svnweb.freebsd.org/changeset/base/338460 Log: amd64: Properly re-merge r334537 into SMAP-ified copyin(9) and copyout(9). Also this fixes the eflags.ac leak from copyin_smap() when the copied data length is multiple of eight bytes. Sponsored by: The FreeBSD Foundation Approved by: re (gjb) Modified: head/sys/amd64/amd64/support.S Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Tue Sep 4 19:26:54 2018 (r338459) +++ head/sys/amd64/amd64/support.S Tue Sep 4 19:27:53 2018 (r338460) @@ -312,9 +312,10 @@ ENTRY(copyout_smap) movsq movb %dl,%cl andb $7,%cl + je 1f rep movsb - clac +1: clac done_copyout: xorl %eax,%eax @@ -361,6 +362,7 @@ ENTRY(copyin_nosmap) movsq movb %al,%cl andb $7,%cl /* copy remaining bytes */ + je done_copyin rep movsb @@ -393,10 +395,10 @@ ENTRY(copyin_smap) movsq movb %al,%cl andb $7,%cl /* copy remaining bytes */ - je done_copyin + je 1f rep movsb - clac +1: clac done_copyin: xorl %eax,%eax From owner-svn-src-all@freebsd.org Tue Sep 4 19:28:47 2018 Return-Path: Delivered-To: svn-src-all@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 ED544FF97C1; Tue, 4 Sep 2018 19:28: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 A0EEA7DC4A; Tue, 4 Sep 2018 19:28: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 9BD171B50D; Tue, 4 Sep 2018 19:28: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 w84JSkp3077905; Tue, 4 Sep 2018 19:28:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w84JSkog077904; Tue, 4 Sep 2018 19:28:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809041928.w84JSkog077904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 4 Sep 2018 19:28:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338461 - head/sys/dev/efidev X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/efidev X-SVN-Commit-Revision: 338461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 19:28:47 -0000 Author: kib Date: Tue Sep 4 19:28:46 2018 New Revision: 338461 URL: https://svnweb.freebsd.org/changeset/base/338461 Log: Assign to correct structure members. Reported by: cem from Coverity Sponsored by: The FreeBSD Foundation MFC after: 6 days Approved by: re (gjb) Modified: head/sys/dev/efidev/efirt.c Modified: head/sys/dev/efidev/efirt.c ============================================================================== --- head/sys/dev/efidev/efirt.c Tue Sep 4 19:27:53 2018 (r338460) +++ head/sys/dev/efidev/efirt.c Tue Sep 4 19:28:46 2018 (r338461) @@ -421,9 +421,9 @@ efi_reset_system(void) ec.ec_name = "rt_reset"; ec.ec_argcnt = 4; ec.ec_arg1 = (uintptr_t)EFI_RESET_WARM; - ec.ec_arg1 = (uintptr_t)0; - ec.ec_arg1 = (uintptr_t)0; - ec.ec_arg1 = (uintptr_t)NULL; + ec.ec_arg2 = (uintptr_t)0; + ec.ec_arg3 = (uintptr_t)0; + ec.ec_arg4 = (uintptr_t)NULL; ec.ec_fptr = EFI_RT_METHOD_PA(rt_reset); return (efi_call(&ec)); } From owner-svn-src-all@freebsd.org Wed Sep 5 00:30:36 2018 Return-Path: Delivered-To: svn-src-all@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 6B371FCF116; Wed, 5 Sep 2018 00:30:36 +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 2154388817; Wed, 5 Sep 2018 00:30:36 +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 1BD071E69E; Wed, 5 Sep 2018 00:30:36 +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 w850UZ0m031646; Wed, 5 Sep 2018 00:30:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w850UZaF031642; Wed, 5 Sep 2018 00:30:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809050030.w850UZaF031642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 5 Sep 2018 00:30: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: r338462 - in stable/11: sys/kern usr.bin/sed usr.bin/sed/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11: sys/kern usr.bin/sed usr.bin/sed/tests X-SVN-Commit-Revision: 338462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 00:30:36 -0000 Author: markj Date: Wed Sep 5 00:30:34 2018 New Revision: 338462 URL: https://svnweb.freebsd.org/changeset/base/338462 Log: MFC r338375: sed: Fix -i option behavior with 'q' command. PR: 230507 Modified: stable/11/sys/kern/imgact_elf.c stable/11/usr.bin/sed/extern.h stable/11/usr.bin/sed/main.c stable/11/usr.bin/sed/process.c stable/11/usr.bin/sed/tests/sed2_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/imgact_elf.c ============================================================================== --- stable/11/sys/kern/imgact_elf.c Tue Sep 4 19:28:46 2018 (r338461) +++ stable/11/sys/kern/imgact_elf.c Wed Sep 5 00:30:34 2018 (r338462) @@ -839,7 +839,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i break; case PT_INTERP: /* Path to interpreter */ - if (phdr[i].p_filesz > MAXPATHLEN) { + if (phdr[i].p_filesz < 2 || + phdr[i].p_filesz > MAXPATHLEN) { uprintf("Invalid PT_INTERP\n"); error = ENOEXEC; goto ret; @@ -870,6 +871,11 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i } else { interp = __DECONST(char *, imgp->image_header) + phdr[i].p_offset; + if (interp[interp_name_len - 1] != '\0') { + uprintf("Invalid PT_INTERP\n"); + error = ENOEXEC; + goto ret; + } } break; case PT_GNU_STACK: Modified: stable/11/usr.bin/sed/extern.h ============================================================================== --- stable/11/usr.bin/sed/extern.h Tue Sep 4 19:28:46 2018 (r338461) +++ stable/11/usr.bin/sed/extern.h Wed Sep 5 00:30:34 2018 (r338462) @@ -44,6 +44,8 @@ extern int aflag, eflag, nflag; extern const char *fname, *outfname; extern FILE *infile, *outfile; extern int rflags; /* regex flags to use */ +extern const char *inplace; +extern int quit; void cfclose(struct s_command *, struct s_command *); void compile(void); Modified: stable/11/usr.bin/sed/main.c ============================================================================== --- stable/11/usr.bin/sed/main.c Tue Sep 4 19:28:46 2018 (r338461) +++ stable/11/usr.bin/sed/main.c Wed Sep 5 00:30:34 2018 (r338462) @@ -101,6 +101,7 @@ FILE *outfile; /* Current output file */ int aflag, eflag, nflag; int rflags = 0; +int quit = 0; static int rval; /* Exit status */ static int ispan; /* Whether inplace editing spans across files */ @@ -114,7 +115,7 @@ const char *fname; /* File name. */ const char *outfname; /* Output file name */ static char oldfname[PATH_MAX]; /* Old file name (for in-place editing) */ static char tmpfname[PATH_MAX]; /* Temporary file name (for in-place editing) */ -static const char *inplace; /* Inplace edit file extension. */ +const char *inplace; /* Inplace edit file extension. */ u_long linenum; static void add_compunit(enum e_cut, char *); @@ -334,7 +335,7 @@ mf_fgets(SPACE *sp, enum e_spflag spflag) } for (;;) { - if (infile != NULL && (c = getc(infile)) != EOF) { + if (infile != NULL && (c = getc(infile)) != EOF && !quit) { (void)ungetc(c, infile); break; } Modified: stable/11/usr.bin/sed/process.c ============================================================================== --- stable/11/usr.bin/sed/process.c Tue Sep 4 19:28:46 2018 (r338461) +++ stable/11/usr.bin/sed/process.c Wed Sep 5 00:30:34 2018 (r338462) @@ -207,10 +207,14 @@ redirect: } break; case 'q': - if (!nflag && !pd) - OUT(); - flush_appends(); - exit(0); + if (inplace == NULL) { + if (!nflag && !pd) + OUT(); + flush_appends(); + exit(0); + } + quit = 1; + break; case 'r': if (appendx >= appendnum) if ((appends = realloc(appends, Modified: stable/11/usr.bin/sed/tests/sed2_test.sh ============================================================================== --- stable/11/usr.bin/sed/tests/sed2_test.sh Tue Sep 4 19:28:46 2018 (r338461) +++ stable/11/usr.bin/sed/tests/sed2_test.sh Wed Sep 5 00:30:34 2018 (r338462) @@ -38,6 +38,7 @@ inplace_hardlink_src_body() atf_check ln a b atf_check sed -i '' -e 's,foo,bar,g' b atf_check -o 'inline:bar\n' -s exit:0 cat b + atf_check -s not-exit:0 stat -q '.!'* } atf_test_case inplace_symlink_src @@ -50,10 +51,27 @@ inplace_symlink_src_body() echo foo > a atf_check ln -s a b atf_check -e not-empty -s not-exit:0 sed -i '' -e 's,foo,bar,g' b + atf_check -s not-exit:0 stat -q '.!'* } +atf_test_case inplace_command_q +inplace_command_q_head() +{ + atf_set "descr" "Verify -i works correctly with the 'q' command" +} +inplace_command_q_body() +{ + printf '1\n2\n3\n' > a + atf_check -o 'inline:1\n2\n' sed '2q' a + atf_check sed -i.bak '2q' a + atf_check -o 'inline:1\n2\n' cat a + atf_check -o 'inline:1\n2\n3\n' cat a.bak + atf_check -s not-exit:0 stat -q '.!'* +} + atf_init_test_cases() { + atf_add_test_case inplace_command_q atf_add_test_case inplace_hardlink_src atf_add_test_case inplace_symlink_src } From owner-svn-src-all@freebsd.org Wed Sep 5 01:24:14 2018 Return-Path: Delivered-To: svn-src-all@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 5348FFD4B37; Wed, 5 Sep 2018 01:24:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 E9E6D8A4F8; Wed, 5 Sep 2018 01:24:13 +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 E02F41F05A; Wed, 5 Sep 2018 01:24:13 +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 w851OD2J061900; Wed, 5 Sep 2018 01:24:13 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w851ODb8061899; Wed, 5 Sep 2018 01:24:13 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809050124.w851ODb8061899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 5 Sep 2018 01:24: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: r338463 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 338463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 01:24:14 -0000 Author: markj Date: Wed Sep 5 01:24:13 2018 New Revision: 338463 URL: https://svnweb.freebsd.org/changeset/base/338463 Log: MFC r337974: Add INVARIANTS-only fences around lockless vnode refcount updates. Modified: stable/11/sys/kern/vfs_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_subr.c ============================================================================== --- stable/11/sys/kern/vfs_subr.c Wed Sep 5 00:30:34 2018 (r338462) +++ stable/11/sys/kern/vfs_subr.c Wed Sep 5 01:24:13 2018 (r338463) @@ -116,6 +116,22 @@ static void vfs_knl_assert_unlocked(void *arg); static void destroy_vpollinfo(struct vpollinfo *vi); /* + * These fences are intended for cases where some synchronization is + * needed between access of v_iflags and lockless vnode refcount (v_holdcnt + * and v_usecount) updates. Access to v_iflags is generally synchronized + * by the interlock, but we have some internal assertions that check vnode + * flags * without acquiring the lock. Thus, these fences are INVARIANTS-only + * for now. + */ +#ifdef INVARIANTS +#define VNODE_REFCOUNT_FENCE_ACQ() atomic_thread_fence_acq() +#define VNODE_REFCOUNT_FENCE_REL() atomic_thread_fence_rel() +#else +#define VNODE_REFCOUNT_FENCE_ACQ() +#define VNODE_REFCOUNT_FENCE_REL() +#endif + +/* * Number of vnodes in existence. Increased whenever getnewvnode() * allocates a new vnode, decreased in vdropl() for VI_DOOMED vnode. */ @@ -1006,6 +1022,7 @@ vnlru_free_locked(int count, struct vfsops *mnt_op) */ freevnodes--; vp->v_iflag &= ~VI_FREE; + VNODE_REFCOUNT_FENCE_REL(); refcount_acquire(&vp->v_holdcnt); mtx_unlock(&vnode_free_list_mtx); @@ -2429,6 +2446,7 @@ v_incr_usecount(struct vnode *vp) if (vp->v_type != VCHR && refcount_acquire_if_not_zero(&vp->v_usecount)) { + VNODE_REFCOUNT_FENCE_ACQ(); VNASSERT((vp->v_iflag & VI_OWEINACT) == 0, vp, ("vnode with usecount and VI_OWEINACT set")); } else { @@ -2527,6 +2545,7 @@ vget(struct vnode *vp, int flags, struct thread *td) } else { oweinact = 1; vp->v_iflag &= ~VI_OWEINACT; + VNODE_REFCOUNT_FENCE_REL(); } refcount_acquire(&vp->v_usecount); v_incr_devcount(vp); @@ -2740,6 +2759,7 @@ _vhold(struct vnode *vp, bool locked) CTR2(KTR_VFS, "%s: vp %p", __func__, vp); if (!locked) { if (refcount_acquire_if_not_zero(&vp->v_holdcnt)) { + VNODE_REFCOUNT_FENCE_ACQ(); VNASSERT((vp->v_iflag & VI_FREE) == 0, vp, ("_vhold: vnode with holdcnt is free")); return; From owner-svn-src-all@freebsd.org Wed Sep 5 01:33:31 2018 Return-Path: Delivered-To: svn-src-all@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 2DAA8FD513E; Wed, 5 Sep 2018 01:33:31 +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 D6AAC8AACE; Wed, 5 Sep 2018 01:33:30 +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 D19AA1F1F2; Wed, 5 Sep 2018 01:33:30 +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 w851XUMm067124; Wed, 5 Sep 2018 01:33:30 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w851XUZh067123; Wed, 5 Sep 2018 01:33:30 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201809050133.w851XUZh067123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 5 Sep 2018 01:33: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: r338464 - in stable: 10/crypto/heimdal/doc/doxyout/krb5/man/man3 11/crypto/heimdal/doc/doxyout/krb5/man/man3 X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/crypto/heimdal/doc/doxyout/krb5/man/man3 11/crypto/heimdal/doc/doxyout/krb5/man/man3 X-SVN-Commit-Revision: 338464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 01:33:31 -0000 Author: cy Date: Wed Sep 5 01:33:30 2018 New Revision: 338464 URL: https://svnweb.freebsd.org/changeset/base/338464 Log: Avoid printing extraneous function names when searching man page database (apropos, man -k). This commit Replaces .SS with .SH, similar to the man page provided by original heimdal (as in port). PR: 230573 Submitted by: yuripv@yuripv.net Modified: stable/11/crypto/heimdal/doc/doxyout/krb5/man/man3/krb5.3 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/crypto/heimdal/doc/doxyout/krb5/man/man3/krb5.3 Directory Properties: stable/10/ (props changed) Modified: stable/11/crypto/heimdal/doc/doxyout/krb5/man/man3/krb5.3 ============================================================================== --- stable/11/crypto/heimdal/doc/doxyout/krb5/man/man3/krb5.3 Wed Sep 5 01:24:13 2018 (r338463) +++ stable/11/crypto/heimdal/doc/doxyout/krb5/man/man3/krb5.3 Wed Sep 5 01:33:30 2018 (r338464) @@ -2,9 +2,8 @@ .ad l .nh .SH NAME -Heimdal Kerberos 5 library \- -.SS "Functions" - +krb5 \- Heimdal Kerberos 5 library +.SH SYNOPSIS .in +1c .ti -1c .RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_add_et_list\fP (krb5_context context, void(*func)(struct et_list **))" From owner-svn-src-all@freebsd.org Wed Sep 5 01:33:31 2018 Return-Path: Delivered-To: svn-src-all@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 82328FD514A; Wed, 5 Sep 2018 01:33:31 +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 369438AAD0; Wed, 5 Sep 2018 01:33:31 +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 318F21F1F3; Wed, 5 Sep 2018 01:33:31 +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 w851XV3L067130; Wed, 5 Sep 2018 01:33:31 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w851XVTD067129; Wed, 5 Sep 2018 01:33:31 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201809050133.w851XVTD067129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 5 Sep 2018 01:33: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: r338464 - in stable: 10/crypto/heimdal/doc/doxyout/krb5/man/man3 11/crypto/heimdal/doc/doxyout/krb5/man/man3 X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/crypto/heimdal/doc/doxyout/krb5/man/man3 11/crypto/heimdal/doc/doxyout/krb5/man/man3 X-SVN-Commit-Revision: 338464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 01:33:31 -0000 Author: cy Date: Wed Sep 5 01:33:30 2018 New Revision: 338464 URL: https://svnweb.freebsd.org/changeset/base/338464 Log: Avoid printing extraneous function names when searching man page database (apropos, man -k). This commit Replaces .SS with .SH, similar to the man page provided by original heimdal (as in port). PR: 230573 Submitted by: yuripv@yuripv.net Modified: stable/10/crypto/heimdal/doc/doxyout/krb5/man/man3/krb5.3 Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/crypto/heimdal/doc/doxyout/krb5/man/man3/krb5.3 Directory Properties: stable/11/ (props changed) Modified: stable/10/crypto/heimdal/doc/doxyout/krb5/man/man3/krb5.3 ============================================================================== --- stable/10/crypto/heimdal/doc/doxyout/krb5/man/man3/krb5.3 Wed Sep 5 01:24:13 2018 (r338463) +++ stable/10/crypto/heimdal/doc/doxyout/krb5/man/man3/krb5.3 Wed Sep 5 01:33:30 2018 (r338464) @@ -2,9 +2,8 @@ .ad l .nh .SH NAME -Heimdal Kerberos 5 library \- -.SS "Functions" - +krb5 \- Heimdal Kerberos 5 library +.SH SYNOPSIS .in +1c .ti -1c .RI "KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL \fBkrb5_add_et_list\fP (krb5_context context, void(*func)(struct et_list **))" From owner-svn-src-all@freebsd.org Wed Sep 5 01:46:29 2018 Return-Path: Delivered-To: svn-src-all@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 D5859FD5B44; Wed, 5 Sep 2018 01:46:28 +0000 (UTC) (envelope-from kbowling@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 80E428B2C1; Wed, 5 Sep 2018 01:46:28 +0000 (UTC) (envelope-from kbowling@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 778831F396; Wed, 5 Sep 2018 01:46:28 +0000 (UTC) (envelope-from kbowling@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w851kSl0072576; Wed, 5 Sep 2018 01:46:28 GMT (envelope-from kbowling@FreeBSD.org) Received: (from kbowling@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w851kSHG072574; Wed, 5 Sep 2018 01:46:28 GMT (envelope-from kbowling@FreeBSD.org) Message-Id: <201809050146.w851kSHG072574@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kbowling set sender to kbowling@FreeBSD.org using -f From: Kevin Bowling Date: Wed, 5 Sep 2018 01:46:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338465 - in head: share/misc usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: kbowling X-SVN-Commit-Paths: in head: share/misc usr.bin/calendar/calendars X-SVN-Commit-Revision: 338465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 01:46:29 -0000 Author: kbowling (ports committer) Date: Wed Sep 5 01:46:27 2018 New Revision: 338465 URL: https://svnweb.freebsd.org/changeset/base/338465 Log: Add kbowling to ports committer list and calendar Approved by: re (rgrimes), timur (mentor), krion (mentor) Differential Revision: https://reviews.freebsd.org/D17021 Modified: head/share/misc/committers-ports.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Wed Sep 5 01:33:30 2018 (r338464) +++ head/share/misc/committers-ports.dot Wed Sep 5 01:46:27 2018 (r338465) @@ -149,6 +149,7 @@ jsm [label="Jesper Schmitz Mouridsen\njsm@FreeBSD.org\ junovitch [label="Jason Unovitch\njunovitch@FreeBSD.org\n2015/07/27"] jylefort [label="Jean-Yves Lefort\njylefort@FreeBSD.org\n2005/04/12"] kami [label="Dominic Fandrey\nkami@FreeBSD.org\n2014/09/09"] +kbowling [label="Kevin Bowling\nkbowling@FreeBSD.org\n2018/09/02"] kevlo [label="Kevin Lo\nkevlo@FreeBSD.org\n2003/02/21"] kmoore [label="Kris Moore\nkmoore@FreeBSD.org\n2009/04/14"] knu [label="Akinori Musha\nknu@FreeBSD.org\n2000/03/22"] @@ -487,6 +488,7 @@ koobs -> xmj krion -> "0mp" krion -> brooks +krion -> kbowling krion -> miwi krion -> novel krion -> philip @@ -703,6 +705,8 @@ tcberner -> arrowd thierry -> jadawin thierry -> riggs + +timur -> kbowling tmclaugh -> itetcu tmclaugh -> xride Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Wed Sep 5 01:33:30 2018 (r338464) +++ head/usr.bin/calendar/calendars/calendar.freebsd Wed Sep 5 01:46:27 2018 (r338465) @@ -87,6 +87,7 @@ 02/23 Mathieu Arnold born in Champigny sur Marne, Val de Marne, France, 1978 02/24 Johan Karlsson born in Mariannelund, Sweden, 1974 02/24 Colin Percival born in Burnaby, Canada, 1981 +02/24 Kevin Bowling born in Scottsdale, Arizona, United States, 1989 02/26 Pietro Cerutti born in Faido, Switzerland, 1984 02/28 Daichi GOTO born in Shimizu Suntou, Shizuoka, Japan, 1980 02/28 Ruslan Makhmatkhanov born in Rostov-on-Don, USSR, 1984 From owner-svn-src-all@freebsd.org Wed Sep 5 09:53:56 2018 Return-Path: Delivered-To: svn-src-all@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 267BBFEAB2B; Wed, 5 Sep 2018 09:53:56 +0000 (UTC) (envelope-from br@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 CFD747A3AD; Wed, 5 Sep 2018 09:53:55 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 CA7CA244D2; Wed, 5 Sep 2018 09:53:55 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w859rteF024870; Wed, 5 Sep 2018 09:53:55 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w859rtne024869; Wed, 5 Sep 2018 09:53:55 GMT (envelope-from br@FreeBSD.org) Message-Id: <201809050953.w859rtne024869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 5 Sep 2018 09:53:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338466 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 338466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 09:53:56 -0000 Author: br Date: Wed Sep 5 09:53:55 2018 New Revision: 338466 URL: https://svnweb.freebsd.org/changeset/base/338466 Log: Fix bug: compare uaddr to VM_MAXUSER_ADDRESS, not to a tmp value left by SET_FAULT_HANDLER(). Approved by: re (kib) Sponsored by: DARPA, AFRL Modified: head/sys/riscv/riscv/copyinout.S Modified: head/sys/riscv/riscv/copyinout.S ============================================================================== --- head/sys/riscv/riscv/copyinout.S Wed Sep 5 01:46:27 2018 (r338465) +++ head/sys/riscv/riscv/copyinout.S Wed Sep 5 09:53:55 2018 (r338466) @@ -111,12 +111,12 @@ END(copyin) ENTRY(copyinstr) mv a5, x0 /* count = 0 */ beqz a2, 3f /* If len == 0 then skip loop */ - li a7, VM_MAXUSER_ADDRESS la a6, copyio_fault /* Get the handler address */ SET_FAULT_HANDLER(a6, a7) /* Set the handler */ -1: bgt a7, a0, copyio_fault + li a7, VM_MAXUSER_ADDRESS +1: bgt a0, a7, copyio_fault lb a4, 0(a0) /* Load from uaddr */ addi a0, a0, 1 sb a4, 0(a1) /* Store in kaddr */ From owner-svn-src-all@freebsd.org Wed Sep 5 11:35:00 2018 Return-Path: Delivered-To: svn-src-all@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 88966FECB04; Wed, 5 Sep 2018 11:35:00 +0000 (UTC) (envelope-from br@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 3F6B17CE63; Wed, 5 Sep 2018 11:35:00 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 35BA625522; Wed, 5 Sep 2018 11:35:00 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w85BZ0gd076040; Wed, 5 Sep 2018 11:35:00 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85BYxgR076020; Wed, 5 Sep 2018 11:34:59 GMT (envelope-from br@FreeBSD.org) Message-Id: <201809051134.w85BYxgR076020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 5 Sep 2018 11:34:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338467 - in head/sys/riscv: include riscv X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys/riscv: include riscv X-SVN-Commit-Revision: 338467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 11:35:00 -0000 Author: br Date: Wed Sep 5 11:34:58 2018 New Revision: 338467 URL: https://svnweb.freebsd.org/changeset/base/338467 Log: Permit supervisor to access user VA space for certain functions only. This is done by setting SUM (permit Supervisor User Memory access) bit in sstatus register. The functions we allow access for are routines in assembly that explicitly handle crossing the user kernel boundary. Approved by: re (kib) Sponsored by: DARPA, AFRL Modified: head/sys/riscv/include/asm.h head/sys/riscv/riscv/copyinout.S head/sys/riscv/riscv/exception.S head/sys/riscv/riscv/locore.S head/sys/riscv/riscv/support.S head/sys/riscv/riscv/vm_machdep.c Modified: head/sys/riscv/include/asm.h ============================================================================== --- head/sys/riscv/include/asm.h Wed Sep 5 09:53:55 2018 (r338466) +++ head/sys/riscv/include/asm.h Wed Sep 5 11:34:58 2018 (r338467) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2018 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -62,5 +62,13 @@ ld tmp, PC_CURTHREAD(gp); \ ld tmp, TD_PCB(tmp); /* Load the pcb */ \ sd handler, PCB_ONFAULT(tmp) /* Set the handler */ + +#define ENTER_USER_ACCESS(tmp) \ + li tmp, SSTATUS_SUM; \ + csrs sstatus, tmp + +#define EXIT_USER_ACCESS(tmp) \ + li tmp, SSTATUS_SUM; \ + csrc sstatus, tmp #endif /* _MACHINE_ASM_H_ */ Modified: head/sys/riscv/riscv/copyinout.S ============================================================================== --- head/sys/riscv/riscv/copyinout.S Wed Sep 5 09:53:55 2018 (r338466) +++ head/sys/riscv/riscv/copyinout.S Wed Sep 5 11:34:58 2018 (r338467) @@ -35,6 +35,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include "assym.inc" @@ -44,6 +45,7 @@ __FBSDID("$FreeBSD$"); */ ENTRY(copyio_fault) SET_FAULT_HANDLER(x0, a1) /* Clear the handler */ + EXIT_USER_ACCESS(a1) copyio_fault_nopcb: li a0, EFAULT ret @@ -62,6 +64,7 @@ ENTRY(copyout) la a6, copyio_fault /* Get the handler address */ SET_FAULT_HANDLER(a6, a7) /* Set the handler */ + ENTER_USER_ACCESS(a7) 1: lb a4, 0(a0) /* Load from kaddr */ addi a0, a0, 1 @@ -70,6 +73,7 @@ ENTRY(copyout) addi a2, a2, -1 /* len-- */ bnez a2, 1b + EXIT_USER_ACCESS(a7) SET_FAULT_HANDLER(x0, a7) /* Clear the handler */ 2: li a0, 0 /* return 0 */ @@ -89,6 +93,7 @@ ENTRY(copyin) la a6, copyio_fault /* Get the handler address */ SET_FAULT_HANDLER(a6, a7) /* Set the handler */ + ENTER_USER_ACCESS(a7) 1: lb a4, 0(a0) /* Load from uaddr */ addi a0, a0, 1 @@ -97,6 +102,7 @@ ENTRY(copyin) addi a2, a2, -1 /* len-- */ bnez a2, 1b + EXIT_USER_ACCESS(a7) SET_FAULT_HANDLER(x0, a7) /* Clear the handler */ 2: li a0, 0 /* return 0 */ @@ -114,6 +120,7 @@ ENTRY(copyinstr) la a6, copyio_fault /* Get the handler address */ SET_FAULT_HANDLER(a6, a7) /* Set the handler */ + ENTER_USER_ACCESS(a7) li a7, VM_MAXUSER_ADDRESS 1: bgt a0, a7, copyio_fault @@ -125,8 +132,9 @@ ENTRY(copyinstr) addi a2, a2, -1 /* len-- */ addi a5, a5, 1 /* count++ */ bnez a2, 1b - -2: SET_FAULT_HANDLER(x0, a7) /* Clear the handler */ + +2: EXIT_USER_ACCESS(a7) + SET_FAULT_HANDLER(x0, a7) /* Clear the handler */ 3: beqz a3, 4f /* Check if done != NULL */ addi a5, a5, 1 /* count++ */ Modified: head/sys/riscv/riscv/exception.S ============================================================================== --- head/sys/riscv/riscv/exception.S Wed Sep 5 09:53:55 2018 (r338466) +++ head/sys/riscv/riscv/exception.S Wed Sep 5 11:34:58 2018 (r338467) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2017 Ruslan Bukin + * Copyright (c) 2015-2018 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -116,11 +116,8 @@ __FBSDID("$FreeBSD$"); .macro load_registers el ld t0, (TF_SSTATUS)(sp) .if \el == 0 - /* - * Ensure user interrupts will be enabled on eret - * and supervisor mode can access userspace on trap. - */ - li t1, (SSTATUS_SPIE | SSTATUS_SUM) + /* Ensure user interrupts will be enabled on eret */ + li t1, SSTATUS_SPIE or t0, t0, t1 .else /* Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Wed Sep 5 09:53:55 2018 (r338466) +++ head/sys/riscv/riscv/locore.S Wed Sep 5 11:34:58 2018 (r338467) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2017 Ruslan Bukin + * Copyright (c) 2015-2018 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -61,9 +61,6 @@ _start: sub s9, t2, t1 /* s9 = physmem base */ mv s10, a0 /* s10 = hart id */ mv s11, a1 /* s11 = dtbp */ - - li t0, SSTATUS_SUM - csrs sstatus, t0 /* Direct secondary cores to mpentry */ bnez s10, mpentry Modified: head/sys/riscv/riscv/support.S ============================================================================== --- head/sys/riscv/riscv/support.S Wed Sep 5 09:53:55 2018 (r338466) +++ head/sys/riscv/riscv/support.S Wed Sep 5 11:34:58 2018 (r338467) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2018 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include "assym.inc" @@ -44,6 +45,7 @@ __FBSDID("$FreeBSD$"); */ ENTRY(fsu_fault) SET_FAULT_HANDLER(x0, a1) /* Reset the handler function */ + EXIT_USER_ACCESS(a1) fsu_fault_nopcb: li a0, -1 ret @@ -57,11 +59,13 @@ ENTRY(casueword32) bgt a0, a4, fsu_fault_nopcb la a6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(a6, a4) /* And set it */ + ENTER_USER_ACCESS(a4) 1: lr.w a4, 0(a0) /* Load-exclusive the data */ bne a4, a1, 2f /* If not equal then exit */ sc.w a5, a3, 0(a0) /* Store the new data */ bnez a5, 1b /* Retry on failure */ -2: SET_FAULT_HANDLER(x0, a5) /* Reset the fault handler */ +2: EXIT_USER_ACCESS(a5) + SET_FAULT_HANDLER(x0, a5) /* Reset the fault handler */ sw a4, 0(a2) /* Store the read data */ li a0, 0 /* Success */ ret /* Return */ @@ -75,11 +79,13 @@ ENTRY(casueword) bgt a0, a4, fsu_fault_nopcb la a6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(a6, a4) /* And set it */ + ENTER_USER_ACCESS(a4) 1: lr.d a4, 0(a0) /* Load-exclusive the data */ bne a4, a1, 2f /* If not equal then exit */ sc.d a5, a3, 0(a0) /* Store the new data */ bnez a5, 1b /* Retry on failure */ -2: SET_FAULT_HANDLER(x0, a5) /* Reset the fault handler */ +2: EXIT_USER_ACCESS(a5) + SET_FAULT_HANDLER(x0, a5) /* Reset the fault handler */ sd a4, 0(a2) /* Store the read data */ li a0, 0 /* Success */ ret /* Return */ @@ -93,7 +99,9 @@ ENTRY(fubyte) bgt a0, a1, fsu_fault_nopcb la a6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(a6, a1) /* And set it */ + ENTER_USER_ACCESS(a1) lb a0, 0(a0) /* Try loading the data */ + EXIT_USER_ACCESS(a1) SET_FAULT_HANDLER(x0, a1) /* Reset the fault handler */ ret /* Return */ END(fubyte) @@ -106,7 +114,9 @@ ENTRY(fuword16) bgt a0, a1, fsu_fault_nopcb la a6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(a6, a1) /* And set it */ + ENTER_USER_ACCESS(a1) lh a0, 0(a0) /* Try loading the data */ + EXIT_USER_ACCESS(a1) SET_FAULT_HANDLER(x0, a1) /* Reset the fault handler */ ret /* Return */ END(fuword16) @@ -119,7 +129,9 @@ ENTRY(fueword32) bgt a0, a2, fsu_fault_nopcb la a6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(a6, a2) /* And set it */ + ENTER_USER_ACCESS(a2) lw a0, 0(a0) /* Try loading the data */ + EXIT_USER_ACCESS(a2) SET_FAULT_HANDLER(x0, a2) /* Reset the fault handler */ sw a0, 0(a1) /* Save the data in kernel space */ li a0, 0 /* Success */ @@ -136,7 +148,9 @@ EENTRY(fueword64) bgt a0, a2, fsu_fault_nopcb la a6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(a6, a2) /* And set it */ + ENTER_USER_ACCESS(a2) ld a0, 0(a0) /* Try loading the data */ + EXIT_USER_ACCESS(a2) SET_FAULT_HANDLER(x0, a2) /* Reset the fault handler */ sd a0, 0(a1) /* Save the data in kernel space */ li a0, 0 /* Success */ @@ -152,7 +166,9 @@ ENTRY(subyte) bgt a0, a2, fsu_fault_nopcb la a6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(a6, a2) /* And set it */ + ENTER_USER_ACCESS(a2) sb a1, 0(a0) /* Try storing the data */ + EXIT_USER_ACCESS(a2) SET_FAULT_HANDLER(x0, a2) /* Reset the fault handler */ li a0, 0 /* Success */ ret /* Return */ @@ -166,7 +182,9 @@ ENTRY(suword16) bgt a0, a2, fsu_fault_nopcb la a6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(a6, a2) /* And set it */ + ENTER_USER_ACCESS(a2) sh a1, 0(a0) /* Try storing the data */ + EXIT_USER_ACCESS(a2) SET_FAULT_HANDLER(x0, a2) /* Reset the fault handler */ li a0, 0 /* Success */ ret /* Return */ @@ -180,7 +198,9 @@ ENTRY(suword32) bgt a0, a2, fsu_fault_nopcb la a6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(a6, a2) /* And set it */ + ENTER_USER_ACCESS(a2) sw a1, 0(a0) /* Try storing the data */ + EXIT_USER_ACCESS(a2) SET_FAULT_HANDLER(x0, a2) /* Reset the fault handler */ li a0, 0 /* Success */ ret /* Return */ @@ -195,7 +215,9 @@ EENTRY(suword64) bgt a0, a2, fsu_fault_nopcb la a6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(a6, a2) /* And set it */ + ENTER_USER_ACCESS(a2) sd a1, 0(a0) /* Try storing the data */ + EXIT_USER_ACCESS(a2) SET_FAULT_HANDLER(x0, a2) /* Reset the fault handler */ li a0, 0 /* Success */ ret /* Return */ Modified: head/sys/riscv/riscv/vm_machdep.c ============================================================================== --- head/sys/riscv/riscv/vm_machdep.c Wed Sep 5 09:53:55 2018 (r338466) +++ head/sys/riscv/riscv/vm_machdep.c Wed Sep 5 11:34:58 2018 (r338467) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2017 Ruslan Bukin + * Copyright (c) 2015-2018 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -105,7 +105,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t tf->tf_a[0] = 0; tf->tf_a[1] = 0; tf->tf_sstatus |= (SSTATUS_SPIE); /* Enable interrupts. */ - tf->tf_sstatus |= (SSTATUS_SUM); /* Supervisor can access userspace. */ tf->tf_sstatus &= ~(SSTATUS_SPP); /* User mode. */ td2->td_frame = tf; From owner-svn-src-all@freebsd.org Wed Sep 5 12:06:24 2018 Return-Path: Delivered-To: svn-src-all@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 8C995FEE384; Wed, 5 Sep 2018 12:06:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 171D97E33A; Wed, 5 Sep 2018 12:06:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w85C66TO025934 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 5 Sep 2018 15:06:09 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w85C66TO025934 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w85C66Sd025933; Wed, 5 Sep 2018 15:06:06 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 5 Sep 2018 15:06:06 +0300 From: Konstantin Belousov To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r338462 - in stable/11: sys/kern usr.bin/sed usr.bin/sed/tests Message-ID: <20180905120606.GA3161@kib.kiev.ua> References: <201809050030.w850UZaF031642@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201809050030.w850UZaF031642@repo.freebsd.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 12:06:24 -0000 On Wed, Sep 05, 2018 at 12:30:35AM +0000, Mark Johnston wrote: > Author: markj > Date: Wed Sep 5 00:30:34 2018 > New Revision: 338462 > URL: https://svnweb.freebsd.org/changeset/base/338462 > > Log: > MFC r338375: > sed: Fix -i option behavior with 'q' command. > > PR: 230507 > > Modified: > stable/11/sys/kern/imgact_elf.c ^^^^ This part is not relevant. > stable/11/usr.bin/sed/extern.h > stable/11/usr.bin/sed/main.c > stable/11/usr.bin/sed/process.c > stable/11/usr.bin/sed/tests/sed2_test.sh > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/sys/kern/imgact_elf.c > ============================================================================== > --- stable/11/sys/kern/imgact_elf.c Tue Sep 4 19:28:46 2018 (r338461) > +++ stable/11/sys/kern/imgact_elf.c Wed Sep 5 00:30:34 2018 (r338462) > @@ -839,7 +839,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i > break; > case PT_INTERP: > /* Path to interpreter */ > - if (phdr[i].p_filesz > MAXPATHLEN) { > + if (phdr[i].p_filesz < 2 || > + phdr[i].p_filesz > MAXPATHLEN) { > uprintf("Invalid PT_INTERP\n"); > error = ENOEXEC; > goto ret; > @@ -870,6 +871,11 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i > } else { > interp = __DECONST(char *, imgp->image_header) + > phdr[i].p_offset; > + if (interp[interp_name_len - 1] != '\0') { > + uprintf("Invalid PT_INTERP\n"); > + error = ENOEXEC; > + goto ret; > + } > } > break; > case PT_GNU_STACK: > > Modified: stable/11/usr.bin/sed/extern.h > ============================================================================== > --- stable/11/usr.bin/sed/extern.h Tue Sep 4 19:28:46 2018 (r338461) > +++ stable/11/usr.bin/sed/extern.h Wed Sep 5 00:30:34 2018 (r338462) > @@ -44,6 +44,8 @@ extern int aflag, eflag, nflag; > extern const char *fname, *outfname; > extern FILE *infile, *outfile; > extern int rflags; /* regex flags to use */ > +extern const char *inplace; > +extern int quit; > > void cfclose(struct s_command *, struct s_command *); > void compile(void); > > Modified: stable/11/usr.bin/sed/main.c > ============================================================================== > --- stable/11/usr.bin/sed/main.c Tue Sep 4 19:28:46 2018 (r338461) > +++ stable/11/usr.bin/sed/main.c Wed Sep 5 00:30:34 2018 (r338462) > @@ -101,6 +101,7 @@ FILE *outfile; /* Current output file */ > > int aflag, eflag, nflag; > int rflags = 0; > +int quit = 0; > static int rval; /* Exit status */ > > static int ispan; /* Whether inplace editing spans across files */ > @@ -114,7 +115,7 @@ const char *fname; /* File name. */ > const char *outfname; /* Output file name */ > static char oldfname[PATH_MAX]; /* Old file name (for in-place editing) */ > static char tmpfname[PATH_MAX]; /* Temporary file name (for in-place editing) */ > -static const char *inplace; /* Inplace edit file extension. */ > +const char *inplace; /* Inplace edit file extension. */ > u_long linenum; > > static void add_compunit(enum e_cut, char *); > @@ -334,7 +335,7 @@ mf_fgets(SPACE *sp, enum e_spflag spflag) > } > > for (;;) { > - if (infile != NULL && (c = getc(infile)) != EOF) { > + if (infile != NULL && (c = getc(infile)) != EOF && !quit) { > (void)ungetc(c, infile); > break; > } > > Modified: stable/11/usr.bin/sed/process.c > ============================================================================== > --- stable/11/usr.bin/sed/process.c Tue Sep 4 19:28:46 2018 (r338461) > +++ stable/11/usr.bin/sed/process.c Wed Sep 5 00:30:34 2018 (r338462) > @@ -207,10 +207,14 @@ redirect: > } > break; > case 'q': > - if (!nflag && !pd) > - OUT(); > - flush_appends(); > - exit(0); > + if (inplace == NULL) { > + if (!nflag && !pd) > + OUT(); > + flush_appends(); > + exit(0); > + } > + quit = 1; > + break; > case 'r': > if (appendx >= appendnum) > if ((appends = realloc(appends, > > Modified: stable/11/usr.bin/sed/tests/sed2_test.sh > ============================================================================== > --- stable/11/usr.bin/sed/tests/sed2_test.sh Tue Sep 4 19:28:46 2018 (r338461) > +++ stable/11/usr.bin/sed/tests/sed2_test.sh Wed Sep 5 00:30:34 2018 (r338462) > @@ -38,6 +38,7 @@ inplace_hardlink_src_body() > atf_check ln a b > atf_check sed -i '' -e 's,foo,bar,g' b > atf_check -o 'inline:bar\n' -s exit:0 cat b > + atf_check -s not-exit:0 stat -q '.!'* > } > > atf_test_case inplace_symlink_src > @@ -50,10 +51,27 @@ inplace_symlink_src_body() > echo foo > a > atf_check ln -s a b > atf_check -e not-empty -s not-exit:0 sed -i '' -e 's,foo,bar,g' b > + atf_check -s not-exit:0 stat -q '.!'* > } > > +atf_test_case inplace_command_q > +inplace_command_q_head() > +{ > + atf_set "descr" "Verify -i works correctly with the 'q' command" > +} > +inplace_command_q_body() > +{ > + printf '1\n2\n3\n' > a > + atf_check -o 'inline:1\n2\n' sed '2q' a > + atf_check sed -i.bak '2q' a > + atf_check -o 'inline:1\n2\n' cat a > + atf_check -o 'inline:1\n2\n3\n' cat a.bak > + atf_check -s not-exit:0 stat -q '.!'* > +} > + > atf_init_test_cases() > { > + atf_add_test_case inplace_command_q > atf_add_test_case inplace_hardlink_src > atf_add_test_case inplace_symlink_src > } From owner-svn-src-all@freebsd.org Wed Sep 5 13:59:37 2018 Return-Path: Delivered-To: svn-src-all@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 EFE9FFF0CCE; Wed, 5 Sep 2018 13:59:36 +0000 (UTC) (envelope-from eugen@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 A5D1B8200A; Wed, 5 Sep 2018 13:59:36 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 9CCA326B7F; Wed, 5 Sep 2018 13:59:36 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w85Dxafa048391; Wed, 5 Sep 2018 13:59:36 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85DxaPl048390; Wed, 5 Sep 2018 13:59:36 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201809051359.w85DxaPl048390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Wed, 5 Sep 2018 13:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338468 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 338468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 13:59:37 -0000 Author: eugen Date: Wed Sep 5 13:59:36 2018 New Revision: 338468 URL: https://svnweb.freebsd.org/changeset/base/338468 Log: Fix "ipfw fwd" to work for incoming IPv4 packets when ip_tryforward() chooses fast forwarding path, as it already works for IPv6 and for both of them on old slow path. PR: 231143 Reviewed by: ae Approved by: re (gjb) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D17039 Modified: head/sys/netinet/ip_fastfwd.c Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Wed Sep 5 11:34:58 2018 (r338467) +++ head/sys/netinet/ip_fastfwd.c Wed Sep 5 13:59:36 2018 (r338468) @@ -153,7 +153,7 @@ ip_tryforward(struct mbuf *m) struct mbuf *m0 = NULL; struct nhop4_basic nh; struct sockaddr_in dst; - struct in_addr odest, dest; + struct in_addr dest, odest, rtdest; uint16_t ip_len, ip_off; int error = 0; struct m_tag *fwd_tag = NULL; @@ -294,12 +294,31 @@ passin: #endif /* + * Next hop forced by pfil(9) hook? + */ + if ((m->m_flags & M_IP_NEXTHOP) && + ((fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL)) != NULL)) { + /* + * Now we will find route to forced destination. + */ + dest.s_addr = ((struct sockaddr_in *) + (fwd_tag + 1))->sin_addr.s_addr; + m_tag_delete(m, fwd_tag); + m->m_flags &= ~M_IP_NEXTHOP; + } + + /* * Find route to destination. */ if (ip_findroute(&nh, dest, m) != 0) return (NULL); /* icmp unreach already sent */ /* + * Avoid second route lookup by caching destination. + */ + rtdest.s_addr = dest.s_addr; + + /* * Step 5: outgoing firewall packet processing */ if (!PFIL_HOOKED(&V_inet_pfil_hook)) @@ -321,6 +340,8 @@ passin: */ if (m->m_flags & M_IP_NEXTHOP) fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); + else + fwd_tag = NULL; if (odest.s_addr != dest.s_addr || fwd_tag != NULL) { /* * Is it now for a local address on this host? @@ -342,7 +363,8 @@ forwardlocal: m_tag_delete(m, fwd_tag); m->m_flags &= ~M_IP_NEXTHOP; } - if (ip_findroute(&nh, dest, m) != 0) + if (dest.s_addr != rtdest.s_addr && + ip_findroute(&nh, dest, m) != 0) return (NULL); /* icmp unreach already sent */ } From owner-svn-src-all@freebsd.org Wed Sep 5 14:49:27 2018 Return-Path: Delivered-To: svn-src-all@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 7DD36FF26F8; Wed, 5 Sep 2018 14:49:27 +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 319DA84218; Wed, 5 Sep 2018 14:49:27 +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 2C7B62737A; Wed, 5 Sep 2018 14:49:27 +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 w85EnRf7074161; Wed, 5 Sep 2018 14:49:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85EnRNv074160; Wed, 5 Sep 2018 14:49:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809051449.w85EnRNv074160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 5 Sep 2018 14:49: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: r338469 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 338469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 14:49:27 -0000 Author: markj Date: Wed Sep 5 14:49:26 2018 New Revision: 338469 URL: https://svnweb.freebsd.org/changeset/base/338469 Log: Revert an unintentional change from r338462. Reported by: kib Modified: stable/11/sys/kern/imgact_elf.c Modified: stable/11/sys/kern/imgact_elf.c ============================================================================== --- stable/11/sys/kern/imgact_elf.c Wed Sep 5 13:59:36 2018 (r338468) +++ stable/11/sys/kern/imgact_elf.c Wed Sep 5 14:49:26 2018 (r338469) @@ -839,8 +839,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i break; case PT_INTERP: /* Path to interpreter */ - if (phdr[i].p_filesz < 2 || - phdr[i].p_filesz > MAXPATHLEN) { + if (phdr[i].p_filesz > MAXPATHLEN) { uprintf("Invalid PT_INTERP\n"); error = ENOEXEC; goto ret; @@ -871,11 +870,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i } else { interp = __DECONST(char *, imgp->image_header) + phdr[i].p_offset; - if (interp[interp_name_len - 1] != '\0') { - uprintf("Invalid PT_INTERP\n"); - error = ENOEXEC; - goto ret; - } } break; case PT_GNU_STACK: From owner-svn-src-all@freebsd.org Wed Sep 5 15:04:12 2018 Return-Path: Delivered-To: svn-src-all@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 9D978FF349D; Wed, 5 Sep 2018 15:04:12 +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 537FA85207; Wed, 5 Sep 2018 15:04:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E533276B8; Wed, 5 Sep 2018 15:04:12 +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 w85F4CZk084251; Wed, 5 Sep 2018 15:04:12 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85F4CN5084250; Wed, 5 Sep 2018 15:04:12 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809051504.w85F4CN5084250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 5 Sep 2018 15:04:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338470 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 338470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 15:04:12 -0000 Author: markj Date: Wed Sep 5 15:04:11 2018 New Revision: 338470 URL: https://svnweb.freebsd.org/changeset/base/338470 Log: Fix style bugs in in_pcblookup_lbgroup(). No functional change intended. Reviewed by: bz, Johannes Lundberg Approved by: re (rgrimes) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17030 Modified: head/sys/netinet/in_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Wed Sep 5 14:49:26 2018 (r338469) +++ head/sys/netinet/in_pcb.c Wed Sep 5 15:04:11 2018 (r338470) @@ -1950,18 +1950,18 @@ in_pcblookup_local(struct inpcbinfo *pcbinfo, struct i static struct inpcb * in_pcblookup_lbgroup(const struct inpcbinfo *pcbinfo, - const struct in_addr *laddr, uint16_t lport, const struct in_addr *faddr, - uint16_t fport, int lookupflags) + const struct in_addr *laddr, uint16_t lport, const struct in_addr *faddr, + uint16_t fport, int lookupflags) { - struct inpcb *local_wild = NULL; + struct inpcb *local_wild; const struct inpcblbgrouphead *hdr; struct inpcblbgroup *grp; - struct inpcblbgroup *grp_local_wild; + uint32_t idx; INP_HASH_LOCK_ASSERT(pcbinfo); - hdr = &pcbinfo->ipi_lbgrouphashbase[ - INP_PCBLBGROUP_PORTHASH(lport, pcbinfo->ipi_lbgrouphashmask)]; + hdr = &pcbinfo->ipi_lbgrouphashbase[INP_PCBLBGROUP_PORTHASH(lport, + pcbinfo->ipi_lbgrouphashmask)]; /* * Order of socket selection: @@ -1972,35 +1972,24 @@ in_pcblookup_lbgroup(const struct inpcbinfo *pcbinfo, * - Load balanced group does not contain jailed sockets * - Load balanced group does not contain IPv4 mapped INET6 wild sockets */ + local_wild = NULL; LIST_FOREACH(grp, hdr, il_list) { #ifdef INET6 if (!(grp->il_vflag & INP_IPV4)) continue; #endif + if (grp->il_lport != lport) + continue; - if (grp->il_lport == lport) { - - uint32_t idx = 0; - int pkt_hash = INP_PCBLBGROUP_PKTHASH(faddr->s_addr, - lport, fport); - - idx = pkt_hash % grp->il_inpcnt; - - if (grp->il_laddr.s_addr == laddr->s_addr) { - return (grp->il_inp[idx]); - } else { - if (grp->il_laddr.s_addr == INADDR_ANY && - (lookupflags & INPLOOKUP_WILDCARD)) { - local_wild = grp->il_inp[idx]; - grp_local_wild = grp; - } - } - } + idx = INP_PCBLBGROUP_PKTHASH(faddr->s_addr, lport, fport) % + grp->il_inpcnt; + if (grp->il_laddr.s_addr == laddr->s_addr) + return (grp->il_inp[idx]); + if (grp->il_laddr.s_addr == INADDR_ANY && + (lookupflags & INPLOOKUP_WILDCARD) != 0) + local_wild = grp->il_inp[idx]; } - if (local_wild != NULL) { - return (local_wild); - } - return (NULL); + return (local_wild); } #ifdef PCBGROUP From owner-svn-src-all@freebsd.org Wed Sep 5 15:25:24 2018 Return-Path: Delivered-To: svn-src-all@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 85941FF3AFA; Wed, 5 Sep 2018 15:25:24 +0000 (UTC) (envelope-from brd@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 3B87E85CE6; Wed, 5 Sep 2018 15:25:24 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 3212D279F8; Wed, 5 Sep 2018 15:25:24 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w85FPNBq094255; Wed, 5 Sep 2018 15:25:23 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85FPNxE094252; Wed, 5 Sep 2018 15:25:23 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201809051525.w85FPNxE094252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Wed, 5 Sep 2018 15:25:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338471 - in head: etc libexec/getty X-SVN-Group: head X-SVN-Commit-Author: brd X-SVN-Commit-Paths: in head: etc libexec/getty X-SVN-Commit-Revision: 338471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 15:25:24 -0000 Author: brd Date: Wed Sep 5 15:25:23 2018 New Revision: 338471 URL: https://svnweb.freebsd.org/changeset/base/338471 Log: Move gettytab to libexec/getty/ Approved by: re (gjb), will (mentor) Differential Revision: https://reviews.freebsd.org/D16953 Added: head/libexec/getty/gettytab - copied unchanged from r338470, head/etc/gettytab Deleted: head/etc/gettytab Modified: head/etc/Makefile head/libexec/getty/Makefile Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Wed Sep 5 15:04:11 2018 (r338470) +++ head/etc/Makefile Wed Sep 5 15:25:23 2018 (r338471) @@ -15,7 +15,6 @@ SUBDIR+=sendmail BIN1= crontab \ dhclient.conf \ disktab \ - gettytab \ group \ hosts \ hosts.allow \ Modified: head/libexec/getty/Makefile ============================================================================== --- head/libexec/getty/Makefile Wed Sep 5 15:04:11 2018 (r338470) +++ head/libexec/getty/Makefile Wed Sep 5 15:25:23 2018 (r338471) @@ -1,6 +1,7 @@ # from: @(#)Makefile 8.1 (Berkeley) 6/4/93 # $FreeBSD$ +CONFS= gettytab PROG= getty SRCS= main.c init.c subr.c chat.c LIBADD= util Copied: head/libexec/getty/gettytab (from r338470, head/etc/gettytab) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/getty/gettytab Wed Sep 5 15:25:23 2018 (r338471, copy of r338470, head/etc/gettytab) @@ -0,0 +1,239 @@ +# $FreeBSD$ +# from: @(#)gettytab 5.14 (Berkeley) 3/27/91 +# +# Most of the table entries here are just copies of the old getty table, +# it is by no means certain, or even likely, that any of them are optimal +# for any purpose whatever. Nor is it likely that more than a couple are +# even correct. +# +# The default gettytab entry, used to set defaults for all other +# entries, and in cases where getty is called with no table name. +# +# cb, ce and ck are desirable on most crt's. The non-crt entries need to +# be changed to turn them off (:cb@:ce@:ck@:). +# +# lc should always be on; it's a remainder of some stone age when there +# have been terminals around not being able of handling lower-case +# characters. Those terminals aren't supported any longer, but getty is +# `smart' about them by default. +# +# Parity defaults to even, but the Pc entry and all the `std' entries +# specify no parity. The different parities are: +# (none): same as ep for getty. login will use terminal as is. +# ep: getty will use raw mode (cs8 -parenb) (unless rw is set) and +# fake parity. login will use even parity (cs7 parenb -parodd). +# op: same as ep except odd parity (cs7 parenb parodd) for login. +# getty will fake odd parity as well. +# ap: same as ep except -inpck instead of inpck for login. +# ap overrides op and ep. +# np: 1. don't fake parity in getty. The fake parity garbles +# characters on non-terminals (like pccons) that don't +# support parity. It would probably better for getty not to +# try to fake parity. It could just use cbreak mode so as +# not to force cs8 and let the hardware handle the parity. +# login has to be rely on the hardware anyway. +# 2. set cs8 -parenb -istrip -inpck. +# ep:op: same as ap. +# +default:\ + :cb:ce:ck:lc:fd#1000:im=\r\n%s/%m (%h) (%t)\r\n\r\n:sp#1200:\ + :if=/etc/issue: + +# +# Fixed speed entries +# +# The "std.NNN" names are known to the special case +# portselector code in getty, however they can +# be assigned to any table desired. +# The "NNN-baud" names are known to the special case +# autobaud code in getty, and likewise can +# be assigned to any table desired (hopefully the same speed). +# +std:\ + :np:sp#0: +a|std.110|110-baud:\ + :np:nd#1:cd#1:uc:sp#110: +b|std.134|134.5-baud:\ + :np:nd#1:cd#2:ff#1:td#1:sp#134:ht:nl: +1|std.150|150-baud:\ + :np:nd#1:cd#2:td#1:fd#1:sp#150:ht:nl:lm=\E\72\6\6\17login\72 : +c|std.300|300-baud:\ + :np:nd#1:cd#1:sp#300: +d|std.600|600-baud:\ + :np:nd#1:cd#1:sp#600: +f|std.1200|1200-baud:\ + :np:fd#1:sp#1200: +6|std.2400|2400-baud:\ + :np:sp#2400: +7|std.4800|4800-baud:\ + :np:sp#4800: +2|std.9600|9600-baud:\ + :np:sp#9600: +g|std.19200|19200-baud:\ + :np:sp#19200: +std.38400|38400-baud:\ + :np:sp#38400: +std.57600|57600-baud:\ + :np:sp#57600: +std.115200|115200-baud:\ + :np:sp#115200: +std.230400|230400-baud:\ + :np:sp#230400: + +# +# Entry specifying explicit device settings. See termios(4) and +# /usr/include/termios.h, too. The entry forces the tty into +# CLOCAL mode (so no DCD is required), and uses Xon/Xoff flow control. +# +# cflags: CLOCAL | HUPCL | CREAD | CS8 +# oflags: OPOST | ONLCR | OXTABS +# iflags: IXOFF | IXON | ICRNL | IGNPAR +# lflags: IEXTEN | ICANON | ISIG | ECHOCTL | ECHO | ECHOK | ECHOE | ECHOKE +# +# The `0' flags don't have input enabled. The `1' flags don't echo. +# (Echoing is done inside getty itself.) +# +local.9600|CLOCAL tty @ 9600 Bd:\ + :c0#0x0000c300:c1#0x0000cb00:c2#0x0000cb00:\ + :o0#0x00000007:o1#0x00000002:o2#0x00000007:\ + :i0#0x00000704:i1#0x00000000:i2#0x00000704:\ + :l0#0x000005cf:l1#0x00000000:l2#0x000005cf:\ + :sp#9600:np: + +# +# Dial in rotary tables, speed selection via 'break' +# +0|d300|Dial-300:\ + :nx=d1200:cd#2:sp#300: +d1200|Dial-1200:\ + :nx=d150:fd#1:sp#1200: +d150|Dial-150:\ + :nx=d110:lm@:tc=150-baud: +d110|Dial-110:\ + :nx=d300:tc=300-baud: + +# +# Fast dialup terminals, 2400/1200/300 rotary (can start either way) +# +D2400|d2400|Fast-Dial-2400:\ + :nx=D1200:tc=2400-baud: +3|D1200|Fast-Dial-1200:\ + :nx=D300:tc=1200-baud: +5|D300|Fast-Dial-300:\ + :nx=D2400:tc=300-baud: + +# +#telebit (19200) +# +t19200:\ + :nx=t2400:tc=19200-baud: +t2400:\ + :nx=t1200:tc=2400-baud: +t1200:\ + :nx=t19200:tc=1200-baud: + +# +#telebit (9600) +# +t9600:\ + :nx=t2400a:tc=9600-baud: +t2400a:\ + :nx=t1200a:tc=2400-baud: +t1200a:\ + :nx=t9600:tc=1200-baud: + +# +# Odd special case terminals +# +-|tty33|asr33|Pity the poor user of this beast:\ + :tc=110-baud: + +4|Console|Console Decwriter II:\ + :nd@:cd@:rw:tc=300-baud: + +e|Console-1200|Console Decwriter III:\ + :fd@:nd@:cd@:rw:tc=1200-baud: + +i|Interdata console:\ + :uc:sp#0: + +l|lsi chess terminal:\ + :sp#300: + +X|Xwindow|X window system:\ + :fd@:nd@:cd@:rw:sp#9600: + +P|Pc|Pc console:\ + :ht:np:sp#9600: + +# +# Weirdo special case for fast crt's with hardcopy devices +# +8|T9600|CRT with hardcopy:\ + :nx=T300:tc=9600-baud: +9|T300|CRT with hardcopy (300):\ + :nx=T9600:tc=300-baud: + +# +# Plugboard, and misc other terminals +# +plug-9600|Plugboard-9600:\ + :pf#1:tc=9600-baud: +p|P9600|Plugboard-9600-rotary:\ + :pf#1:nx=P300:tc=9600-baud: +q|P300|Plugboard-300:\ + :pf#1:nx=P1200:tc=300-baud: +r|P1200|Plugboard-1200:\ + :pf#1:nx=P9600:tc=1200-baud: + +# +# XXXX Port selector +# +s|DSW|Port Selector:\ + :ps:sp#2400: + +# +# Auto-baud speed detect entry for Micom 600. +# Special code in getty will switch this out +# to one of the NNN-baud entries. +# +A|Auto-baud:\ + :ab:sp#2400:f0#040: + +# +# autologin - automatically log in as root +# + +autologin|al.9600:\ + :al=root:tc=std.9600: +al.19200:\ + :al=root:tc=std.19200: +al.38400:\ + :al=root:tc=std.38400: +al.57600:\ + :al=root:tc=std.57600: +al.115200:\ + :al=root:tc=std.115200: +al.230400:\ + :al=root:tc=std.230400: +al.Pc:\ + :al=root:tc=Pc + +# +# Entries for 3-wire serial terminals. These don't supply carrier, so +# clocal needs to be set, and crtscts needs to be unset. +# +3wire:\ + :np:nc:sp#0: +3wire.9600|9600-3wire:\ + :np:nc:sp#9600: +3wire.19200|19200-3wire:\ + :np:nc:sp#19200: +3wire.38400|38400-3wire:\ + :np:nc:sp#38400: +3wire.57600|57600-3wire:\ + :np:nc:sp#57600: +3wire.115200|115200-3wire:\ + :np:nc:sp#115200: +3wire.230400|230400-3wire:\ + :np:nc:sp#230400: From owner-svn-src-all@freebsd.org Wed Sep 5 19:05:30 2018 Return-Path: Delivered-To: svn-src-all@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 CFB15FFA451; Wed, 5 Sep 2018 19:05:30 +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 84BBF8ED1B; Wed, 5 Sep 2018 19:05:30 +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 7B96A29D1B; Wed, 5 Sep 2018 19:05:30 +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 w85J5Uju007401; Wed, 5 Sep 2018 19:05:30 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85J5UGH007400; Wed, 5 Sep 2018 19:05:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809051905.w85J5UGH007400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 5 Sep 2018 19:05:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338472 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 338472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 19:05:31 -0000 Author: markj Date: Wed Sep 5 19:05:30 2018 New Revision: 338472 URL: https://svnweb.freebsd.org/changeset/base/338472 Log: Correct the condition under which we allocate a terminator node. We will have last_block < blocks if the block count is divisible by BLIST_BMAP_RADIX, but a terminator node is still needed if the tree isn't balanced. In this case we were overruning the blist array by 16 bytes during initialization. While here, add a check for the invalid blocks == 0 case. PR: 231116 Reviewed by: alc, kib (previous version), Doug Moore Approved by: re (gjb) MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17020 Modified: head/sys/kern/subr_blist.c Modified: head/sys/kern/subr_blist.c ============================================================================== --- head/sys/kern/subr_blist.c Wed Sep 5 15:25:23 2018 (r338471) +++ head/sys/kern/subr_blist.c Wed Sep 5 19:05:30 2018 (r338472) @@ -224,17 +224,19 @@ blist_create(daddr_t blocks, int flags) u_daddr_t nodes, radix, skip; int digit; + if (blocks == 0) + panic("invalid block count"); + /* - * Calculate the radix and node count used for scanning. Find the last - * block that is followed by a terminator. + * Calculate the radix and node count used for scanning. */ last_block = blocks - 1; radix = BLIST_BMAP_RADIX; while (radix < blocks) { if (((last_block / radix + 1) & BLIST_META_MASK) != 0) /* - * A terminator will be added. Update last_block to the - * position just before that terminator. + * We must widen the blist to avoid partially + * filled nodes. */ last_block |= radix - 1; radix *= BLIST_META_RADIX; @@ -244,7 +246,9 @@ blist_create(daddr_t blocks, int flags) * Count the meta-nodes in the expanded tree, including the final * terminator, from the bottom level up to the root. */ - nodes = (last_block >= blocks) ? 2 : 1; + nodes = 1; + if (radix - blocks >= BLIST_BMAP_RADIX) + nodes++; last_block /= BLIST_BMAP_RADIX; while (last_block > 0) { nodes += last_block + 1; From owner-svn-src-all@freebsd.org Wed Sep 5 19:16:10 2018 Return-Path: Delivered-To: svn-src-all@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 7188FFFA811; Wed, 5 Sep 2018 19:16:10 +0000 (UTC) (envelope-from jilles@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 1E4238F46D; Wed, 5 Sep 2018 19:16:10 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 12E9629EB0; Wed, 5 Sep 2018 19:16:10 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w85JG9vb013100; Wed, 5 Sep 2018 19:16:09 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85JG9cF013099; Wed, 5 Sep 2018 19:16:09 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201809051916.w85JG9cF013099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Wed, 5 Sep 2018 19:16:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338473 - head/bin/sh X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/bin/sh X-SVN-Commit-Revision: 338473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 19:16:10 -0000 Author: jilles Date: Wed Sep 5 19:16:09 2018 New Revision: 338473 URL: https://svnweb.freebsd.org/changeset/base/338473 Log: sh: Fix formal overflow in pointer arithmetic The intention is to lower the value of the pointer, which according to ubsan cannot be done by adding an unsigned quantity. Reported by: kevans Approved by: re (kib) MFC after: 1 week Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Wed Sep 5 19:05:30 2018 (r338472) +++ head/bin/sh/expand.c Wed Sep 5 19:16:09 2018 (r338473) @@ -896,7 +896,7 @@ reprocess(int startloc, int flag, int subtype, int quo startp = stackblock() + startloc; len = expdest - startp; - if (len >= SIZE_MAX / 2) + if (len >= SIZE_MAX / 2 || len > PTRDIFF_MAX) abort(); INTOFF; if (len >= buflen) { @@ -912,7 +912,7 @@ reprocess(int startloc, int flag, int subtype, int quo INTON; memcpy(buf, startp, len); buf[len] = '\0'; - STADJUST(-len, expdest); + STADJUST(-(ptrdiff_t)len, expdest); for (zpos = 0;;) { zlen = strlen(buf + zpos); strtodest(buf + zpos, flag, subtype, quoted, dst); From owner-svn-src-all@freebsd.org Wed Sep 5 20:02:24 2018 Return-Path: Delivered-To: svn-src-all@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 16E01FFB625; Wed, 5 Sep 2018 20:02:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C15A870E4B; Wed, 5 Sep 2018 20:02:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC58F2A6B9; Wed, 5 Sep 2018 20:02:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w85K2Not037766; Wed, 5 Sep 2018 20:02:23 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85K2Npd037765; Wed, 5 Sep 2018 20:02:23 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201809052002.w85K2Npd037765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 5 Sep 2018 20:02:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338474 - head/stand X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand X-SVN-Commit-Revision: 338474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 20:02:24 -0000 Author: imp Date: Wed Sep 5 20:02:23 2018 New Revision: 338474 URL: https://svnweb.freebsd.org/changeset/base/338474 Log: Be a little conservative about when to force size optimizations. Reports have come in that there's issue with powerpc and sparc64 since we've switched to using -Oz / -Os. We don't strictly need them for !x86, so be conservative about when we enable them. Approved by: re@ (gjb) Differential Revision: https://reviews.freebsd.org/D17016 Modified: head/stand/defs.mk Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Wed Sep 5 19:16:09 2018 (r338473) +++ head/stand/defs.mk Wed Sep 5 20:02:23 2018 (r338474) @@ -53,12 +53,14 @@ CFLAGS+= -I${SASRC} -D_STANDALONE CFLAGS+= -I${SYSDIR} # Spike the floating point interfaces CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" # Slim down the image. This saves about 15% in size with clang 6 on x86 # Our most constrained /boot/loader env is BIOS booting on x86, where # our text + data + BTX have to fit into 640k below the ISA hole. # Experience has shown that problems arise between ~520k to ~530k. CFLAGS.clang+= -Oz CFLAGS.gcc+= -Os +.endif # GELI Support, with backward compat hooks (mostly) .if defined(LOADER_NO_GELI_SUPPORT) From owner-svn-src-all@freebsd.org Wed Sep 5 20:13:29 2018 Return-Path: Delivered-To: svn-src-all@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 6F4C2FFBBEA; Wed, 5 Sep 2018 20:13:29 +0000 (UTC) (envelope-from oshogbo@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 1B4F5716A1; Wed, 5 Sep 2018 20:13:29 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 138402A85A; Wed, 5 Sep 2018 20:13:29 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w85KDSLb043450; Wed, 5 Sep 2018 20:13:28 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85KDSDr043449; Wed, 5 Sep 2018 20:13:28 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201809052013.w85KDSDr043449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Wed, 5 Sep 2018 20:13: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: r338475 - in stable/11: contrib/traceroute usr.sbin/traceroute X-SVN-Group: stable-11 X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in stable/11: contrib/traceroute usr.sbin/traceroute X-SVN-Commit-Revision: 338475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 20:13:29 -0000 Author: oshogbo Date: Wed Sep 5 20:13:28 2018 New Revision: 338475 URL: https://svnweb.freebsd.org/changeset/base/338475 Log: MFC r314000: Capsicumize traceroute. PR: 193973 Submitted by: Mikhail Reviewed by: pjd, bapt, emaste, AllanJude Differential Revision: https://reviews.freebsd.org/D9303 Modified: stable/11/contrib/traceroute/traceroute.c stable/11/usr.sbin/traceroute/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/traceroute/traceroute.c ============================================================================== --- stable/11/contrib/traceroute/traceroute.c Wed Sep 5 20:02:23 2018 (r338474) +++ stable/11/contrib/traceroute/traceroute.c Wed Sep 5 20:13:28 2018 (r338475) @@ -203,6 +203,7 @@ static const char rcsid[] = */ #include +#include #include #include #ifdef HAVE_SYS_SELECT_H @@ -227,6 +228,11 @@ static const char rcsid[] = #include +#ifdef HAVE_LIBCASPER +#include +#include +#endif + #ifdef IPSEC #include #include /* XXX */ @@ -363,6 +369,10 @@ extern int optind; extern int opterr; extern char *optarg; +#ifdef HAVE_LIBCASPER +static cap_channel_t *capdns; +#endif + /* Forwards */ double deltaT(struct timeval *, struct timeval *); void freehostinfo(struct hostinfo *); @@ -511,6 +521,13 @@ main(int argc, char **argv) int requestPort = -1; int sump = 0; int sockerrno; +#ifdef HAVE_LIBCASPER + const char *types[] = { "NAME", "ADDR" }; + int families[1]; + cap_channel_t *casper; +#endif + cap_rights_t rights; + bool cansandbox; /* Insure the socket fds won't be 0, 1 or 2 */ if (open(devnull, O_RDONLY) < 0 || @@ -539,6 +556,20 @@ main(int argc, char **argv) exit(1); } +#ifdef HAVE_LIBCASPER + casper = cap_init(); + if (casper == NULL) + errx(1, "unable to create casper process"); + capdns = cap_service_open(casper, "system.dns"); + if (capdns == NULL) + errx(1, "unable to open system.dns service"); + if (cap_dns_type_limit(capdns, types, 2) < 0) + errx(1, "unable to limit access to system.dns service"); + families[0] = AF_INET; + if (cap_dns_family_limit(capdns, families, 1) < 0) + errx(1, "unable to limit access to system.dns service"); +#endif /* HAVE_LIBCASPER */ + #ifdef IPCTL_DEFTTL { int mib[4] = { CTL_NET, PF_INET, IPPROTO_IP, IPCTL_DEFTTL }; @@ -549,10 +580,14 @@ main(int argc, char **argv) exit(1); } } -#else +#else /* !IPCTL_DEFTTL */ max_ttl = 30; #endif +#ifdef HAVE_LIBCASPER + cap_close(casper); +#endif + if (argv[0] == NULL) prog = "traceroute"; else if ((cp = strrchr(argv[0], '/')) != NULL) @@ -965,6 +1000,45 @@ main(int argc, char **argv) } } + if (connect(sndsock, (struct sockaddr *)&whereto, + sizeof(whereto)) != 0) { + Fprintf(stderr, "%s: connect: %s\n", prog, strerror(errno)); + exit(1); + } + +#ifdef HAVE_LIBCASPER + cansandbox = true; +#else + if (nflag) + cansandbox = true; + else + cansandbox = false; +#endif + + /* + * Here we enter capability mode. Further down access to global + * namespaces (e.g filesystem) is restricted (see capsicum(4)). + * We must connect(2) our socket before this point. + */ + if (cansandbox && cap_enter() < 0) { + Fprintf(stderr, "%s: cap_enter: %s\n", prog, strerror(errno)); + exit(1); + } + + cap_rights_init(&rights, CAP_SEND, CAP_SETSOCKOPT); + if (cansandbox && cap_rights_limit(sndsock, &rights) < 0) { + Fprintf(stderr, "%s: cap_rights_limit sndsock: %s\n", prog, + strerror(errno)); + exit(1); + } + + cap_rights_init(&rights, CAP_RECV, CAP_EVENT); + if (cansandbox && cap_rights_limit(s, &rights) < 0) { + Fprintf(stderr, "%s: cap_rights_limit s: %s\n", prog, + strerror(errno)); + exit(1); + } + #if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) if (setpolicy(sndsock, "in bypass") < 0) errx(1, "%s", ipsec_strerror()); @@ -1252,8 +1326,7 @@ send_probe(int seq, int ttl) } #endif - cc = sendto(sndsock, (char *)outip, - packlen, 0, &whereto, sizeof(whereto)); + cc = send(sndsock, (char *)outip, packlen, 0); if (cc < 0 || cc != packlen) { if (cc < 0) Fprintf(stderr, "%s: sendto: %s\n", @@ -1826,7 +1899,12 @@ inetname(struct in_addr in) else { cp = strchr(domain, '.'); if (cp == NULL) { - hp = gethostbyname(domain); +#ifdef HAVE_LIBCASPER + if (capdns != NULL) + hp = cap_gethostbyname(capdns, domain); + else +#endif + hp = gethostbyname(domain); if (hp != NULL) cp = strchr(hp->h_name, '.'); } @@ -1840,7 +1918,13 @@ inetname(struct in_addr in) } } if (!nflag && in.s_addr != INADDR_ANY) { - hp = gethostbyaddr((char *)&in, sizeof(in), AF_INET); +#ifdef HAVE_LIBCASPER + if (capdns != NULL) + hp = cap_gethostbyaddr(capdns, (char *)&in, sizeof(in), + AF_INET); + else +#endif + hp = gethostbyaddr((char *)&in, sizeof(in), AF_INET); if (hp != NULL) { if ((cp = strchr(hp->h_name, '.')) != NULL && strcmp(cp + 1, domain) == 0) @@ -1886,7 +1970,12 @@ gethostinfo(register char *hostname) return (hi); } - hp = gethostbyname(hostname); +#ifdef HAVE_LIBCASPER + if (capdns != NULL) + hp = cap_gethostbyname(capdns, hostname); + else +#endif + hp = gethostbyname(hostname); if (hp == NULL) { Fprintf(stderr, "%s: unknown host %s\n", prog, hostname); exit(1); Modified: stable/11/usr.sbin/traceroute/Makefile ============================================================================== --- stable/11/usr.sbin/traceroute/Makefile Wed Sep 5 20:02:23 2018 (r338474) +++ stable/11/usr.sbin/traceroute/Makefile Wed Sep 5 20:13:28 2018 (r338475) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + TRACEROUTE_DISTDIR?= ${SRCTOP}/contrib/traceroute .PATH: ${TRACEROUTE_DISTDIR} @@ -26,6 +28,12 @@ CFLAGS+= -DIPSEC .if !defined(TRACEROUTE_NO_IPSEC) LIBADD+= ipsec +.endif + +.if ${MK_CASPER} != "no" +LIBADD+= casper +LIBADD+= cap_dns +CFLAGS+=-DHAVE_LIBCASPER .endif CFLAGS+= -I${TRACEROUTE_DISTDIR} From owner-svn-src-all@freebsd.org Wed Sep 5 20:43:47 2018 Return-Path: Delivered-To: svn-src-all@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 9FC0EFFC5D8; Wed, 5 Sep 2018 20:43:47 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D34972503; Wed, 5 Sep 2018 20:43:47 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 450072AD26; Wed, 5 Sep 2018 20:43:47 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w85Khlac058886; Wed, 5 Sep 2018 20:43:47 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85KhlIO058885; Wed, 5 Sep 2018 20:43:47 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201809052043.w85KhlIO058885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 5 Sep 2018 20:43:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338476 - stable/11/sys/dev/mmc X-SVN-Group: stable-11 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/11/sys/dev/mmc X-SVN-Commit-Revision: 338476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 20:43:47 -0000 Author: marius Date: Wed Sep 5 20:43:46 2018 New Revision: 338476 URL: https://svnweb.freebsd.org/changeset/base/338476 Log: MFC: r338304 The read accessors generated by __BUS_ACCESSOR() have the problem that they don't check the result of BUS_READ_IVAR(9) and silently return stack garbage on failure in case a bus doesn't implement a particular instance variable for example. With MMC bridges not providing MMCBR_IVAR_RETUNE_REQ, yet, this in turn can cause mmc(4) to get into a state in which re-tuning seems to be necessary but is inappropriate, causing mmc_wait_for_request() to fail. Thus, don't use __BUS_ACCESSOR() for mmcbr_get_retune_req() and instead provide a version of the latter which returns retune_req_none if reading MMCBR_IVAR_RETUNE_REQ fails. Modified: stable/11/sys/dev/mmc/mmcbrvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mmc/mmcbrvar.h ============================================================================== --- stable/11/sys/dev/mmc/mmcbrvar.h Wed Sep 5 20:13:28 2018 (r338475) +++ stable/11/sys/dev/mmc/mmcbrvar.h Wed Sep 5 20:43:46 2018 (r338476) @@ -95,7 +95,6 @@ MMCBR_ACCESSOR(host_ocr, HOST_OCR, int) MMCBR_ACCESSOR(mode, MODE, int) MMCBR_ACCESSOR(ocr, OCR, int) MMCBR_ACCESSOR(power_mode, POWER_MODE, int) -MMCBR_ACCESSOR(retune_req, RETUNE_REQ, int) MMCBR_ACCESSOR(vdd, VDD, int) MMCBR_ACCESSOR(vccq, VCCQ, int) MMCBR_ACCESSOR(caps, CAPS, int) @@ -103,6 +102,20 @@ MMCBR_ACCESSOR(timing, TIMING, int) MMCBR_ACCESSOR(max_data, MAX_DATA, int) MMCBR_ACCESSOR(max_busy_timeout, MAX_BUSY_TIMEOUT, u_int) +static int __inline +mmcbr_get_retune_req(device_t dev) +{ + uintptr_t v; + + if (__predict_false(BUS_READ_IVAR(device_get_parent(dev), dev, + MMCBR_IVAR_RETUNE_REQ, &v) != 0)) + return (retune_req_none); + return ((int)v); +} + +/* + * Convenience wrappers for the mmcbr interface + */ static int __inline mmcbr_update_ios(device_t dev) { From owner-svn-src-all@freebsd.org Wed Sep 5 20:47:52 2018 Return-Path: Delivered-To: svn-src-all@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 EF0FCFFC748; Wed, 5 Sep 2018 20:47:51 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9581E72713; Wed, 5 Sep 2018 20:47:51 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82AC42AD27; Wed, 5 Sep 2018 20:47:51 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w85Klp1k059213; Wed, 5 Sep 2018 20:47:51 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85KlpEb059212; Wed, 5 Sep 2018 20:47:51 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201809052047.w85KlpEb059212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 5 Sep 2018 20:47:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r338477 - stable/10/sys/dev/mmc X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/sys/dev/mmc X-SVN-Commit-Revision: 338477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 20:47:52 -0000 Author: marius Date: Wed Sep 5 20:47:51 2018 New Revision: 338477 URL: https://svnweb.freebsd.org/changeset/base/338477 Log: MFC: r338304 The read accessors generated by __BUS_ACCESSOR() have the problem that they don't check the result of BUS_READ_IVAR(9) and silently return stack garbage on failure in case a bus doesn't implement a particular instance variable for example. With MMC bridges not providing MMCBR_IVAR_RETUNE_REQ, yet, this in turn can cause mmc(4) to get into a state in which re-tuning seems to be necessary but is inappropriate, causing mmc_wait_for_request() to fail. Thus, don't use __BUS_ACCESSOR() for mmcbr_get_retune_req() and instead provide a version of the latter which returns retune_req_none if reading MMCBR_IVAR_RETUNE_REQ fails. Modified: stable/10/sys/dev/mmc/mmcbrvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mmc/mmcbrvar.h ============================================================================== --- stable/10/sys/dev/mmc/mmcbrvar.h Wed Sep 5 20:43:46 2018 (r338476) +++ stable/10/sys/dev/mmc/mmcbrvar.h Wed Sep 5 20:47:51 2018 (r338477) @@ -95,7 +95,6 @@ MMCBR_ACCESSOR(host_ocr, HOST_OCR, int) MMCBR_ACCESSOR(mode, MODE, int) MMCBR_ACCESSOR(ocr, OCR, int) MMCBR_ACCESSOR(power_mode, POWER_MODE, int) -MMCBR_ACCESSOR(retune_req, RETUNE_REQ, int) MMCBR_ACCESSOR(vdd, VDD, int) MMCBR_ACCESSOR(vccq, VCCQ, int) MMCBR_ACCESSOR(caps, CAPS, int) @@ -103,6 +102,20 @@ MMCBR_ACCESSOR(timing, TIMING, int) MMCBR_ACCESSOR(max_data, MAX_DATA, int) MMCBR_ACCESSOR(max_busy_timeout, MAX_BUSY_TIMEOUT, u_int) +static int __inline +mmcbr_get_retune_req(device_t dev) +{ + uintptr_t v; + + if (__predict_false(BUS_READ_IVAR(device_get_parent(dev), dev, + MMCBR_IVAR_RETUNE_REQ, &v) != 0)) + return (retune_req_none); + return ((int)v); +} + +/* + * Convenience wrappers for the mmcbr interface + */ static int __inline mmcbr_update_ios(device_t dev) { From owner-svn-src-all@freebsd.org Wed Sep 5 20:51:55 2018 Return-Path: Delivered-To: svn-src-all@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 CC7C0FFC86D; Wed, 5 Sep 2018 20:51:55 +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 81ED372991; Wed, 5 Sep 2018 20:51:55 +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 7CC982AE83; Wed, 5 Sep 2018 20:51:55 +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 w85Kpt9d064071; Wed, 5 Sep 2018 20:51:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85KpsCl064064; Wed, 5 Sep 2018 20:51:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201809052051.w85KpsCl064064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 5 Sep 2018 20:51:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338478 - in head: contrib/elftoolchain/elfcopy contrib/elftoolchain/libelf sys/sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: contrib/elftoolchain/elfcopy contrib/elftoolchain/libelf sys/sys X-SVN-Commit-Revision: 338478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 20:51:56 -0000 Author: jhb Date: Wed Sep 5 20:51:53 2018 New Revision: 338478 URL: https://svnweb.freebsd.org/changeset/base/338478 Log: Fix objcopy for little-endian MIPS64 objects. MIPS64 does not store the 'r_info' field of a relocation table entry as a 64-bit value consisting of a 32-bit symbol index in the high 32 bits and a 32-bit type in the low 32 bits as on other architectures. Instead, the 64-bit 'r_info' field is really a 32-bit symbol index followed by four individual byte type fields. For big-endian MIPS64, treating this as a 64-bit integer happens to be compatible with the layout expected by other architectures (symbol index in upper 32-bits of resulting "native" 64-bit integer). However, for little-endian MIPS64 the parsed 64-bit integer contains the symbol index in the low 32 bits and the 4 individual byte type fields in the upper 32-bits (but as if the upper 32-bits were byte-swapped). To cope, add two helper routines in gelf_getrel.c to translate between the correct native 'r_info' value and the value obtained after the normal byte-swap translation. Use these routines in gelf_getrel(), gelf_getrela(), gelf_update_rel(), and gelf_update_rela(). This fixes 'readelf -r' on little-endian MIPS64 objects which was previously decoding incorrect relocations as well as 'objcopy: invalid symbox index' warnings from objcopy when extracting debug symbols from kernel modules. Even with this fixed, objcopy was still crashing when trying to extract debug symbols from little-endian MIPS64 modules. The workaround in gelf_*rel*() depends on the current ELF object having a valid ELF header so that the 'e_machine' field can be compared against EM_MIPS. objcopy was parsing the relocation entries to possibly rewrite the 'r_info' fields in the update_relocs() function before writing the initial ELF header to the destination object file. Move the initial write of the ELF header earlier before copy_contents() so that update_relocs() uses the correct symbol index values. Note that this change should really go upstream. The binutils readelf source has a similar hack for MIPS64EL though I implemented this version from scratch using the MIPS64 ABI PDF as a reference. Discussed with: jkoshy Reviewed by: emaste, imp Approved by: re (gjb, kib) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D15734 Added: head/contrib/elftoolchain/libelf/gelf_mips64el.c (contents, props changed) Modified: head/contrib/elftoolchain/elfcopy/main.c head/contrib/elftoolchain/libelf/Makefile head/contrib/elftoolchain/libelf/_libelf.h head/contrib/elftoolchain/libelf/gelf_rel.c head/contrib/elftoolchain/libelf/gelf_rela.c head/sys/sys/param.h Modified: head/contrib/elftoolchain/elfcopy/main.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/main.c Wed Sep 5 20:47:51 2018 (r338477) +++ head/contrib/elftoolchain/elfcopy/main.c Wed Sep 5 20:51:53 2018 (r338478) @@ -372,6 +372,14 @@ create_elf(struct elfcopy *ecp) create_symtab(ecp); /* + * Write the underlying ehdr. Note that it should be called + * before elf_setshstrndx() since it will overwrite e->e_shstrndx. + */ + if (gelf_update_ehdr(ecp->eout, &oeh) == 0) + errx(EXIT_FAILURE, "gelf_update_ehdr() failed: %s", + elf_errmsg(-1)); + + /* * First processing of output sections: at this stage we copy the * content of each section from input to output object. Section * content will be modified and printed (mcs) if need. Also content of @@ -379,14 +387,6 @@ create_elf(struct elfcopy *ecp) * to symbol table changes. */ copy_content(ecp); - - /* - * Write the underlying ehdr. Note that it should be called - * before elf_setshstrndx() since it will overwrite e->e_shstrndx. - */ - if (gelf_update_ehdr(ecp->eout, &oeh) == 0) - errx(EXIT_FAILURE, "gelf_update_ehdr() failed: %s", - elf_errmsg(-1)); /* Generate section name string table (.shstrtab). */ set_shstrtab(ecp); Modified: head/contrib/elftoolchain/libelf/Makefile ============================================================================== --- head/contrib/elftoolchain/libelf/Makefile Wed Sep 5 20:47:51 2018 (r338477) +++ head/contrib/elftoolchain/libelf/Makefile Wed Sep 5 20:51:53 2018 (r338478) @@ -35,6 +35,7 @@ SRCS= elf.c \ gelf_ehdr.c \ gelf_getclass.c \ gelf_fsize.c \ + gelf_mips64el.c \ gelf_move.c \ gelf_phdr.c \ gelf_rel.c \ Modified: head/contrib/elftoolchain/libelf/_libelf.h ============================================================================== --- head/contrib/elftoolchain/libelf/_libelf.h Wed Sep 5 20:47:51 2018 (r338477) +++ head/contrib/elftoolchain/libelf/_libelf.h Wed Sep 5 20:51:53 2018 (r338478) @@ -216,12 +216,15 @@ int (*_libelf_get_translator(Elf_Type _t, int _directi void *_libelf_getphdr(Elf *_e, int _elfclass); void *_libelf_getshdr(Elf_Scn *_scn, int _elfclass); void _libelf_init_elf(Elf *_e, Elf_Kind _kind); +int _libelf_is_mips64el(Elf *e); int _libelf_load_section_headers(Elf *e, void *ehdr); unsigned int _libelf_malign(Elf_Type _t, int _elfclass); Elf *_libelf_memory(unsigned char *_image, size_t _sz, int _reporterror); size_t _libelf_msize(Elf_Type _t, int _elfclass, unsigned int _version); void *_libelf_newphdr(Elf *_e, int _elfclass, size_t _count); Elf *_libelf_open_object(int _fd, Elf_Cmd _c, int _reporterror); +Elf64_Xword _libelf_mips64el_r_info_tof(Elf64_Xword r_info); +Elf64_Xword _libelf_mips64el_r_info_tom(Elf64_Xword r_info); struct _Libelf_Data *_libelf_release_data(struct _Libelf_Data *_d); Elf *_libelf_release_elf(Elf *_e); Elf_Scn *_libelf_release_scn(Elf_Scn *_s); Added: head/contrib/elftoolchain/libelf/gelf_mips64el.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/elftoolchain/libelf/gelf_mips64el.c Wed Sep 5 20:51:53 2018 (r338478) @@ -0,0 +1,81 @@ +/*- + * Copyright (c) 2018 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. + */ + +#include + +#include "_libelf.h" + +ELFTC_VCSID("$Id$"); + +int +_libelf_is_mips64el(Elf *e) +{ + + return (e->e_kind == ELF_K_ELF && e->e_byteorder == ELFDATA2LSB && + e->e_u.e_elf.e_ehdr.e_ehdr64->e_machine == EM_MIPS); +} + +/* + * For MIPS64, the r_info field is actually stored as a 32-bit symbol + * index (r_sym) followed by four single-byte fields (r_ssym, r_type3, + * r_type2, and r_type). The byte-swap for the little-endian case + * jumbles this incorrectly so compensate. + */ +Elf64_Xword +_libelf_mips64el_r_info_tof(Elf64_Xword r_info) +{ + Elf64_Xword new_info; + uint8_t ssym, type3, type2, type; + + ssym = r_info >> 24; + type3 = r_info >> 16; + type2 = r_info >> 8; + type = r_info; + new_info = r_info >> 32; + new_info |= (Elf64_Xword)ssym << 32; + new_info |= (Elf64_Xword)type3 << 40; + new_info |= (Elf64_Xword)type2 << 48; + new_info |= (Elf64_Xword)type << 56; + return (new_info); +} + +Elf64_Xword +_libelf_mips64el_r_info_tom(Elf64_Xword r_info) +{ + Elf64_Xword new_info; + uint8_t ssym, type3, type2, type; + + ssym = r_info >> 32; + type3 = r_info >> 40; + type2 = r_info >> 48; + type = r_info >> 56; + new_info = (r_info & 0xffffffff) << 32; + new_info |= (Elf64_Xword)ssym << 24; + new_info |= (Elf64_Xword)type3 << 16; + new_info |= (Elf64_Xword)type2 << 8; + new_info |= (Elf64_Xword)type; + return (new_info); +} Modified: head/contrib/elftoolchain/libelf/gelf_rel.c ============================================================================== --- head/contrib/elftoolchain/libelf/gelf_rel.c Wed Sep 5 20:47:51 2018 (r338477) +++ head/contrib/elftoolchain/libelf/gelf_rel.c Wed Sep 5 20:51:53 2018 (r338478) @@ -90,6 +90,9 @@ gelf_getrel(Elf_Data *ed, int ndx, GElf_Rel *dst) rel64 = (Elf64_Rel *) d->d_data.d_buf + ndx; *dst = *rel64; + + if (_libelf_is_mips64el(e)) + dst->r_info = _libelf_mips64el_r_info_tom(rel64->r_info); } return (dst); @@ -156,6 +159,9 @@ gelf_update_rel(Elf_Data *ed, int ndx, GElf_Rel *dr) rel64 = (Elf64_Rel *) d->d_data.d_buf + ndx; *rel64 = *dr; + + if (_libelf_is_mips64el(e)) + rel64->r_info = _libelf_mips64el_r_info_tof(dr->r_info); } return (1); Modified: head/contrib/elftoolchain/libelf/gelf_rela.c ============================================================================== --- head/contrib/elftoolchain/libelf/gelf_rela.c Wed Sep 5 20:47:51 2018 (r338477) +++ head/contrib/elftoolchain/libelf/gelf_rela.c Wed Sep 5 20:51:53 2018 (r338478) @@ -91,6 +91,10 @@ gelf_getrela(Elf_Data *ed, int ndx, GElf_Rela *dst) rela64 = (Elf64_Rela *) d->d_data.d_buf + ndx; *dst = *rela64; + + if (_libelf_is_mips64el(e)) + dst->r_info = + _libelf_mips64el_r_info_tom(rela64->r_info); } return (dst); @@ -159,6 +163,9 @@ gelf_update_rela(Elf_Data *ed, int ndx, GElf_Rela *dr) rela64 = (Elf64_Rela *) d->d_data.d_buf + ndx; *rela64 = *dr; + + if (_libelf_is_mips64el(e)) + rela64->r_info = _libelf_mips64el_r_info_tof(dr->r_info); } return (1); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Wed Sep 5 20:47:51 2018 (r338477) +++ head/sys/sys/param.h Wed Sep 5 20:51:53 2018 (r338478) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200083 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200084 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Wed Sep 5 21:05:17 2018 Return-Path: Delivered-To: svn-src-all@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 A759AFFCEA4; Wed, 5 Sep 2018 21:05:17 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D89F7326E; Wed, 5 Sep 2018 21:05:17 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A4B32B053; Wed, 5 Sep 2018 21:05:17 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w85L5HKR069449; Wed, 5 Sep 2018 21:05:17 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85L5HsN069448; Wed, 5 Sep 2018 21:05:17 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201809052105.w85L5HsN069448@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 5 Sep 2018 21:05: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: r338479 - stable/11/sys/dev/sdhci X-SVN-Group: stable-11 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/11/sys/dev/sdhci X-SVN-Commit-Revision: 338479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 21:05:17 -0000 Author: marius Date: Wed Sep 5 21:05:16 2018 New Revision: 338479 URL: https://svnweb.freebsd.org/changeset/base/338479 Log: MFC: r338261 - According to section 2.2.5 of the SDHCI specification version 4.20, SDHCI_TRNS_ACMD12 is to be set only for multiple-block read/write commands without data length information, so don't unconditionally set this bit. The result matches what e. g. Linux does. - Section 2.2.19 of the SDHCI specification version 4.20 states that SDHCI_ACMD12_ERR should be only valid if SDHCI_INT_ACMD12ERR is set and hardware may clear SDHCI_ACMD12_ERR when SDHCI_INT_ACMD12ERR is cleared (differing silicon behavior is specifically allowed, though). Thus, read SDHCI_ACMD12_ERR before clearing SDHCI_INT_ACMD12ERR. While at it, use the 16-bit accessor rather than the 32-bit one for reading the 16-bit SDHCI_ACMD12_ERR. - SDHCI_INT_TUNEERR isn't one of the ROC bits in SDHCI_INT_STATUS so clear it explicitly. - Add missing prototypes and sort them. Modified: stable/11/sys/dev/sdhci/sdhci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sdhci/sdhci.c ============================================================================== --- stable/11/sys/dev/sdhci/sdhci.c Wed Sep 5 20:51:53 2018 (r338478) +++ stable/11/sys/dev/sdhci/sdhci.c Wed Sep 5 21:05:16 2018 (r338479) @@ -80,17 +80,37 @@ SYSCTL_INT(_hw_sdhci, OID_AUTO, quirk_set, CTLFLAG_RWT #define WR_MULTI_4(slot, off, ptr, count) \ SDHCI_WRITE_MULTI_4((slot)->bus, (slot), (off), (ptr), (count)) +static void sdhci_acmd_irq(struct sdhci_slot *slot, uint16_t acmd_err); static void sdhci_card_poll(void *arg); static void sdhci_card_task(void *arg, int pending); +static void sdhci_cmd_irq(struct sdhci_slot *slot, uint32_t intmask); +static void sdhci_data_irq(struct sdhci_slot *slot, uint32_t intmask); static int sdhci_exec_tuning(struct sdhci_slot *slot, bool reset); +static void sdhci_handle_card_present_locked(struct sdhci_slot *slot, + bool is_present); +static void sdhci_finish_command(struct sdhci_slot *slot); +static void sdhci_init(struct sdhci_slot *slot); +static void sdhci_read_block_pio(struct sdhci_slot *slot); +static void sdhci_req_done(struct sdhci_slot *slot); static void sdhci_req_wakeup(struct mmc_request *req); +static void sdhci_reset(struct sdhci_slot *slot, uint8_t mask); static void sdhci_retune(void *arg); static void sdhci_set_clock(struct sdhci_slot *slot, uint32_t clock); +static void sdhci_set_power(struct sdhci_slot *slot, u_char power); +static void sdhci_set_transfer_mode(struct sdhci_slot *slot, + struct mmc_data *data); static void sdhci_start(struct sdhci_slot *slot); +static void sdhci_timeout(void *arg); +static void sdhci_start_command(struct sdhci_slot *slot, + struct mmc_command *cmd); static void sdhci_start_data(struct sdhci_slot *slot, struct mmc_data *data); +static void sdhci_write_block_pio(struct sdhci_slot *slot); +static void sdhci_transfer_pio(struct sdhci_slot *slot); /* helper routines */ static void sdhci_dumpregs(struct sdhci_slot *slot); +static void sdhci_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, + int error); static int slot_printf(struct sdhci_slot *slot, const char * fmt, ...) __printflike(2, 3); static uint32_t sdhci_tuning_intmask(struct sdhci_slot *slot); @@ -1433,12 +1453,14 @@ sdhci_set_transfer_mode(struct sdhci_slot *slot, struc return; mode = SDHCI_TRNS_BLK_CNT_EN; - if (data->len > 512) + if (data->len > 512) { mode |= SDHCI_TRNS_MULTI; + if (__predict_true(slot->req->stop && + !(slot->quirks & SDHCI_QUIRK_BROKEN_AUTO_STOP))) + mode |= SDHCI_TRNS_ACMD12; + } if (data->flags & MMC_DATA_READ) mode |= SDHCI_TRNS_READ; - if (slot->req->stop && !(slot->quirks & SDHCI_QUIRK_BROKEN_AUTO_STOP)) - mode |= SDHCI_TRNS_ACMD12; if (slot->flags & SDHCI_USE_DMA) mode |= SDHCI_TRNS_DMA; @@ -1957,18 +1979,16 @@ done: } static void -sdhci_acmd_irq(struct sdhci_slot *slot) +sdhci_acmd_irq(struct sdhci_slot *slot, uint16_t acmd_err) { - uint16_t err; - err = RD4(slot, SDHCI_ACMD12_ERR); if (!slot->curcmd) { slot_printf(slot, "Got AutoCMD12 error 0x%04x, but " - "there is no active command.\n", err); + "there is no active command.\n", acmd_err); sdhci_dumpregs(slot); return; } - slot_printf(slot, "Got AutoCMD12 error 0x%04x\n", err); + slot_printf(slot, "Got AutoCMD12 error 0x%04x\n", acmd_err); sdhci_reset(slot, SDHCI_RESET_CMD); } @@ -1976,6 +1996,7 @@ void sdhci_generic_intr(struct sdhci_slot *slot) { uint32_t intmask, present; + uint16_t val16; SDHCI_LOCK(slot); /* Read slot interrupt status. */ @@ -1989,6 +2010,7 @@ sdhci_generic_intr(struct sdhci_slot *slot) /* Handle tuning error interrupt. */ if (__predict_false(intmask & SDHCI_INT_TUNEERR)) { + WR4(slot, SDHCI_INT_STATUS, SDHCI_INT_TUNEERR); slot_printf(slot, "Tuning error indicated\n"); slot->retune_req |= SDHCI_RETUNE_REQ_RESET; if (slot->curcmd) { @@ -2026,8 +2048,10 @@ sdhci_generic_intr(struct sdhci_slot *slot) } /* Handle AutoCMD12 error interrupt. */ if (intmask & SDHCI_INT_ACMD12ERR) { + /* Clearing SDHCI_INT_ACMD12ERR may clear SDHCI_ACMD12_ERR. */ + val16 = RD2(slot, SDHCI_ACMD12_ERR); WR4(slot, SDHCI_INT_STATUS, SDHCI_INT_ACMD12ERR); - sdhci_acmd_irq(slot); + sdhci_acmd_irq(slot, val16); } /* Handle bus power interrupt. */ if (intmask & SDHCI_INT_BUS_POWER) { From owner-svn-src-all@freebsd.org Wed Sep 5 21:15:24 2018 Return-Path: Delivered-To: svn-src-all@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 E5100FFD324; Wed, 5 Sep 2018 21:15:23 +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 9A806738F6; Wed, 5 Sep 2018 21:15:23 +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 956E02B200; Wed, 5 Sep 2018 21:15:23 +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 w85LFNtP074665; Wed, 5 Sep 2018 21:15:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85LFNKe074664; Wed, 5 Sep 2018 21:15:23 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809052115.w85LFNKe074664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 5 Sep 2018 21:15:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338480 - stable/11/sys/compat/freebsd32 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/compat/freebsd32 X-SVN-Commit-Revision: 338480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 21:15:24 -0000 Author: kib Date: Wed Sep 5 21:15:23 2018 New Revision: 338480 URL: https://svnweb.freebsd.org/changeset/base/338480 Log: MFC r338357: Fix compat32 ftruncate cap mode. PR: 230120 Modified: stable/11/sys/compat/freebsd32/capabilities.conf Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/freebsd32/capabilities.conf ============================================================================== --- stable/11/sys/compat/freebsd32/capabilities.conf Wed Sep 5 21:05:16 2018 (r338479) +++ stable/11/sys/compat/freebsd32/capabilities.conf Wed Sep 5 21:15:23 2018 (r338480) @@ -103,6 +103,7 @@ freebsd32_fstat fstatfs fsync ftruncate +freebsd32_ftruncate freebsd32_futimens freebsd32_futimes getaudit From owner-svn-src-all@freebsd.org Wed Sep 5 21:15:49 2018 Return-Path: Delivered-To: svn-src-all@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 D3FA8FFD373; Wed, 5 Sep 2018 21:15:48 +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 86F88739FF; Wed, 5 Sep 2018 21:15:48 +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 81D602B202; Wed, 5 Sep 2018 21:15:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w85LFmkt074744; Wed, 5 Sep 2018 21:15:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85LFmOW074743; Wed, 5 Sep 2018 21:15:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809052115.w85LFmOW074743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 5 Sep 2018 21:15:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338481 - stable/11/sys/compat/freebsd32 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/compat/freebsd32 X-SVN-Commit-Revision: 338481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 21:15:49 -0000 Author: kib Date: Wed Sep 5 21:15:48 2018 New Revision: 338481 URL: https://svnweb.freebsd.org/changeset/base/338481 Log: Regen. Modified: stable/11/sys/compat/freebsd32/freebsd32_sysent.c Modified: stable/11/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_sysent.c Wed Sep 5 21:15:23 2018 (r338480) +++ stable/11/sys/compat/freebsd32/freebsd32_sysent.c Wed Sep 5 21:15:48 2018 (r338481) @@ -253,7 +253,7 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 198 = __syscall */ { compat6(AS(freebsd6_freebsd32_lseek_args),freebsd32_lseek), AUE_LSEEK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 199 = freebsd6 freebsd32_lseek */ { compat6(AS(freebsd6_freebsd32_truncate_args),freebsd32_truncate), AUE_TRUNCATE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 200 = freebsd6 freebsd32_truncate */ - { compat6(AS(freebsd6_freebsd32_ftruncate_args),freebsd32_ftruncate), AUE_FTRUNCATE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 201 = freebsd6 freebsd32_ftruncate */ + { compat6(AS(freebsd6_freebsd32_ftruncate_args),freebsd32_ftruncate), AUE_FTRUNCATE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 201 = freebsd6 freebsd32_ftruncate */ { AS(freebsd32_sysctl_args), (sy_call_t *)freebsd32_sysctl, AUE_SYSCTL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 202 = freebsd32_sysctl */ { AS(mlock_args), (sy_call_t *)sys_mlock, AUE_MLOCK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 203 = mlock */ { AS(munlock_args), (sy_call_t *)sys_munlock, AUE_MUNLOCK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 204 = munlock */ @@ -533,14 +533,14 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_mmap_args), (sy_call_t *)freebsd32_mmap, AUE_MMAP, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 477 = freebsd32_mmap */ { AS(freebsd32_lseek_args), (sy_call_t *)freebsd32_lseek, AUE_LSEEK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 478 = freebsd32_lseek */ { AS(freebsd32_truncate_args), (sy_call_t *)freebsd32_truncate, AUE_TRUNCATE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 479 = freebsd32_truncate */ - { AS(freebsd32_ftruncate_args), (sy_call_t *)freebsd32_ftruncate, AUE_FTRUNCATE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 480 = freebsd32_ftruncate */ + { AS(freebsd32_ftruncate_args), (sy_call_t *)freebsd32_ftruncate, AUE_FTRUNCATE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 480 = freebsd32_ftruncate */ #else { AS(freebsd32_pread_args), (sy_call_t *)freebsd32_pread, AUE_PREAD, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 475 = freebsd32_pread */ { AS(freebsd32_pwrite_args), (sy_call_t *)freebsd32_pwrite, AUE_PWRITE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 476 = freebsd32_pwrite */ { AS(freebsd32_mmap_args), (sy_call_t *)freebsd32_mmap, AUE_MMAP, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 477 = freebsd32_mmap */ { AS(freebsd32_lseek_args), (sy_call_t *)freebsd32_lseek, AUE_LSEEK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 478 = freebsd32_lseek */ { AS(freebsd32_truncate_args), (sy_call_t *)freebsd32_truncate, AUE_TRUNCATE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 479 = freebsd32_truncate */ - { AS(freebsd32_ftruncate_args), (sy_call_t *)freebsd32_ftruncate, AUE_FTRUNCATE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 480 = freebsd32_ftruncate */ + { AS(freebsd32_ftruncate_args), (sy_call_t *)freebsd32_ftruncate, AUE_FTRUNCATE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 480 = freebsd32_ftruncate */ #endif { AS(thr_kill2_args), (sy_call_t *)sys_thr_kill2, AUE_KILL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 481 = thr_kill2 */ { AS(shm_open_args), (sy_call_t *)sys_shm_open, AUE_SHMOPEN, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 482 = shm_open */ From owner-svn-src-all@freebsd.org Wed Sep 5 21:23:41 2018 Return-Path: Delivered-To: svn-src-all@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 0ACF4FFD8E2; Wed, 5 Sep 2018 21:23:41 +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 B428A741D3; Wed, 5 Sep 2018 21:23:40 +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 951102B3A3; Wed, 5 Sep 2018 21:23:40 +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 w85LNeRG079590; Wed, 5 Sep 2018 21:23:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85LNeUw079589; Wed, 5 Sep 2018 21:23:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809052123.w85LNeUw079589@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 5 Sep 2018 21:23: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: r338482 - stable/11/libexec/rtld-elf X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/libexec/rtld-elf X-SVN-Commit-Revision: 338482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 21:23:41 -0000 Author: kib Date: Wed Sep 5 21:23:40 2018 New Revision: 338482 URL: https://svnweb.freebsd.org/changeset/base/338482 Log: MFC r324856: Don't call realpath(3) from libmap rtld code. Modified: stable/11/libexec/rtld-elf/libmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/rtld-elf/libmap.c ============================================================================== --- stable/11/libexec/rtld-elf/libmap.c Wed Sep 5 21:15:48 2018 (r338481) +++ stable/11/libexec/rtld-elf/libmap.c Wed Sep 5 21:23:40 2018 (r338482) @@ -36,6 +36,8 @@ struct lmp { static TAILQ_HEAD(lmc_list, lmc) lmc_head = TAILQ_HEAD_INITIALIZER(lmc_head); struct lmc { char *path; + dev_t dev; + ino_t ino; TAILQ_ENTRY(lmc) next; }; @@ -99,45 +101,45 @@ lmc_parse_file(char *path) struct lmc *p; struct stat st; int fd; - char *rpath; char *lm_map; - rpath = realpath(path, NULL); - if (rpath == NULL) - return; - TAILQ_FOREACH(p, &lmc_head, next) { - if (strcmp(p->path, rpath) == 0) { - free(rpath); + if (strcmp(p->path, path) == 0) return; - } } - fd = open(rpath, O_RDONLY | O_CLOEXEC); + fd = open(path, O_RDONLY | O_CLOEXEC); if (fd == -1) { - dbg("lm_parse_file: open(\"%s\") failed, %s", rpath, + dbg("lm_parse_file: open(\"%s\") failed, %s", path, rtld_strerror(errno)); - free(rpath); return; } if (fstat(fd, &st) == -1) { close(fd); - dbg("lm_parse_file: fstat(\"%s\") failed, %s", rpath, + dbg("lm_parse_file: fstat(\"%s\") failed, %s", path, rtld_strerror(errno)); - free(rpath); return; } + + TAILQ_FOREACH(p, &lmc_head, next) { + if (p->dev == st.st_dev && p->ino == st.st_ino) { + close(fd); + return; + } + } + lm_map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (lm_map == (const char *)MAP_FAILED) { close(fd); - dbg("lm_parse_file: mmap(\"%s\") failed, %s", rpath, + dbg("lm_parse_file: mmap(\"%s\") failed, %s", path, rtld_strerror(errno)); - free(rpath); return; } close(fd); p = xmalloc(sizeof(struct lmc)); - p->path = rpath; + p->path = xstrdup(path); + p->dev = st.st_dev; + p->ino = st.st_ino; TAILQ_INSERT_HEAD(&lmc_head, p, next); lmc_parse(lm_map, st.st_size); munmap(lm_map, st.st_size); @@ -151,26 +153,19 @@ lmc_parse_dir(char *idir) struct lmc *p; char conffile[MAXPATHLEN]; char *ext; - char *rpath; - rpath = realpath(idir, NULL); - if (rpath == NULL) - return; - TAILQ_FOREACH(p, &lmc_head, next) { - if (strcmp(p->path, rpath) == 0) { - free(rpath); + if (strcmp(p->path, idir) == 0) return; - } } d = opendir(idir); - if (d == NULL) { - free(rpath); + if (d == NULL) return; - } p = xmalloc(sizeof(struct lmc)); - p->path = rpath; + p->path = xstrdup(idir); + p->dev = NODEV; + p->ino = 0; TAILQ_INSERT_HEAD(&lmc_head, p, next); while ((dp = readdir(d)) != NULL) { From owner-svn-src-all@freebsd.org Wed Sep 5 21:24:27 2018 Return-Path: Delivered-To: svn-src-all@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 E1A22FFD9F7; Wed, 5 Sep 2018 21:24:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 970FB7435D; Wed, 5 Sep 2018 21:24:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90A9C2B3A6; Wed, 5 Sep 2018 21:24:26 +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 w85LOQkG079679; Wed, 5 Sep 2018 21:24:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85LOQYT079678; Wed, 5 Sep 2018 21:24:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809052124.w85LOQYT079678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 5 Sep 2018 21:24: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: r338483 - stable/11/libexec/rtld-elf X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/libexec/rtld-elf X-SVN-Commit-Revision: 338483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 21:24:27 -0000 Author: kib Date: Wed Sep 5 21:24:26 2018 New Revision: 338483 URL: https://svnweb.freebsd.org/changeset/base/338483 Log: MFC r338428: Style cleanup. Modified: stable/11/libexec/rtld-elf/libmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/rtld-elf/libmap.c ============================================================================== --- stable/11/libexec/rtld-elf/libmap.c Wed Sep 5 21:23:40 2018 (r338482) +++ stable/11/libexec/rtld-elf/libmap.c Wed Sep 5 21:24:26 2018 (r338483) @@ -99,9 +99,9 @@ static void lmc_parse_file(char *path) { struct lmc *p; + char *lm_map; struct stat st; int fd; - char *lm_map; TAILQ_FOREACH(p, &lmc_head, next) { if (strcmp(p->path, path) == 0) @@ -219,17 +219,20 @@ lmc_parse(char *lm_p, size_t lm_len) t = f = c = NULL; /* Skip over leading space */ - while (rtld_isspace(*cp)) cp++; + while (rtld_isspace(*cp)) + cp++; /* Found a comment or EOL */ - if (iseol(*cp)) continue; + if (iseol(*cp)) + continue; /* Found a constraint selector */ if (*cp == '[') { cp++; /* Skip leading space */ - while (rtld_isspace(*cp)) cp++; + while (rtld_isspace(*cp)) + cp++; /* Found comment, EOL or end of selector */ if (iseol(*cp) || *cp == ']') @@ -241,10 +244,12 @@ lmc_parse(char *lm_p, size_t lm_len) cp++; /* Skip and zero out trailing space */ - while (rtld_isspace(*cp)) *cp++ = '\0'; + while (rtld_isspace(*cp)) + *cp++ = '\0'; /* Check if there is a closing brace */ - if (*cp != ']') continue; + if (*cp != ']') + continue; /* Terminate string if there was no trailing space */ *cp++ = '\0'; @@ -253,8 +258,10 @@ lmc_parse(char *lm_p, size_t lm_len) * There should be nothing except whitespace or comment from this point to the end of the line. */ - while(rtld_isspace(*cp)) cp++; - if (!iseol(*cp)) continue; + while (rtld_isspace(*cp)) + cp++; + if (!iseol(*cp)) + continue; if (strlcpy(prog, c, sizeof prog) >= sizeof prog) continue; @@ -264,23 +271,29 @@ lmc_parse(char *lm_p, size_t lm_len) /* Parse the 'from' candidate. */ f = cp++; - while (!rtld_isspace(*cp) && !iseol(*cp)) cp++; + while (!rtld_isspace(*cp) && !iseol(*cp)) + cp++; /* Skip and zero out the trailing whitespace */ - while (rtld_isspace(*cp)) *cp++ = '\0'; + while (rtld_isspace(*cp)) + *cp++ = '\0'; /* Found a comment or EOL */ - if (iseol(*cp)) continue; + if (iseol(*cp)) + continue; /* Parse 'to' mapping */ t = cp++; - while (!rtld_isspace(*cp) && !iseol(*cp)) cp++; + while (!rtld_isspace(*cp) && !iseol(*cp)) + cp++; /* Skip and zero out the trailing whitespace */ - while (rtld_isspace(*cp)) *cp++ = '\0'; + while (rtld_isspace(*cp)) + *cp++ = '\0'; /* Should be no extra tokens at this point */ - if (!iseol(*cp)) continue; + if (!iseol(*cp)) + continue; *cp = '\0'; if (strcmp(f, "includedir") == 0) @@ -293,7 +306,7 @@ lmc_parse(char *lm_p, size_t lm_len) } static void -lm_free (struct lm_list *lml) +lm_free(struct lm_list *lml) { struct lm *lm; @@ -306,11 +319,10 @@ lm_free (struct lm_list *lml) free(lm->t); free(lm); } - return; } void -lm_fini (void) +lm_fini(void) { struct lmp *lmp; struct lmc *p; @@ -331,11 +343,10 @@ lm_fini (void) lm_free(&lmp->lml); free(lmp); } - return; } static void -lm_add (const char *p, const char *f, const char *t) +lm_add(const char *p, const char *f, const char *t) { struct lm_list *lml; struct lm *lm; @@ -356,7 +367,7 @@ lm_add (const char *p, const char *f, const char *t) } char * -lm_find (const char *p, const char *f) +lm_find(const char *p, const char *f) { struct lm_list *lml; char *t; @@ -377,14 +388,15 @@ lm_find (const char *p, const char *f) lml = lmp_find("$DEFAULT$"); if (lml != NULL) return (lml_find(lml, f)); - else - return (NULL); + return (NULL); } -/* Given a libmap translation list and a library name, return the - replacement library, or NULL */ +/* + * Given a libmap translation list and a library name, return the + * replacement library, or NULL. + */ char * -lm_findn (const char *p, const char *f, const int n) +lm_findn(const char *p, const char *f, const int n) { char pathbuf[64], *s, *t; @@ -401,37 +413,43 @@ lm_findn (const char *p, const char *f, const int n) } static char * -lml_find (struct lm_list *lmh, const char *f) +lml_find(struct lm_list *lmh, const char *f) { struct lm *lm; dbg("%s(%p, \"%s\")", __func__, lmh, f); - TAILQ_FOREACH(lm, lmh, lm_link) + TAILQ_FOREACH(lm, lmh, lm_link) { if (strcmp(f, lm->f) == 0) return (lm->t); + } return (NULL); } -/* Given an executable name, return a pointer to the translation list or - NULL if no matches */ +/* + * Given an executable name, return a pointer to the translation list or + * NULL if no matches. + */ static struct lm_list * -lmp_find (const char *n) +lmp_find(const char *n) { struct lmp *lmp; dbg("%s(\"%s\")", __func__, n); - TAILQ_FOREACH(lmp, &lmp_head, lmp_link) + TAILQ_FOREACH(lmp, &lmp_head, lmp_link) { if ((lmp->type == T_EXACT && strcmp(n, lmp->p) == 0) || - (lmp->type == T_DIRECTORY && strncmp(n, lmp->p, strlen(lmp->p)) == 0) || - (lmp->type == T_BASENAME && strcmp(quickbasename(n), lmp->p) == 0)) + (lmp->type == T_DIRECTORY && strncmp(n, lmp->p, + strlen(lmp->p)) == 0) || + (lmp->type == T_BASENAME && strcmp(quickbasename(n), + lmp->p) == 0)) return (&lmp->lml); + } return (NULL); } static struct lm_list * -lmp_init (char *n) +lmp_init(char *n) { struct lmp *lmp; @@ -439,7 +457,7 @@ lmp_init (char *n) lmp = xmalloc(sizeof(struct lmp)); lmp->p = n; - if (n[strlen(n)-1] == '/') + if (n[strlen(n) - 1] == '/') lmp->type = T_DIRECTORY; else if (strchr(n,'/') == NULL) lmp->type = T_BASENAME; @@ -451,15 +469,18 @@ lmp_init (char *n) return (&lmp->lml); } -/* libc basename is overkill. Return a pointer to the character after the - last /, or the original string if there are no slashes. */ +/* + * libc basename is overkill. Return a pointer to the character after + * the last /, or the original string if there are no slashes. + */ static const char * -quickbasename (const char *path) +quickbasename(const char *path) { - const char *p = path; - for (; *path; path++) { + const char *p; + + for (p = path; *path != '\0'; path++) { if (*path == '/') - p = path+1; + p = path + 1; } return (p); } From owner-svn-src-all@freebsd.org Wed Sep 5 21:28:36 2018 Return-Path: Delivered-To: svn-src-all@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 137C9FFDBB7; Wed, 5 Sep 2018 21:28:36 +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 B6FD374603; Wed, 5 Sep 2018 21:28:35 +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 B088D2B3AA; Wed, 5 Sep 2018 21:28:35 +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 w85LSZgr079905; Wed, 5 Sep 2018 21:28:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85LSXcp079894; Wed, 5 Sep 2018 21:28:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809052128.w85LSXcp079894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 5 Sep 2018 21:28:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338484 - in stable/11/sys: amd64/amd64 arm/arm arm64/arm64 cddl/contrib/opensolaris/uts/common/fs/zfs/sys i386/i386 mips/mips riscv/riscv vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 arm/arm arm64/arm64 cddl/contrib/opensolaris/uts/common/fs/zfs/sys i386/i386 mips/mips riscv/riscv vm X-SVN-Commit-Revision: 338484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 21:28:36 -0000 Author: kib Date: Wed Sep 5 21:28:33 2018 New Revision: 338484 URL: https://svnweb.freebsd.org/changeset/base/338484 Log: MFC r338370: Remove {max/min}_offset() macros, use vm_map_{max/min}() inlines. Modified: stable/11/sys/amd64/amd64/pmap.c stable/11/sys/arm/arm/pmap-v6.c stable/11/sys/arm64/arm64/pmap.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h stable/11/sys/i386/i386/pmap.c stable/11/sys/mips/mips/pmap.c stable/11/sys/riscv/riscv/pmap.c stable/11/sys/vm/vm_glue.c stable/11/sys/vm/vm_init.c stable/11/sys/vm/vm_map.c stable/11/sys/vm/vm_map.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Wed Sep 5 21:24:26 2018 (r338483) +++ stable/11/sys/amd64/amd64/pmap.c Wed Sep 5 21:28:33 2018 (r338484) @@ -3020,8 +3020,8 @@ pmap_growkernel(vm_offset_t addr) return; addr = roundup2(addr, NBPDR); - if (addr - 1 >= kernel_map->max_offset) - addr = kernel_map->max_offset; + if (addr - 1 >= vm_map_max(kernel_map)) + addr = vm_map_max(kernel_map); while (kernel_vm_end < addr) { pdpe = pmap_pdpe(kernel_pmap, kernel_vm_end); if ((*pdpe & X86_PG_V) == 0) { @@ -3041,8 +3041,8 @@ pmap_growkernel(vm_offset_t addr) pde = pmap_pdpe_to_pde(pdpe, kernel_vm_end); if ((*pde & X86_PG_V) != 0) { kernel_vm_end = (kernel_vm_end + NBPDR) & ~PDRMASK; - if (kernel_vm_end - 1 >= kernel_map->max_offset) { - kernel_vm_end = kernel_map->max_offset; + if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { + kernel_vm_end = vm_map_max(kernel_map); break; } continue; @@ -3060,8 +3060,8 @@ pmap_growkernel(vm_offset_t addr) pde_store(pde, newpdir); kernel_vm_end = (kernel_vm_end + NBPDR) & ~PDRMASK; - if (kernel_vm_end - 1 >= kernel_map->max_offset) { - kernel_vm_end = kernel_map->max_offset; + if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { + kernel_vm_end = vm_map_max(kernel_map); break; } } Modified: stable/11/sys/arm/arm/pmap-v6.c ============================================================================== --- stable/11/sys/arm/arm/pmap-v6.c Wed Sep 5 21:24:26 2018 (r338483) +++ stable/11/sys/arm/arm/pmap-v6.c Wed Sep 5 21:28:33 2018 (r338484) @@ -2021,21 +2021,21 @@ pmap_growkernel(vm_offset_t addr) * not called, it could be first unused KVA (which is not * rounded up to PTE1_SIZE), * - * (2) when all KVA space is mapped and kernel_map->max_offset + * (2) when all KVA space is mapped and vm_map_max(kernel_map) * address is not rounded up to PTE1_SIZE. (For example, * it could be 0xFFFFFFFF.) */ kernel_vm_end = pte1_roundup(kernel_vm_end); mtx_assert(&kernel_map->system_mtx, MA_OWNED); addr = roundup2(addr, PTE1_SIZE); - if (addr - 1 >= kernel_map->max_offset) - addr = kernel_map->max_offset; + if (addr - 1 >= vm_map_max(kernel_map)) + addr = vm_map_max(kernel_map); while (kernel_vm_end < addr) { pte1 = pte1_load(kern_pte1(kernel_vm_end)); if (pte1_is_valid(pte1)) { kernel_vm_end += PTE1_SIZE; - if (kernel_vm_end - 1 >= kernel_map->max_offset) { - kernel_vm_end = kernel_map->max_offset; + if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { + kernel_vm_end = vm_map_max(kernel_map); break; } continue; @@ -2077,8 +2077,8 @@ pmap_growkernel(vm_offset_t addr) pmap_kenter_pte1(kernel_vm_end, PTE1_LINK(pt2_pa)); kernel_vm_end = kernel_vm_end_new; - if (kernel_vm_end - 1 >= kernel_map->max_offset) { - kernel_vm_end = kernel_map->max_offset; + if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { + kernel_vm_end = vm_map_max(kernel_map); break; } } Modified: stable/11/sys/arm64/arm64/pmap.c ============================================================================== --- stable/11/sys/arm64/arm64/pmap.c Wed Sep 5 21:24:26 2018 (r338483) +++ stable/11/sys/arm64/arm64/pmap.c Wed Sep 5 21:28:33 2018 (r338484) @@ -1734,8 +1734,8 @@ pmap_growkernel(vm_offset_t addr) mtx_assert(&kernel_map->system_mtx, MA_OWNED); addr = roundup2(addr, L2_SIZE); - if (addr - 1 >= kernel_map->max_offset) - addr = kernel_map->max_offset; + if (addr - 1 >= vm_map_max(kernel_map)) + addr = vm_map_max(kernel_map); while (kernel_vm_end < addr) { l0 = pmap_l0(kernel_pmap, kernel_vm_end); KASSERT(pmap_load(l0) != 0, @@ -1759,8 +1759,8 @@ pmap_growkernel(vm_offset_t addr) l2 = pmap_l1_to_l2(l1, kernel_vm_end); if ((pmap_load(l2) & ATTR_AF) != 0) { kernel_vm_end = (kernel_vm_end + L2_SIZE) & ~L2_OFFSET; - if (kernel_vm_end - 1 >= kernel_map->max_offset) { - kernel_vm_end = kernel_map->max_offset; + if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { + kernel_vm_end = vm_map_max(kernel_map); break; } continue; @@ -1779,8 +1779,8 @@ pmap_growkernel(vm_offset_t addr) pmap_invalidate_page(kernel_pmap, kernel_vm_end); kernel_vm_end = (kernel_vm_end + L2_SIZE) & ~L2_OFFSET; - if (kernel_vm_end - 1 >= kernel_map->max_offset) { - kernel_vm_end = kernel_map->max_offset; + if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { + kernel_vm_end = vm_map_max(kernel_map); break; } } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Wed Sep 5 21:24:26 2018 (r338483) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Wed Sep 5 21:28:33 2018 (r338484) @@ -104,13 +104,6 @@ extern "C" { #include #include #include -/* There is clash. vm_map.h defines the two below and vdev_cache.c use them. */ -#ifdef min_offset -#undef min_offset -#endif -#ifdef max_offset -#undef max_offset -#endif #include #include Modified: stable/11/sys/i386/i386/pmap.c ============================================================================== --- stable/11/sys/i386/i386/pmap.c Wed Sep 5 21:24:26 2018 (r338483) +++ stable/11/sys/i386/i386/pmap.c Wed Sep 5 21:28:33 2018 (r338484) @@ -2107,13 +2107,13 @@ pmap_growkernel(vm_offset_t addr) mtx_assert(&kernel_map->system_mtx, MA_OWNED); addr = roundup2(addr, NBPDR); - if (addr - 1 >= kernel_map->max_offset) - addr = kernel_map->max_offset; + if (addr - 1 >= vm_map_max(kernel_map)) + addr = vm_map_max(kernel_map); while (kernel_vm_end < addr) { if (pdir_pde(PTD, kernel_vm_end)) { kernel_vm_end = (kernel_vm_end + NBPDR) & ~PDRMASK; - if (kernel_vm_end - 1 >= kernel_map->max_offset) { - kernel_vm_end = kernel_map->max_offset; + if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { + kernel_vm_end = vm_map_max(kernel_map); break; } continue; @@ -2135,8 +2135,8 @@ pmap_growkernel(vm_offset_t addr) pmap_kenter_pde(kernel_vm_end, newpdir); kernel_vm_end = (kernel_vm_end + NBPDR) & ~PDRMASK; - if (kernel_vm_end - 1 >= kernel_map->max_offset) { - kernel_vm_end = kernel_map->max_offset; + if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { + kernel_vm_end = vm_map_max(kernel_map); break; } } Modified: stable/11/sys/mips/mips/pmap.c ============================================================================== --- stable/11/sys/mips/mips/pmap.c Wed Sep 5 21:24:26 2018 (r338483) +++ stable/11/sys/mips/mips/pmap.c Wed Sep 5 21:28:33 2018 (r338484) @@ -1249,8 +1249,8 @@ pmap_growkernel(vm_offset_t addr) mtx_assert(&kernel_map->system_mtx, MA_OWNED); req_class = VM_ALLOC_INTERRUPT; addr = roundup2(addr, NBSEG); - if (addr - 1 >= kernel_map->max_offset) - addr = kernel_map->max_offset; + if (addr - 1 >= vm_map_max(kernel_map)) + addr = vm_map_max(kernel_map); while (kernel_vm_end < addr) { pdpe = pmap_segmap(kernel_pmap, kernel_vm_end); #ifdef __mips_n64 @@ -1266,8 +1266,8 @@ pmap_growkernel(vm_offset_t addr) pde = pmap_pdpe_to_pde(pdpe, kernel_vm_end); if (*pde != 0) { kernel_vm_end = (kernel_vm_end + NBPDR) & ~PDRMASK; - if (kernel_vm_end - 1 >= kernel_map->max_offset) { - kernel_vm_end = kernel_map->max_offset; + if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { + kernel_vm_end = vm_map_max(kernel_map); break; } continue; @@ -1299,8 +1299,8 @@ pmap_growkernel(vm_offset_t addr) pte[i] = PTE_G; kernel_vm_end = (kernel_vm_end + NBPDR) & ~PDRMASK; - if (kernel_vm_end - 1 >= kernel_map->max_offset) { - kernel_vm_end = kernel_map->max_offset; + if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { + kernel_vm_end = vm_map_max(kernel_map); break; } } Modified: stable/11/sys/riscv/riscv/pmap.c ============================================================================== --- stable/11/sys/riscv/riscv/pmap.c Wed Sep 5 21:24:26 2018 (r338483) +++ stable/11/sys/riscv/riscv/pmap.c Wed Sep 5 21:28:33 2018 (r338484) @@ -1412,8 +1412,8 @@ pmap_growkernel(vm_offset_t addr) mtx_assert(&kernel_map->system_mtx, MA_OWNED); addr = roundup2(addr, L2_SIZE); - if (addr - 1 >= kernel_map->max_offset) - addr = kernel_map->max_offset; + if (addr - 1 >= vm_map_max(kernel_map)) + addr = vm_map_max(kernel_map); while (kernel_vm_end < addr) { l1 = pmap_l1(kernel_pmap, kernel_vm_end); if (pmap_load(l1) == 0) { @@ -1440,8 +1440,8 @@ pmap_growkernel(vm_offset_t addr) l2 = pmap_l1_to_l2(l1, kernel_vm_end); if ((pmap_load(l2) & PTE_REF) != 0) { kernel_vm_end = (kernel_vm_end + L2_SIZE) & ~L2_OFFSET; - if (kernel_vm_end - 1 >= kernel_map->max_offset) { - kernel_vm_end = kernel_map->max_offset; + if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { + kernel_vm_end = vm_map_max(kernel_map); break; } continue; @@ -1465,8 +1465,8 @@ pmap_growkernel(vm_offset_t addr) pmap_invalidate_page(kernel_pmap, kernel_vm_end); kernel_vm_end = (kernel_vm_end + L2_SIZE) & ~L2_OFFSET; - if (kernel_vm_end - 1 >= kernel_map->max_offset) { - kernel_vm_end = kernel_map->max_offset; + if (kernel_vm_end - 1 >= vm_map_max(kernel_map)) { + kernel_vm_end = vm_map_max(kernel_map); break; } } Modified: stable/11/sys/vm/vm_glue.c ============================================================================== --- stable/11/sys/vm/vm_glue.c Wed Sep 5 21:24:26 2018 (r338483) +++ stable/11/sys/vm/vm_glue.c Wed Sep 5 21:28:33 2018 (r338484) @@ -122,7 +122,7 @@ kernacc(addr, len, rw) KASSERT((rw & ~VM_PROT_ALL) == 0, ("illegal ``rw'' argument to kernacc (%x)\n", rw)); - if ((vm_offset_t)addr + len > kernel_map->max_offset || + if ((vm_offset_t)addr + len > vm_map_max(kernel_map) || (vm_offset_t)addr + len < (vm_offset_t)addr) return (FALSE); Modified: stable/11/sys/vm/vm_init.c ============================================================================== --- stable/11/sys/vm/vm_init.c Wed Sep 5 21:24:26 2018 (r338483) +++ stable/11/sys/vm/vm_init.c Wed Sep 5 21:28:33 2018 (r338484) @@ -192,8 +192,8 @@ again: * Discount the physical memory larger than the size of kernel_map * to avoid eating up all of KVA space. */ - physmem_est = lmin(physmem, btoc(kernel_map->max_offset - - kernel_map->min_offset)); + physmem_est = lmin(physmem, btoc(vm_map_max(kernel_map) - + vm_map_min(kernel_map))); v = kern_vfs_bio_buffer_alloc(v, physmem_est); Modified: stable/11/sys/vm/vm_map.c ============================================================================== --- stable/11/sys/vm/vm_map.c Wed Sep 5 21:24:26 2018 (r338483) +++ stable/11/sys/vm/vm_map.c Wed Sep 5 21:28:33 2018 (r338484) @@ -334,8 +334,8 @@ vmspace_dofree(struct vmspace *vm) * Delete all of the mappings and pages they hold, then call * the pmap module to reclaim anything left. */ - (void)vm_map_remove(&vm->vm_map, vm->vm_map.min_offset, - vm->vm_map.max_offset); + (void)vm_map_remove(&vm->vm_map, vm_map_min(&vm->vm_map), + vm_map_max(&vm->vm_map)); pmap_release(vmspace_pmap(vm)); vm->vm_map.pmap = NULL; @@ -794,8 +794,8 @@ _vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t mi map->needs_wakeup = FALSE; map->system_map = 0; map->pmap = pmap; - map->min_offset = min; - map->max_offset = max; + map->header.end = min; + map->header.start = max; map->flags = 0; map->root = NULL; map->timestamp = 0; @@ -1193,7 +1193,8 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof /* * Check that the start and end points are not bogus. */ - if (start < map->min_offset || end > map->max_offset || start >= end) + if (start < vm_map_min(map) || end > vm_map_max(map) || + start >= end) return (KERN_INVALID_ADDRESS); /* @@ -1393,9 +1394,8 @@ vm_map_findspace(vm_map_t map, vm_offset_t start, vm_s * Request must fit within min/max VM address and must avoid * address wrap. */ - if (start < map->min_offset) - start = map->min_offset; - if (start + length > map->max_offset || start + length < start) + start = MAX(start, vm_map_min(map)); + if (start + length > vm_map_max(map) || start + length < start) return (1); /* Empty tree means wide open address space. */ @@ -3367,7 +3367,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c old_map = &vm1->vm_map; /* Copy immutable fields of vm1 to vm2. */ - vm2 = vmspace_alloc(old_map->min_offset, old_map->max_offset, NULL); + vm2 = vmspace_alloc(vm_map_min(old_map), vm_map_max(old_map), NULL); if (vm2 == NULL) return (NULL); vm2->vm_taddr = vm1->vm_taddr; @@ -4267,14 +4267,14 @@ vm_offset_t vm_map_max_KBI(const struct vm_map *map) { - return (map->max_offset); + return (vm_map_max(map)); } vm_offset_t vm_map_min_KBI(const struct vm_map *map) { - return (map->min_offset); + return (vm_map_min(map)); } pmap_t Modified: stable/11/sys/vm/vm_map.h ============================================================================== --- stable/11/sys/vm/vm_map.h Wed Sep 5 21:24:26 2018 (r338483) +++ stable/11/sys/vm/vm_map.h Wed Sep 5 21:28:33 2018 (r338484) @@ -172,19 +172,26 @@ 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. The list - * header has max start value and min end value to act as - * sentinels for sequential search of the doubly-linked list. + * end addresses contained within each map entry. + * + * Counterintuitively, the map's min offset value is stored in + * map->header.end, and its max offset value is stored in + * map->header.start. + * + * 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 + * 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) */ +/* + map min_offset header.end (c) + map max_offset header.start (c) +*/ struct sx lock; /* Lock for map data */ struct mtx system_mtx; int nentries; /* Number of entries */ @@ -213,13 +220,15 @@ struct vm_map { static __inline vm_offset_t vm_map_max(const struct vm_map *map) { - return (map->max_offset); + + return (map->header.start); } static __inline vm_offset_t vm_map_min(const struct vm_map *map) { - return (map->min_offset); + + return (map->header.end); } static __inline pmap_t From owner-svn-src-all@freebsd.org Wed Sep 5 21:39:26 2018 Return-Path: Delivered-To: svn-src-all@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 AD448FFDF35; Wed, 5 Sep 2018 21:39:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C08174BAC; Wed, 5 Sep 2018 21:39:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 54DF510AFD2; Wed, 5 Sep 2018 17:39:25 -0400 (EDT) Subject: Re: svn commit: r338478 - in head: contrib/elftoolchain/elfcopy contrib/elftoolchain/libelf sys/sys From: John Baldwin To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201809052051.w85KpsCl064064@repo.freebsd.org> Message-ID: <147ea5a2-9652-b08e-5744-df748e3fea8d@FreeBSD.org> Date: Wed, 5 Sep 2018 14:39:24 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <201809052051.w85KpsCl064064@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 05 Sep 2018 17:39:25 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 21:39:26 -0000 On 9/5/18 1:51 PM, John Baldwin wrote: > Author: jhb > Date: Wed Sep 5 20:51:53 2018 > New Revision: 338478 > URL: https://svnweb.freebsd.org/changeset/base/338478 > > Log: > Fix objcopy for little-endian MIPS64 objects. Bah, I forgot to include the hunk to add the new file to libelf's Makefile in the diff I sent to re@ and the diff I committed. I have the fix waiting for re@ approval, but in the meantime: Index: lib/libelf/Makefile =================================================================== --- lib/libelf/Makefile (revision 338478) +++ lib/libelf/Makefile (working copy) @@ -43,6 +43,7 @@ gelf_ehdr.c \ gelf_getclass.c \ gelf_fsize.c \ + gelf_mips64el.c \ gelf_move.c \ gelf_phdr.c \ gelf_rel.c \ -- John Baldwin                                                                              From owner-svn-src-all@freebsd.org Wed Sep 5 21:47:23 2018 Return-Path: Delivered-To: svn-src-all@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 5083CFFE20A; Wed, 5 Sep 2018 21:47:23 +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 F1127750AB; Wed, 5 Sep 2018 21:47:22 +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 E205E2B6D5; Wed, 5 Sep 2018 21:47:22 +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 w85LlM0o090161; Wed, 5 Sep 2018 21:47:22 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85LlMf8090160; Wed, 5 Sep 2018 21:47:22 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201809052147.w85LlMf8090160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 5 Sep 2018 21:47:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338485 - head/lib/libelf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/libelf X-SVN-Commit-Revision: 338485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 21:47:23 -0000 Author: jhb Date: Wed Sep 5 21:47:22 2018 New Revision: 338485 URL: https://svnweb.freebsd.org/changeset/base/338485 Log: Add gelf_mips64el.c to the list of files to include in libelf. Missed in r338478. Pointy hat to: jhb Approved by: re (rgrimes) MFC after: 1 month Modified: head/lib/libelf/Makefile Modified: head/lib/libelf/Makefile ============================================================================== --- head/lib/libelf/Makefile Wed Sep 5 21:28:33 2018 (r338484) +++ head/lib/libelf/Makefile Wed Sep 5 21:47:22 2018 (r338485) @@ -43,6 +43,7 @@ SRCS= elf.c \ gelf_ehdr.c \ gelf_getclass.c \ gelf_fsize.c \ + gelf_mips64el.c \ gelf_move.c \ gelf_phdr.c \ gelf_rel.c \ From owner-svn-src-all@freebsd.org Wed Sep 5 23:23:18 2018 Return-Path: Delivered-To: svn-src-all@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 A4012FCCF51; Wed, 5 Sep 2018 23:23:18 +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 486AB7841E; Wed, 5 Sep 2018 23:23:18 +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 3DC7E2C6D7; Wed, 5 Sep 2018 23:23:18 +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 w85NNIBU044134; Wed, 5 Sep 2018 23:23:18 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w85NNGMZ044128; Wed, 5 Sep 2018 23:23:16 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201809052323.w85NNGMZ044128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 5 Sep 2018 23:23:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338486 - in head/libexec/rtld-elf: . aarch64 arm mips powerpc powerpc64 riscv X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/libexec/rtld-elf: . aarch64 arm mips powerpc powerpc64 riscv X-SVN-Commit-Revision: 338486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 23:23:18 -0000 Author: brooks Date: Wed Sep 5 23:23:16 2018 New Revision: 338486 URL: https://svnweb.freebsd.org/changeset/base/338486 Log: Rework rtld's TLS Variant I implementation to match r326794 The above commit fixed handling overaligned TLS segments in libc's TLS Variant I implementation, but rtld provides its own implementation for dynamically-linked executables which lacks these fixes. Thus, port these changes to rtld. This was previously commited as r337978 and reverted in r338149 due to exposing a bug the ARM rtld. This bug was fixed in r338317 by mmel. Submitted by: James Clarke Approved by: re (kib) Reviewed by: kbowling Testing by: kbowling (powerpc64), br (riscv), kevans (armv7) Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16510 Modified: head/libexec/rtld-elf/aarch64/rtld_machdep.h head/libexec/rtld-elf/arm/rtld_machdep.h head/libexec/rtld-elf/mips/rtld_machdep.h head/libexec/rtld-elf/powerpc/rtld_machdep.h head/libexec/rtld-elf/powerpc64/rtld_machdep.h head/libexec/rtld-elf/riscv/rtld_machdep.h head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/aarch64/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/aarch64/rtld_machdep.h Wed Sep 5 21:47:22 2018 (r338485) +++ head/libexec/rtld-elf/aarch64/rtld_machdep.h Wed Sep 5 23:23:16 2018 (r338486) @@ -69,6 +69,8 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr targe #define calculate_tls_offset(prev_offset, prev_size, size, align) \ round(prev_offset + prev_size, align) #define calculate_tls_end(off, size) ((off) + (size)) +#define calculate_tls_post_size(align) \ + round(TLS_TCB_SIZE, align) - TLS_TCB_SIZE #define TLS_TCB_SIZE 16 typedef struct { Modified: head/libexec/rtld-elf/arm/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/arm/rtld_machdep.h Wed Sep 5 21:47:22 2018 (r338485) +++ head/libexec/rtld-elf/arm/rtld_machdep.h Wed Sep 5 23:23:16 2018 (r338486) @@ -69,6 +69,8 @@ typedef struct { #define calculate_tls_offset(prev_offset, prev_size, size, align) \ round(prev_offset + prev_size, align) #define calculate_tls_end(off, size) ((off) + (size)) +#define calculate_tls_post_size(align) \ + round(TLS_TCB_SIZE, align) - TLS_TCB_SIZE extern void *__tls_get_addr(tls_index *ti); Modified: head/libexec/rtld-elf/mips/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/mips/rtld_machdep.h Wed Sep 5 21:47:22 2018 (r338485) +++ head/libexec/rtld-elf/mips/rtld_machdep.h Wed Sep 5 23:23:16 2018 (r338486) @@ -64,10 +64,11 @@ typedef struct { #define round(size, align) \ (((size) + (align) - 1) & ~((align) - 1)) #define calculate_first_tls_offset(size, align) \ - round(TLS_TCB_SIZE, align) + TLS_TCB_SIZE #define calculate_tls_offset(prev_offset, prev_size, size, align) \ round(prev_offset + prev_size, align) #define calculate_tls_end(off, size) ((off) + (size)) +#define calculate_tls_post_size(align) 0 extern void *__tls_get_addr(tls_index *ti); Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/powerpc/rtld_machdep.h Wed Sep 5 21:47:22 2018 (r338485) +++ head/libexec/rtld-elf/powerpc/rtld_machdep.h Wed Sep 5 23:23:16 2018 (r338486) @@ -74,10 +74,11 @@ void _rtld_powerpc_pltcall(void); #define round(size, align) \ (((size) + (align) - 1) & ~((align) - 1)) #define calculate_first_tls_offset(size, align) \ - round(8, align) + TLS_TCB_SIZE #define calculate_tls_offset(prev_offset, prev_size, size, align) \ round(prev_offset + prev_size, align) #define calculate_tls_end(off, size) ((off) + (size)) +#define calculate_tls_post_size(align) 0 typedef struct { unsigned long ti_module; Modified: head/libexec/rtld-elf/powerpc64/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/powerpc64/rtld_machdep.h Wed Sep 5 21:47:22 2018 (r338485) +++ head/libexec/rtld-elf/powerpc64/rtld_machdep.h Wed Sep 5 23:23:16 2018 (r338486) @@ -66,10 +66,11 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr targe #define round(size, align) \ (((size) + (align) - 1) & ~((align) - 1)) #define calculate_first_tls_offset(size, align) \ - round(16, align) + TLS_TCB_SIZE #define calculate_tls_offset(prev_offset, prev_size, size, align) \ round(prev_offset + prev_size, align) #define calculate_tls_end(off, size) ((off) + (size)) +#define calculate_tls_post_size(align) 0 typedef struct { unsigned long ti_module; Modified: head/libexec/rtld-elf/riscv/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/riscv/rtld_machdep.h Wed Sep 5 21:47:22 2018 (r338485) +++ head/libexec/rtld-elf/riscv/rtld_machdep.h Wed Sep 5 23:23:16 2018 (r338486) @@ -89,10 +89,11 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr targe #define round(size, align) \ (((size) + (align) - 1) & ~((align) - 1)) #define calculate_first_tls_offset(size, align) \ - round(16, align) + TLS_TCB_SIZE #define calculate_tls_offset(prev_offset, prev_size, size, align) \ round(prev_offset + prev_size, align) #define calculate_tls_end(off, size) ((off) + (size)) +#define calculate_tls_post_size(align) 0 typedef struct { unsigned long ti_module; Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Wed Sep 5 21:47:22 2018 (r338485) +++ head/libexec/rtld-elf/rtld.c Wed Sep 5 23:23:16 2018 (r338486) @@ -4693,47 +4693,87 @@ tls_get_addr_common(Elf_Addr **dtvp, int index, size_t defined(__powerpc__) || defined(__riscv) /* + * Return pointer to allocated TLS block + */ +static void * +get_tls_block_ptr(void *tcb, size_t tcbsize) +{ + size_t extra_size, post_size, pre_size, tls_block_size; + size_t tls_init_align; + + tls_init_align = MAX(obj_main->tlsalign, 1); + + /* Compute fragments sizes. */ + extra_size = tcbsize - TLS_TCB_SIZE; + post_size = calculate_tls_post_size(tls_init_align); + tls_block_size = tcbsize + post_size; + pre_size = roundup2(tls_block_size, tls_init_align) - tls_block_size; + + return ((char *)tcb - pre_size - extra_size); +} + +/* * Allocate Static TLS using the Variant I method. + * + * For details on the layout, see lib/libc/gen/tls.c. + * + * NB: rtld's tls_static_space variable includes TLS_TCB_SIZE and post_size as + * it is based on tls_last_offset, and TLS offsets here are really TCB + * offsets, whereas libc's tls_static_space is just the executable's static + * TLS segment. */ void * allocate_tls(Obj_Entry *objs, void *oldtcb, size_t tcbsize, size_t tcbalign) { Obj_Entry *obj; - char *tcb; - Elf_Addr **tls; - Elf_Addr *dtv; + char *tls_block; + Elf_Addr *dtv, **tcb; Elf_Addr addr; int i; + size_t extra_size, maxalign, post_size, pre_size, tls_block_size; + size_t tls_init_align; if (oldtcb != NULL && tcbsize == TLS_TCB_SIZE) return (oldtcb); assert(tcbsize >= TLS_TCB_SIZE); - tcb = xcalloc(1, tls_static_space - TLS_TCB_SIZE + tcbsize); - tls = (Elf_Addr **)(tcb + tcbsize - TLS_TCB_SIZE); + maxalign = MAX(tcbalign, tls_static_max_align); + tls_init_align = MAX(obj_main->tlsalign, 1); + /* Compute fragmets sizes. */ + extra_size = tcbsize - TLS_TCB_SIZE; + post_size = calculate_tls_post_size(tls_init_align); + tls_block_size = tcbsize + post_size; + pre_size = roundup2(tls_block_size, tls_init_align) - tls_block_size; + tls_block_size += pre_size + tls_static_space - TLS_TCB_SIZE - post_size; + + /* Allocate whole TLS block */ + tls_block = malloc_aligned(tls_block_size, maxalign); + tcb = (Elf_Addr **)(tls_block + pre_size + extra_size); + if (oldtcb != NULL) { - memcpy(tls, oldtcb, tls_static_space); - free(oldtcb); + memcpy(tls_block, get_tls_block_ptr(oldtcb, tcbsize), + tls_static_space); + free_aligned(get_tls_block_ptr(oldtcb, tcbsize)); /* Adjust the DTV. */ - dtv = tls[0]; + dtv = tcb[0]; for (i = 0; i < dtv[1]; i++) { if (dtv[i+2] >= (Elf_Addr)oldtcb && dtv[i+2] < (Elf_Addr)oldtcb + tls_static_space) { - dtv[i+2] = dtv[i+2] - (Elf_Addr)oldtcb + (Elf_Addr)tls; + dtv[i+2] = dtv[i+2] - (Elf_Addr)oldtcb + (Elf_Addr)tcb; } } } else { dtv = xcalloc(tls_max_index + 2, sizeof(Elf_Addr)); - tls[0] = dtv; + tcb[0] = dtv; dtv[0] = tls_dtv_generation; dtv[1] = tls_max_index; for (obj = globallist_curr(objs); obj != NULL; obj = globallist_next(obj)) { if (obj->tlsoffset > 0) { - addr = (Elf_Addr)tls + obj->tlsoffset; + addr = (Elf_Addr)tcb + obj->tlsoffset; if (obj->tlsinitsize > 0) memcpy((void*) addr, obj->tlsinit, obj->tlsinitsize); if (obj->tlssize > obj->tlsinitsize) @@ -4752,14 +4792,19 @@ free_tls(void *tcb, size_t tcbsize, size_t tcbalign) { Elf_Addr *dtv; Elf_Addr tlsstart, tlsend; - int dtvsize, i; + size_t post_size; + size_t dtvsize, i, tls_init_align; assert(tcbsize >= TLS_TCB_SIZE); + tls_init_align = MAX(obj_main->tlsalign, 1); - tlsstart = (Elf_Addr)tcb + tcbsize - TLS_TCB_SIZE; - tlsend = tlsstart + tls_static_space; + /* Compute fragments sizes. */ + post_size = calculate_tls_post_size(tls_init_align); - dtv = *(Elf_Addr **)tlsstart; + tlsstart = (Elf_Addr)tcb + TLS_TCB_SIZE + post_size; + tlsend = (Elf_Addr)tcb + tls_static_space; + + dtv = *(Elf_Addr **)tcb; dtvsize = dtv[1]; for (i = 0; i < dtvsize; i++) { if (dtv[i+2] && (dtv[i+2] < tlsstart || dtv[i+2] >= tlsend)) { @@ -4767,7 +4812,7 @@ free_tls(void *tcb, size_t tcbsize, size_t tcbalign) } } free(dtv); - free(tcb); + free_aligned(get_tls_block_ptr(tcb, tcbsize)); } #endif From owner-svn-src-all@freebsd.org Thu Sep 6 02:11:00 2018 Return-Path: Delivered-To: svn-src-all@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 7C1A5FE368F; Thu, 6 Sep 2018 02:11:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 30BA080996; Thu, 6 Sep 2018 02:11:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BBD92E343; Thu, 6 Sep 2018 02:11:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w862B0MR031420; Thu, 6 Sep 2018 02:11:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w862AxxL031410; Thu, 6 Sep 2018 02:10:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809060210.w862AxxL031410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 6 Sep 2018 02:10:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338487 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 338487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 02:11:00 -0000 Author: markj Date: Thu Sep 6 02:10:59 2018 New Revision: 338487 URL: https://svnweb.freebsd.org/changeset/base/338487 Log: Rename hardclock_cnt() to hardclock() and remove the old implementation. Also remove some related and unused subroutines. They have long been replaced by variants that handle multiple coalesced events with a single call. No functional change intended. Reviewed by: cem, kib Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D17029 Modified: head/sys/kern/kern_clock.c head/sys/kern/kern_clocksource.c head/sys/sys/systm.h Modified: head/sys/kern/kern_clock.c ============================================================================== --- head/sys/kern/kern_clock.c Wed Sep 5 23:23:16 2018 (r338486) +++ head/sys/kern/kern_clock.c Thu Sep 6 02:10:59 2018 (r338487) @@ -421,85 +421,12 @@ initclocks(void *dummy) #endif } -/* - * Each time the real-time timer fires, this function is called on all CPUs. - * Note that hardclock() calls hardclock_cpu() for the boot CPU, so only - * the other CPUs in the system need to call this function. - */ void -hardclock_cpu(int usermode) +hardclock(int cnt, int usermode) { struct pstats *pstats; struct thread *td = curthread; struct proc *p = td->td_proc; - int flags; - - /* - * Run current process's virtual and profile time, as needed. - */ - pstats = p->p_stats; - flags = 0; - if (usermode && - timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value)) { - PROC_ITIMLOCK(p); - if (itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0) - flags |= TDF_ALRMPEND | TDF_ASTPENDING; - PROC_ITIMUNLOCK(p); - } - if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value)) { - PROC_ITIMLOCK(p); - if (itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0) - flags |= TDF_PROFPEND | TDF_ASTPENDING; - PROC_ITIMUNLOCK(p); - } - thread_lock(td); - td->td_flags |= flags; - thread_unlock(td); - -#ifdef HWPMC_HOOKS - if (PMC_CPU_HAS_SAMPLES(PCPU_GET(cpuid))) - PMC_CALL_HOOK_UNLOCKED(curthread, PMC_FN_DO_SAMPLES, NULL); - if (td->td_intr_frame != NULL) - PMC_SOFT_CALL_TF( , , clock, hard, td->td_intr_frame); -#endif - callout_process(sbinuptime()); - if (__predict_false(DPCPU_GET(epoch_cb_count))) - GROUPTASK_ENQUEUE(DPCPU_PTR(epoch_cb_task)); -} - -/* - * The real-time timer, interrupting hz times per second. - */ -void -hardclock(int usermode, uintfptr_t pc) -{ - - atomic_add_int(&ticks, 1); - hardclock_cpu(usermode); - tc_ticktock(1); - cpu_tick_calibration(); - /* - * If no separate statistics clock is available, run it from here. - * - * XXX: this only works for UP - */ - if (stathz == 0) { - profclock(usermode, pc); - statclock(usermode); - } -#ifdef DEVICE_POLLING - hardclock_device_poll(); /* this is very short and quick */ -#endif /* DEVICE_POLLING */ - if (watchdog_enabled > 0 && --watchdog_ticks <= 0) - watchdog_fire(); -} - -void -hardclock_cnt(int cnt, int usermode) -{ - struct pstats *pstats; - struct thread *td = curthread; - struct proc *p = td->td_proc; int *t = DPCPU_PTR(pcputicks); int flags, global, newticks; int i; @@ -696,15 +623,8 @@ stopprofclock(struct proc *p) * This should be called by all active processors. */ void -statclock(int usermode) +statclock(int cnt, int usermode) { - - statclock_cnt(1, usermode); -} - -void -statclock_cnt(int cnt, int usermode) -{ struct rusage *ru; struct vmspace *vm; struct thread *td; @@ -776,14 +696,7 @@ statclock_cnt(int cnt, int usermode) } void -profclock(int usermode, uintfptr_t pc) -{ - - profclock_cnt(1, usermode, pc); -} - -void -profclock_cnt(int cnt, int usermode, uintfptr_t pc) +profclock(int cnt, int usermode, uintfptr_t pc) { struct thread *td; #ifdef GPROF Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Wed Sep 5 23:23:16 2018 (r338486) +++ head/sys/kern/kern_clocksource.c Thu Sep 6 02:10:59 2018 (r338487) @@ -183,7 +183,7 @@ handleevents(sbintime_t now, int fake) hct = DPCPU_PTR(hardclocktime); *hct = state->nexthard - tick_sbt; if (fake < 2) { - hardclock_cnt(runs, usermode); + hardclock(runs, usermode); done = 1; } } @@ -193,7 +193,7 @@ handleevents(sbintime_t now, int fake) runs++; } if (runs && fake < 2) { - statclock_cnt(runs, usermode); + statclock(runs, usermode); done = 1; } if (profiling) { @@ -203,7 +203,7 @@ handleevents(sbintime_t now, int fake) runs++; } if (runs && !fake) { - profclock_cnt(runs, usermode, TRAPF_PC(frame)); + profclock(runs, usermode, TRAPF_PC(frame)); done = 1; } } else Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Wed Sep 5 23:23:16 2018 (r338486) +++ head/sys/sys/systm.h Thu Sep 6 02:10:59 2018 (r338487) @@ -363,15 +363,11 @@ void realitexpire(void *); int sysbeep(int hertz, int period); -void hardclock(int usermode, uintfptr_t pc); -void hardclock_cnt(int cnt, int usermode); -void hardclock_cpu(int usermode); +void hardclock(int cnt, int usermode); void hardclock_sync(int cpu); void softclock(void *); -void statclock(int usermode); -void statclock_cnt(int cnt, int usermode); -void profclock(int usermode, uintfptr_t pc); -void profclock_cnt(int cnt, int usermode, uintfptr_t pc); +void statclock(int cnt, int usermode); +void profclock(int cnt, int usermode, uintfptr_t pc); int hardclockintr(void); From owner-svn-src-all@freebsd.org Thu Sep 6 11:06:07 2018 Return-Path: Delivered-To: svn-src-all@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 BC83EFF7515; Thu, 6 Sep 2018 11:06:07 +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 722B77168B; Thu, 6 Sep 2018 11:06:07 +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 6D1B73EC2; Thu, 6 Sep 2018 11:06:07 +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 w86B67Zj006372; Thu, 6 Sep 2018 11:06:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86B67wx006371; Thu, 6 Sep 2018 11:06:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201809061106.w86B67wx006371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 6 Sep 2018 11:06:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338489 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 338489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 11:06:07 -0000 Author: hselasky Date: Thu Sep 6 11:06:07 2018 New Revision: 338489 URL: https://svnweb.freebsd.org/changeset/base/338489 Log: Maximum number of mbuf frags is off-by-one for worst case scenario in mlx5en(4). Inspecting the PRM no more than 0x3F data segments, DS, of size 16 bytes is allowed. Worst case scenario summary of DS usage: Header is fixed: 2 DS Maximum inlining: 98 => (98 - 2) / 16 = 6 DS Remainder: 0x3F - 2 - 6 = 55 DS (mbuf frags) Previously a value of 56 DS was used and this would work in the normal case because not all inline data area was used up. MFC after: 3 days Approved by: re (marius) Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Thu Sep 6 07:10:49 2018 (r338488) +++ head/sys/dev/mlx5/mlx5_en/en.h Thu Sep 6 11:06:07 2018 (r338489) @@ -123,7 +123,8 @@ #define MLX5E_MAX_TX_MBUF_SIZE 65536 /* bytes */ #define MLX5E_MAX_TX_MBUF_FRAGS \ ((MLX5_SEND_WQE_MAX_WQEBBS * MLX5_SEND_WQEBB_NUM_DS) - \ - (MLX5E_MAX_TX_HEADER / MLX5_SEND_WQE_DS)) /* units */ + (MLX5E_MAX_TX_HEADER / MLX5_SEND_WQE_DS) - \ + 1 /* the maximum value of the DS counter is 0x3F and not 0x40 */) /* units */ #define MLX5E_MAX_TX_INLINE \ (MLX5E_MAX_TX_HEADER - sizeof(struct mlx5e_tx_wqe) + \ sizeof(((struct mlx5e_tx_wqe *)0)->eth.inline_hdr_start)) /* bytes */ From owner-svn-src-all@freebsd.org Thu Sep 6 12:19:37 2018 Return-Path: Delivered-To: svn-src-all@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 3D807FF9A76; Thu, 6 Sep 2018 12:19:37 +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 E62A873CEC; Thu, 6 Sep 2018 12:19:36 +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 E14954A48; Thu, 6 Sep 2018 12:19:36 +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 w86CJa4p041873; Thu, 6 Sep 2018 12:19:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86CJagB041872; Thu, 6 Sep 2018 12:19:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201809061219.w86CJagB041872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 6 Sep 2018 12:19:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338490 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 338490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 12:19:37 -0000 Author: hselasky Date: Thu Sep 6 12:19:36 2018 New Revision: 338490 URL: https://svnweb.freebsd.org/changeset/base/338490 Log: Don't stall transmit queue on drops in mlx5en(4). When a transmitted packet is dropped don't stall the transmit queue. MFC after: 3 days Approved by: re (marius) Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Sep 6 11:06:07 2018 (r338489) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Sep 6 12:19:36 2018 (r338490) @@ -528,13 +528,11 @@ mlx5e_xmit_locked(struct ifnet *ifp, struct mlx5e_sq * /* Process the queue */ while ((next = drbr_peek(ifp, sq->br)) != NULL) { if (mlx5e_sq_xmit(sq, &next) != 0) { - if (next == NULL) { - drbr_advance(ifp, sq->br); - } else { + if (next != NULL) { drbr_putback(ifp, sq->br, next); atomic_store_rel_int(&sq->queue_state, MLX5E_SQ_FULL); + break; } - break; } drbr_advance(ifp, sq->br); } From owner-svn-src-all@freebsd.org Thu Sep 6 12:26:58 2018 Return-Path: Delivered-To: svn-src-all@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 408C1FF9E25; Thu, 6 Sep 2018 12:26:58 +0000 (UTC) (envelope-from slavash@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 E84CF7497C; Thu, 6 Sep 2018 12:26:57 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E31114FF2; Thu, 6 Sep 2018 12:26:57 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86CQvV8046898; Thu, 6 Sep 2018 12:26:57 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86CQvBn046897; Thu, 6 Sep 2018 12:26:57 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201809061226.w86CQvBn046897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Thu, 6 Sep 2018 12:26:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338491 - head/sys/ofed/include/rdma X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/include/rdma X-SVN-Commit-Revision: 338491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 12:26:58 -0000 Author: slavash Date: Thu Sep 6 12:26:57 2018 New Revision: 338491 URL: https://svnweb.freebsd.org/changeset/base/338491 Log: ibcore: Fix endless loop in searching for matching VLAN device In r337943 ifnet's if_pcp was set to the PCP value in use instead of IFNET_PCP_NONE. Current ibcore code assumes that if_pcp is IFNET_PCP_NONE with VLAN interfaces so it can identify prio-tagged traffic. Fix that by explicitly verifying that that the if_type is IFT_ETHER and not IFT_L2VLAN. MFC after: 3 days Approved by: re (Marius), hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: head/sys/ofed/include/rdma/ib_addr.h Modified: head/sys/ofed/include/rdma/ib_addr.h ============================================================================== --- head/sys/ofed/include/rdma/ib_addr.h Thu Sep 6 12:19:36 2018 (r338490) +++ head/sys/ofed/include/rdma/ib_addr.h Thu Sep 6 12:26:57 2018 (r338491) @@ -167,7 +167,7 @@ static inline u16 rdma_vlan_dev_vlan_id(const struct n { uint16_t tag; - if (dev->if_pcp != IFNET_PCP_NONE) + if (dev->if_type == IFT_ETHER && dev->if_pcp != IFNET_PCP_NONE) return 0x0000; /* prio-tagged traffic */ if (VLAN_TAG(__DECONST(struct ifnet *, dev), &tag) != 0) return 0xffff; @@ -350,7 +350,7 @@ static inline u16 rdma_get_vlan_id(union ib_gid *dgid) static inline struct net_device *rdma_vlan_dev_real_dev(struct net_device *dev) { - if (dev->if_pcp != IFNET_PCP_NONE) + if (dev->if_type == IFT_ETHER && dev->if_pcp != IFNET_PCP_NONE) return dev; /* prio-tagged traffic */ return VLAN_TRUNKDEV(__DECONST(struct ifnet *, dev)); } From owner-svn-src-all@freebsd.org Thu Sep 6 12:28:07 2018 Return-Path: Delivered-To: svn-src-all@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 3ED9CFF9EB7; Thu, 6 Sep 2018 12:28:07 +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 E973A74AF2; Thu, 6 Sep 2018 12:28:06 +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 E43C14FF4; Thu, 6 Sep 2018 12:28:06 +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 w86CS6PK047001; Thu, 6 Sep 2018 12:28:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86CS6Bo046998; Thu, 6 Sep 2018 12:28:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201809061228.w86CS6Bo046998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 6 Sep 2018 12:28:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338492 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 338492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 12:28:07 -0000 Author: hselasky Date: Thu Sep 6 12:28:06 2018 New Revision: 338492 URL: https://svnweb.freebsd.org/changeset/base/338492 Log: Add support for receive side scaling stride, RSSS, in mlx5en(4). The receive side scaling stride parameter is a value which define the interval between active receive side queues. The traffic for the inactive queues is redirected to the nearest active queue by use of modulus. The default value of this parameter is one, which means all receive side queues are used. The point of this feature is to redirect more traffic to fewer receive side queues in order to take more advantage of sorted large receive offload, sorted LRO. The sorted LRO works better when more packets are accumulated per service interval. MFC after: 3 days Approved by: re (marius) Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Thu Sep 6 12:26:57 2018 (r338491) +++ head/sys/dev/mlx5/mlx5_en/en.h Thu Sep 6 12:28:06 2018 (r338492) @@ -454,6 +454,7 @@ struct mlx5e_params { u32 rx_priority_flow_control __aligned(4); u16 tx_max_inline; u8 tx_min_inline_mode; + u8 channels_rsss; }; #define MLX5E_PARAMS(m) \ @@ -462,6 +463,7 @@ struct mlx5e_params { m(+1, u64 tx_queue_size, "tx_queue_size", "Default send queue size") \ m(+1, u64 rx_queue_size, "rx_queue_size", "Default receive queue size") \ m(+1, u64 channels, "channels", "Default number of channels") \ + m(+1, u64 channels_rsss, "channels_rsss", "Default channels receive side scaling stride") \ m(+1, u64 coalesce_usecs_max, "coalesce_usecs_max", "Maximum usecs for joining packets") \ m(+1, u64 coalesce_pkts_max, "coalesce_pkts_max", "Maximum packets to join") \ m(+1, u64 rx_coalesce_usecs, "rx_coalesce_usecs", "Limit in usec for joining rx packets") \ Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Sep 6 12:26:57 2018 (r338491) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Sep 6 12:28:06 2018 (r338492) @@ -493,6 +493,24 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_open_locked(priv->ifp); break; + case MLX5_PARAM_OFFSET(channels_rsss): + /* network interface must be down */ + if (was_opened) + mlx5e_close_locked(priv->ifp); + + /* import number of channels */ + if (priv->params_ethtool.channels_rsss < 1) + priv->params_ethtool.channels_rsss = 1; + else if (priv->params_ethtool.channels_rsss > 128) + priv->params_ethtool.channels_rsss = 128; + + priv->params.channels_rsss = priv->params_ethtool.channels_rsss; + + /* restart network interface, if any */ + if (was_opened) + mlx5e_open_locked(priv->ifp); + break; + case MLX5_PARAM_OFFSET(channels): /* network interface must be down */ if (was_opened) @@ -1041,6 +1059,7 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) priv->params_ethtool.tx_queue_size = 1 << priv->params.log_sq_size; priv->params_ethtool.rx_queue_size = 1 << priv->params.log_rq_size; priv->params_ethtool.channels = priv->params.num_channels; + priv->params_ethtool.channels_rsss = priv->params.channels_rsss; priv->params_ethtool.coalesce_pkts_max = MLX5E_FLD_MAX(cqc, cq_max_count); priv->params_ethtool.coalesce_usecs_max = MLX5E_FLD_MAX(cqc, cq_period); priv->params_ethtool.rx_coalesce_mode = priv->params.rx_cq_moderation_mode; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Sep 6 12:26:57 2018 (r338491) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Sep 6 12:28:06 2018 (r338492) @@ -2204,14 +2204,16 @@ mlx5e_open_rqt(struct mlx5e_priv *priv) MLX5_SET(rqtc, rqtc, rqt_max_size, sz); for (i = 0; i < sz; i++) { - int ix; + int ix = i; #ifdef RSS - ix = rss_get_indirection_to_bucket(i); -#else - ix = i; + ix = rss_get_indirection_to_bucket(ix); #endif /* ensure we don't overflow */ ix %= priv->params.num_channels; + + /* apply receive side scaling stride, if any */ + ix -= ix % (int)priv->params.channels_rsss; + MLX5_SET(rqtc, rqtc, rq_num[i], priv->channel[ix]->rq.rqn); } @@ -3083,6 +3085,7 @@ mlx5e_build_ifp_priv(struct mlx5_core_dev *mdev, priv->mdev = mdev; priv->params.num_channels = num_comp_vectors; + priv->params.channels_rsss = 1; priv->order_base_2_num_channels = order_base_2(num_comp_vectors); priv->queue_mapping_channel_mask = roundup_pow_of_two(num_comp_vectors) - 1; From owner-svn-src-all@freebsd.org Thu Sep 6 12:36:00 2018 Return-Path: Delivered-To: svn-src-all@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 48C59FFA13F; Thu, 6 Sep 2018 12:36:00 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A3BA74FB6; Thu, 6 Sep 2018 12:35:59 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wm0-x241.google.com with SMTP id y2-v6so11258390wma.1; Thu, 06 Sep 2018 05:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:subject:to:cc:references:openpgp:autocrypt:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9ARrNELqBOw6vrtopnpFNjJ3wfIs0mfRUgKC5fBDfW8=; b=oDZUihcUbt/rjK792gH7SkaZMOFdKR4Lb6zD1elxplF+MfdV+ioO8iTRQ75/y3OiHK 1nczrafGOUwIDAKK5XGq1YS2prUEUH6HxTYH5t75qUHVkN/JlAeomUzGJgYmIDOq27QX Sv7e2n2rvFRL1AcsddyEEgMEmQ3rTuIf6X01Vnf0rh9FLmsEAbzAbXzUHDA+eIZrWahU 9QCdw0U+3yRiOv0sUOl8LZfXxboIY2IRh1GRzS/BWWTXr41uw2Glqk2gWCoGv/ez0Sdt SldtWukRfbPJ+R3xmp1prbnzOm3qB9TanBz9XO6itFn9XLYk9jAGoMg8BTib2mYGr4Jn S1eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:subject:to:cc:references:openpgp :autocrypt:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=9ARrNELqBOw6vrtopnpFNjJ3wfIs0mfRUgKC5fBDfW8=; b=rHC0iu0uGfT2VlFku8kV2tJynHuzFiZ46CFRW4pV1LwzmAHUUQg1lAqhESYRLgYDo5 p5hRo6jv7hwOOdCTs+PGxwc8bsA/32ZGwjydcta1k6koah2mjSZj66vQWyy0rloRITUi EeNMrCECjUhcp/pj3le2h0jACdQv09GkBz1qxPoWn08wev2upbaJPGHURiSHFuL0+Z7Y V+3Bmzy5ZO0N/UB+IXt5ps+rfxVT8aDQnaWUP5z3Qf8Tad0NTXpXkruoPlDc47sYxW1U 5avKLfOGa86QmJpwg9Qpe326TEDZCAeyRLrjHIPU9Wav7Pk82l4TLNI8RgmSykczO91W o0uA== X-Gm-Message-State: APzg51A0mL+oi5GHaFm273vDHc32CQoHQQVtW4cwnTYWCWdLLSpCdT+/ k7skL7nRfVtDe9MZPaQlc5UZ5N1Z X-Google-Smtp-Source: ANB0VdYN/AUBj2hDrIjZP+E7OeItP2uS1pFm3r7dNq7mJBCNn/iQT5kGkpJtFQBu3uGKZ9MDnDEjgA== X-Received: by 2002:a1c:85cb:: with SMTP id h194-v6mr2176522wmd.54.1536237358314; Thu, 06 Sep 2018 05:35:58 -0700 (PDT) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id f6-v6sm5819654wrr.68.2018.09.06.05.35.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 05:35:57 -0700 (PDT) From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r324815 - in head: lib/libc/gen sys/sys To: Ian Lepore , Jan Beich Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201710211206.v9LC6INJ032680@repo.freebsd.org> <5zzo-vvbu-wny@FreeBSD.org> <1535906683.9486.20.camel@freebsd.org> Openpgp: preference=signencrypt Autocrypt: addr=mmel@freebsd.org; prefer-encrypt=mutual; keydata= xsBNBFYuVRkBCADZiwLCCne3wG9b9k+R2Neo5zVo2bLaZRfNNY/v9kg283i0sb1Da4EdEiNT 15El5UyozhphUIbIR/zrVpxF1TvvFdoCyzx6a68bNY2d9dBrDcNDZC+XnyDdHQoobN87DWT1 mRVkmbg9LHZ/SVUOkGYuWyE+8UYeDAcUizuXwSK5zFWmeTyIoWNa68ifrWLfQe0p4x5jC/AI VURCi17p360vU4fhgwoMvEEhrRBWCr4DYHToFjIt2WdBy3GR1qoO0+Xkd6G+OoBULo+XDfgu L2WdPvh0K69F9/LgHkMmG5Il7SCe62QGpG2vaCgRV7BQhLX+kxlvM+WrdRatWRml4Y/3ABEB AAHNIE1pY2hhbCBNZWxvdW4gPG1tZWxAZnJlZWJzZC5vcmc+wsCABBMBCgAqAhsDBQsJCAcD BRUKCQgLBRYDAgEAAh4BAheAAhkBBQJZjBHDBQkHICOqAAoJEGkesmtexaqqIKMIAJ9xTp1w ge86ns2ZYOac5++mAgpFatohSlxYUR3gwud3Y3Ej0eumavpv/C26N6dsLnspwRenKdLbIPKe 0N8lI7CcDBIJGiFyY3c4H79QjIkYpRgbWFyCM85zEyVJpB+U7BhsgXE2uwVjE9RNhEP0KBoj sp357uqq1B1+VUO4GJ+RjdmYSOcNrjR8tTfy02456qovGjJ4JcJBlhyK6GzBKvnZSoA0s+QP OMn3gd8gdomMLEJdS3kTsfhLh2rQPZa9EmzafIyjXrirWq4+4fVFgd8SiMZyyTM+Kz30ZSUe 6SmfaQTQ/WLRIl5jku2uYQWlrRIKT9xaQzRWtZO9UgtXFRHOwE0EVi5VGQEIALqgRkfS21D/ OqWE9mXfh2bIjrp9uC8T0MCuimbsrAdLKNNorGu2nE+rebgX8n5nYM377HOnalPGyOuXvCbQ 8MFVRdWOHxenJjXJialNdBsOf2wLva3vSSVsdoPzibWDIcJqhBOQ3EuhsILyWSPvYYKEiy95 mfhrDtuTTOAYVR9aNQBOENztB2TDJyMx/qZmtGroGV3N0Hqde/znHPtQO8RG5/FQGMfHMI5G FMuycr1ceHnLo/ovrqAl4TYV+UHSHJ+FDE9dt9wXHclWbWbC0yNugchZq6rho5Jjfv4a2v7P pyn3HoDinh1lWP7hYA0ZNExGHekLnXWVqO/lzGS6bMEAEQEAAcLAZQQYAQoADwIbDAUCWYwR wwUJByAjqgAKCRBpHrJrXsWqqrsrB/4g4ESK5TLxUxi8pLWcLPyvwtN4Fmf7VsCVefkhakaG rDPmfvfnG+OFwN60Xqoni7GBeakl01xwT4RINfvVfShDy6cHpLS7QL/M8pzfulVX38MkVkOD yGZhwjE+jyT/kZNA1Olaw3N3IefHq3brskQ7G4d9oPep2DDbw7C4Q76uOBjxy34JVB0WOsB6 NyMQB9h6LGljQtdEddyUqwnRZzzHiGvp0hPtdYQHQZlqbj4FV9lTRK7a8Ega+y7MgmeMiztG zeXyjNP02r3PRHCPagwa57bPxH2aAh4Q7UzBBZ0GTMm7DLKNtCP58WDxblrrhZ+7kHqGK8Fs bdeUpDdEYLVd Message-ID: <9b82bdaa-cc98-f53c-a0c0-d1e36239e947@freebsd.org> Date: Thu, 6 Sep 2018 14:36:00 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1535906683.9486.20.camel@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 12:36:00 -0000 On 02.09.2018 18:44, Ian Lepore wrote: > On Sun, 2018-09-02 at 16:16 +0200, Jan Beich wrote: >> Michal Meloun writes: >> >>> >>> Author: mmel >>> Date: Sat Oct 21 12:06:18 2017 >>> New Revision: 324815 >>> URL: https://svnweb.freebsd.org/changeset/base/324815 >>> >>> Log: >>>   Make elf_aux_info() as public libc function. >>>   - Teach elf aux vector functions about newly added AT_HWCAP and >>> AT_HWCAP2 >>>     vectors. >>>   - Export _elf_aux_info() as new public libc function >>> elf_aux_info(3) >>>    >>>   The elf_aux_info(3) should be considered as FreeBSD counterpart >>> of glibc >>>   getauxval() with more robust interface. >> Can you back it out? I've reported sys/auxv.h breaks existing >> consumers >> and the function is yet to be documented. 12.0-RELEASE is approaching >> but there's no fix in sight, and by the time it lands there maybe >> not enough time to test. >> >> http://docs.freebsd.org/cgi/mid.cgi?03a31eff-34e8-be4c-c008-528824fea >> 261 >> > > Are you seriously suggesting that freebsd is forbidden to add a system > header file of any name it chooses, just because some port's autotools > stuff mistakenly assumes the presence of that name implies something > linux-specific? If the port is broken, fix it. > > -- Ian > Jan, I apologize for the late reply but right now I noticed this thread in my spam folder. I don't know why gmail so classified it :( I agree with Ian, the port should test getauxval() presence, not a header file. Moreover, at this point elf_aux_info () is the only function with which we can implement FreeBSD specific version of the runtime hw feature detection for ARM cpus. So I think revert is the worst option. Do you know how many ports are affected? I only know about libvpx (for which I immediately sent a fix) and (from memory) mono is also affected. But, please remember, with or without the getauxval () emulation, majority of ports will still need a patch. Mainly because the cpu detection code is covered by #ifdef __linux__ and/or the port have hardcoded #AT_ values (we uses different numbers for it) or so. I ready to prepare patch for every single port affected by this problem, simple list of problematic ports is enough. Michal From owner-svn-src-all@freebsd.org Thu Sep 6 12:41:10 2018 Return-Path: Delivered-To: svn-src-all@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 9880AFFA280; Thu, 6 Sep 2018 12:41:10 +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 4E6D275295; Thu, 6 Sep 2018 12:41:10 +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 2F7ED51CB; Thu, 6 Sep 2018 12:41:10 +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 w86CfA8h056755; Thu, 6 Sep 2018 12:41:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86Cf9Ej056754; Thu, 6 Sep 2018 12:41:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201809061241.w86Cf9Ej056754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 6 Sep 2018 12:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338493 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 338493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 12:41:10 -0000 Author: hselasky Date: Thu Sep 6 12:41:09 2018 New Revision: 338493 URL: https://svnweb.freebsd.org/changeset/base/338493 Log: Make the MSIX module parameter limit per device, in mlx5en(4). MFC after: 3 days Approved by: re (marius) Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Thu Sep 6 12:28:06 2018 (r338492) +++ head/sys/dev/mlx5/driver.h Thu Sep 6 12:41:09 2018 (r338493) @@ -682,6 +682,9 @@ struct mlx5_core_dev { struct mlx5_flow_root_namespace *sniffer_tx_root_ns; u32 num_q_counter_allocated[MLX5_INTERFACE_NUMBER]; struct mlx5_dump_data *dump_data; + + struct sysctl_ctx_list sysctl_ctx; + int msix_eqvec; }; enum { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Sep 6 12:28:06 2018 (r338492) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Sep 6 12:41:09 2018 (r338493) @@ -61,10 +61,6 @@ static int prof_sel = MLX5_DEFAULT_PROF; module_param_named(prof_sel, prof_sel, int, 0444); MODULE_PARM_DESC(prof_sel, "profile selector. Valid range 0 - 2"); -static int mlx5_core_msix_eqvec; -module_param_named(msix_eqvec, mlx5_core_msix_eqvec, int, 0644); -MODULE_PARM_DESC(msix_eqvec, "Maximum number of MSIX event queue vectors"); - #define NUMA_NO_NODE -1 static LIST_HEAD(intf_list); @@ -243,7 +239,7 @@ static int mlx5_enable_msix(struct mlx5_core_dev *dev) struct mlx5_priv *priv = &dev->priv; struct mlx5_eq_table *table = &priv->eq_table; int num_eqs = 1 << MLX5_CAP_GEN(dev, log_max_eq); - int limit = mlx5_core_msix_eqvec; + int limit = dev->msix_eqvec; int nvec = MLX5_EQ_VEC_COMP_BASE; int i; @@ -1206,6 +1202,7 @@ static int init_one(struct pci_dev *pdev, { struct mlx5_core_dev *dev; struct mlx5_priv *priv; + device_t bsddev = pdev->dev.bsddev; int err; dev = kzalloc(sizeof(*dev), GFP_KERNEL); @@ -1221,6 +1218,12 @@ static int init_one(struct pci_dev *pdev, dev->pdev = pdev; dev->event = mlx5_core_event; + sysctl_ctx_init(&dev->sysctl_ctx); + SYSCTL_ADD_INT(&dev->sysctl_ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(bsddev)), + OID_AUTO, "msix_eqvec", CTLFLAG_RDTUN, &dev->msix_eqvec, 0, + "Maximum number of MSIX event queue vectors, if set"); + INIT_LIST_HEAD(&priv->ctx_list); spin_lock_init(&priv->ctx_lock); mutex_init(&dev->pci_status_mutex); @@ -1256,6 +1259,7 @@ clean_health: close_pci: mlx5_pci_close(dev, priv); clean_dev: + sysctl_ctx_free(&dev->sysctl_ctx); kfree(dev); return err; } @@ -1276,6 +1280,7 @@ static void remove_one(struct pci_dev *pdev) mlx5_health_cleanup(dev); mlx5_pci_close(dev, priv); pci_set_drvdata(pdev, NULL); + sysctl_ctx_free(&dev->sysctl_ctx); kfree(dev); } From owner-svn-src-all@freebsd.org Thu Sep 6 13:56:56 2018 Return-Path: Delivered-To: svn-src-all@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 56D91FFC060; Thu, 6 Sep 2018 13:56:56 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 116EC78082; Thu, 6 Sep 2018 13:56:56 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 0A2A4E554; Thu, 6 Sep 2018 13:56:56 +0000 (UTC) Date: Thu, 6 Sep 2018 13:56:56 +0000 From: Alexey Dokuchaev To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r337773 - in head/sys/amd64: amd64 include Message-ID: <20180906135656.GA28635@FreeBSD.org> References: <201808141637.w7EGbFpZ087559@repo.freebsd.org> <20180815084503.GA96451@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180815084503.GA96451@FreeBSD.org> User-Agent: Mutt/1.9.5 (2018-04-13) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 13:56:56 -0000 On Wed, Aug 15, 2018 at 08:45:04AM +0000, Alexey Dokuchaev wrote: > On Tue, Aug 14, 2018 at 04:37:15PM +0000, Konstantin Belousov wrote: > > New Revision: 337773 > > URL: https://svnweb.freebsd.org/changeset/base/337773 > > > > Log: > > amd64: ensure that curproc->p_vmspace pmap always matches PCPU > > curpmap. > > > > When performing context switch on a machine without PCID, if current > > %cr3 equals to the new pmap %cr3, which is typical for kernel_pmap > > vs. kernel process, I overlooked to update PCPU curpmap value. Remove > > check for %cr3 not equal to pm_cr3 for doing the update. It is > > believed that this case cannot happen at all, due to other changes in > > this revision. > > ... > > - } else if (cr3 != pmap->pm_cr3) { > > + } else { > > load_cr3(pmap->pm_cr3); > > If this case cannot happen at all, would it make sense to assert it? Did I miss your reply on this one? ./danfe From owner-svn-src-all@freebsd.org Thu Sep 6 14:03:11 2018 Return-Path: Delivered-To: svn-src-all@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 5EF12FFC381; Thu, 6 Sep 2018 14:03:11 +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 0CBF4785AA; Thu, 6 Sep 2018 14:03:11 +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 056F96099; Thu, 6 Sep 2018 14:03:11 +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 w86E3A7g097916; Thu, 6 Sep 2018 14:03:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86E3AUm097915; Thu, 6 Sep 2018 14:03:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201809061403.w86E3AUm097915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 6 Sep 2018 14:03:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338494 - head/sys/cam/ctl X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam/ctl X-SVN-Commit-Revision: 338494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 14:03:11 -0000 Author: mav Date: Thu Sep 6 14:03:10 2018 New Revision: 338494 URL: https://svnweb.freebsd.org/changeset/base/338494 Log: Add missing copyin() to access LUN and port ioctl arguments. Somehow this was working even after PTI in, at least on amd64, and got broken by something only very recently. Reviewed by: araujo Approved by: re (gjb) Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Sep 6 12:41:09 2018 (r338493) +++ head/sys/cam/ctl/ctl.c Thu Sep 6 14:03:10 2018 (r338494) @@ -2943,8 +2943,17 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, } if (lun_req->args != NULL) { - lun_req->args_nvl = nvlist_unpack(lun_req->args, + packed = malloc(lun_req->args_len, M_CTL, M_WAITOK); + if (copyin(lun_req->args, packed, lun_req->args_len) != 0) { + free(packed, M_CTL); + lun_req->status = CTL_LUN_ERROR; + snprintf(lun_req->error_str, sizeof(lun_req->error_str), + "Cannot copyin args."); + break; + } + lun_req->args_nvl = nvlist_unpack(packed, lun_req->args_len, 0); + free(packed, M_CTL); if (lun_req->args_nvl == NULL) { lun_req->status = CTL_LUN_ERROR; @@ -3211,8 +3220,17 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, } if (req->args != NULL) { - req->args_nvl = nvlist_unpack(req->args, + packed = malloc(req->args_len, M_CTL, M_WAITOK); + if (copyin(req->args, packed, req->args_len) != 0) { + free(packed, M_CTL); + req->status = CTL_LUN_ERROR; + snprintf(req->error_str, sizeof(req->error_str), + "Cannot copyin args."); + break; + } + req->args_nvl = nvlist_unpack(packed, req->args_len, 0); + free(packed, M_CTL); if (req->args_nvl == NULL) { req->status = CTL_LUN_ERROR; From owner-svn-src-all@freebsd.org Thu Sep 6 14:03:12 2018 Return-Path: Delivered-To: svn-src-all@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 B676CFFC387; Thu, 6 Sep 2018 14:03:12 +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 6BBEF785AD; Thu, 6 Sep 2018 14:03:12 +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 6626B609A; Thu, 6 Sep 2018 14:03:12 +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 w86E3CNA097960; Thu, 6 Sep 2018 14:03:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86E3CZU097959; Thu, 6 Sep 2018 14:03:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201809061403.w86E3CZU097959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 6 Sep 2018 14:03:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338495 - head/sys/contrib/rdma/krping X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/contrib/rdma/krping X-SVN-Commit-Revision: 338495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 14:03:12 -0000 Author: hselasky Date: Thu Sep 6 14:03:11 2018 New Revision: 338495 URL: https://svnweb.freebsd.org/changeset/base/338495 Log: Add proper support for VIMAGE to krping. Make sure we pass the correct VNET when allocating the RDMA ID. MFC after: 3 days Approved by: re (gjb) Sponsored by: Mellanox Technologies Modified: head/sys/contrib/rdma/krping/krping.c Modified: head/sys/contrib/rdma/krping/krping.c ============================================================================== --- head/sys/contrib/rdma/krping/krping.c Thu Sep 6 14:03:10 2018 (r338494) +++ head/sys/contrib/rdma/krping/krping.c Thu Sep 6 14:03:11 2018 (r338495) @@ -2156,7 +2156,7 @@ int krping_doit(char *cmd) goto out; } - cb->cm_id = rdma_create_id(&init_net, krping_cma_event_handler, cb, RDMA_PS_TCP, IB_QPT_RC); + cb->cm_id = rdma_create_id(TD_TO_VNET(curthread), krping_cma_event_handler, cb, RDMA_PS_TCP, IB_QPT_RC); if (IS_ERR(cb->cm_id)) { ret = PTR_ERR(cb->cm_id); printk(KERN_ERR PFX "rdma_create_id error %d\n", ret); From owner-svn-src-all@freebsd.org Thu Sep 6 14:15:04 2018 Return-Path: Delivered-To: svn-src-all@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 9B8CAFFC91D; Thu, 6 Sep 2018 14:15:04 +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 50740792AE; Thu, 6 Sep 2018 14:15:04 +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 4B38E623A; Thu, 6 Sep 2018 14:15:04 +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 w86EF4KE003657; Thu, 6 Sep 2018 14:15:04 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86EF4Rs003656; Thu, 6 Sep 2018 14:15:04 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809061415.w86EF4Rs003656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 6 Sep 2018 14:15:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338496 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 338496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 14:15:04 -0000 Author: markj Date: Thu Sep 6 14:15:03 2018 New Revision: 338496 URL: https://svnweb.freebsd.org/changeset/base/338496 Log: Define sctp probes only when SCTP is configured. Otherwise the "depends_on provider" guard in sctp.d does not work as intended. Reported by: mjg Reviewed by: tuexen Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D17057 Modified: head/sys/netinet/in_kdtrace.c Modified: head/sys/netinet/in_kdtrace.c ============================================================================== --- head/sys/netinet/in_kdtrace.c Thu Sep 6 14:03:11 2018 (r338495) +++ head/sys/netinet/in_kdtrace.c Thu Sep 6 14:15:03 2018 (r338496) @@ -31,12 +31,16 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_sctp.h" + #include #include #include SDT_PROVIDER_DEFINE(ip); +#ifdef SCTP SDT_PROVIDER_DEFINE(sctp); +#endif SDT_PROVIDER_DEFINE(tcp); SDT_PROVIDER_DEFINE(udp); SDT_PROVIDER_DEFINE(udplite); @@ -57,6 +61,7 @@ SDT_PROBE_DEFINE6_XLATE(ip, , , send, "struct ip *", "ipv4info_t *", "struct ip6_hdr *", "ipv6info_t *"); +#ifdef SCTP SDT_PROBE_DEFINE5_XLATE(sctp, , , receive, "void *", "pktinfo_t *", "struct sctp_tcb *", "csinfo_t *", @@ -78,6 +83,7 @@ SDT_PROBE_DEFINE6_XLATE(sctp, , , state__change, "struct sctp_tcb *", "sctpsinfo_t *", "void *", "void *", "int", "sctplsinfo_t *"); +#endif SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established, "void *", "pktinfo_t *", From owner-svn-src-all@freebsd.org Thu Sep 6 14:55:26 2018 Return-Path: Delivered-To: svn-src-all@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 08170FFD5F3 for ; Thu, 6 Sep 2018 14:55:26 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 607DC7A529 for ; Thu, 6 Sep 2018 14:55:25 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-lf1-x143.google.com with SMTP id v77-v6so9337496lfa.6 for ; Thu, 06 Sep 2018 07:55:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=QdTEWGbchy/mfeoSEEKWWPuej0CvgD7mmzuJ1TvRn/w=; b=HBLVU4P2iJ5+Unlf3s5xqwDKM54WzWj7Q6kA9qdrUouG3cRR8VLs2YnG4QED1JXJRO a7gwbjTrsYgHnIaLfi99VexQ3ZyW35rZafPyW6g1Hm7mtc9MksWDGDVhcIvtMw2bzIzy YlmN9O+CSyuX8x+IB0nFrbM7zhI0h208Mhv/sjYXy3GphwdHI/PH/EtNI1kxy1U+HUol 3D43XYWEAaLNZDuB76mdVZ2XjObvs4CoSQgI39Y0Fo8wODTh3JbM1MBh46aBZ5BW69wo xm7nUk85v3Lta+z56RgVMqECTCg64IXo4zanN0d/pLkGCaOW1HYFhilqVj6a4zvYukuU Qv6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=QdTEWGbchy/mfeoSEEKWWPuej0CvgD7mmzuJ1TvRn/w=; b=fXTaODiCle0how3bEeB8waob00ZbvehhAt5QjLBbEoCWiRUS3L96eRmu0ffuX+DZbs LAsjV9P1CVZyqD1NEYEEtclm0JcuQI+XJ0fzoOa6qahck7g/LxUNgeXQLPZaLuiFXUCj 8GlHbnTm/1AuK+s+wrROXdvybAF4gt7MoXJMezgsVohDNeQO7unWKpHmgF3/rZgQkoZL zut0P7NyMLa3jypD6amFLc8L0QP0wDwb5NTXR2p5QrFqPH1rUfley2El3s4h4YeLxlTX D3zBpeRdqapd5mGyQJdwMafJ8+IIj3IK2awn+wYogbZVxlrzkyAYSQSpVMmTaU793TVV JDsQ== X-Gm-Message-State: APzg51AF+ziYZI33VVDDi61DLLurXqxlDVtEho0CZbL132yy7QZ4TjTY //r5+r0GrHcgEz53vu09WWXkbUWma4Xd9g== X-Google-Smtp-Source: ANB0VdYJKPNhgpJl1XYO7rFJGUEJnwfnt0ZEU8d8Uql4Kf5Pz2kRWoixxy+g7fmDto35cQEnFCVHfg== X-Received: by 2002:a19:18d8:: with SMTP id 85-v6mr2325109lfy.133.1536245723504; Thu, 06 Sep 2018 07:55:23 -0700 (PDT) Received: from mutt-hbsd (tor-exit1.netnik.xyz. [176.31.208.193]) by smtp.gmail.com with ESMTPSA id 84-v6sm861043lje.48.2018.09.06.07.55.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 07:55:22 -0700 (PDT) Date: Thu, 6 Sep 2018 10:54:21 -0400 From: Shawn Webb To: Alexander Motin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r338494 - head/sys/cam/ctl Message-ID: <20180906145421.7mejwhcfezwtsk4k@mutt-hbsd> References: <201809061403.w86E3AUm097915@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mmrwseyezc5r226h" Content-Disposition: inline In-Reply-To: <201809061403.w86E3AUm097915@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hbsd 12.0-ALPHA4 FreeBSD 12.0-ALPHA4 X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: NeoMutt/20180622 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 14:55:26 -0000 --mmrwseyezc5r226h Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 06, 2018 at 02:03:10PM +0000, Alexander Motin wrote: > Author: mav > Date: Thu Sep 6 14:03:10 2018 > New Revision: 338494 > URL: https://svnweb.freebsd.org/changeset/base/338494 >=20 > Log: > Add missing copyin() to access LUN and port ioctl arguments. > =20 > Somehow this was working even after PTI in, at least on amd64, and got > broken by something only very recently. Is anyone investigating why the direct access still worked? Thanks, --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --mmrwseyezc5r226h Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKrq2ve9q9Ia+iT2eaoRlj1JFbu4FAluRP5kACgkQaoRlj1JF bu4WxRAArUu5oRGA77mJ5JvrKRBJ8TPmN7kPhN/ydOnkat+Rde8JouNRg8RmUZ/Q Jb9doAQkEDReMatHuy7fOPYm/x3o3hMqF65tAFcPPK5iZPvc/+yQVOpx+ir4TdZC L5w7U/4z7s4pF4ikAZ16PZLfKibpQtgJWR1Vo/Tj5jfeB0ql8pu3shr0xz+tJb5g qGjTOifZ1NewLz5GkQBV90sldr3xvw5hqRLFc4Gw43mxtlHLgVV31DK1w+gDBuFe IVK9mT0y0wcBjwBVK8lnnP39+3taqTiXdBrrUCx98u4tbqSRkXnroz0rADPAt/Ls jRBg3Mzg8BRb8VeiSNBdT5ZwhPqu4WzPcbHqHT4gsk3fKoH8TJy9v8v915kQ45fo aU2GQVog+2Nay+rbN3LC7Arga/CYrj1bWDHVEccXtNQiEJBeVL6+gHOY7RatK21k Y2E7iPOWwoGLjR2rI39SCbqVELVnIFlTgc8WCyJOFSIqZSM9AU5fDOEH0BW2JpZa FDXqkEARU0h4sbfzQYNNd0V2T2qkIpOVX3BwSiV9Wgc2d/aaGaz9X99Q3Ja76pgD c/uQWkCIrI+/8MyQ2dnHrz5KgbVPUqQyAZPn3Dhy9hUDRG4BG6KaU6MKBKeIMdpj LJpT3bIWZK9oInU7sOPMKFOlgQHneKECksj1qBlPi8/sgyCLUNs= =A2SI -----END PGP SIGNATURE----- --mmrwseyezc5r226h-- From owner-svn-src-all@freebsd.org Thu Sep 6 14:55:55 2018 Return-Path: Delivered-To: svn-src-all@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 3F849FFD634; Thu, 6 Sep 2018 14:55:55 +0000 (UTC) (envelope-from brd@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 E9D327A668; Thu, 6 Sep 2018 14:55:54 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E09B568D7; Thu, 6 Sep 2018 14:55:54 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86EtsTb023869; Thu, 6 Sep 2018 14:55:54 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86Etsr2023866; Thu, 6 Sep 2018 14:55:54 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201809061455.w86Etsr2023866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Thu, 6 Sep 2018 14:55:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338497 - in head: etc usr.sbin/cron/cron X-SVN-Group: head X-SVN-Commit-Author: brd X-SVN-Commit-Paths: in head: etc usr.sbin/cron/cron X-SVN-Commit-Revision: 338497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 14:55:55 -0000 Author: brd Date: Thu Sep 6 14:55:54 2018 New Revision: 338497 URL: https://svnweb.freebsd.org/changeset/base/338497 Log: Move etc/crontab to usr.sbin/cron/cron/ Approved by: re (gjb), will (mentor) Differential Revision: https://reviews.freebsd.org/D16786 Added: head/usr.sbin/cron/cron/crontab - copied unchanged from r338496, head/etc/crontab Deleted: head/etc/crontab Modified: head/etc/Makefile head/usr.sbin/cron/cron/Makefile Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Thu Sep 6 14:15:03 2018 (r338496) +++ head/etc/Makefile Thu Sep 6 14:55:54 2018 (r338497) @@ -12,7 +12,7 @@ UPDATE_DEPENDFILE= no SUBDIR+=sendmail .endif -BIN1= crontab \ +BIN1= \ dhclient.conf \ disktab \ group \ Modified: head/usr.sbin/cron/cron/Makefile ============================================================================== --- head/usr.sbin/cron/cron/Makefile Thu Sep 6 14:15:03 2018 (r338496) +++ head/usr.sbin/cron/cron/Makefile Thu Sep 6 14:55:54 2018 (r338497) @@ -1,5 +1,6 @@ # $FreeBSD$ +CONFS= crontab PROG= cron MAN= cron.8 SRCS= cron.c database.c do_command.c job.c user.c popen.c Copied: head/usr.sbin/cron/cron/crontab (from r338496, head/etc/crontab) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/cron/cron/crontab Thu Sep 6 14:55:54 2018 (r338497, copy of r338496, head/etc/crontab) @@ -0,0 +1,23 @@ +# /etc/crontab - root's crontab for FreeBSD +# +# $FreeBSD$ +# +SHELL=/bin/sh +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin +# +#minute hour mday month wday who command +# +# Save some entropy so that /dev/random can re-seed on boot. +*/11 * * * * operator /usr/libexec/save-entropy +# +# Rotate log files every hour, if necessary. +0 * * * * root newsyslog +# +# Perform daily/weekly/monthly maintenance. +1 3 * * * root periodic daily +15 4 * * 6 root periodic weekly +30 5 1 * * root periodic monthly +# +# Adjust the time zone if the CMOS clock keeps local time, as opposed to +# UTC time. See adjkerntz(8) for details. +1,31 0-5 * * * root adjkerntz -a From owner-svn-src-all@freebsd.org Thu Sep 6 15:24:36 2018 Return-Path: Delivered-To: svn-src-all@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 91F03FFE303; Thu, 6 Sep 2018 15:24:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E68A7BB75; Thu, 6 Sep 2018 15:24:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id C4C8910A87D; Thu, 6 Sep 2018 11:24:34 -0400 (EDT) Subject: Re: svn commit: r338494 - head/sys/cam/ctl To: Shawn Webb , Alexander Motin References: <201809061403.w86E3AUm097915@repo.freebsd.org> <20180906145421.7mejwhcfezwtsk4k@mutt-hbsd> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: John Baldwin Message-ID: <51c27534-8cc2-cd30-dd53-77fd7ad5bdf7@FreeBSD.org> Date: Thu, 6 Sep 2018 08:24:32 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180906145421.7mejwhcfezwtsk4k@mutt-hbsd> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Thu, 06 Sep 2018 11:24:35 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 15:24:36 -0000 On 9/6/18 7:54 AM, Shawn Webb wrote: > On Thu, Sep 06, 2018 at 02:03:10PM +0000, Alexander Motin wrote: >> Author: mav >> Date: Thu Sep 6 14:03:10 2018 >> New Revision: 338494 >> URL: https://svnweb.freebsd.org/changeset/base/338494 >> >> Log: >> Add missing copyin() to access LUN and port ioctl arguments. >> >> Somehow this was working even after PTI in, at least on amd64, and got >> broken by something only very recently. > > Is anyone investigating why the direct access still worked? PTI doesn't disable kernel access to user pages, it only disables translation of kernel virtual addresses while in user mode. The thing that catches this type of access is SMAP (which was only recently enabled on x86). -- John Baldwin                                                                              From owner-svn-src-all@freebsd.org Thu Sep 6 15:26:36 2018 Return-Path: Delivered-To: svn-src-all@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 9B7CCFFE496 for ; Thu, 6 Sep 2018 15:26:36 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1168C7BE39 for ; Thu, 6 Sep 2018 15:26:36 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-wr1-x441.google.com with SMTP id k5-v6so11842201wre.10 for ; Thu, 06 Sep 2018 08:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=P9hFrAmsfTsiALyZGSEcg1DHaSgf383lbVH2v2Qp6xk=; b=gc9fRk7ne7x9em/8N8H59sDvUNWANITjKnAOw3j52pn/NDy752C6cqmSSBCHjYQWKn TYFmpUozmgfygJm9ynaWQCIX+oRlLwakO9A2apw2W8eYiw3ESnjPlk5sZAFH7cbLIHZ9 TW4VPHt7egDDYurTTontCfUBqoB7+woLXsdvgEf5eNm951lp+ArheyerlSpkNe8czy+C 4HBBgBFt9ZAz+ClNh2WTpae6ZYm32RtZNwZi8FXSUjIEJeaVVbdR/AJhlBON0IkScNpr ofcQwqoMVP7Zou426gv3qZLPBJWWMs2vprY6hGnrHdIdxC6Y/Q+tZ/QFlmj0smVhTB6B SFaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=P9hFrAmsfTsiALyZGSEcg1DHaSgf383lbVH2v2Qp6xk=; b=qEwTisbZYZRnRLWGGkxY1t1RUkm9KrncHrrRxjWyxbUw+3FIJHdBFsMrzXAfFrAsdN p1HoOoqS+DUyXQs2v2m3fq2B5fCcX/USLk1afncY9J4DmIV+BDZeInXK0MP63ifnBmPd mOIG5+Ydw85xV9BprP2YX+E1tMmfXaeKQ/dtfr/etDciVIfBhgTxZuxo8XiW1aI+qKVm LBS7MnbAHVwELfuO3Fi8xBCvUtb3UW9Q5Jl0dzmYxOM+H4NKADNV2e1Ufn25m3bOTePy oKmfOIyHKPSUgNhEfcxfpHQ4nsR4pPOaAjWuYutFYEgtDAMqE3PkT6338954qswZWrd3 b1Dw== X-Gm-Message-State: APzg51DJIE+P+cQTYOJTcODzWgp7J/uAodTaTlDgM0fDmsaQ9sR6OaZR BB3BVmn0GR+lz9V6R9U4EOHfTg== X-Google-Smtp-Source: ANB0VdYpsJ7bEjsm9p0PnORPV+q+ReM9AGyCVtOc69aO6mLMBnp0flpJFNhOFgpR2bITWb8VNjxr7A== X-Received: by 2002:adf:9d81:: with SMTP id p1-v6mr2707299wre.12.1536247594855; Thu, 06 Sep 2018 08:26:34 -0700 (PDT) Received: from mutt-hbsd (exit1.ipredator.se. [197.231.221.211]) by smtp.gmail.com with ESMTPSA id d10-v6sm9448610wrv.70.2018.09.06.08.26.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 08:26:34 -0700 (PDT) Date: Thu, 6 Sep 2018 11:25:33 -0400 From: Shawn Webb To: John Baldwin Cc: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r338494 - head/sys/cam/ctl Message-ID: <20180906152533.ygsqei2jgod42ydt@mutt-hbsd> References: <201809061403.w86E3AUm097915@repo.freebsd.org> <20180906145421.7mejwhcfezwtsk4k@mutt-hbsd> <51c27534-8cc2-cd30-dd53-77fd7ad5bdf7@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="snqdvlofjpj57woe" Content-Disposition: inline In-Reply-To: <51c27534-8cc2-cd30-dd53-77fd7ad5bdf7@FreeBSD.org> X-Operating-System: FreeBSD mutt-hbsd 12.0-ALPHA4 FreeBSD 12.0-ALPHA4 X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: NeoMutt/20180622 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 15:26:36 -0000 --snqdvlofjpj57woe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 06, 2018 at 08:24:32AM -0700, John Baldwin wrote: > On 9/6/18 7:54 AM, Shawn Webb wrote: > > On Thu, Sep 06, 2018 at 02:03:10PM +0000, Alexander Motin wrote: > >> Author: mav > >> Date: Thu Sep 6 14:03:10 2018 > >> New Revision: 338494 > >> URL: https://svnweb.freebsd.org/changeset/base/338494 > >> > >> Log: > >> Add missing copyin() to access LUN and port ioctl arguments. > >> =20 > >> Somehow this was working even after PTI in, at least on amd64, and g= ot > >> broken by something only very recently. > >=20 > > Is anyone investigating why the direct access still worked? >=20 > PTI doesn't disable kernel access to user pages, it only disables > translation of kernel virtual addresses while in user mode. The thing th= at > catches this type of access is SMAP (which was only recently enabled on > x86). Whoops. Blonde moment. I blame the lack of caffeine in my body when I wrote the email. Too many acronyms to keep track of when tired. ;) Thanks for the clarification. --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --snqdvlofjpj57woe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKrq2ve9q9Ia+iT2eaoRlj1JFbu4FAluRRugACgkQaoRlj1JF bu7ULA/+I1hk2FVR+dUlyVvrzC27vUO24PZAX/Fh4Iih/whj+PEAkJoPPwBviPGR QVt8Ie+NThM0Su3mcR8RxXopzoB3Bac8g+qo2AeIilfeVDUjOBFuqaSwVYeLbk9t 3Kg0+dxZSSnJ7B/odkMv6WiodDdK8lVpKtgQrrkrXrRLHlbpVJHSdPttrcJbD41G rf7uW9L45k6QK3Q3+Rqk9efD3ifeGSsAPvTe7I3HTROoDc9Oyi9lKQm28C+yfxTN elQG/lu1RUksbIUhZ7x7sNYFnzUhY3VOScZ4tno6rui7RY411DvpB+PXATe2WgRP VdO6dvH6FEqymxF3QX32HrgSZjJdEU1tTyL8D8PpWdliPVcILZg77fxhV/mHLTRz rHBf6vk78MW1znanJDLAPHyN1xrxB9HX/TwnQOLWLIJGHhKkxYZqL8/VP5ZoVpsb kqjLwzBxPo5ibYAGDYlwdebVo4y5P6czmaZBHFqOKKRglrQWiUH8JEkEzaVWldIx AEfoGZzxHyXeur4yqTiwwmVvIxujbwM7vJdpzuBmtkHfoULymy1r+Uxdlvksf4Mw X7kRrfH4C9yBXe8AASfLWRC8HtkTmlfKekNt/vnXjoiGJ/GaMhEetlMyl0UFQSpv PT3vAqvPMlt2RxnuWOutYGslPUssI9fVm/3OLdMo37aHe5wR7FE= =Jfjr -----END PGP SIGNATURE----- --snqdvlofjpj57woe-- From owner-svn-src-all@freebsd.org Thu Sep 6 16:11:24 2018 Return-Path: Delivered-To: svn-src-all@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 C3D4EFFF971; Thu, 6 Sep 2018 16:11:24 +0000 (UTC) (envelope-from bz@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 7A94E7DEFF; Thu, 6 Sep 2018 16:11:24 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 7592F74E8; Thu, 6 Sep 2018 16:11:24 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86GBOuQ062574; Thu, 6 Sep 2018 16:11:24 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86GBOaD062573; Thu, 6 Sep 2018 16:11:24 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201809061611.w86GBOaD062573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 6 Sep 2018 16:11:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338498 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 338498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 16:11:24 -0000 Author: bz Date: Thu Sep 6 16:11:24 2018 New Revision: 338498 URL: https://svnweb.freebsd.org/changeset/base/338498 Log: Make tcp_hpts.c compile a LINT kernel with options RSS and PCBGROUPS added by adding the missing include files and changing a the type of cpuid which would otherwise cause a false comparison with NETISR_CPUID_NONE. Reviewed by: rrs Approved by: re (marius) Differential Revision: https://reviews.freebsd.org/D16891 Modified: head/sys/netinet/tcp_hpts.c Modified: head/sys/netinet/tcp_hpts.c ============================================================================== --- head/sys/netinet/tcp_hpts.c Thu Sep 6 14:55:54 2018 (r338497) +++ head/sys/netinet/tcp_hpts.c Thu Sep 6 16:11:24 2018 (r338498) @@ -167,6 +167,8 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_TCPHPTS, "tcp_hpts", "TCP hpts"); #ifdef RSS +#include +#include static int tcp_bind_threads = 1; #else static int tcp_bind_threads = 0; @@ -1076,7 +1078,7 @@ hpts_random_cpu(struct inpcb *inp){ static uint16_t hpts_cpuid(struct inpcb *inp){ - uint16_t cpuid; + u_int cpuid; /* From owner-svn-src-all@freebsd.org Thu Sep 6 16:17:46 2018 Return-Path: Delivered-To: svn-src-all@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 C292CFFFBD1; Thu, 6 Sep 2018 16:17:46 +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 731E47E2BA; Thu, 6 Sep 2018 16:17:46 +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 6E0D07651; Thu, 6 Sep 2018 16:17:46 +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 w86GHko1065307; Thu, 6 Sep 2018 16:17:46 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86GHjsW065304; Thu, 6 Sep 2018 16:17:45 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809061617.w86GHjsW065304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 6 Sep 2018 16:17:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338499 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 338499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 16:17:47 -0000 Author: markj Date: Thu Sep 6 16:17:45 2018 New Revision: 338499 URL: https://svnweb.freebsd.org/changeset/base/338499 Log: Remove vm_page_remque(). Testing m->queue != PQ_NONE is not sufficient; see the commit log message for r338276. As of r332974 vm_page_dequeue() handles already-dequeued pages, so just replace vm_page_remque() calls with vm_page_dequeue() calls. Reviewed by: kib Tested by: pho Approved by: re (marius) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17025 Modified: head/sys/vm/vm_fault.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Thu Sep 6 16:11:24 2018 (r338498) +++ head/sys/vm/vm_fault.c Thu Sep 6 16:17:45 2018 (r338499) @@ -1124,7 +1124,7 @@ readrest: */ fs.object == fs.first_object->backing_object) { vm_page_lock(fs.m); - vm_page_remque(fs.m); + vm_page_dequeue(fs.m); vm_page_remove(fs.m); vm_page_unlock(fs.m); vm_page_lock(fs.first_m); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Sep 6 16:11:24 2018 (r338498) +++ head/sys/vm/vm_page.c Thu Sep 6 16:17:45 2018 (r338499) @@ -2627,7 +2627,7 @@ retry: m_new->dirty = m->dirty; m->flags &= ~PG_ZERO; vm_page_xbusy(m); - vm_page_remque(m); + vm_page_dequeue(m); vm_page_replace_checked(m_new, object, m->pindex, m); if (vm_page_free_prep(m)) @@ -2642,7 +2642,7 @@ retry: vm_page_deactivate(m_new); } else { m->flags &= ~PG_ZERO; - vm_page_remque(m); + vm_page_dequeue(m); vm_page_remove(m); if (vm_page_free_prep(m)) SLIST_INSERT_HEAD(&free, m, @@ -3404,7 +3404,7 @@ vm_page_activate(vm_page_t m) return; } - vm_page_remque(m); + vm_page_dequeue(m); if (m->act_count < ACT_INIT) m->act_count = ACT_INIT; vm_page_enqueue(m, PQ_ACTIVE); @@ -3676,7 +3676,7 @@ vm_page_deactivate(vm_page_t m) return; if (!vm_page_inactive(m)) { - vm_page_remque(m); + vm_page_dequeue(m); vm_page_enqueue(m, PQ_INACTIVE); } else vm_page_requeue(m); @@ -3699,9 +3699,10 @@ vm_page_deactivate_noreuse(vm_page_t m) if (m->wire_count > 0 || (m->oflags & VPO_UNMANAGED) != 0) return; - if (!vm_page_inactive(m)) - vm_page_remque(m); - m->queue = PQ_INACTIVE; + if (!vm_page_inactive(m)) { + vm_page_dequeue(m); + m->queue = PQ_INACTIVE; + } if ((m->aflags & PGA_REQUEUE_HEAD) == 0) vm_page_aflag_set(m, PGA_REQUEUE_HEAD); vm_pqbatch_submit_page(m, PQ_INACTIVE); @@ -3723,7 +3724,7 @@ vm_page_launder(vm_page_t m) if (vm_page_in_laundry(m)) vm_page_requeue(m); else { - vm_page_remque(m); + vm_page_dequeue(m); vm_page_enqueue(m, PQ_LAUNDRY); } } @@ -3741,7 +3742,7 @@ vm_page_unswappable(vm_page_t m) KASSERT(m->wire_count == 0 && (m->oflags & VPO_UNMANAGED) == 0, ("page %p already unswappable", m)); - vm_page_remque(m); + vm_page_dequeue(m); vm_page_enqueue(m, PQ_UNSWAPPABLE); } Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Thu Sep 6 16:11:24 2018 (r338498) +++ head/sys/vm/vm_page.h Thu Sep 6 16:17:45 2018 (r338499) @@ -740,22 +740,6 @@ vm_page_dirty(vm_page_t m) } /* - * vm_page_remque: - * - * If the given page is in a page queue, then remove it from that page - * queue. - * - * The page must be locked. - */ -static inline void -vm_page_remque(vm_page_t m) -{ - - if (m->queue != PQ_NONE) - vm_page_dequeue(m); -} - -/* * vm_page_undirty: * * Set page to not be dirty. Note: does not clear pmap modify bits From owner-svn-src-all@freebsd.org Thu Sep 6 17:07:22 2018 Return-Path: Delivered-To: svn-src-all@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 85CC2FCD0C5; Thu, 6 Sep 2018 17:07:22 +0000 (UTC) (envelope-from leitao@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 3C646802B0; Thu, 6 Sep 2018 17:07:22 +0000 (UTC) (envelope-from leitao@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 374537EB8; Thu, 6 Sep 2018 17:07:22 +0000 (UTC) (envelope-from leitao@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86H7LFl090974; Thu, 6 Sep 2018 17:07:21 GMT (envelope-from leitao@FreeBSD.org) Received: (from leitao@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86H7LwT090971; Thu, 6 Sep 2018 17:07:21 GMT (envelope-from leitao@FreeBSD.org) Message-Id: <201809061707.w86H7LwT090971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: leitao set sender to leitao@FreeBSD.org using -f From: Breno Leitao Date: Thu, 6 Sep 2018 17:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338500 - head/sys/powerpc/include X-SVN-Group: head X-SVN-Commit-Author: leitao X-SVN-Commit-Paths: head/sys/powerpc/include X-SVN-Commit-Revision: 338500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 17:07:22 -0000 Author: leitao Date: Thu Sep 6 17:07:21 2018 New Revision: 338500 URL: https://svnweb.freebsd.org/changeset/base/338500 Log: powerpc64: Add initial support for HTM (kABI) This patch adds the very initial support for HTM that might come at FreeBSD version 12.1. This basic support defines a new kABI, so, we do not need to change it later during 12.1 time frame, when the full implementation will come. Reviewed by: jhibbits Approved by: re(marius), jhibbits (mentor) Differential Revision: https://reviews.freebsd.org/D16889 Modified: head/sys/powerpc/include/pcb.h head/sys/powerpc/include/pcpu.h Modified: head/sys/powerpc/include/pcb.h ============================================================================== --- head/sys/powerpc/include/pcb.h Thu Sep 6 16:17:45 2018 (r338499) +++ head/sys/powerpc/include/pcb.h Thu Sep 6 17:07:21 2018 (r338500) @@ -56,6 +56,7 @@ struct pcb { #define PCB_VEC 0x4 /* Process had Altivec initialized */ #define PCB_VSX 0x8 /* Process had VSX initialized */ #define PCB_CDSCR 0x10 /* Process had Custom DSCR initialized */ +#define PCB_HTM 0x20 /* Process had HTM initialized */ struct fpu { union { double fpr; @@ -73,6 +74,11 @@ struct pcb { } pcb_vec __aligned(16); /* Vector processor */ unsigned int pcb_veccpu; /* which CPU had our vector stuff. */ + struct htm { + uint64_t tfhar; + uint64_t texasr; + uint64_t tfiar; + } pcb_htm; union { struct { Modified: head/sys/powerpc/include/pcpu.h ============================================================================== --- head/sys/powerpc/include/pcpu.h Thu Sep 6 16:17:45 2018 (r338499) +++ head/sys/powerpc/include/pcpu.h Thu Sep 6 17:07:21 2018 (r338500) @@ -45,6 +45,7 @@ struct pvo_entry; struct pmap *pc_curpmap; /* current pmap */ \ struct thread *pc_fputhread; /* current fpu user */ \ struct thread *pc_vecthread; /* current vec user */ \ + struct thread *pc_htmthread; /* current htm user */ \ uintptr_t pc_hwref; \ int pc_bsp; \ volatile int pc_awake; \ From owner-svn-src-all@freebsd.org Thu Sep 6 17:25:02 2018 Return-Path: Delivered-To: svn-src-all@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 0453FFCDB0B; Thu, 6 Sep 2018 17:25:02 +0000 (UTC) (envelope-from andrew@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 A8FDB80ED1; Thu, 6 Sep 2018 17:25:01 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2CAA101FF; Thu, 6 Sep 2018 17:25:01 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86HP1Uq001075; Thu, 6 Sep 2018 17:25:01 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86HP1QR001074; Thu, 6 Sep 2018 17:25:01 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201809061725.w86HP1QR001074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 6 Sep 2018 17:25:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338501 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 338501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 17:25:02 -0000 Author: andrew Date: Thu Sep 6 17:25:01 2018 New Revision: 338501 URL: https://svnweb.freebsd.org/changeset/base/338501 Log: Remove the check that the Arm generic interrupt controller variant is non-zero. This is the case on qemu, so remove it to allow us to boot there. This change is needed to boot on qemu with ACPI. Approved by: re (gjb) Modified: head/sys/arm/arm/gic.c Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Thu Sep 6 17:07:21 2018 (r338500) +++ head/sys/arm/arm/gic.c Thu Sep 6 17:25:01 2018 (r338501) @@ -497,8 +497,7 @@ arm_gic_read_ivar(device_t dev, device_t child, int wh switch(which) { case GIC_IVAR_HW_REV: - KASSERT(GICD_IIDR_VAR(sc->gic_iidr) < 3 && - GICD_IIDR_VAR(sc->gic_iidr) != 0, + KASSERT(GICD_IIDR_VAR(sc->gic_iidr) < 3, ("arm_gic_read_ivar: Unknown IIDR revision %u (%.08x)", GICD_IIDR_VAR(sc->gic_iidr), sc->gic_iidr)); *result = GICD_IIDR_VAR(sc->gic_iidr); From owner-svn-src-all@freebsd.org Thu Sep 6 17:25:51 2018 Return-Path: Delivered-To: svn-src-all@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 8185CFCDB63; Thu, 6 Sep 2018 17:25:51 +0000 (UTC) (envelope-from andrew@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 3855F81026; Thu, 6 Sep 2018 17:25:51 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 331A410200; Thu, 6 Sep 2018 17:25:51 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86HPoxL001157; Thu, 6 Sep 2018 17:25:50 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86HPo8Y001156; Thu, 6 Sep 2018 17:25:50 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201809061725.w86HPo8Y001156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 6 Sep 2018 17:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338502 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 338502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 17:25:51 -0000 Author: andrew Date: Thu Sep 6 17:25:50 2018 New Revision: 338502 URL: https://svnweb.freebsd.org/changeset/base/338502 Log: Fix the GIC ACPI cross reference value. To support INTRNG with ACPI we need to set a non-zero cross reference value for the interrupt controller. The GICv3 driver already had this value set, however it was missed in the GICv2 driver. Fix this by setting xref to the correct value. Approved by: re (gjb) Modified: head/sys/arm/arm/gic_acpi.c Modified: head/sys/arm/arm/gic_acpi.c ============================================================================== --- head/sys/arm/arm/gic_acpi.c Thu Sep 6 17:25:01 2018 (r338501) +++ head/sys/arm/arm/gic_acpi.c Thu Sep 6 17:25:50 2018 (r338502) @@ -34,6 +34,7 @@ * SUCH DAMAGE. */ +#include "opt_acpi.h" #include "opt_platform.h" #include @@ -217,7 +218,7 @@ gic_acpi_attach(device_t dev) if (err != 0) return (err); - xref = 0; + xref = ACPI_INTR_XREF; /* * Now, when everything is initialized, it's right time to From owner-svn-src-all@freebsd.org Thu Sep 6 18:34:12 2018 Return-Path: Delivered-To: svn-src-all@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 B11F9FCFB9A; Thu, 6 Sep 2018 18:34:12 +0000 (UTC) (envelope-from obrien@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 5D10884722; Thu, 6 Sep 2018 18:34:12 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 5526F10E1C; Thu, 6 Sep 2018 18:34:12 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86IYCvG039808; Thu, 6 Sep 2018 18:34:12 GMT (envelope-from obrien@FreeBSD.org) Received: (from obrien@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86IYCYF039807; Thu, 6 Sep 2018 18:34:12 GMT (envelope-from obrien@FreeBSD.org) Message-Id: <201809061834.w86IYCYF039807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: obrien set sender to obrien@FreeBSD.org using -f From: "David E. O'Brien" Date: Thu, 6 Sep 2018 18:34:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338503 - head/usr.sbin/services_mkdb X-SVN-Group: head X-SVN-Commit-Author: obrien X-SVN-Commit-Paths: head/usr.sbin/services_mkdb X-SVN-Commit-Revision: 338503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 18:34:12 -0000 Author: obrien Date: Thu Sep 6 18:34:11 2018 New Revision: 338503 URL: https://svnweb.freebsd.org/changeset/base/338503 Log: Add MPLS LSP-echo (RFC8029, March 2017) port. Reviewed by: stevek Approved by: re(gjb) Obtained from: Juniper Networks Modified: head/usr.sbin/services_mkdb/services Modified: head/usr.sbin/services_mkdb/services ============================================================================== --- head/usr.sbin/services_mkdb/services Thu Sep 6 17:25:50 2018 (r338502) +++ head/usr.sbin/services_mkdb/services Thu Sep 6 18:34:11 2018 (r338503) @@ -2238,6 +2238,8 @@ vat-control 3457/tcp #VAT default control vat-control 3457/udp #VAT default control nut 3493/tcp #Network UPS Tools nut 3493/udp #Network UPS Tools +lsp-ping 3503/tcp #MPLS LSP-echo (RFC8029) +lsp-ping 3503/udp #MPLS LSP-echo (RFC8029) m2pa 3565/sctp #M2PA m2pa 3565/tcp #M2PA tsp 3653/tcp #Tunnel Setup Protocol From owner-svn-src-all@freebsd.org Thu Sep 6 18:45:32 2018 Return-Path: Delivered-To: svn-src-all@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 A7F20FDA322; Thu, 6 Sep 2018 18:45:32 +0000 (UTC) (envelope-from bwidawsk@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 504F084F7A; Thu, 6 Sep 2018 18:45:32 +0000 (UTC) (envelope-from bwidawsk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 4641F10FEF; Thu, 6 Sep 2018 18:45:32 +0000 (UTC) (envelope-from bwidawsk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86IjWCB044897; Thu, 6 Sep 2018 18:45:32 GMT (envelope-from bwidawsk@FreeBSD.org) Received: (from bwidawsk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86IjWIJ044896; Thu, 6 Sep 2018 18:45:32 GMT (envelope-from bwidawsk@FreeBSD.org) Message-Id: <201809061845.w86IjWIJ044896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bwidawsk set sender to bwidawsk@FreeBSD.org using -f From: Ben Widawsky Date: Thu, 6 Sep 2018 18:45:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338504 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: bwidawsk X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 338504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 18:45:32 -0000 Author: bwidawsk Date: Thu Sep 6 18:45:31 2018 New Revision: 338504 URL: https://svnweb.freebsd.org/changeset/base/338504 Log: Add device_attach and device_detach events to man page. Approved by: bcr, emaste (mentor), imp, jhb Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D17052 Modified: head/share/man/man9/EVENTHANDLER.9 Modified: head/share/man/man9/EVENTHANDLER.9 ============================================================================== --- head/share/man/man9/EVENTHANDLER.9 Thu Sep 6 18:34:11 2018 (r338503) +++ head/share/man/man9/EVENTHANDLER.9 Thu Sep 6 18:45:31 2018 (r338504) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" $FreeBSD$ .\" -.Dd October 31, 2017 +.Dd September 6, 2018 .Dt EVENTHANDLER 9 .Os .Sh NAME @@ -283,6 +283,10 @@ Callback invoked after cpu frequency has changed. Callback invoked before cpu frequency has changed. .It Vt dcons_poll Callback invoked to poll for dcons changes. +.It Vt device_attach +Callback invoked after a device has attached. +.It Vt device_detach +Callbacks invoked before and after a device has detached. .It Vt dev_clone Callbacks invoked when a new entry is created under .Pa /dev . From owner-svn-src-all@freebsd.org Thu Sep 6 18:51:53 2018 Return-Path: Delivered-To: svn-src-all@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 6010CFDA605; Thu, 6 Sep 2018 18:51:53 +0000 (UTC) (envelope-from shurd@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 10C8C85347; Thu, 6 Sep 2018 18:51:53 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 0BBD41105D; Thu, 6 Sep 2018 18:51:53 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86IpqhR049842; Thu, 6 Sep 2018 18:51:52 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86Ipqe3049841; Thu, 6 Sep 2018 18:51:52 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201809061851.w86Ipqe3049841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Thu, 6 Sep 2018 18:51:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338505 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 338505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 18:51:53 -0000 Author: shurd Date: Thu Sep 6 18:51:52 2018 New Revision: 338505 URL: https://svnweb.freebsd.org/changeset/base/338505 Log: Clean up iflib sysctls Remove sysctls: txq_drain_encapfail - now a duplicate of encap_txd_encap_fail intr_link - was never incremented intr_msix - was never incremented rx_zero_len - was never incremented The following were not incremented in all code-paths that apply: m_pullups, mbuf_defrag, rxd_flush, tx_encap, rx_intr_enables, tx_frees, encap_txd_encap_fail. Fixes: Replace the broken collapse_pkthdr() implementation with an MPASS(). fl_refills and fl_refills_large were not incremented when using netmap. Reviewed by: gallatin Approved by: re (marius) Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D16733 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Sep 6 18:45:31 2018 (r338504) +++ head/sys/net/iflib.c Thu Sep 6 18:51:52 2018 (r338505) @@ -641,7 +641,6 @@ SYSCTL_INT(_net_iflib, OID_AUTO, fl_refills_large, CTL static int iflib_txq_drain_flushing; static int iflib_txq_drain_oactive; static int iflib_txq_drain_notready; -static int iflib_txq_drain_encapfail; SYSCTL_INT(_net_iflib, OID_AUTO, txq_drain_flushing, CTLFLAG_RD, &iflib_txq_drain_flushing, 0, "# drain flushes"); @@ -649,8 +648,6 @@ SYSCTL_INT(_net_iflib, OID_AUTO, txq_drain_oactive, CT &iflib_txq_drain_oactive, 0, "# drain oactives"); SYSCTL_INT(_net_iflib, OID_AUTO, txq_drain_notready, CTLFLAG_RD, &iflib_txq_drain_notready, 0, "# drain notready"); -SYSCTL_INT(_net_iflib, OID_AUTO, txq_drain_encapfail, CTLFLAG_RD, - &iflib_txq_drain_encapfail, 0, "# drain encap fails"); static int iflib_encap_load_mbuf_fail; @@ -670,21 +667,14 @@ SYSCTL_INT(_net_iflib, OID_AUTO, encap_txd_encap_fail, static int iflib_task_fn_rxs; static int iflib_rx_intr_enables; static int iflib_fast_intrs; -static int iflib_intr_link; -static int iflib_intr_msix; static int iflib_rx_unavail; static int iflib_rx_ctx_inactive; -static int iflib_rx_zero_len; static int iflib_rx_if_input; static int iflib_rx_mbuf_null; static int iflib_rxd_flush; static int iflib_verbose_debug; -SYSCTL_INT(_net_iflib, OID_AUTO, intr_link, CTLFLAG_RD, - &iflib_intr_link, 0, "# intr link calls"); -SYSCTL_INT(_net_iflib, OID_AUTO, intr_msix, CTLFLAG_RD, - &iflib_intr_msix, 0, "# intr msix calls"); SYSCTL_INT(_net_iflib, OID_AUTO, task_fn_rx, CTLFLAG_RD, &iflib_task_fn_rxs, 0, "# task_fn_rx calls"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_intr_enables, CTLFLAG_RD, @@ -695,8 +685,6 @@ SYSCTL_INT(_net_iflib, OID_AUTO, rx_unavail, CTLFLAG_R &iflib_rx_unavail, 0, "# times rxeof called with no available data"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_ctx_inactive, CTLFLAG_RD, &iflib_rx_ctx_inactive, 0, "# times rxeof called with inactive context"); -SYSCTL_INT(_net_iflib, OID_AUTO, rx_zero_len, CTLFLAG_RD, - &iflib_rx_zero_len, 0, "# times rxeof saw zero len mbuf"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_if_input, CTLFLAG_RD, &iflib_rx_if_input, 0, "# times rxeof called if_input"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_mbuf_null, CTLFLAG_RD, @@ -713,12 +701,12 @@ iflib_debug_reset(void) iflib_tx_seen = iflib_tx_sent = iflib_tx_encap = iflib_rx_allocs = iflib_fl_refills = iflib_fl_refills_large = iflib_tx_frees = iflib_txq_drain_flushing = iflib_txq_drain_oactive = - iflib_txq_drain_notready = iflib_txq_drain_encapfail = + iflib_txq_drain_notready = iflib_encap_load_mbuf_fail = iflib_encap_pad_mbuf_fail = iflib_encap_txq_avail_fail = iflib_encap_txd_encap_fail = iflib_task_fn_rxs = iflib_rx_intr_enables = iflib_fast_intrs = - iflib_intr_link = iflib_intr_msix = iflib_rx_unavail = - iflib_rx_ctx_inactive = iflib_rx_zero_len = iflib_rx_if_input = + iflib_rx_unavail = + iflib_rx_ctx_inactive = iflib_rx_if_input = iflib_rx_mbuf_null = iflib_rxd_flush = 0; } @@ -839,6 +827,9 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring if_ctx_t ctx = rxq->ifr_ctx; iflib_fl_t fl = &rxq->ifr_fl[0]; uint32_t refill_pidx, nic_i; +#if IFLIB_DEBUG_COUNTERS + int rf_count = 0; +#endif if (nm_i == head && __predict_true(!init)) return 0; @@ -851,7 +842,12 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring */ head = nm_prev(head, lim); nic_i = UINT_MAX; + DBG_COUNTER_INC(fl_refills); while (nm_i != head) { +#if IFLIB_DEBUG_COUNTERS + if (++rf_count == 9) + DBG_COUNTER_INC(fl_refills_large); +#endif for (int tmp_pidx = 0; tmp_pidx < IFLIB_MAX_RX_REFRESH && nm_i != head; tmp_pidx++) { struct netmap_slot *slot = &ring->slot[nm_i]; void *addr = PNMB(na, slot, &fl->ifl_bus_addrs[tmp_pidx]); @@ -898,8 +894,10 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring if (map) bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - if (__predict_true(nic_i != UINT_MAX)) + if (__predict_true(nic_i != UINT_MAX)) { ctx->isc_rxd_flush(ctx->ifc_softc, rxq->ifr_id, fl->ifl_id, nic_i); + DBG_COUNTER_INC(rxd_flush); + } return (0); } @@ -998,6 +996,7 @@ iflib_netmap_txsync(struct netmap_kring *kring, int fl /* Fill the slot in the NIC ring. */ ctx->isc_txd_encap(ctx->ifc_softc, &pi); + DBG_COUNTER_INC(tx_encap); /* prefetch for next round */ __builtin_prefetch(&ring->slot[nm_i + 1]); @@ -1524,8 +1523,10 @@ iflib_fast_intr_rxtx(void *arg) cidx = rxq->ifr_fl[0].ifl_cidx; if (iflib_rxd_avail(ctx, rxq, cidx, 1)) GROUPTASK_ENQUEUE(gtask); - else + else { IFDI_RX_QUEUE_INTR_ENABLE(ctx, rxq->ifr_id); + DBG_COUNTER_INC(rx_intr_enables); + } return (FILTER_HANDLED); } @@ -2887,6 +2888,7 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, return (ENOMEM); } else { m_freem(*mp); + DBG_COUNTER_INC(tx_frees); *mp = m; } } @@ -2994,6 +2996,7 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, pi->ipi_ip_hlen = sizeof(struct ip6_hdr); if (__predict_false(m->m_len < pi->ipi_ehdrlen + sizeof(struct ip6_hdr))) { + txq->ift_pullups++; if (__predict_false((m = m_pullup(m, pi->ipi_ehdrlen + sizeof(struct ip6_hdr))) == NULL)) return (ENOMEM); } @@ -3041,34 +3044,6 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, return (0); } -static __noinline struct mbuf * -collapse_pkthdr(struct mbuf *m0) -{ - struct mbuf *m, *m_next, *tmp; - - m = m0; - m_next = m->m_next; - while (m_next != NULL && m_next->m_len == 0) { - m = m_next; - m->m_next = NULL; - m_free(m); - m_next = m_next->m_next; - } - m = m0; - m->m_next = m_next; - if (m_next == NULL) - return (m); - if ((m_next->m_flags & M_EXT) == 0) { - m = m_defrag(m, M_NOWAIT); - } else { - tmp = m_next->m_next; - memcpy(m_next, m, MPKTHSIZE); - m = m_next; - m->m_next = tmp; - } - return (m); -} - /* * If dodgy hardware rejects the scatter gather chain we've handed it * we'll need to remove the mbuf chain from ifsg_m[] before we can add the @@ -3117,8 +3092,7 @@ iflib_busdma_load_mbuf_sg(iflib_txq_t txq, bus_dma_tag /* * Please don't ever do this */ - if (__predict_false(m->m_len == 0)) - *m0 = collapse_pkthdr(m); + MPASS(__predict_true(m->m_len > 0)); ctx = txq->ift_ctx; sctx = ctx->ifc_sctx; @@ -3259,6 +3233,7 @@ iflib_ether_pad(device_t dev, struct mbuf **m_head, ui m_freem(*m_head); device_printf(dev, "cannot pad short frame, m_dup() failed"); DBG_COUNTER_INC(encap_pad_mbuf_fail); + DBG_COUNTER_INC(tx_frees); return ENOMEM; } m_freem(*m_head); @@ -3274,6 +3249,7 @@ iflib_ether_pad(device_t dev, struct mbuf **m_head, ui m_freem(*m_head); device_printf(dev, "cannot pad short frame\n"); DBG_COUNTER_INC(encap_pad_mbuf_fail); + DBG_COUNTER_INC(tx_frees); return (ENOBUFS); } @@ -3337,8 +3313,10 @@ iflib_encap(iflib_txq_t txq, struct mbuf **m_headp) if ((sctx->isc_flags & IFLIB_NEED_ETHER_PAD) && __predict_false(m_head->m_pkthdr.len < scctx->isc_min_frame_size)) { err = iflib_ether_pad(ctx->ifc_dev, m_headp, scctx->isc_min_frame_size); - if (err) + if (err) { + DBG_COUNTER_INC(encap_txd_encap_fail); return err; + } } m_head = *m_headp; @@ -3352,8 +3330,10 @@ iflib_encap(iflib_txq_t txq, struct mbuf **m_headp) /* deliberate bitwise OR to make one condition */ if (__predict_true((pi.ipi_csum_flags | pi.ipi_vtag))) { - if (__predict_false((err = iflib_parse_header(txq, &pi, m_headp)) != 0)) + if (__predict_false((err = iflib_parse_header(txq, &pi, m_headp)) != 0)) { + DBG_COUNTER_INC(encap_txd_encap_fail); return (err); + } m_head = *m_headp; } @@ -3370,12 +3350,13 @@ defrag: if (m_head == NULL) remap++; } - if (remap == 1) + if (remap == 1) { + txq->ift_mbuf_defrag++; m_head = m_defrag(*m_headp, M_NOWAIT); + } remap++; if (__predict_false(m_head == NULL)) goto defrag_failed; - txq->ift_mbuf_defrag++; *m_headp = m_head; goto retry; break; @@ -3391,6 +3372,7 @@ defrag: } txq->ift_map_failed++; DBG_COUNTER_INC(encap_load_mbuf_fail); + DBG_COUNTER_INC(encap_txd_encap_fail); return (err); } @@ -3404,6 +3386,7 @@ defrag: if (map != NULL) bus_dmamap_unload(desc_tag, map); DBG_COUNTER_INC(encap_txq_avail_fail); + DBG_COUNTER_INC(encap_txd_encap_fail); if ((txq->ift_task.gt_task.ta_flags & TASK_ENQUEUED) == 0) GROUPTASK_ENQUEUE(&txq->ift_task); return (ENOBUFS); @@ -3466,9 +3449,12 @@ defrag: goto defrag; } } - DBG_COUNTER_INC(encap_txd_encap_fail); goto defrag_failed; } + /* + * err can't possibly be non-zero here, so we don't neet to test it + * to see if we need to DBG_COUNTER_INC(encap_txd_encap_fail). + */ return (err); defrag_failed: @@ -3477,6 +3463,7 @@ defrag_failed: m_freem(*m_headp); DBG_COUNTER_INC(tx_frees); *m_headp = NULL; + DBG_COUNTER_INC(encap_txd_encap_fail); return (ENOMEM); } @@ -3676,12 +3663,10 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui in_use_prev = txq->ift_in_use; err = iflib_encap(txq, mp); if (__predict_false(err)) { - DBG_COUNTER_INC(txq_drain_encapfail); /* no room - bail out */ if (err == ENOBUFS) break; consumed++; - DBG_COUNTER_INC(txq_drain_encapfail); /* we can't send this packet - skip it */ continue; } @@ -3741,6 +3726,7 @@ iflib_txq_drain_free(struct ifmp_ring *r, uint32_t cid if (__predict_false(*mp == (struct mbuf *)txq)) continue; m_freem(*mp); + DBG_COUNTER_INC(tx_frees); } MPASS(ifmp_ring_is_stalled(r) == 0); return (avail); @@ -3987,6 +3973,7 @@ iflib_if_transmit(if_t ifp, struct mbuf *m) next = m->m_nextpkt; m->m_nextpkt = NULL; m_freem(m); + DBG_COUNTER_INC(tx_frees); m = next; } return (ENOBUFS); @@ -4029,6 +4016,7 @@ iflib_if_transmit(if_t ifp, struct mbuf *m) #endif ifmp_ring_check_drainage(txq->ift_br, TX_BATCH_SIZE); m_freem(m); + DBG_COUNTER_INC(tx_frees); } return (err); From owner-svn-src-all@freebsd.org Thu Sep 6 19:21:32 2018 Return-Path: Delivered-To: svn-src-all@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 AE197FE0776; Thu, 6 Sep 2018 19:21:32 +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 63A7286E8C; Thu, 6 Sep 2018 19:21:32 +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 5EAA911664; Thu, 6 Sep 2018 19:21:32 +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 w86JLWJp063641; Thu, 6 Sep 2018 19:21:32 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86JLW2h063639; Thu, 6 Sep 2018 19:21:32 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201809061921.w86JLW2h063639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 6 Sep 2018 19:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338506 - in head: . sys/mips/conf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: . sys/mips/conf X-SVN-Commit-Revision: 338506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 19:21:32 -0000 Author: jhb Date: Thu Sep 6 19:21:31 2018 New Revision: 338506 URL: https://svnweb.freebsd.org/changeset/base/338506 Log: Re-enable kernel modules for the MALTA64EL kernel configuration. Update the BOOTSTRAPPING check for libelf to require the fix for mips64el object files committed in r338478 and re-enable kernel modules in the MALTA64EL config file. Reviewed by: emaste Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D17054 Modified: head/Makefile.inc1 head/sys/mips/conf/MALTA64EL Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Sep 6 18:51:52 2018 (r338505) +++ head/Makefile.inc1 Thu Sep 6 19:21:31 2018 (r338506) @@ -1933,7 +1933,8 @@ update: .PHONY # r296685 fix cross-endian objcopy # r310724 fixed PR 215350, a crash in libdwarf with objects built by GCC 6.2. # r334881 added libdwarf constants used by ctfconvert. -.if ${BOOTSTRAPPING} < 1200067 +# r338478 fixed a crash in objcopy for mips64el objects +.if ${BOOTSTRAPPING} < 1200084 _elftoolchain_libs= lib/libelf lib/libdwarf .endif Modified: head/sys/mips/conf/MALTA64EL ============================================================================== --- head/sys/mips/conf/MALTA64EL Thu Sep 6 18:51:52 2018 (r338505) +++ head/sys/mips/conf/MALTA64EL Thu Sep 6 19:21:31 2018 (r338506) @@ -9,5 +9,4 @@ include "std.MALTA" machine mips mips64el makeoptions ARCH_FLAGS="-march=mips64 -mabi=64" -makeoptions MODULES_OVERRIDE="" makeoptions KERNLOADADDR=0xffffffff80100000 From owner-svn-src-all@freebsd.org Thu Sep 6 19:28:55 2018 Return-Path: Delivered-To: svn-src-all@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 EFDA4FE0CFD; Thu, 6 Sep 2018 19:28:54 +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 98CA288077; Thu, 6 Sep 2018 19:28:54 +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 8FF17116D7; Thu, 6 Sep 2018 19:28:54 +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 w86JSspT067809; Thu, 6 Sep 2018 19:28:54 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86JSrSb067799; Thu, 6 Sep 2018 19:28:53 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809061928.w86JSrSb067799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 6 Sep 2018 19:28:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338507 - in head/sys: sys vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: sys vm X-SVN-Commit-Revision: 338507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 19:28:55 -0000 Author: markj Date: Thu Sep 6 19:28:52 2018 New Revision: 338507 URL: https://svnweb.freebsd.org/changeset/base/338507 Log: Avoid resource deadlocks when one domain has exhausted its memory. Attempt other allowed domains if the requested domain is below the minimum paging threshold. Block in fork only if all domains available to the forking thread are below the severe threshold rather than any. Submitted by: jeff Reported by: mjg Reviewed by: alc, kib, markj Approved by: re (rgrimes) Differential Revision: https://reviews.freebsd.org/D16191 Modified: head/sys/sys/vmmeter.h head/sys/vm/vm_domainset.c head/sys/vm/vm_domainset.h head/sys/vm/vm_fault.c head/sys/vm/vm_glue.c head/sys/vm/vm_page.c head/sys/vm/vm_pageout.h Modified: head/sys/sys/vmmeter.h ============================================================================== --- head/sys/sys/vmmeter.h Thu Sep 6 19:21:31 2018 (r338506) +++ head/sys/sys/vmmeter.h Thu Sep 6 19:28:52 2018 (r338507) @@ -187,6 +187,13 @@ vm_page_count_severe(void) return (!DOMAINSET_EMPTY(&vm_severe_domains)); } +static inline int +vm_page_count_severe_set(domainset_t *mask) +{ + + return (DOMAINSET_SUBSET(&vm_severe_domains, mask)); +} + /* * Return TRUE if we are under our minimum low-free-pages threshold. * Modified: head/sys/vm/vm_domainset.c ============================================================================== --- head/sys/vm/vm_domainset.c Thu Sep 6 19:21:31 2018 (r338506) +++ head/sys/vm/vm_domainset.c Thu Sep 6 19:28:52 2018 (r338507) @@ -100,6 +100,8 @@ vm_domainset_iter_init(struct vm_domainset_iter *di, s pindex += (((uintptr_t)obj) / sizeof(*obj)); di->di_offset = pindex; } + /* Skip zones below min on the first pass. */ + di->di_minskip = true; } static void @@ -213,6 +215,8 @@ vm_domainset_iter_page_init(struct vm_domainset_iter * *req = (di->di_flags & ~(VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL)) | VM_ALLOC_NOWAIT; vm_domainset_iter_first(di, domain); + if (DOMAINSET_ISSET(*domain, &vm_min_domains)) + vm_domainset_iter_page(di, domain, req); } int @@ -227,8 +231,15 @@ vm_domainset_iter_page(struct vm_domainset_iter *di, i return (ENOMEM); /* If there are more domains to visit we run the iterator. */ - if (--di->di_n != 0) { + while (--di->di_n != 0) { vm_domainset_iter_next(di, domain); + if (!di->di_minskip || + !DOMAINSET_ISSET(*domain, &vm_min_domains)) + return (0); + } + if (di->di_minskip) { + di->di_minskip = false; + vm_domainset_iter_first(di, domain); return (0); } @@ -258,6 +269,8 @@ vm_domainset_iter_malloc_init(struct vm_domainset_iter di->di_flags = *flags; *flags = (di->di_flags & ~M_WAITOK) | M_NOWAIT; vm_domainset_iter_first(di, domain); + if (DOMAINSET_ISSET(*domain, &vm_min_domains)) + vm_domainset_iter_malloc(di, domain, flags); } int @@ -265,8 +278,17 @@ vm_domainset_iter_malloc(struct vm_domainset_iter *di, { /* If there are more domains to visit we run the iterator. */ - if (--di->di_n != 0) { + while (--di->di_n != 0) { vm_domainset_iter_next(di, domain); + if (!di->di_minskip || + !DOMAINSET_ISSET(*domain, &vm_min_domains)) + return (0); + } + + /* If we skipped zones below min start the search from the beginning. */ + if (di->di_minskip) { + di->di_minskip = false; + vm_domainset_iter_first(di, domain); return (0); } Modified: head/sys/vm/vm_domainset.h ============================================================================== --- head/sys/vm/vm_domainset.h Thu Sep 6 19:21:31 2018 (r338506) +++ head/sys/vm/vm_domainset.h Thu Sep 6 19:28:52 2018 (r338507) @@ -34,9 +34,10 @@ struct vm_domainset_iter { struct domainset *di_domain; int *di_iter; vm_pindex_t di_offset; - int di_policy; int di_flags; - int di_n; + uint16_t di_policy; + domainid_t di_n; + bool di_minskip; }; int vm_domainset_iter_page(struct vm_domainset_iter *, int *, int *); @@ -45,5 +46,7 @@ void vm_domainset_iter_page_init(struct vm_domainset_i int vm_domainset_iter_malloc(struct vm_domainset_iter *, int *, int *); void vm_domainset_iter_malloc_init(struct vm_domainset_iter *, struct vm_object *, int *, int *); + +void vm_wait_doms(const domainset_t *); #endif /* __VM_DOMAINSET_H__ */ Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Thu Sep 6 19:21:31 2018 (r338506) +++ head/sys/vm/vm_fault.c Thu Sep 6 19:28:52 2018 (r338507) @@ -548,6 +548,7 @@ vm_fault_hold(vm_map_t map, vm_offset_t vaddr, vm_prot { struct faultstate fs; struct vnode *vp; + struct domainset *dset; vm_object_t next_object, retry_object; vm_offset_t e_end, e_start; vm_pindex_t retry_pindex; @@ -791,7 +792,11 @@ RetryFault:; * there, and allocation can fail, causing * restart and new reading of the p_flag. */ - if (!vm_page_count_severe() || P_KILLED(curproc)) { + dset = fs.object->domain.dr_policy; + if (dset == NULL) + dset = curthread->td_domain.dr_policy; + if (!vm_page_count_severe_set(&dset->ds_mask) || + P_KILLED(curproc)) { #if VM_NRESERVLEVEL > 0 vm_object_color(fs.object, atop(vaddr) - fs.pindex); @@ -806,7 +811,7 @@ RetryFault:; } if (fs.m == NULL) { unlock_and_deallocate(&fs); - vm_waitpfault(); + vm_waitpfault(dset); goto RetryFault; } } Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Thu Sep 6 19:21:31 2018 (r338506) +++ head/sys/vm/vm_glue.c Thu Sep 6 19:28:52 2018 (r338507) @@ -92,6 +92,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -534,6 +535,7 @@ vm_forkproc(struct thread *td, struct proc *p2, struct struct vmspace *vm2, int flags) { struct proc *p1 = td->td_proc; + struct domainset *dset; int error; if ((flags & RFPROC) == 0) { @@ -557,9 +559,9 @@ vm_forkproc(struct thread *td, struct proc *p2, struct p2->p_vmspace = p1->p_vmspace; atomic_add_int(&p1->p_vmspace->vm_refcnt, 1); } - - while (vm_page_count_severe()) { - vm_wait_severe(); + dset = td2->td_domain.dr_policy; + while (vm_page_count_severe_set(&dset->ds_mask)) { + vm_wait_doms(&dset->ds_mask); } if ((flags & RFMEM) == 0) { Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Sep 6 19:21:31 2018 (r338506) +++ head/sys/vm/vm_page.c Thu Sep 6 19:28:52 2018 (r338507) @@ -2935,7 +2935,7 @@ vm_wait_count(void) return (vm_severe_waiters + vm_min_waiters + vm_pageproc_waiters); } -static void +void vm_wait_doms(const domainset_t *wdoms) { @@ -2961,10 +2961,10 @@ vm_wait_doms(const domainset_t *wdoms) mtx_lock(&vm_domainset_lock); if (DOMAINSET_SUBSET(&vm_min_domains, wdoms)) { vm_min_waiters++; - msleep(&vm_min_domains, &vm_domainset_lock, PVM, - "vmwait", 0); - } - mtx_unlock(&vm_domainset_lock); + msleep(&vm_min_domains, &vm_domainset_lock, + PVM | PDROP, "vmwait", 0); + } else + mtx_unlock(&vm_domainset_lock); } } @@ -3069,15 +3069,21 @@ vm_domain_alloc_fail(struct vm_domain *vmd, vm_object_ * this balance without careful testing first. */ void -vm_waitpfault(void) +vm_waitpfault(struct domainset *dset) { + /* + * XXX Ideally we would wait only until the allocation could + * be satisfied. This condition can cause new allocators to + * consume all freed pages while old allocators wait. + */ mtx_lock(&vm_domainset_lock); - if (vm_page_count_min()) { + if (DOMAINSET_SUBSET(&vm_min_domains, &dset->ds_mask)) { vm_min_waiters++; - msleep(&vm_min_domains, &vm_domainset_lock, PUSER, "pfault", 0); - } - mtx_unlock(&vm_domainset_lock); + msleep(&vm_min_domains, &vm_domainset_lock, PUSER | PDROP, + "pfault", 0); + } else + mtx_unlock(&vm_domainset_lock); } struct vm_pagequeue * Modified: head/sys/vm/vm_pageout.h ============================================================================== --- head/sys/vm/vm_pageout.h Thu Sep 6 19:21:31 2018 (r338506) +++ head/sys/vm/vm_pageout.h Thu Sep 6 19:28:52 2018 (r338507) @@ -96,7 +96,7 @@ extern int vm_pageout_page_count; */ void vm_wait(vm_object_t obj); -void vm_waitpfault(void); +void vm_waitpfault(struct domainset *); void vm_wait_domain(int domain); void vm_wait_min(void); void vm_wait_severe(void); From owner-svn-src-all@freebsd.org Thu Sep 6 19:42:40 2018 Return-Path: Delivered-To: svn-src-all@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 E115FFE3580; Thu, 6 Sep 2018 19:42:40 +0000 (UTC) (envelope-from mjg@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 96C4088F2F; Thu, 6 Sep 2018 19:42:40 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 9181D11A44; Thu, 6 Sep 2018 19:42:40 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86Jgeix078623; Thu, 6 Sep 2018 19:42:40 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86JgeCr078622; Thu, 6 Sep 2018 19:42:40 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201809061942.w86JgeCr078622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 6 Sep 2018 19:42:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338508 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 338508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 19:42:41 -0000 Author: mjg Date: Thu Sep 6 19:42:40 2018 New Revision: 338508 URL: https://svnweb.freebsd.org/changeset/base/338508 Log: amd64: depessimize copyinstr_smap The stac/clac combo around each byte copy is causing a measurable slowdown in benchmarks. Do it only before and after all data is copied. While here reorder the code to avoid a forward branch in the common case. Note the copying loop (originating from copyinstr) is avoidably slow and will be fixed later. Reviewed by: kib Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D17063 Modified: head/sys/amd64/amd64/support.S Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Thu Sep 6 19:28:52 2018 (r338507) +++ head/sys/amd64/amd64/support.S Thu Sep 6 19:42:40 2018 (r338508) @@ -914,6 +914,8 @@ ENTRY(copyinstr_smap) subq %rsi,%rax jbe cpystrflt + stac + /* restrict maxlen to <= VM_MAXUSER_ADDRESS-from */ cmpq %rdx,%rax jae 1f @@ -924,32 +926,20 @@ ENTRY(copyinstr_smap) 2: decq %rdx - jz copyinstr_toolong + jz copyinstr_toolong_smap - stac lodsb stosb - clac orb %al,%al jnz 2b + clac + copyinstr_succ: /* Success -- 0 byte reached */ decq %rdx xorl %eax,%eax - jmp cpystrflt_x -copyinstr_toolong: - /* rdx is zero - return ENAMETOOLONG or EFAULT */ - movq $VM_MAXUSER_ADDRESS,%rax - cmpq %rax,%rsi - jae cpystrflt - movq $ENAMETOOLONG,%rax - jmp cpystrflt_x - /* Fault entry clears PSL.AC */ -cpystrflt: - movq $EFAULT,%rax - cpystrflt_x: /* set *lencopied and return %eax */ movq PCPU(CURPCB),%rcx @@ -962,6 +952,21 @@ cpystrflt_x: 1: POP_FRAME_POINTER ret + /* Fault entry clears PSL.AC */ +cpystrflt: + movq $EFAULT,%rax + jmp cpystrflt_x + +copyinstr_toolong_smap: + clac +copyinstr_toolong: + /* rdx is zero - return ENAMETOOLONG or EFAULT */ + movq $VM_MAXUSER_ADDRESS,%rax + cmpq %rax,%rsi + jae cpystrflt + movq $ENAMETOOLONG,%rax + jmp cpystrflt_x + END(copyinstr_smap) /* From owner-svn-src-all@freebsd.org Thu Sep 6 19:55:40 2018 Return-Path: Delivered-To: svn-src-all@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 BD076FE406D; Thu, 6 Sep 2018 19:55:40 +0000 (UTC) (envelope-from bz@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 7227A89BB6; Thu, 6 Sep 2018 19:55:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6D26D11C1C; Thu, 6 Sep 2018 19:55:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86Jte4f084002; Thu, 6 Sep 2018 19:55:40 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86JteY6084001; Thu, 6 Sep 2018 19:55:40 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201809061955.w86JteY6084001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 6 Sep 2018 19:55:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338509 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 338509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 19:55:40 -0000 Author: bz Date: Thu Sep 6 19:55:40 2018 New Revision: 338509 URL: https://svnweb.freebsd.org/changeset/base/338509 Log: The inp_lle field to struct inpcb, along with two "valid" flags for the rt and lle cache were added in r191129 (2009). To my best knowledge they have never been used and route caching has converted the inp_rt field from that commit to inp_route rendering this field and these flags obsolete. Convert the pointer into a spare pointer to not change the size of the structure anymore (and to have a spare pointer) and mark the two fields as unused. Reviewed by: markj, karels Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D17062 Modified: head/sys/netinet/in_pcb.h Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Thu Sep 6 19:42:40 2018 (r338508) +++ head/sys/netinet/in_pcb.h Thu Sep 6 19:55:40 2018 (r338509) @@ -320,7 +320,7 @@ struct inpcb { CK_LIST_ENTRY(inpcb) inp_portlist; /* (i/h) */ struct inpcbport *inp_phd; /* (i/h) head of this list */ inp_gen_t inp_gencnt; /* (c) generation count */ - struct llentry *inp_lle; /* cached L2 information */ + void *spare_ptr; /* Spare pointer. */ rt_gen_t inp_rt_cookie; /* generation for route entry */ union { /* cached L3 information */ struct route inp_route; @@ -744,8 +744,8 @@ int inp_so_options(const struct inpcb *inp); /* * Flags for inp_flags2. */ -#define INP_LLE_VALID 0x00000001 /* cached lle is valid */ -#define INP_RT_VALID 0x00000002 /* cached rtentry is valid */ +#define INP_2UNUSED1 0x00000001 +#define INP_2UNUSED2 0x00000002 #define INP_PCBGROUPWILD 0x00000004 /* in pcbgroup wildcard list */ #define INP_REUSEPORT 0x00000008 /* SO_REUSEPORT option is set */ #define INP_FREED 0x00000010 /* inp itself is not valid */ From owner-svn-src-all@freebsd.org Thu Sep 6 20:02:20 2018 Return-Path: Delivered-To: svn-src-all@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 54373FE44C7; Thu, 6 Sep 2018 20:02:20 +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 0B2848A2C5; Thu, 6 Sep 2018 20:02:20 +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 060D011DCA; Thu, 6 Sep 2018 20:02:20 +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 w86K2JmC089249; Thu, 6 Sep 2018 20:02:19 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86K2Jdm089248; Thu, 6 Sep 2018 20:02:19 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809062002.w86K2Jdm089248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 6 Sep 2018 20:02:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338510 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 338510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 20:02:20 -0000 Author: markj Date: Thu Sep 6 20:02:19 2018 New Revision: 338510 URL: https://svnweb.freebsd.org/changeset/base/338510 Log: Use the correct terminology. Reported by: kib Approved by: re (gjb) Differential revision: https://reviews.freebsd.org/D16191 Modified: head/sys/vm/vm_domainset.c Modified: head/sys/vm/vm_domainset.c ============================================================================== --- head/sys/vm/vm_domainset.c Thu Sep 6 19:55:40 2018 (r338509) +++ head/sys/vm/vm_domainset.c Thu Sep 6 20:02:19 2018 (r338510) @@ -100,7 +100,7 @@ vm_domainset_iter_init(struct vm_domainset_iter *di, s pindex += (((uintptr_t)obj) / sizeof(*obj)); di->di_offset = pindex; } - /* Skip zones below min on the first pass. */ + /* Skip domains below min on the first pass. */ di->di_minskip = true; } @@ -285,7 +285,7 @@ vm_domainset_iter_malloc(struct vm_domainset_iter *di, return (0); } - /* If we skipped zones below min start the search from the beginning. */ + /* If we skipped domains below min restart the search. */ if (di->di_minskip) { di->di_minskip = false; vm_domainset_iter_first(di, domain); From owner-svn-src-all@freebsd.org Thu Sep 6 20:29:41 2018 Return-Path: Delivered-To: svn-src-all@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 9D657FE4F26; Thu, 6 Sep 2018 20:29: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 540898B086; Thu, 6 Sep 2018 20:29:41 +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 4EDCF12123; Thu, 6 Sep 2018 20:29: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 w86KTfBB001411; Thu, 6 Sep 2018 20:29:41 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86KTfxJ001410; Thu, 6 Sep 2018 20:29:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201809062029.w86KTfxJ001410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 6 Sep 2018 20:29:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338511 - head/lib/libvmmapi X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/libvmmapi X-SVN-Commit-Revision: 338511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 20:29:41 -0000 Author: jhb Date: Thu Sep 6 20:29:40 2018 New Revision: 338511 URL: https://svnweb.freebsd.org/changeset/base/338511 Log: bhyve: Use MAP_GUARD when mapping guest memory ranges. Instead of relying on PROT_NONE mappings with MAP_ANON, use MAP_GUARD to reserve address space around guest memory ranges including the guard ranges of address space around mappings. Submitted by: Shawn Webb Reviewed by: araujo Approved by: re (rgrimes) MFC after: 1 month Sponsored by: HardendBSD and G2, Inc Differential Revision: https://reviews.freebsd.org/D16822 Modified: head/lib/libvmmapi/vmmapi.c Modified: head/lib/libvmmapi/vmmapi.c ============================================================================== --- head/lib/libvmmapi/vmmapi.c Thu Sep 6 20:02:19 2018 (r338510) +++ head/lib/libvmmapi/vmmapi.c Thu Sep 6 20:29:40 2018 (r338511) @@ -362,7 +362,7 @@ vm_setup_memory(struct vmctx *ctx, size_t memsize, enu size_t objsize, len; vm_paddr_t gpa; char *baseaddr, *ptr; - int error, flags; + int error; assert(vms == VM_MMAP_ALL); @@ -389,8 +389,7 @@ vm_setup_memory(struct vmctx *ctx, size_t memsize, enu * and the adjoining guard regions. */ len = VM_MMAP_GUARD_SIZE + objsize + VM_MMAP_GUARD_SIZE; - flags = MAP_PRIVATE | MAP_ANON | MAP_NOCORE | MAP_ALIGNED_SUPER; - ptr = mmap(NULL, len, PROT_NONE, flags, -1, 0); + ptr = mmap(NULL, len, PROT_NONE, MAP_GUARD | MAP_ALIGNED_SUPER, -1, 0); if (ptr == MAP_FAILED) return (-1); @@ -492,8 +491,8 @@ vm_create_devmem(struct vmctx *ctx, int segid, const c * adjoining guard regions. */ len2 = VM_MMAP_GUARD_SIZE + len + VM_MMAP_GUARD_SIZE; - flags = MAP_PRIVATE | MAP_ANON | MAP_NOCORE | MAP_ALIGNED_SUPER; - base = mmap(NULL, len2, PROT_NONE, flags, -1, 0); + base = mmap(NULL, len2, PROT_NONE, MAP_GUARD | MAP_ALIGNED_SUPER, -1, + 0); if (base == MAP_FAILED) goto done; From owner-svn-src-all@freebsd.org Thu Sep 6 21:09:55 2018 Return-Path: Delivered-To: svn-src-all@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 95768FE5C70; Thu, 6 Sep 2018 21:09:55 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C7428C354; Thu, 6 Sep 2018 21:09:55 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4770A127DC; Thu, 6 Sep 2018 21:09:55 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86L9tme026093; Thu, 6 Sep 2018 21:09:55 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86L9taP026092; Thu, 6 Sep 2018 21:09:55 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201809062109.w86L9taP026092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 6 Sep 2018 21:09:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338512 - head/sys/dev/sdhci X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/dev/sdhci X-SVN-Commit-Revision: 338512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 21:09:55 -0000 Author: marius Date: Thu Sep 6 21:09:54 2018 New Revision: 338512 URL: https://svnweb.freebsd.org/changeset/base/338512 Log: - Explicitly compare a pointer to NULL. The __builtin_expect() of clang 3.4.1 otherwise isn't able to cope with the expression. - Fix a nearby whitespace bug. Approved by: re (gjb, kib) Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Thu Sep 6 20:29:40 2018 (r338511) +++ head/sys/dev/sdhci/sdhci.c Thu Sep 6 21:09:54 2018 (r338512) @@ -1575,11 +1575,10 @@ sdhci_set_transfer_mode(struct sdhci_slot *slot, struc #ifdef MMCCAM slot->ccb->mmcio.stop.opcode == MMC_STOP_TRANSMISSION && #else - slot->req->stop && + slot->req->stop != NULL && #endif !(slot->quirks & SDHCI_QUIRK_BROKEN_AUTO_STOP))) mode |= SDHCI_TRNS_ACMD12; - } if (data->flags & MMC_DATA_READ) mode |= SDHCI_TRNS_READ; From owner-svn-src-all@freebsd.org Thu Sep 6 21:24:15 2018 Return-Path: Delivered-To: svn-src-all@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 31EAAFE639B; Thu, 6 Sep 2018 21:24:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC65F8CC7A; Thu, 6 Sep 2018 21:24:14 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D748212B15; Thu, 6 Sep 2018 21:24:14 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86LOEPL036021; Thu, 6 Sep 2018 21:24:14 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86LOEoX036020; Thu, 6 Sep 2018 21:24:14 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201809062124.w86LOEoX036020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 6 Sep 2018 21:24:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338513 - head/sys/dev/mmc X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/dev/mmc X-SVN-Commit-Revision: 338513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 21:24:15 -0000 Author: marius Date: Thu Sep 6 21:24:14 2018 New Revision: 338513 URL: https://svnweb.freebsd.org/changeset/base/338513 Log: Avoid uninitialized read of ext_csd. Reported by: Coverity CID: 1395275 Approved by: re (gjb, kib) Modified: head/sys/dev/mmc/mmc.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Thu Sep 6 21:09:54 2018 (r338512) +++ head/sys/dev/mmc/mmc.c Thu Sep 6 21:24:14 2018 (r338513) @@ -1591,6 +1591,7 @@ mmc_discover_cards(struct mmc_softc *sc) int err, host_caps, i, newcard; uint32_t resp, sec_count, status; uint16_t rca = 2; + int16_t rev; uint8_t card_type; host_caps = mmcbr_get_caps(sc->dev); @@ -1779,6 +1780,7 @@ mmc_discover_cards(struct mmc_softc *sc) goto free_ivar; } + rev = -1; /* Only MMC >= 4.x devices support EXT_CSD. */ if (ivar->csd.spec_vers >= 4) { err = mmc_send_ext_csd(sc->dev, sc->dev, @@ -1789,6 +1791,7 @@ mmc_discover_cards(struct mmc_softc *sc) goto free_ivar; } ext_csd = ivar->raw_ext_csd; + rev = ext_csd[EXT_CSD_REV]; /* Handle extended capacity from EXT_CSD */ sec_count = le32dec(&ext_csd[EXT_CSD_SEC_CNT]); if (sec_count != 0) { @@ -1859,7 +1862,7 @@ mmc_discover_cards(struct mmc_softc *sc) * units of 10 ms), defaulting to 500 ms. */ ivar->cmd6_time = 500 * 1000; - if (ext_csd[EXT_CSD_REV] >= 6) + if (rev >= 6) ivar->cmd6_time = 10 * ext_csd[EXT_CSD_GEN_CMD6_TIME]; /* Handle HC erase sector size. */ @@ -1880,8 +1883,7 @@ mmc_discover_cards(struct mmc_softc *sc) } } - mmc_decode_cid_mmc(ivar->raw_cid, &ivar->cid, - ext_csd[EXT_CSD_REV] >= 5); + mmc_decode_cid_mmc(ivar->raw_cid, &ivar->cid, rev >= 5); child_common: for (quirk = &mmc_quirks[0]; quirk->mid != 0x0; quirk++) { From owner-svn-src-all@freebsd.org Thu Sep 6 22:23:41 2018 Return-Path: Delivered-To: svn-src-all@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 5A76DFE7824; Thu, 6 Sep 2018 22:23: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 F23F38F1FF; Thu, 6 Sep 2018 22:23: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 EA0E0134DA; Thu, 6 Sep 2018 22:23: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 w86MNesZ067786; Thu, 6 Sep 2018 22:23:40 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86MNdcq067782; Thu, 6 Sep 2018 22:23:39 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201809062223.w86MNdcq067782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 6 Sep 2018 22:23:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338514 - in stable/11: sys/arm/include sys/arm64/include sys/mips/include sys/riscv/include tests/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/11: sys/arm/include sys/arm64/include sys/mips/include sys/riscv/include tests/sys/kern X-SVN-Commit-Revision: 338514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 22:23:41 -0000 Author: jhb Date: Thu Sep 6 22:23:39 2018 New Revision: 338514 URL: https://svnweb.freebsd.org/changeset/base/338514 Log: MFC 332906,332907,332976,333679,336053: Expand testing of breakpoints. 332906: Extend support for ptrace() tests using breakpoints. - Use a single list of platforms to define HAVE_BREAKPOINT for platforms that expose a functional breakpoint() inline to userland. Replace existing lists of platform tests with HAVE_BREAKPOINT instead. - Add support for advancing PC past a breakpoint inserted via breakpoint() to support the existing ptrace__PT_CONTINUE_different_thread test on non-x86 platforms (x86 advances the PC past the breakpoint instruction, but other platforms do not). This is implemented by defining a new SKIP_BREAK macro which accepts a pointer to a 'struct reg' as its sole argument and modifies the contents to advance the PC. The intention is to use it in between PT_GETREGS and PT_SETREGS. 332907: Expose breakpoint() to userland from on MIPS. Enable ptrace() tests using breakpoint on MIPS as well. 332976: Shorten some recently-added lines that are an extra indent over 80 columns. 333679: Export a breakpoint() function to userland for riscv. As a result, enable tests using breakpoint() on riscv. 336053: Export a breakpoint() function to userland for arm and arm64. Enable ptrace() tests using breakpoint() on these architectures. Modified: stable/11/sys/arm/include/cpufunc.h stable/11/sys/arm64/include/cpufunc.h stable/11/sys/mips/include/cpufunc.h stable/11/sys/riscv/include/cpufunc.h stable/11/tests/sys/kern/ptrace_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/include/cpufunc.h ============================================================================== --- stable/11/sys/arm/include/cpufunc.h Thu Sep 6 21:24:14 2018 (r338513) +++ stable/11/sys/arm/include/cpufunc.h Thu Sep 6 22:23:39 2018 (r338514) @@ -52,7 +52,7 @@ static __inline void breakpoint(void) { - __asm(".word 0xe7ffffff"); + __asm("udf 0xffff"); } struct cpu_functions { @@ -525,6 +525,19 @@ extern int arm_dcache_align_mask; extern u_int arm_cache_level; extern u_int arm_cache_loc; extern u_int arm_cache_type[14]; + +#else /* !_KERNEL */ + +static __inline void +breakpoint(void) +{ + + /* + * This matches the instruction used by GDB for software + * breakpoints. + */ + __asm("udf 0xfdee"); +} #endif /* _KERNEL */ #endif /* _MACHINE_CPUFUNC_H_ */ Modified: stable/11/sys/arm64/include/cpufunc.h ============================================================================== --- stable/11/sys/arm64/include/cpufunc.h Thu Sep 6 21:24:14 2018 (r338513) +++ stable/11/sys/arm64/include/cpufunc.h Thu Sep 6 22:23:39 2018 (r338514) @@ -29,18 +29,18 @@ #ifndef _MACHINE_CPUFUNC_H_ #define _MACHINE_CPUFUNC_H_ -#ifdef _KERNEL - -#include - -void pan_enable(void); - static __inline void breakpoint(void) { __asm("brk #0"); } + +#ifdef _KERNEL + +#include + +void pan_enable(void); static __inline register_t dbg_disable(void) Modified: stable/11/sys/mips/include/cpufunc.h ============================================================================== --- stable/11/sys/mips/include/cpufunc.h Thu Sep 6 21:24:14 2018 (r338513) +++ stable/11/sys/mips/include/cpufunc.h Thu Sep 6 22:23:39 2018 (r338514) @@ -106,6 +106,12 @@ mips_wbflush(void) #endif } +static __inline void +breakpoint(void) +{ + __asm __volatile ("break"); +} + #ifdef _KERNEL /* * XXX @@ -339,12 +345,6 @@ get_intr_mask(void) { return (mips_rd_status() & MIPS_SR_INT_MASK); -} - -static __inline void -breakpoint(void) -{ - __asm __volatile ("break"); } #if defined(__GNUC__) && !defined(__mips_o32) Modified: stable/11/sys/riscv/include/cpufunc.h ============================================================================== --- stable/11/sys/riscv/include/cpufunc.h Thu Sep 6 21:24:14 2018 (r338513) +++ stable/11/sys/riscv/include/cpufunc.h Thu Sep 6 22:23:39 2018 (r338514) @@ -37,16 +37,16 @@ #ifndef _MACHINE_CPUFUNC_H_ #define _MACHINE_CPUFUNC_H_ -#ifdef _KERNEL - -#include - static __inline void breakpoint(void) { __asm("ebreak"); } + +#ifdef _KERNEL + +#include static __inline register_t intr_disable(void) Modified: stable/11/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/11/tests/sys/kern/ptrace_test.c Thu Sep 6 21:24:14 2018 (r338513) +++ stable/11/tests/sys/kern/ptrace_test.c Thu Sep 6 22:23:39 2018 (r338514) @@ -52,6 +52,37 @@ __FBSDID("$FreeBSD$"); #include /* + * Architectures with a user-visible breakpoint(). + */ +#if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \ + defined(__i386__) || defined(__mips__) || defined(__riscv) || \ + defined(__sparc64__) +#define HAVE_BREAKPOINT +#endif + +/* + * Adjust PC to skip over a breakpoint when stopped for a breakpoint trap. + */ +#ifdef HAVE_BREAKPOINT +#if defined(__aarch64__) +#define SKIP_BREAK(reg) ((reg)->elr += 4) +#elif defined(__amd64__) || defined(__i386__) +#define SKIP_BREAK(reg) +#elif defined(__arm__) +#define SKIP_BREAK(reg) ((reg)->r_pc += 4) +#elif defined(__mips__) +#define SKIP_BREAK(reg) ((reg)->r_regs[PC] += 4) +#elif defined(__riscv) +#define SKIP_BREAK(reg) ((reg)->sepc += 4) +#elif defined(__sparc64__) +#define SKIP_BREAK(reg) do { \ + (reg)->r_tpc = (reg)->r_tnpc + 4; \ + (reg)->r_tnpc += 8; \ +} while (0) +#endif +#endif + +/* * A variant of ATF_REQUIRE that is suitable for use in child * processes. This only works if the parent process is tripped up by * the early exit and fails some requirement itself. @@ -1688,12 +1719,8 @@ ATF_TC_BODY(ptrace__ptrace_vfork_follow, tc) ATF_REQUIRE(errno == ECHILD); } +#ifdef HAVE_BREAKPOINT /* - * XXX: There's nothing inherently platform specific about this test, however a - * userspace visible breakpoint() is a prerequisite. - */ - #if defined(__amd64__) || defined(__i386__) || defined(__sparc64__) -/* * Verify that no more events are reported after PT_KILL except for the * process exit when stopped due to a breakpoint trap. */ @@ -1738,7 +1765,7 @@ ATF_TC_BODY(ptrace__PT_KILL_breakpoint, tc) ATF_REQUIRE(wpid == -1); ATF_REQUIRE(errno == ECHILD); } -#endif /* defined(__amd64__) || defined(__i386__) || defined(__sparc64__) */ +#endif /* HAVE_BREAKPOINT */ /* * Verify that no more events are reported after PT_KILL except for the @@ -3468,11 +3495,7 @@ 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. - */ +#if defined(HAVE_BREAKPOINT) && defined(SKIP_BREAK) static void * continue_thread(void *arg __unused) { @@ -3506,6 +3529,7 @@ ATF_TC_BODY(ptrace__PT_CONTINUE_different_thread, tc) pid_t fpid, wpid; lwpid_t lwps[2]; bool hit_break[2]; + struct reg reg; int i, j, status; ATF_REQUIRE((fpid = fork()) != -1); @@ -3579,6 +3603,9 @@ ATF_TC_BODY(ptrace__PT_CONTINUE_different_thread, tc) else i = 1; hit_break[i] = true; + ATF_REQUIRE(ptrace(PT_GETREGS, pl.pl_lwpid, (caddr_t)®, 0) != -1); + SKIP_BREAK(®); + ATF_REQUIRE(ptrace(PT_SETREGS, pl.pl_lwpid, (caddr_t)®, 0) != -1); /* * Resume both threads but pass the other thread's LWPID to @@ -3616,6 +3643,11 @@ ATF_TC_BODY(ptrace__PT_CONTINUE_different_thread, tc) ATF_REQUIRE_MSG(!hit_break[i], "double breakpoint event"); hit_break[i] = true; + ATF_REQUIRE(ptrace(PT_GETREGS, pl.pl_lwpid, (caddr_t)®, + 0) != -1); + SKIP_BREAK(®); + ATF_REQUIRE(ptrace(PT_SETREGS, pl.pl_lwpid, (caddr_t)®, + 0) != -1); } ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); @@ -3663,7 +3695,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__event_mask); ATF_TP_ADD_TC(tp, ptrace__ptrace_vfork); ATF_TP_ADD_TC(tp, ptrace__ptrace_vfork_follow); -#if defined(__amd64__) || defined(__i386__) || defined(__sparc64__) +#ifdef HAVE_BREAKPOINT ATF_TP_ADD_TC(tp, ptrace__PT_KILL_breakpoint); #endif ATF_TP_ADD_TC(tp, ptrace__PT_KILL_system_call); @@ -3688,7 +3720,7 @@ 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__) +#if defined(HAVE_BREAKPOINT) && defined(SKIP_BREAK) ATF_TP_ADD_TC(tp, ptrace__PT_CONTINUE_different_thread); #endif From owner-svn-src-all@freebsd.org Thu Sep 6 22:30:35 2018 Return-Path: Delivered-To: svn-src-all@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 20E2DFE7A13; Thu, 6 Sep 2018 22:30:35 +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 CB47D8F52D; Thu, 6 Sep 2018 22:30:34 +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 C64AF134F7; Thu, 6 Sep 2018 22:30:34 +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 w86MUYQX068357; Thu, 6 Sep 2018 22:30:34 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86MUYvF068356; Thu, 6 Sep 2018 22:30:34 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201809062230.w86MUYvF068356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 6 Sep 2018 22:30: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: r338515 - stable/11/sys/mips/mips X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/mips/mips X-SVN-Commit-Revision: 338515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 22:30:35 -0000 Author: jhb Date: Thu Sep 6 22:30:34 2018 New Revision: 338515 URL: https://svnweb.freebsd.org/changeset/base/338515 Log: MFC 332909: Report proper signal codes for SIGTRAP traps on MIPS. - Use TRAP_TRACE for traps after stepping via PT_STEP. - Use TRAP_BRKPT for software breakpoint traps and watchpoint traps. This was tested via the recently added siginfo ptrace() tests. PT_STEP on MIPS has several bugs that prevent it from working yet, but this does fix the ptrace__breakpoint_siginfo test on MIPS. Modified: stable/11/sys/mips/mips/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/mips/mips/trap.c ============================================================================== --- stable/11/sys/mips/mips/trap.c Thu Sep 6 22:23:39 2018 (r338514) +++ stable/11/sys/mips/mips/trap.c Thu Sep 6 22:30:34 2018 (r338515) @@ -852,6 +852,7 @@ dofault: if (td->td_md.md_ss_addr != va || instr != MIPS_BREAK_SSTEP) { i = SIGTRAP; + ucode = TRAP_BRKPT; addr = trapframe->pc; break; } @@ -863,6 +864,7 @@ dofault: */ addr = trapframe->pc; i = SIGTRAP; + ucode = TRAP_TRACE; break; } @@ -877,6 +879,7 @@ dofault: va += sizeof(int); printf("watch exception @ %p\n", (void *)va); i = SIGTRAP; + ucode = TRAP_BRKPT; addr = va; break; } From owner-svn-src-all@freebsd.org Thu Sep 6 22:33:00 2018 Return-Path: Delivered-To: svn-src-all@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 5599DFE7CE2; Thu, 6 Sep 2018 22:33:00 +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 F064D8F9AB; Thu, 6 Sep 2018 22:32:59 +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 E592913683; Thu, 6 Sep 2018 22:32:59 +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 w86MWxpj072899; Thu, 6 Sep 2018 22:32:59 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86MWxDA072898; Thu, 6 Sep 2018 22:32:59 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201809062232.w86MWxDA072898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 6 Sep 2018 22:32:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338516 - stable/11/tests/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/tests/sys/kern X-SVN-Commit-Revision: 338516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 22:33:00 -0000 Author: jhb Date: Thu Sep 6 22:32:59 2018 New Revision: 338516 URL: https://svnweb.freebsd.org/changeset/base/338516 Log: MFC 332908: Add two tests for TRAP_* signal codes for SIGTRAP. - ptrace__breakpoint_siginfo tests that a SIGTRAP for a software breakpoint in userland triggers a SIGTRAP with a signal code of TRAP_BRKPT. - ptrace__step_siginfo tests that a SIGTRAP reported for a step after stepping via PT_STEP or PT_SETSTEP has a signal code of TRAP_TRACE. Modified: stable/11/tests/sys/kern/ptrace_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/11/tests/sys/kern/ptrace_test.c Thu Sep 6 22:30:34 2018 (r338515) +++ stable/11/tests/sys/kern/ptrace_test.c Thu Sep 6 22:32:59 2018 (r338516) @@ -3495,6 +3495,110 @@ ATF_TC_BODY(ptrace__PT_STEP_with_signal, tc) ATF_REQUIRE(errno == ECHILD); } +#ifdef HAVE_BREAKPOINT +/* + * Verify that a SIGTRAP event with the TRAP_BRKPT code is reported + * for a breakpoint trap. + */ +ATF_TC_WITHOUT_HEAD(ptrace__breakpoint_siginfo); +ATF_TC_BODY(ptrace__breakpoint_siginfo, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + int status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + breakpoint(); + exit(1); + } + + /* 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); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The second wait() should report hitting the 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); + ATF_REQUIRE(pl.pl_siginfo.si_code == TRAP_BRKPT); + + /* Kill the child process. */ + ATF_REQUIRE(ptrace(PT_KILL, fpid, 0, 0) == 0); + + /* The last wait() should report the SIGKILL. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSIGNALED(status)); + ATF_REQUIRE(WTERMSIG(status) == SIGKILL); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} +#endif /* HAVE_BREAKPOINT */ + +/* + * Verify that a SIGTRAP event with the TRAP_TRACE code is reported + * for a single-step trap from PT_STEP. + */ +ATF_TC_WITHOUT_HEAD(ptrace__step_siginfo); +ATF_TC_BODY(ptrace__step_siginfo, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + int status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + exit(1); + } + + /* 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); + + /* Step the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_STEP, fpid, (caddr_t)1, 0) == 0); + + /* The second wait() should report a single-step trap. */ + 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); + ATF_REQUIRE(pl.pl_siginfo.si_code == TRAP_TRACE); + + /* Continue the child process. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 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); +} + #if defined(HAVE_BREAKPOINT) && defined(SKIP_BREAK) static void * continue_thread(void *arg __unused) @@ -3720,6 +3824,10 @@ 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); +#ifdef HAVE_BREAKPOINT + ATF_TP_ADD_TC(tp, ptrace__breakpoint_siginfo); +#endif + ATF_TP_ADD_TC(tp, ptrace__step_siginfo); #if defined(HAVE_BREAKPOINT) && defined(SKIP_BREAK) ATF_TP_ADD_TC(tp, ptrace__PT_CONTINUE_different_thread); #endif From owner-svn-src-all@freebsd.org Thu Sep 6 23:28:36 2018 Return-Path: Delivered-To: svn-src-all@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 47430FE9031; Thu, 6 Sep 2018 23:28:36 +0000 (UTC) (envelope-from mckusick@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 E0754710DA; Thu, 6 Sep 2018 23:28:35 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 D40DA13ECE; Thu, 6 Sep 2018 23:28:35 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w86NSZd2098833; Thu, 6 Sep 2018 23:28:35 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w86NSZO4098832; Thu, 6 Sep 2018 23:28:35 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201809062328.w86NSZO4098832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Thu, 6 Sep 2018 23:28:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338517 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 338517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 23:28:36 -0000 Author: mckusick Date: Thu Sep 6 23:28:35 2018 New Revision: 338517 URL: https://svnweb.freebsd.org/changeset/base/338517 Log: The Call For Testing had no reports of operational problems and found that performance was no worse and usually better when running with TRIM consolidation. Performance improvement was most noticable when multiple large files are released in a short period of time. Thus, TRIM consolidation is being enabled by default. Should operational problems be found, it can be disabled using the command `sysctl vfs.ffs.dotrimcons=0'. This variable can also be set as a tunable if early disabling is necessary. Approved by: re (gjb) Sponsored by: Netflix Modified: head/sys/ufs/ffs/ffs_alloc.c Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Thu Sep 6 22:32:59 2018 (r338516) +++ head/sys/ufs/ffs/ffs_alloc.c Thu Sep 6 23:28:35 2018 (r338517) @@ -484,8 +484,8 @@ static int doreallocblks = 1; SYSCTL_INT(_vfs_ffs, OID_AUTO, doreallocblks, CTLFLAG_RW, &doreallocblks, 0, "enable block reallocation"); -static int dotrimcons = 0; -SYSCTL_INT(_vfs_ffs, OID_AUTO, dotrimcons, CTLFLAG_RW, &dotrimcons, 0, +static int dotrimcons = 1; +SYSCTL_INT(_vfs_ffs, OID_AUTO, dotrimcons, CTLFLAG_RWTUN, &dotrimcons, 0, "enable BIO_DELETE / TRIM consolidation"); static int maxclustersearch = 10; From owner-svn-src-all@freebsd.org Fri Sep 7 00:00:32 2018 Return-Path: Delivered-To: svn-src-all@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 35EE6FE9C1A; Fri, 7 Sep 2018 00:00: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 E1E5871E44; Fri, 7 Sep 2018 00:00:31 +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 DCDB6143BA; Fri, 7 Sep 2018 00:00:31 +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 w8700VeE014404; Fri, 7 Sep 2018 00:00:31 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8700VCZ014403; Fri, 7 Sep 2018 00:00:31 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201809070000.w8700VCZ014403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 7 Sep 2018 00:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338518 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 338518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 00:00:32 -0000 Author: gjb Date: Fri Sep 7 00:00:31 2018 New Revision: 338518 URL: https://svnweb.freebsd.org/changeset/base/338518 Log: Update head from ALPHA4 to ALPHA5 as part of the 12.0-RELEASE cycle. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Thu Sep 6 23:28:35 2018 (r338517) +++ head/sys/conf/newvers.sh Fri Sep 7 00:00:31 2018 (r338518) @@ -46,7 +46,7 @@ TYPE="FreeBSD" REVISION="12.0" -BRANCH="ALPHA4" +BRANCH="ALPHA5" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@freebsd.org Fri Sep 7 00:11:46 2018 Return-Path: Delivered-To: svn-src-all@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 38826FEA2FA; Fri, 7 Sep 2018 00:11:46 +0000 (UTC) (envelope-from mm@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 DF58E725E0; Fri, 7 Sep 2018 00:11:45 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 DA4F6146C4; Fri, 7 Sep 2018 00:11:45 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w870BjQF022505; Fri, 7 Sep 2018 00:11:45 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w870BhCj022492; Fri, 7 Sep 2018 00:11:43 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201809070011.w870BhCj022492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Fri, 7 Sep 2018 00:11:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r338519 - in vendor/libarchive/dist: . build build/cmake cpio/test libarchive X-SVN-Group: vendor X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in vendor/libarchive/dist: . build build/cmake cpio/test libarchive X-SVN-Commit-Revision: 338519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 00:11:46 -0000 Author: mm Date: Fri Sep 7 00:11:43 2018 New Revision: 338519 URL: https://svnweb.freebsd.org/changeset/base/338519 Log: Update vendor/libarchive/dist to git 5fe69dd018745a88eecf1f7db40daf12d26f7ed0 libarchive 3.3.3 Modified: vendor/libarchive/dist/CMakeLists.txt vendor/libarchive/dist/NEWS vendor/libarchive/dist/README.md vendor/libarchive/dist/build/cmake/config.h.in vendor/libarchive/dist/build/version vendor/libarchive/dist/configure.ac vendor/libarchive/dist/cpio/test/test_basic.c vendor/libarchive/dist/cpio/test/test_format_newc.c vendor/libarchive/dist/libarchive/archive.h vendor/libarchive/dist/libarchive/archive_cryptor.c vendor/libarchive/dist/libarchive/archive_pack_dev.c Modified: vendor/libarchive/dist/CMakeLists.txt ============================================================================== --- vendor/libarchive/dist/CMakeLists.txt Fri Sep 7 00:00:31 2018 (r338518) +++ vendor/libarchive/dist/CMakeLists.txt Fri Sep 7 00:11:43 2018 (r338519) @@ -639,6 +639,7 @@ LA_CHECK_INCLUDE_FILE("sys/select.h" HAVE_SYS_SELECT_H LA_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H) LA_CHECK_INCLUDE_FILE("sys/statfs.h" HAVE_SYS_STATFS_H) LA_CHECK_INCLUDE_FILE("sys/statvfs.h" HAVE_SYS_STATVFS_H) +LA_CHECK_INCLUDE_FILE("sys/sysmacros.h" HAVE_SYS_SYSMACROS_H) LA_CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H) LA_CHECK_INCLUDE_FILE("sys/utime.h" HAVE_SYS_UTIME_H) LA_CHECK_INCLUDE_FILE("sys/utsname.h" HAVE_SYS_UTSNAME_H) Modified: vendor/libarchive/dist/NEWS ============================================================================== --- vendor/libarchive/dist/NEWS Fri Sep 7 00:00:31 2018 (r338518) +++ vendor/libarchive/dist/NEWS Fri Sep 7 00:11:43 2018 (r338519) @@ -1,3 +1,13 @@ +Sep 03, 2018: libarchive 3.3.3 released + +Jul 19, 2018: Avoid super-linear slowdown on malformed mtree files + +Jan 27, 2018: Many fixes for building with Visual Studio + +Oct 19, 2017: NO_OVERWRITE doesn't change existing directory attributes + +Aug 12, 2017: New support for Zstandard read and write filters + Jul 09, 2017: libarchive 3.3.2 released Mar 16, 2017: NFSv4 ACL support for Linux (librichacl) Modified: vendor/libarchive/dist/README.md ============================================================================== --- vendor/libarchive/dist/README.md Fri Sep 7 00:00:31 2018 (r338518) +++ vendor/libarchive/dist/README.md Fri Sep 7 00:11:43 2018 (r338519) @@ -99,6 +99,7 @@ The library also detects and handles any of the follow * lzma, lzip, and xz compression * lz4 compression * lzop compression + * zstandard compression The library can create archives in any of the following formats: * POSIX ustar @@ -125,6 +126,7 @@ When creating archives, the result can be filtered wit * lzma, lzip, and xz compression * lz4 compression * lzop compression + * zstandard compression ## Notes about the Library Design @@ -159,7 +161,7 @@ questions we are asked about libarchive: * On read, compression and format are always detected automatically. -* The same API is used for all formats; in particular, it's very +* The same API is used for all formats; it should be very easy for software using libarchive to transparently handle any of libarchive's archiving formats. Modified: vendor/libarchive/dist/build/cmake/config.h.in ============================================================================== --- vendor/libarchive/dist/build/cmake/config.h.in Fri Sep 7 00:00:31 2018 (r338518) +++ vendor/libarchive/dist/build/cmake/config.h.in Fri Sep 7 00:11:43 2018 (r338519) @@ -1068,6 +1068,10 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SYSMACROS_H 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_TIME_H 1 Modified: vendor/libarchive/dist/build/version ============================================================================== --- vendor/libarchive/dist/build/version Fri Sep 7 00:00:31 2018 (r338518) +++ vendor/libarchive/dist/build/version Fri Sep 7 00:11:43 2018 (r338519) @@ -1 +1 @@ -3003003dev +3003003 Modified: vendor/libarchive/dist/configure.ac ============================================================================== --- vendor/libarchive/dist/configure.ac Fri Sep 7 00:00:31 2018 (r338518) +++ vendor/libarchive/dist/configure.ac Fri Sep 7 00:11:43 2018 (r338519) @@ -4,7 +4,7 @@ dnl First, define all of the version numbers up front. dnl In particular, this allows the version macro to be used in AC_INIT dnl These first two version numbers are updated automatically on each release. -m4_define([LIBARCHIVE_VERSION_S],[3.3.3dev]) +m4_define([LIBARCHIVE_VERSION_S],[3.3.3]) m4_define([LIBARCHIVE_VERSION_N],[3003003]) dnl bsdtar and bsdcpio versioning tracks libarchive @@ -290,7 +290,7 @@ AC_CHECK_HEADERS([stdarg.h stdint.h stdlib.h string.h] AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/ea.h sys/extattr.h]) AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h]) AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/richacl.h]) -AC_CHECK_HEADERS([sys/select.h sys/statfs.h sys/statvfs.h]) +AC_CHECK_HEADERS([sys/select.h sys/statfs.h sys/statvfs.h sys/sysmacros.h]) AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h sys/xattr.h]) AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h]) AC_CHECK_HEADERS([windows.h]) Modified: vendor/libarchive/dist/cpio/test/test_basic.c ============================================================================== --- vendor/libarchive/dist/cpio/test/test_basic.c Fri Sep 7 00:00:31 2018 (r338518) +++ vendor/libarchive/dist/cpio/test/test_basic.c Fri Sep 7 00:11:43 2018 (r338519) @@ -144,49 +144,79 @@ DEFINE_TEST(test_basic) /* File with 10 bytes content. */ assertMakeFile("file", 0644, "1234567890"); fprintf(filelist, "file\n"); - if (is_LargeInode("file")) + if (is_LargeInode("file")) { strncat(result, - "bsdcpio: file: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: file: large inode number truncated: ", sizeof(result) - strlen(result) -1); + strncat(result, + strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, + "\n", + sizeof(result) - strlen(result) -1); + } /* hardlink to above file. */ assertMakeHardlink("linkfile", "file"); fprintf(filelist, "linkfile\n"); - if (is_LargeInode("linkfile")) + if (is_LargeInode("linkfile")) { strncat(result, - "bsdcpio: linkfile: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: linkfile: large inode number truncated: ", sizeof(result) - strlen(result) -1); + strncat(result, + strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, + "\n", + sizeof(result) - strlen(result) -1); + } /* Symlink to above file. */ if (canSymlink()) { assertMakeSymlink("symlink", "file"); fprintf(filelist, "symlink\n"); - if (is_LargeInode("symlink")) + if (is_LargeInode("symlink")) { strncat(result, - "bsdcpio: symlink: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: symlink: large inode number truncated: ", sizeof(result) - strlen(result) -1); + strncat(result, + strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, + "\n", + sizeof(result) - strlen(result) -1); + } } /* Another file with different permissions. */ assertMakeFile("file2", 0777, "1234567890"); fprintf(filelist, "file2\n"); - if (is_LargeInode("file2")) + if (is_LargeInode("file2")) { strncat(result, - "bsdcpio: file2: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: file2: large inode number truncated: ", sizeof(result) - strlen(result) -1); + strncat(result, + strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, + "\n", + sizeof(result) - strlen(result) -1); + } /* Directory. */ assertMakeDir("dir", 0775); fprintf(filelist, "dir\n"); - if (is_LargeInode("dir")) + if (is_LargeInode("dir")) { strncat(result, - "bsdcpio: dir: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: dir: large inode number truncated: ", sizeof(result) - strlen(result) -1); + strncat(result, + strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, + "\n", + sizeof(result) - strlen(result) -1); + } strncat(result, "2 blocks\n", sizeof(result) - strlen(result) -1); /* All done. */ Modified: vendor/libarchive/dist/cpio/test/test_format_newc.c ============================================================================== --- vendor/libarchive/dist/cpio/test/test_format_newc.c Fri Sep 7 00:00:31 2018 (r338518) +++ vendor/libarchive/dist/cpio/test/test_format_newc.c Fri Sep 7 00:11:43 2018 (r338519) @@ -124,26 +124,42 @@ DEFINE_TEST(test_format_newc) /* Setup result message. */ memset(result, 0, sizeof(result)); - if (is_LargeInode("file1")) + if (is_LargeInode("file1")) { strncat(result, - "bsdcpio: file1: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: file1: large inode number truncated: ", sizeof(result) - strlen(result) -1); - if (canSymlink() && is_LargeInode("symlink")) + strncat(result, strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, "\n", + sizeof(result) - strlen(result) -1); + } + if (canSymlink() && is_LargeInode("symlink")) { strncat(result, - "bsdcpio: symlink: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: symlink: large inode number truncated: ", sizeof(result) - strlen(result) -1); - if (is_LargeInode("dir")) + strncat(result, strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, "\n", + sizeof(result) - strlen(result) -1); + } + if (is_LargeInode("dir")) { strncat(result, - "bsdcpio: dir: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: dir: large inode number truncated: ", sizeof(result) - strlen(result) -1); - if (is_LargeInode("hardlink")) + strncat(result, strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, "\n", + sizeof(result) - strlen(result) -1); + } + if (is_LargeInode("hardlink")) { strncat(result, - "bsdcpio: hardlink: large inode number truncated: " - "Numerical result out of range\n", + "bsdcpio: hardlink: large inode number truncated: ", sizeof(result) - strlen(result) -1); + strncat(result, strerror(ERANGE), + sizeof(result) - strlen(result) -1); + strncat(result, "\n", + sizeof(result) - strlen(result) -1); + } /* Record some facts about what we just created: */ now = time(NULL); /* They were all created w/in last two seconds. */ Modified: vendor/libarchive/dist/libarchive/archive.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive.h Fri Sep 7 00:00:31 2018 (r338518) +++ vendor/libarchive/dist/libarchive/archive.h Fri Sep 7 00:11:43 2018 (r338519) @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.3.3dev" +#define ARCHIVE_VERSION_ONLY_STRING "3.3.3" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); Modified: vendor/libarchive/dist/libarchive/archive_cryptor.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_cryptor.c Fri Sep 7 00:00:31 2018 (r338518) +++ vendor/libarchive/dist/libarchive/archive_cryptor.c Fri Sep 7 00:11:43 2018 (r338519) @@ -153,7 +153,7 @@ aes_ctr_encrypt_counter(archive_crypto_ctx *ctx) CCCryptorStatus r; r = CCCryptorReset(ref, NULL); - if (r != kCCSuccess) + if (r != kCCSuccess && r != kCCUnimplemented) return -1; r = CCCryptorUpdate(ref, ctx->nonce, AES_BLOCK_SIZE, ctx->encr_buf, AES_BLOCK_SIZE, NULL); Modified: vendor/libarchive/dist/libarchive/archive_pack_dev.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_pack_dev.c Fri Sep 7 00:00:31 2018 (r338518) +++ vendor/libarchive/dist/libarchive/archive_pack_dev.c Fri Sep 7 00:11:43 2018 (r338519) @@ -57,6 +57,9 @@ __RCSID("$NetBSD$"); #ifdef HAVE_SYS_STAT_H #include #endif +#ifdef HAVE_SYS_SYSMACROS_H +#include +#endif #ifdef HAVE_UNISTD_H #include #endif From owner-svn-src-all@freebsd.org Fri Sep 7 00:12:47 2018 Return-Path: Delivered-To: svn-src-all@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 A2512FEA3AB; Fri, 7 Sep 2018 00:12:47 +0000 (UTC) (envelope-from mm@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 58C0A727E1; Fri, 7 Sep 2018 00:12:47 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 533A31470B; Fri, 7 Sep 2018 00:12:47 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w870ClSM024312; Fri, 7 Sep 2018 00:12:47 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w870ClWL024310; Fri, 7 Sep 2018 00:12:47 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201809070012.w870ClWL024310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Fri, 7 Sep 2018 00:12:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r338520 - in vendor/libarchive/3.3.3: . build build/cmake cpio/test libarchive X-SVN-Group: vendor X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in vendor/libarchive/3.3.3: . build build/cmake cpio/test libarchive X-SVN-Commit-Revision: 338520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 00:12:48 -0000 Author: mm Date: Fri Sep 7 00:12:46 2018 New Revision: 338520 URL: https://svnweb.freebsd.org/changeset/base/338520 Log: Tag libarchive 3.3.3 Added: vendor/libarchive/3.3.3/ - copied from r338518, vendor/libarchive/dist/ Replaced: vendor/libarchive/3.3.3/CMakeLists.txt - copied unchanged from r338519, vendor/libarchive/dist/CMakeLists.txt vendor/libarchive/3.3.3/NEWS - copied unchanged from r338519, vendor/libarchive/dist/NEWS vendor/libarchive/3.3.3/README.md - copied unchanged from r338519, vendor/libarchive/dist/README.md vendor/libarchive/3.3.3/build/cmake/config.h.in - copied unchanged from r338519, vendor/libarchive/dist/build/cmake/config.h.in vendor/libarchive/3.3.3/build/version - copied unchanged from r338519, vendor/libarchive/dist/build/version vendor/libarchive/3.3.3/configure.ac - copied unchanged from r338519, vendor/libarchive/dist/configure.ac vendor/libarchive/3.3.3/cpio/test/test_basic.c - copied unchanged from r338519, vendor/libarchive/dist/cpio/test/test_basic.c vendor/libarchive/3.3.3/cpio/test/test_format_newc.c - copied unchanged from r338519, vendor/libarchive/dist/cpio/test/test_format_newc.c vendor/libarchive/3.3.3/libarchive/archive.h - copied unchanged from r338519, vendor/libarchive/dist/libarchive/archive.h vendor/libarchive/3.3.3/libarchive/archive_cryptor.c - copied unchanged from r338519, vendor/libarchive/dist/libarchive/archive_cryptor.c vendor/libarchive/3.3.3/libarchive/archive_pack_dev.c - copied unchanged from r338519, vendor/libarchive/dist/libarchive/archive_pack_dev.c Copied: vendor/libarchive/3.3.3/CMakeLists.txt (from r338519, vendor/libarchive/dist/CMakeLists.txt) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/3.3.3/CMakeLists.txt Fri Sep 7 00:12:46 2018 (r338520, copy of r338519, vendor/libarchive/dist/CMakeLists.txt) @@ -0,0 +1,1947 @@ +# +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR) +# +PROJECT(libarchive C) +# +SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") +if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin) +endif() +# +# Set the Build type for make based generators. +# You can choose following types: +# Debug : Debug build +# Release : Release build +# RelWithDebInfo : Release build with Debug Info +# MinSizeRel : Release Min Size build +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type" FORCE) +ENDIF(NOT CMAKE_BUILD_TYPE) +# Set a value type to properly display CMAKE_BUILD_TYPE on GUI if the +# value type is "UNINITIALIZED". +GET_PROPERTY(cached_type CACHE CMAKE_BUILD_TYPE PROPERTY TYPE) +IF("${cached_type}" STREQUAL "UNINITIALIZED") + SET(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Build Type" FORCE) +ENDIF("${cached_type}" STREQUAL "UNINITIALIZED") +# Check the Build Type. +IF(NOT "${CMAKE_BUILD_TYPE}" + MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)\$") + MESSAGE(FATAL_ERROR + "Unknown keyword for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}\n" + "Acceptable keywords: Debug,Release,RelWithDebInfo,MinSizeRel") +ENDIF(NOT "${CMAKE_BUILD_TYPE}" + MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)\$") + +# On MacOS, prefer MacPorts libraries to system libraries. +# I haven't come up with a compelling argument for this to be conditional. +list(APPEND CMAKE_PREFIX_PATH /opt/local) +# Enable @rpath in the install name. +# detail in "cmake --help-policy CMP0042" +SET(CMAKE_MACOSX_RPATH ON) + +# +# Version - read from 'version' file. +# +FILE(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/build/version _version) +STRING(REGEX REPLACE + "^([0-9])[0-9][0-9][0-9][0-9][0-9][0-9][a-z]*$" "\\1" _major ${_version}) +STRING(REGEX REPLACE + "^[0-9]([0-9][0-9][0-9])[0-9][0-9][0-9][a-z]*$" "\\1" _minor ${_version}) +STRING(REGEX REPLACE + "^[0-9][0-9][0-9][0-9]([0-9][0-9][0-9])[a-z]*$" "\\1" _revision ${_version}) +STRING(REGEX REPLACE + "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9]([a-z]*)$" "\\1" _quality ${_version}) +SET(_version_number ${_major}${_minor}${_revision}) +STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_minor ${_minor}) +STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_revision ${_revision}) +# +SET(VERSION "${_major}.${_trimmed_minor}.${_trimmed_revision}${_quality}") +SET(BSDCPIO_VERSION_STRING "${VERSION}") +SET(BSDTAR_VERSION_STRING "${VERSION}") +SET(BSDCAT_VERSION_STRING "${VERSION}") +SET(LIBARCHIVE_VERSION_NUMBER "${_version_number}") +SET(LIBARCHIVE_VERSION_STRING "${VERSION}") + +# INTERFACE_VERSION increments with every release +# libarchive 2.7 == interface version 9 = 2 + 7 +# libarchive 2.8 == interface version 10 = 2 + 8 +# libarchive 2.9 == interface version 11 = 2 + 9 +# libarchive 3.0 == interface version 12 +# libarchive 3.1 == interface version 13 +math(EXPR INTERFACE_VERSION "13 + ${_minor}") + +# Set SOVERSION == Interface version +# ?? Should there be more here ?? +SET(SOVERSION "${INTERFACE_VERSION}") + +# Enalbe CMAKE_PUSH_CHECK_STATE() and CMAKE_POP_CHECK_STATE() macros +# saving and restoring the state of the variables. +INCLUDE(CMakePushCheckState) + +# Initialize the state of the variables. This initialization is not +# necessary but this shows you what value the variables initially have. +SET(CMAKE_REQUIRED_DEFINITIONS) +SET(CMAKE_REQUIRED_INCLUDES) +SET(CMAKE_REQUIRED_LIBRARIES) +SET(CMAKE_REQUIRED_FLAGS) + +# Especially for early development, we want to be a little +# aggressive about diagnosing build problems; this can get +# relaxed somewhat in final shipping versions. +IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$") + SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security") + ################################################################# + # Set compile flags for all build types. + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wformat -Wformat-security") + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wextra") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wunused") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual") +ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$") +IF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") + SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security") + ################################################################# + # Set compile flags for all build types. + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wformat -Wformat-security") + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wextra") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wunused") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual") +ENDIF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") +IF (CMAKE_C_COMPILER_ID MATCHES "^XL$") + SET(CMAKE_C_COMPILER "xlc_r") + SET(CMAKE_REQUIRED_FLAGS "-qflag=e:e -qformat=sec") + ################################################################# + # Set compile flags for all build types. + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qflag=e:e -qformat=sec") + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qhalt=w") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qflag=w:w") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qinfo=pro:use") +ENDIF(CMAKE_C_COMPILER_ID MATCHES "^XL$") +IF (MSVC) + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" + # Enable level 4 C4061: The enumerate has no associated handler in a switch + # statement. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4061") + # Enable level 4 C4254: A larger bit field was assigned to a smaller bit + # field. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4254") + # Enable level 4 C4295: An array was initialized but the last character in + # the array is not a null; accessing the array may + # produce unexpected results. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4295") + # Enable level 4 C4296: An unsigned variable was used in a comparison + # operation with zero. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4296") + # Enable level 4 C4389: An operation involved signed and unsigned variables. + # This could result in a loss of data. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4389") + # Enable level 4 C4505: The given function is local and not referenced in + # the body of the module; therefore, the function is + # dead code. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4505") + # Enable level 4 C4514: The optimizer removed an inline function that is not + # called. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4514") + # Enable level 4 C4702: Unreachable code. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4702") + # Enable level 4 C4706: The test value in a conditional expression was the + # result of an assignment. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4706") + # /WX option is the same as gcc's -Werror option. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /WX") + # /Oi option enables built-in functions. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Oi") + ################################################################# + # Set compile flags for release build. + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi") +ENDIF (MSVC) + +# Enable CTest/CDash support +include(CTest) + +OPTION(ENABLE_NETTLE "Enable use of Nettle" ON) +OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON) +OPTION(ENABLE_LZ4 "Enable the use of the system LZ4 library if found" ON) +OPTION(ENABLE_LZO "Enable the use of the system LZO library if found" OFF) +OPTION(ENABLE_LZMA "Enable the use of the system LZMA library if found" ON) + +OPTION(ENABLE_ZLIB "Enable the use of the system ZLIB library if found" ON) +OPTION(ENABLE_BZip2 "Enable the use of the system BZip2 library if found" ON) +OPTION(ENABLE_LIBXML2 "Enable the use of the system libxml2 library if found" ON) +OPTION(ENABLE_EXPAT "Enable the use of the system EXPAT library if found" ON) +OPTION(ENABLE_PCREPOSIX "Enable the use of the system PCREPOSIX library if found" ON) +OPTION(ENABLE_LibGCC "Enable the use of the system LibGCC library if found" ON) +# CNG is used for encrypt/decrypt Zip archives on Windows. +OPTION(ENABLE_CNG "Enable the use of CNG(Crypto Next Generation)" ON) + +OPTION(ENABLE_TAR "Enable tar building" ON) +OPTION(ENABLE_TAR_SHARED "Enable dynamic build of tar" FALSE) +OPTION(ENABLE_CPIO "Enable cpio building" ON) +OPTION(ENABLE_CPIO_SHARED "Enable dynamic build of cpio" FALSE) +OPTION(ENABLE_CAT "Enable cat building" ON) +OPTION(ENABLE_CAT_SHARED "Enable dynamic build of cat" FALSE) +OPTION(ENABLE_XATTR "Enable extended attribute support" ON) +OPTION(ENABLE_ACL "Enable ACL support" ON) +OPTION(ENABLE_ICONV "Enable iconv support" ON) +OPTION(ENABLE_TEST "Enable unit and regression tests" ON) +OPTION(ENABLE_COVERAGE "Enable code coverage (GCC only, automatically sets ENABLE_TEST to ON)" FALSE) +OPTION(ENABLE_INSTALL "Enable installing of libraries" ON) + +SET(POSIX_REGEX_LIB "AUTO" CACHE STRING "Choose what library should provide POSIX regular expression support") +SET(ENABLE_SAFESEH "AUTO" CACHE STRING "Enable use of /SAFESEH linker flag (MSVC only)") +SET(WINDOWS_VERSION "WIN7" CACHE STRING "Set Windows version to use (Windows only)") + +IF(ENABLE_COVERAGE) + include(LibarchiveCodeCoverage) +ENDIF(ENABLE_COVERAGE) + +IF(ENABLE_TEST) + ENABLE_TESTING() +ENDIF(ENABLE_TEST) + +IF(WIN32) + IF(WINDOWS_VERSION STREQUAL "WIN8") + SET(NTDDI_VERSION 0x06020000) + SET(_WIN32_WINNT 0x0602) + SET(WINVER 0x0602) + ELSEIF(WINDOWS_VERSION STREQUAL "WIN7") + SET(NTDDI_VERSION 0x06010000) + SET(_WIN32_WINNT 0x0601) + SET(WINVER 0x0601) + ELSEIF(WINDOWS_VERSION STREQUAL "WS08") + SET(NTDDI_VERSION 0x06000100) + SET(_WIN32_WINNT 0x0600) + SET(WINVER 0x0600) + ELSEIF(WINDOWS_VERSION STREQUAL "VISTA") + SET(NTDDI_VERSION 0x06000000) + SET(_WIN32_WINNT 0x0600) + SET(WINVER 0x0600) + ELSEIF(WINDOWS_VERSION STREQUAL "WS03") + SET(NTDDI_VERSION 0x05020000) + SET(_WIN32_WINNT 0x0502) + SET(WINVER 0x0502) + ELSEIF(WINDOWS_VERSION STREQUAL "WINXP") + SET(NTDDI_VERSION 0x05010000) + SET(_WIN32_WINNT 0x0501) + SET(WINVER 0x0501) + ELSE(WINDOWS_VERSION STREQUAL "WIN8") + # Default to Windows Server 2003 API if we don't recognize the specifier + SET(NTDDI_VERSION 0x05020000) + SET(_WIN32_WINNT 0x0502) + SET(WINVER 0x0502) + ENDIF(WINDOWS_VERSION STREQUAL "WIN8") +ENDIF(WIN32) + +IF(MSVC) + IF(ENABLE_SAFESEH STREQUAL "YES") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH") + SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH") + SET(ENV{LDFLAGS} "$ENV{LDFLAGS} /SAFESEH") + ELSEIF(ENABLE_SAFESEH STREQUAL "NO") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") + SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO") + SET(ENV{LDFLAGS} "$ENV{LDFLAGS} /SAFESEH:NO") + ENDIF(ENABLE_SAFESEH STREQUAL "YES") +ENDIF(MSVC) + +IF("${CMAKE_C_PLATFORM_ID}" MATCHES "^(HP-UX)$") + ADD_DEFINITIONS(-D_XOPEN_SOURCE=500) # Ask wchar.h for mbstate_t +ENDIF() + +# +INCLUDE(CheckCSourceCompiles) +INCLUDE(CheckCSourceRuns) +INCLUDE(CheckFileOffsetBits) +INCLUDE(CheckFuncs) +INCLUDE(CheckHeaderDirent) +INCLUDE(CheckIncludeFile) +INCLUDE(CheckIncludeFiles) +INCLUDE(CheckLibraryExists) +INCLUDE(CheckStructHasMember) +INCLUDE(CheckSymbolExists) +INCLUDE(CheckTypeExists) +INCLUDE(CheckTypeSize) + +# +# Generate list.h +# +MACRO (GENERATE_LIST_H _listfile _cmlist __list_sources) + SET(_argv ${ARGV}) + # Remove _listfile and _cmlist from _argv + LIST(REMOVE_AT _argv 0 1) + IF (NOT EXISTS "${_listfile}" OR + ${_cmlist} IS_NEWER_THAN "${_listfile}") + + MESSAGE(STATUS "Generating ${_listfile}") + FILE(WRITE ${_listfile} "") + FOREACH (testfile ${_argv}) + IF (testfile MATCHES "^test_[^/]+[.]c$") + FILE(STRINGS ${testfile} testvar REGEX "^DEFINE_TEST") + FOREACH (deftest ${testvar}) + FILE(APPEND ${_listfile} "${deftest}\n") + ENDFOREACH (deftest) + ENDIF (testfile MATCHES "^test_[^/]+[.]c$") + ENDFOREACH (testfile) + + ENDIF (NOT EXISTS "${_listfile}" OR + ${_cmlist} IS_NEWER_THAN "${_listfile}") +ENDMACRO (GENERATE_LIST_H) +# +# Generate installation rules for man pages. +# +MACRO (INSTALL_MAN __mans) + FOREACH (_man ${ARGV}) + STRING(REGEX REPLACE "^.+[.]([1-9])" "\\1" _mansect ${_man}) + INSTALL(FILES ${_man} DESTINATION "share/man/man${_mansect}") + ENDFOREACH (_man) +ENDMACRO (INSTALL_MAN __mans) +# +# Find out what macro is needed to use libraries on Windows. +# +MACRO (TRY_MACRO_FOR_LIBRARY INCLUDES LIBRARIES + TRY_TYPE SAMPLE_SOURCE MACRO_LIST) + IF(WIN32 AND NOT CYGWIN) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + SET(CMAKE_REQUIRED_INCLUDES ${INCLUDES}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBRARIES}) + FOREACH(VAR ${MACRO_LIST}) + # Clear ${VAR} from CACHE If the libraries which ${VAR} was + # checked with are changed. + SET(VAR_WITH_LIB "${VAR}_WITH_LIB") + GET_PROPERTY(PREV_VAR_WITH_LIB VARIABLE PROPERTY ${VAR_WITH_LIB}) + IF(NOT "${PREV_VAR_WITH_LIB}" STREQUAL "${LIBRARIES}") + UNSET(${VAR} CACHE) + ENDIF(NOT "${PREV_VAR_WITH_LIB}" STREQUAL "${LIBRARIES}") + # Check if the library can be used with the macro. + IF("${TRY_TYPE}" MATCHES "COMPILES") + CHECK_C_SOURCE_COMPILES("${SAMPLE_SOURCE}" ${VAR}) + ELSEIF("${TRY_TYPE}" MATCHES "RUNS") + CHECK_C_SOURCE_RUNS("${SAMPLE_SOURCE}" ${VAR}) + ELSE("${TRY_TYPE}" MATCHES "COMPILES") + MESSAGE(FATAL_ERROR "UNKNOWN KEYWORD \"${TRY_TYPE}\" FOR TRY_TYPE") + ENDIF("${TRY_TYPE}" MATCHES "COMPILES") + # Save the libraries which ${VAR} is checked with. + SET(${VAR_WITH_LIB} "${LIBRARIES}" CACHE INTERNAL + "Macro ${VAR} is checked with") + ENDFOREACH(VAR) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + ENDIF(WIN32 AND NOT CYGWIN) +ENDMACRO (TRY_MACRO_FOR_LIBRARY) +# +# Check compress/decompress libraries +# +IF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN) + # GnuWin32 is only for Win32, not Win64. + SET(__GNUWIN32PATH "C:/Program Files/GnuWin32") +ENDIF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN) +IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") + # You have to add a path availabel DLL file into PATH environment variable. + # Maybe DLL path is "C:/Program Files/GnuWin32/bin". + # The zlib and the bzip2 Setup program have installed programs and DLLs into + # "C:/Program Files/GnuWin32" by default. + # This is convenience setting for Windows. + SET(CMAKE_PREFIX_PATH ${__GNUWIN32PATH} $(CMAKE_PREFIX_PATH)) + # + # If you didn't use Setup program or installed into nonstandard path, + # cmake cannot find out your zlib or bzip2 libraries and include files, + # you should execute cmake with -DCMAKE_PREFIX_PATH option. + # e.g. + # cmake -DCMAKE_PREFIX_PATH= + # + # If compiling error occurred in zconf.h, You may need patch to zconf.h. + #--- zconf.h.orig 2005-07-21 00:40:26.000000000 + #+++ zconf.h 2009-01-19 11:39:10.093750000 + #@@ -286,7 +286,7 @@ + # + # #if 1 /* HAVE_UNISTD_H -- this line is updated by ./configure */ + # # include /* for off_t */ + #-# include /* for SEEK_* and off_t */ + #+# include /* for SEEK_* and off_t */ + # # ifdef VMS + # # include /* for off_t */ + # # endif +ENDIF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") + +SET(ADDITIONAL_LIBS "") +# +# Find ZLIB +# +IF(ENABLE_ZLIB) + FIND_PACKAGE(ZLIB) +ELSE() + SET(ZLIB_FOUND FALSE) # Override cached value +ENDIF() +IF(ZLIB_FOUND) + SET(HAVE_LIBZ 1) + SET(HAVE_ZLIB_H 1) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) + IF(WIN32 AND NOT CYGWIN) + # + # Test if ZLIB_WINAPI macro is needed to use. + # + TRY_MACRO_FOR_LIBRARY( + "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" + RUNS + "#include \nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" + ZLIB_WINAPI) + IF(ZLIB_WINAPI) + ADD_DEFINITIONS(-DZLIB_WINAPI) + ELSE(ZLIB_WINAPI) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" + COMPILES + "#include \nint main() {return zlibVersion()?1:0; }" + "ZLIB_DLL;WITHOUT_ZLIB_DLL") + IF(ZLIB_DLL) + ADD_DEFINITIONS(-DZLIB_DLL) + ENDIF(ZLIB_DLL) + ENDIF(ZLIB_WINAPI) + ENDIF(WIN32 AND NOT CYGWIN) +ENDIF(ZLIB_FOUND) +MARK_AS_ADVANCED(CLEAR ZLIB_INCLUDE_DIR) +MARK_AS_ADVANCED(CLEAR ZLIB_LIBRARY) +# +# Find BZip2 +# +IF(ENABLE_BZip2) + FIND_PACKAGE(BZip2) +ELSE() + SET(BZIP2_FOUND FALSE) # Override cached value +ENDIF() +IF(BZIP2_FOUND) + SET(HAVE_LIBBZ2 1) + SET(HAVE_BZLIB_H 1) + INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${BZIP2_LIBRARIES}) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${BZIP2_INCLUDE_DIR}" "${BZIP2_LIBRARIES}" + COMPILES + "#include \nint main() {return BZ2_bzlibVersion()?1:0; }" + "USE_BZIP2_DLL;USE_BZIP2_STATIC") + IF(USE_BZIP2_DLL) + ADD_DEFINITIONS(-DUSE_BZIP2_DLL) + ELSEIF(USE_BZIP2_STATIC) + ADD_DEFINITIONS(-DUSE_BZIP2_STATIC) + ENDIF(USE_BZIP2_DLL) +ENDIF(BZIP2_FOUND) +MARK_AS_ADVANCED(CLEAR BZIP2_INCLUDE_DIR) +MARK_AS_ADVANCED(CLEAR BZIP2_LIBRARIES) + + +# +# Find LZMA +# +IF(ENABLE_LZMA) + FIND_PACKAGE(LibLZMA) +ELSE() + SET(LIBZMA_FOUND FALSE) # Override cached value +ENDIF() + +IF(LIBLZMA_FOUND) + SET(HAVE_LIBLZMA 1) + SET(HAVE_LZMA_H 1) + SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES}) + INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS}) + LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES}) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${LIBLZMA_INCLUDE_DIRS}" "${LIBLZMA_LIBRARIES}" + COMPILES + "#include \nint main() {return (int)lzma_version_number(); }" + "WITHOUT_LZMA_API_STATIC;LZMA_API_STATIC") + IF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC) + ADD_DEFINITIONS(-DLZMA_API_STATIC) + ENDIF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC) +ELSE(LIBLZMA_FOUND) +# LZMA not found and will not be used. +ENDIF(LIBLZMA_FOUND) +# +# Find LZO2 +# +IF(ENABLE_LZO) + IF (LZO2_INCLUDE_DIR) + # Already in cache, be silent + SET(LZO2_FIND_QUIETLY TRUE) + ENDIF (LZO2_INCLUDE_DIR) + + FIND_PATH(LZO2_INCLUDE_DIR lzo/lzoconf.h) + FIND_LIBRARY(LZO2_LIBRARY NAMES lzo2 liblzo2) + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO2 DEFAULT_MSG LZO2_LIBRARY LZO2_INCLUDE_DIR) +ELSE(ENABLE_LZO) + SET(LZO2_FOUND FALSE) # Override cached value +ENDIF(ENABLE_LZO) +IF(LZO2_FOUND) + SET(HAVE_LIBLZO2 1) + SET(HAVE_LZO_LZOCONF_H 1) + SET(HAVE_LZO_LZO1X_H 1) + INCLUDE_DIRECTORIES(${LZO2_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${LZO2_LIBRARY}) + # + # TODO: test for static library. + # +ENDIF(LZO2_FOUND) +MARK_AS_ADVANCED(CLEAR LZO2_INCLUDE_DIR) +MARK_AS_ADVANCED(CLEAR LZO2_LIBRARY) +# +# Find LZ4 +# +IF(ENABLE_LZ4) + IF (LZ4_INCLUDE_DIR) + # Already in cache, be silent + SET(LZ4_FIND_QUIETLY TRUE) + ENDIF (LZ4_INCLUDE_DIR) + + FIND_PATH(LZ4_INCLUDE_DIR lz4.h) + FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4) + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR) +ELSE(ENABLE_LZ4) + SET(LZ4_FOUND FALSE) # Override cached value +ENDIF(ENABLE_LZ4) +IF(LZ4_FOUND) + SET(HAVE_LIBLZ4 1) + SET(HAVE_LZ4_H 1) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + SET(CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIR}) + CHECK_INCLUDE_FILES("lz4hc.h" HAVE_LZ4HC_H) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + INCLUDE_DIRECTORIES(${LZ4_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${LZ4_LIBRARY}) + # + # TODO: test for static library. + # +ENDIF(LZ4_FOUND) +MARK_AS_ADVANCED(CLEAR LZ4_INCLUDE_DIR) +MARK_AS_ADVANCED(CLEAR LZ4_LIBRARY) +# +# Find Zstd +# +IF (ZSTD_INCLUDE_DIR) + # Already in cache, be silent + SET(ZSTD_FIND_QUIETLY TRUE) +ENDIF (ZSTD_INCLUDE_DIR) + +FIND_PATH(ZSTD_INCLUDE_DIR zstd.h) +FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd libzstd) +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZSTD DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR) +IF(ZSTD_FOUND) + SET(HAVE_ZSTD_H 1) + INCLUDE_DIRECTORIES(${ZSTD_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZSTD_LIBRARY}) + SET(CMAKE_REQUIRED_LIBRARIES ${ZSTD_LIBRARY}) + SET(CMAKE_REQUIRED_INCLUDES ${ZSTD_INCLUDE_DIR}) + CHECK_FUNCTION_EXISTS(ZSTD_compressStream HAVE_LIBZSTD) + # + # TODO: test for static library. + # +ENDIF(ZSTD_FOUND) +MARK_AS_ADVANCED(CLEAR ZSTD_INCLUDE_DIR) +MARK_AS_ADVANCED(CLEAR ZSTD_LIBRARY) + +# +# Check headers +# +CHECK_HEADER_DIRENT() + +SET(INCLUDES "") +MACRO (LA_CHECK_INCLUDE_FILE header var) + CHECK_INCLUDE_FILES("${INCLUDES};${header}" ${var}) + IF (${var}) + SET(INCLUDES ${INCLUDES} ${header}) + ENDIF (${var}) +ENDMACRO (LA_CHECK_INCLUDE_FILE) + +# Some FreeBSD headers assume sys/types.h was already included. +LA_CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H) + +# Alphabetize the rest unless there's a compelling reason +LA_CHECK_INCLUDE_FILE("acl/libacl.h" HAVE_ACL_LIBACL_H) +LA_CHECK_INCLUDE_FILE("attr/xattr.h" HAVE_ATTR_XATTR_H) +LA_CHECK_INCLUDE_FILE("ctype.h" HAVE_CTYPE_H) +LA_CHECK_INCLUDE_FILE("copyfile.h" HAVE_COPYFILE_H) +LA_CHECK_INCLUDE_FILE("direct.h" HAVE_DIRECT_H) +LA_CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H) +LA_CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H) +LA_CHECK_INCLUDE_FILE("ext2fs/ext2_fs.h" HAVE_EXT2FS_EXT2_FS_H) + +CHECK_C_SOURCE_COMPILES("#include +#include +int main(void) { return EXT2_IOC_GETFLAGS; }" HAVE_WORKING_EXT2_IOC_GETFLAGS) + +LA_CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H) +LA_CHECK_INCLUDE_FILE("grp.h" HAVE_GRP_H) +LA_CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H) +LA_CHECK_INCLUDE_FILE("io.h" HAVE_IO_H) +LA_CHECK_INCLUDE_FILE("langinfo.h" HAVE_LANGINFO_H) +LA_CHECK_INCLUDE_FILE("limits.h" HAVE_LIMITS_H) +LA_CHECK_INCLUDE_FILE("linux/types.h" HAVE_LINUX_TYPES_H) +LA_CHECK_INCLUDE_FILE("linux/fiemap.h" HAVE_LINUX_FIEMAP_H) +LA_CHECK_INCLUDE_FILE("linux/fs.h" HAVE_LINUX_FS_H) + +CHECK_C_SOURCE_COMPILES("#include +#include +int main(void) { return FS_IOC_GETFLAGS; }" HAVE_WORKING_FS_IOC_GETFLAGS) + +LA_CHECK_INCLUDE_FILE("linux/magic.h" HAVE_LINUX_MAGIC_H) +LA_CHECK_INCLUDE_FILE("locale.h" HAVE_LOCALE_H) +LA_CHECK_INCLUDE_FILE("membership.h" HAVE_MEMBERSHIP_H) +LA_CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H) +LA_CHECK_INCLUDE_FILE("paths.h" HAVE_PATHS_H) +LA_CHECK_INCLUDE_FILE("poll.h" HAVE_POLL_H) +LA_CHECK_INCLUDE_FILE("process.h" HAVE_PROCESS_H) +LA_CHECK_INCLUDE_FILE("pthread.h" HAVE_PTHREAD_H) +LA_CHECK_INCLUDE_FILE("pwd.h" HAVE_PWD_H) +LA_CHECK_INCLUDE_FILE("readpassphrase.h" HAVE_READPASSPHRASE_H) +LA_CHECK_INCLUDE_FILE("regex.h" HAVE_REGEX_H) +LA_CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H) +LA_CHECK_INCLUDE_FILE("spawn.h" HAVE_SPAWN_H) +LA_CHECK_INCLUDE_FILE("stdarg.h" HAVE_STDARG_H) +LA_CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H) +LA_CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H) +LA_CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H) +LA_CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H) +LA_CHECK_INCLUDE_FILE("sys/acl.h" HAVE_SYS_ACL_H) +LA_CHECK_INCLUDE_FILE("sys/cdefs.h" HAVE_SYS_CDEFS_H) +LA_CHECK_INCLUDE_FILE("sys/extattr.h" HAVE_SYS_EXTATTR_H) +LA_CHECK_INCLUDE_FILE("sys/ioctl.h" HAVE_SYS_IOCTL_H) +LA_CHECK_INCLUDE_FILE("sys/mkdev.h" HAVE_SYS_MKDEV_H) +LA_CHECK_INCLUDE_FILE("sys/mount.h" HAVE_SYS_MOUNT_H) +LA_CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H) +LA_CHECK_INCLUDE_FILE("sys/poll.h" HAVE_SYS_POLL_H) +LA_CHECK_INCLUDE_FILE("sys/richacl.h" HAVE_SYS_RICHACL_H) +LA_CHECK_INCLUDE_FILE("sys/select.h" HAVE_SYS_SELECT_H) +LA_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H) +LA_CHECK_INCLUDE_FILE("sys/statfs.h" HAVE_SYS_STATFS_H) +LA_CHECK_INCLUDE_FILE("sys/statvfs.h" HAVE_SYS_STATVFS_H) +LA_CHECK_INCLUDE_FILE("sys/sysmacros.h" HAVE_SYS_SYSMACROS_H) +LA_CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H) +LA_CHECK_INCLUDE_FILE("sys/utime.h" HAVE_SYS_UTIME_H) +LA_CHECK_INCLUDE_FILE("sys/utsname.h" HAVE_SYS_UTSNAME_H) +LA_CHECK_INCLUDE_FILE("sys/vfs.h" HAVE_SYS_VFS_H) +LA_CHECK_INCLUDE_FILE("sys/wait.h" HAVE_SYS_WAIT_H) +LA_CHECK_INCLUDE_FILE("sys/xattr.h" HAVE_SYS_XATTR_H) +LA_CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H) +LA_CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) +LA_CHECK_INCLUDE_FILE("utime.h" HAVE_UTIME_H) +LA_CHECK_INCLUDE_FILE("wchar.h" HAVE_WCHAR_H) +LA_CHECK_INCLUDE_FILE("wctype.h" HAVE_WCTYPE_H) +LA_CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H) +IF(ENABLE_CNG) + LA_CHECK_INCLUDE_FILE("Bcrypt.h" HAVE_BCRYPT_H) + IF(HAVE_BCRYPT_H) + LIST(APPEND ADDITIONAL_LIBS "Bcrypt") + ENDIF(HAVE_BCRYPT_H) +ELSE(ENABLE_CNG) + UNSET(HAVE_BCRYPT_H CACHE) +ENDIF(ENABLE_CNG) +# Following files need windows.h, so we should test it after windows.h test. +LA_CHECK_INCLUDE_FILE("wincrypt.h" HAVE_WINCRYPT_H) +LA_CHECK_INCLUDE_FILE("winioctl.h" HAVE_WINIOCTL_H) + +# +# Check whether use of __EXTENSIONS__ is safe. +# We need some macro such as _GNU_SOURCE to use extension functions. +# +SET(_INCLUDE_FILES) +FOREACH (it ${_HEADER}) + SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") +ENDFOREACH (it) + +CHECK_C_SOURCE_COMPILES( + "#define __EXTENSIONS__ 1 + ${_INCLUDE_FILES} + int main() { return 0;}" + SAFE_TO_DEFINE_EXTENSIONS) + +# +# Find Nettle +# +IF(ENABLE_NETTLE) + FIND_PACKAGE(Nettle) + IF(NETTLE_FOUND) + SET(HAVE_LIBNETTLE 1) + LIST(APPEND ADDITIONAL_LIBS ${NETTLE_LIBRARIES}) + INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR}) + + LIST(APPEND CMAKE_REQUIRED_INCLUDES ${NETTLE_INCLUDE_DIR}) + LA_CHECK_INCLUDE_FILE("nettle/aes.h" HAVE_NETTLE_AES_H) + LA_CHECK_INCLUDE_FILE("nettle/hmac.h" HAVE_NETTLE_HMAC_H) + LA_CHECK_INCLUDE_FILE("nettle/md5.h" HAVE_NETTLE_MD5_H) + LA_CHECK_INCLUDE_FILE("nettle/pbkdf2.h" HAVE_NETTLE_PBKDF2_H) + LA_CHECK_INCLUDE_FILE("nettle/ripemd160.h" HAVE_NETTLE_RIPEMD160_H) + LA_CHECK_INCLUDE_FILE("nettle/sha.h" HAVE_NETTLE_SHA_H) + + ENDIF(NETTLE_FOUND) + MARK_AS_ADVANCED(CLEAR NETTLE_INCLUDE_DIR) + MARK_AS_ADVANCED(CLEAR NETTLE_LIBRARIES) +ENDIF(ENABLE_NETTLE) + +# +# Find OpenSSL +# (Except on Mac, where OpenSSL is deprecated.) +# +IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(HAVE_LIBCRYPTO 1) + INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_CRYPTO_LIBRARY}) + ENDIF(OPENSSL_FOUND) +ELSE() + SET(OPENSSL_FOUND FALSE) # Override cached value +ENDIF() + +# FreeBSD libmd +IF(NOT OPENSSL_FOUND) + CHECK_LIBRARY_EXISTS(md "MD5Init" "" LIBMD_FOUND) + IF(LIBMD_FOUND) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + SET(CMAKE_REQUIRED_LIBRARIES "md") + FIND_LIBRARY(LIBMD_LIBRARY NAMES md) + LIST(APPEND ADDITIONAL_LIBS ${LIBMD_LIBRARY}) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + ENDIF(LIBMD_FOUND) +ENDIF(NOT OPENSSL_FOUND) + +# +# How to prove that CRYPTO functions, which have several names on various +# platforms, just see if archive_digest.c can compile and link against +# required libraries. +# +MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + FOREACH(ALGORITHM ${ALGORITHMS}) + IF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) + STRING(TOLOWER "${ALGORITHM}" lower_algorithm) + STRING(TOUPPER "${ALGORITHM}" algorithm) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND NOT OPENSSL_FOUND) + SET(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} FALSE) + ELSEIF("${IMPLEMENTATION}" MATCHES "^NETTLE$" AND NOT NETTLE_FOUND) + SET(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} FALSE) + ENDIF("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND NOT OPENSSL_FOUND) + + IF(NOT DEFINED ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + # Probe the local implementation for whether this + # crypto implementation is available on this platform. + SET(TRY_CRYPTO_REQUIRED_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive;${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp") + SET(TRY_CRYPTO_REQUIRED_LIBS) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + SET(TRY_CRYPTO_REQUIRED_INCLUDES + "${TRY_CRYPTO_REQUIRED_INCLUDES};${OPENSSL_INCLUDE_DIR}") + SET(TRY_CRYPTO_REQUIRED_LIBS + "-DLINK_LIBRARIES:STRING=${OPENSSL_LIBRARIES}") + ELSEIF("${IMPLEMENTATION}" MATCHES "^NETTLE$" AND NETTLE_FOUND) + SET(TRY_CRYPTO_REQUIRED_INCLUDES + "${TRY_CRYPTO_REQUIRED_INCLUDES};${NETTLE_INCLUDE_DIR}") + SET(TRY_CRYPTO_REQUIRED_LIBS + "-DLINK_LIBRARIES:STRING=${NETTLE_LIBRARY}") + ELSEIF("${IMPLEMENTATION}" MATCHES "^LIBMD$" AND LIBMD_FOUND) + SET(TRY_CRYPTO_REQUIRED_LIBS + "-DLINK_LIBRARIES:STRING=${LIBMD_LIBRARY}") + ENDIF("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h) + FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h" + CONFDEFS_H) + FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/libarchive/archive_digest.c" + ARCHIVE_CRYPTO_C) + + SET(SOURCE "${CONFDEFS_H} + +#define ARCHIVE_${algorithm}_COMPILE_TEST +#define ARCHIVE_CRYPTO_${algorithm}_${IMPLEMENTATION} +#define PLATFORM_CONFIG_H \"check_crypto_md.h\" + +${ARCHIVE_CRYPTO_C} + +int +main(int argc, char **argv) +{ + archive_${lower_algorithm}_ctx ctx; + archive_${lower_algorithm}_init(&ctx); + archive_${lower_algorithm}_update(&ctx, *argv, argc); + archive_${lower_algorithm}_final(&ctx, NULL); + return 0; +} +") + + FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.h" "") + FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.c" "${SOURCE}") + MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}") + + TRY_COMPILE(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.c + CMAKE_FLAGS + "${TRY_CRYPTO_REQUIRED_LIBS}" + "${TRY_CRYPTO_REQUIRED_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + + # Inform user whether or not we found it; if not, log why we didn't. + IF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} -- found") + SET(ARCHIVE_CRYPTO_${ALGORITHM} 1) + ELSE (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} -- not found") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} failed with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n") + ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + ENDIF(NOT DEFINED ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + + # Add appropriate libs/includes depending on whether the implementation + # was found on this platform. + IF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES}) + LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS) + ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) + ENDFOREACH(ALGORITHM ${ALGORITHMS}) +ENDMACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + +# +# CRYPTO functions on Windows is defined at archive_windows.c, thus we do not +# need the test what the functions can be mapped to archive_{crypto name}_init, +# archive_{crypto name}_update and archive_{crypto name}_final. +# The functions on Windows use CALG_{crypto name} macro to create a crypt object +# and then we need to know what CALG_{crypto name} macros is available to show +# ARCHIVE_CRYPTO_{crypto name}_WIN macros because Windows 2000 and earlier version +# of Windows XP do not support SHA256, SHA384 and SHA512. +# +MACRO(CHECK_CRYPTO_WIN CRYPTO_LIST) + IF(WIN32 AND NOT CYGWIN) + FOREACH(CRYPTO ${CRYPTO_LIST}) + IF(NOT ARCHIVE_CRYPTO_${CRYPTO}) + IF(NOT DEFINED ARCHIVE_CRYPTO_${CRYPTO}_WIN) + STRING(TOUPPER "${CRYPTO}" crypto) + SET(ALGID "") + IF ("${CRYPTO}" MATCHES "^MD5$") + SET(ALGID "CALG_MD5") + ENDIF ("${CRYPTO}" MATCHES "^MD5$") + IF ("${CRYPTO}" MATCHES "^SHA1$") + SET(ALGID "CALG_SHA1") + ENDIF ("${CRYPTO}" MATCHES "^SHA1$") + IF ("${CRYPTO}" MATCHES "^SHA256$") + SET(ALGID "CALG_SHA_256") + ENDIF ("${CRYPTO}" MATCHES "^SHA256$") + IF ("${CRYPTO}" MATCHES "^SHA384$") + SET(ALGID "CALG_SHA_384") + ENDIF ("${CRYPTO}" MATCHES "^SHA384$") + IF ("${CRYPTO}" MATCHES "^SHA512$") + SET(ALGID "CALG_SHA_512") + ENDIF ("${CRYPTO}" MATCHES "^SHA512$") + + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h) + FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h" + CONFDEFS_H) + + SET(SOURCE "${CONFDEFS_H} + +#define ${crypto}_COMPILE_TEST +#include +#include + +int +main(int argc, char **argv) +{ + return ${ALGID}; +} +") + SET(SOURCE_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_win.c") + + FILE(WRITE "${SOURCE_FILE}" "${SOURCE}") + MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN") + + TRY_COMPILE(ARCHIVE_CRYPTO_${CRYPTO}_WIN + ${CMAKE_BINARY_DIR} + ${SOURCE_FILE} + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive" + OUTPUT_VARIABLE OUTPUT) + + IF (ARCHIVE_CRYPTO_${CRYPTO}_WIN) + MESSAGE(STATUS + "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN -- found") + SET(ARCHIVE_CRYPTO_${CRYPTO} 1) + ELSE (ARCHIVE_CRYPTO_${CRYPTO}_WIN) + MESSAGE(STATUS + "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN -- not found") + FILE(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN failed with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n") + ENDIF (ARCHIVE_CRYPTO_${CRYPTO}_WIN) + + ENDIF(NOT DEFINED ARCHIVE_CRYPTO_${CRYPTO}_WIN) + ENDIF(NOT ARCHIVE_CRYPTO_${CRYPTO}) + ENDFOREACH(CRYPTO) + ENDIF(WIN32 AND NOT CYGWIN) +ENDMACRO(CHECK_CRYPTO_WIN CRYPTO_LIST) + +# +# Find iconv +# POSIX defines the second arg as const char ** +# and requires it to be in libc. But we can accept +# a non-const argument here and can support iconv() +# being in libiconv. +# +MACRO(CHECK_ICONV LIB TRY_ICONV_CONST) + IF(NOT HAVE_ICONV) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR + CMAKE_C_COMPILER_ID MATCHES "^Clang$") + # + # During checking iconv proto type, we should use -Werror to avoid the + # success of iconv detection with a warnig which success is a miss + # detection. So this needs for all build mode(even it's a release mode). + # + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") + ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR + CMAKE_C_COMPILER_ID MATCHES "^Clang$") + IF (CMAKE_C_COMPILER_ID MATCHES "^XL$") + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -qhalt=w -qflag=w:w") + ENDIF (CMAKE_C_COMPILER_ID MATCHES "^XL$") + IF (MSVC) + # NOTE: /WX option is the same as gcc's -Werror option. + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /WX") + ENDIF (MSVC) + # + CHECK_C_SOURCE_COMPILES( + "#include + #include + int main() { + ${TRY_ICONV_CONST} char *ccp; + iconv_t cd = iconv_open(\"\", \"\"); + iconv(cd, &ccp, (size_t *)0, (char **)0, (size_t *)0); + iconv_close(cd); + return 0; + }" + HAVE_ICONV_${LIB}_${TRY_ICONV_CONST}) + IF(HAVE_ICONV_${LIB}_${TRY_ICONV_CONST}) + SET(HAVE_ICONV true) + SET(ICONV_CONST ${TRY_ICONV_CONST}) + ENDIF(HAVE_ICONV_${LIB}_${TRY_ICONV_CONST}) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + ENDIF(NOT HAVE_ICONV) +ENDMACRO(CHECK_ICONV TRY_ICONV_CONST) + +IF(ENABLE_ICONV) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + FIND_PATH(ICONV_INCLUDE_DIR iconv.h) + IF(ICONV_INCLUDE_DIR) + #SET(INCLUDES ${INCLUDES} "iconv.h") + SET(HAVE_ICONV_H 1) + INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR}) + SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) + CHECK_ICONV("libc" "const") + CHECK_ICONV("libc" "") + + # If iconv isn't in libc and we have a libiconv, try that. + FIND_LIBRARY(LIBICONV_PATH NAMES iconv libiconv) + IF(NOT HAVE_ICONV AND LIBICONV_PATH) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBICONV_PATH}) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${ICONV_INCLUDE_DIR}" "${LIBICONV_PATH}" + COMPILES + "#include \nint main() {return iconv_close((iconv_t)0);}" + "WITHOUT_LIBICONV_STATIC;LIBICONV_STATIC") + IF(NOT WITHOUT_LIBICONV_STATIC AND LIBICONV_STATIC) + ADD_DEFINITIONS(-DLIBICONV_STATIC) + ENDIF(NOT WITHOUT_LIBICONV_STATIC AND LIBICONV_STATIC) + # + # Set up CMAKE_REQUIRED_* for CHECK_ICONV + # + SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBICONV_PATH}) + IF(LIBICONV_STATIC) + # LIBICONV_STATIC is necessary for the success of CHECK_ICONV + # on Windows. + SET(CMAKE_REQUIRED_DEFINITIONS "-DLIBICONV_STATIC") + ELSE(LIBICONV_STATIC) + SET(CMAKE_REQUIRED_DEFINITIONS) + ENDIF(LIBICONV_STATIC) + CHECK_ICONV("libiconv" "const") + CHECK_ICONV("libiconv" "") *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Sep 7 07:50:38 2018 Return-Path: Delivered-To: svn-src-all@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 47AD1FF347F; Fri, 7 Sep 2018 07:50:38 +0000 (UTC) (envelope-from Alexander@leidinger.net) Received: from mailgate.Leidinger.net (bastille.leidinger.net [89.238.82.207]) (using TLSv1.2 with cipher DHE-RSA-CAMELLIA128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCACE7E996; Fri, 7 Sep 2018 07:50:37 +0000 (UTC) (envelope-from Alexander@leidinger.net) Date: Fri, 07 Sep 2018 09:50:10 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=leidinger.net; s=outgoing-alex; t=1536306629; bh=K2e+YbsWwDcKBPKELISWQ8/QvaxulAc9gMz6aFSfgLI=; h=Date:From:To:Cc:Subject:In-Reply-To; b=caEygB2N4l3Ykf++wFvNdh0r5teG8U2BGVvYVyNfydIbhxzOj3O5eipqopikBsy52 d31R2F3f7AgGUNZ5KiHXHVTQoAk5ZKW4Rvcl1lLuu9v5PUI8jboJqLlU0yaC+v4sOJ UBOykl+KrR0a3FMo2b48yo1JlpSeluDhZaXpt5yFyqOq/VEfiBvQM94EVhnpxBVLxc Ry0LDgzRJKD0T5knkgFkX/5Xh1aI4jzyw1a2+BGx8wni5iNWFIRX2A5gd4EUdIyEOx ztqSEIne8+ZhkpDHKTZTUa3sA6CYS3NM8UD1lnpEK/j5WyHM2BRdS99Y5t0YKHORdH OPirB6hTb9HLg== Message-ID: <20180907095010.Horde.LHANrMIgb7RjrRNYbtaBqYT@webmail.leidinger.net> From: Alexander Leidinger To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r338507 - in head/sys: sys vm In-Reply-To: <201809061928.w86JSrSb067799@repo.freebsd.org> User-Agent: Horde Application Framework 5 Accept-Language: de,en Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 07:50:38 -0000 Quoting Mark Johnston (from Thu, 6 Sep 2018 19:28:53 +0000 (UTC)): > Author: markj > Date: Thu Sep 6 19:28:52 2018 > New Revision: 338507 > URL: https://svnweb.freebsd.org/changeset/base/338507 > > Log: > Avoid resource deadlocks when one domain has exhausted its memory. Attempt > other allowed domains if the requested domain is below the minimum paging > threshold. Block in fork only if all domains available to the forking > thread are below the severe threshold rather than any. Could the problem you fixed manifest itself in e.g. a hanging system due to not enough memory free despite top displaying a lot of memory free (let's assume 2 memory domains and several gigs in both)? I have a system which never went below a specific amount of memory (before the fix of the no-rebalancing bug in the scheduler) if NUMA was enabled. With NUMA disabled I see much less memory free. I haven't tried NUMA after the fix of the scheduler, but would give it a try again if you think this could be a manifestation of the problem. Bye, Alexander. -- http://www.Leidinger.net Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF http://www.FreeBSD.org netchild@FreeBSD.org : PGP 0x8F31830F9F2772BF From owner-svn-src-all@freebsd.org Fri Sep 7 10:34:28 2018 Return-Path: Delivered-To: svn-src-all@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 B5BB3FF7582; Fri, 7 Sep 2018 10:34:28 +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 69BBC83E45; Fri, 7 Sep 2018 10:34:28 +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 5F4221AC26; Fri, 7 Sep 2018 10:34:28 +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 w87AYS8v040351; Fri, 7 Sep 2018 10:34:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w87AYSp3040350; Fri, 7 Sep 2018 10:34:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809071034.w87AYSp3040350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 7 Sep 2018 10:34: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: r338521 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 338521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 10:34:28 -0000 Author: kib Date: Fri Sep 7 10:34:27 2018 New Revision: 338521 URL: https://svnweb.freebsd.org/changeset/base/338521 Log: MFC r338459: amd64: For non-PTI mode, do not initialize PCPU kcr3 to KPML4phys. Modified: stable/11/sys/amd64/amd64/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Fri Sep 7 00:12:46 2018 (r338520) +++ stable/11/sys/amd64/amd64/pmap.c Fri Sep 7 10:34:27 2018 (r338521) @@ -7526,9 +7526,13 @@ pmap_activate_boot(pmap_t pmap) CPU_SET(cpuid, &pmap->pm_active); #endif PCPU_SET(curpmap, pmap); - kcr3 = pmap->pm_cr3; - if (pmap_pcid_enabled) - kcr3 |= pmap->pm_pcids[cpuid].pm_pcid | CR3_PCID_SAVE; + if (pti) { + kcr3 = pmap->pm_cr3; + if (pmap_pcid_enabled) + kcr3 |= pmap->pm_pcids[cpuid].pm_pcid | CR3_PCID_SAVE; + } else { + kcr3 = PMAP_NO_CR3; + } PCPU_SET(kcr3, kcr3); PCPU_SET(ucr3, PMAP_NO_CR3); } From owner-svn-src-all@freebsd.org Fri Sep 7 14:37:44 2018 Return-Path: Delivered-To: svn-src-all@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 E11E9FFC888; Fri, 7 Sep 2018 14:37: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 920398BE00; Fri, 7 Sep 2018 14:37: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 8644F1D2CB; Fri, 7 Sep 2018 14:37: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 w87EbiWW062599; Fri, 7 Sep 2018 14:37:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w87Ebi0C062598; Fri, 7 Sep 2018 14:37:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809071437.w87Ebi0C062598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 7 Sep 2018 14:37:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338522 - head/sbin/sysctl X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sbin/sysctl X-SVN-Commit-Revision: 338522 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 14:37:45 -0000 Author: kib Date: Fri Sep 7 14:37:44 2018 New Revision: 338522 URL: https://svnweb.freebsd.org/changeset/base/338522 Log: Trim whitespace. Approved by: re (gjb) Modified: head/sbin/sysctl/sysctl.c Modified: head/sbin/sysctl/sysctl.c ============================================================================== --- head/sbin/sysctl/sysctl.c Fri Sep 7 10:34:27 2018 (r338521) +++ head/sbin/sysctl/sysctl.c Fri Sep 7 14:37:44 2018 (r338522) @@ -717,7 +717,7 @@ S_efi_map(size_t l2, void *p) } efihdr = p; efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf; - map = (struct efi_md *)((uint8_t *)efihdr + efisz); + map = (struct efi_md *)((uint8_t *)efihdr + efisz); if (efihdr->descriptor_size == 0) return (0); @@ -725,7 +725,7 @@ S_efi_map(size_t l2, void *p) warnx("S_efi_map length mismatch %zu vs %zu", l2, efisz + efihdr->memory_size); return (1); - } + } ndesc = efihdr->memory_size / efihdr->descriptor_size; printf("\n%23s %12s %12s %8s %4s", From owner-svn-src-all@freebsd.org Fri Sep 7 15:09:57 2018 Return-Path: Delivered-To: svn-src-all@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 32CEEFFD590; Fri, 7 Sep 2018 15:09:57 +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 DD3EC8D12F; Fri, 7 Sep 2018 15:09:56 +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 D82ED1D7A5; Fri, 7 Sep 2018 15:09:56 +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 w87F9uSb078086; Fri, 7 Sep 2018 15:09:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w87F9uEO078085; Fri, 7 Sep 2018 15:09:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809071509.w87F9uEO078085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 7 Sep 2018 15:09:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338523 - head/sbin/sysctl X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sbin/sysctl X-SVN-Commit-Revision: 338523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 15:09:57 -0000 Author: kib Date: Fri Sep 7 15:09:56 2018 New Revision: 338523 URL: https://svnweb.freebsd.org/changeset/base/338523 Log: Teach sysctl(8) about the Persistent memory type. Add PersistentMemory to the list of sysctl's known memory types when decoding an EFI memory map. Submitted by: D Scott Phillips MFC after: 1 week Approved by: re (rgrimes) Modified: head/sbin/sysctl/sysctl.c Modified: head/sbin/sysctl/sysctl.c ============================================================================== --- head/sbin/sysctl/sysctl.c Fri Sep 7 14:37:44 2018 (r338522) +++ head/sbin/sysctl/sysctl.c Fri Sep 7 15:09:56 2018 (r338523) @@ -704,7 +704,8 @@ S_efi_map(size_t l2, void *p) "ACPIMemoryNVS", "MemoryMappedIO", "MemoryMappedIOPortSpace", - "PalCode" + "PalCode", + "PersistentMemory" }; /* @@ -733,7 +734,7 @@ S_efi_map(size_t l2, void *p) for (i = 0; i < ndesc; i++, map = efi_next_descriptor(map, efihdr->descriptor_size)) { - if (map->md_type <= EFI_MD_TYPE_PALCODE) + if (map->md_type <= EFI_MD_TYPE_PERSISTENT) type = types[map->md_type]; else type = ""; From owner-svn-src-all@freebsd.org Fri Sep 7 15:48:02 2018 Return-Path: Delivered-To: svn-src-all@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 3BE5FFFE1BB; Fri, 7 Sep 2018 15:48:02 +0000 (UTC) (envelope-from rgrimes@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 E60F78E4D5; Fri, 7 Sep 2018 15:48:01 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 DC6AD1DE3E; Fri, 7 Sep 2018 15:48:01 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w87Fm1hD098875; Fri, 7 Sep 2018 15:48:01 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w87Fm1j8098874; Fri, 7 Sep 2018 15:48:01 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201809071548.w87Fm1j8098874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Fri, 7 Sep 2018 15:48:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338524 - head/tools/tools/build_option_survey X-SVN-Group: head X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: head/tools/tools/build_option_survey X-SVN-Commit-Revision: 338524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 15:48:02 -0000 Author: rgrimes Date: Fri Sep 7 15:48:01 2018 New Revision: 338524 URL: https://svnweb.freebsd.org/changeset/base/338524 Log: Remove rsync to phk's server Submitted by: dexter Approved by: re(gjb), phk (mentor) MFC after: 3 days Modified: head/tools/tools/build_option_survey/mkhtml.sh Modified: head/tools/tools/build_option_survey/mkhtml.sh ============================================================================== --- head/tools/tools/build_option_survey/mkhtml.sh Fri Sep 7 15:09:56 2018 (r338523) +++ head/tools/tools/build_option_survey/mkhtml.sh Fri Sep 7 15:48:01 2018 (r338524) @@ -219,6 +219,3 @@ echo ' ' >> $H echo "" >> $H - -echo "rsync phk" -rsync -r $HDIR/. phk@phk:www/misc/build_options From owner-svn-src-all@freebsd.org Fri Sep 7 15:52:21 2018 Return-Path: Delivered-To: svn-src-all@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 2C2F7FFE441; Fri, 7 Sep 2018 15:52:21 +0000 (UTC) (envelope-from rgrimes@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 D33848E90C; Fri, 7 Sep 2018 15:52:20 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 CE0221DFD4; Fri, 7 Sep 2018 15:52:20 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w87FqKsh003625; Fri, 7 Sep 2018 15:52:20 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w87FqKt0003624; Fri, 7 Sep 2018 15:52:20 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201809071552.w87FqKt0003624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Fri, 7 Sep 2018 15:52:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338525 - head/tools/tools/build_option_survey X-SVN-Group: head X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: head/tools/tools/build_option_survey X-SVN-Commit-Revision: 338525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 15:52:21 -0000 Author: rgrimes Date: Fri Sep 7 15:52:20 2018 New Revision: 338525 URL: https://svnweb.freebsd.org/changeset/base/338525 Log: Increase size of working imgfile from 250MB to 4GB Submitted by: dexter Approved by: re(gjb), phk (mentor) MFC after: 3 days Modified: head/tools/tools/build_option_survey/option_survey.sh Modified: head/tools/tools/build_option_survey/option_survey.sh ============================================================================== --- head/tools/tools/build_option_survey/option_survey.sh Fri Sep 7 15:48:01 2018 (r338524) +++ head/tools/tools/build_option_survey/option_survey.sh Fri Sep 7 15:52:20 2018 (r338525) @@ -118,7 +118,7 @@ trap "umount ${MNT} || true; mdconfig -d -u $MDUNIT" 1 umount $MNT || true mdconfig -d -u $MDUNIT || true -dd if=/dev/zero of=${ODIR}/imgfile bs=1m count=250 +dd if=/dev/zero of=${ODIR}/imgfile bs=1m count=4096 mdconfig -a -t vnode -f ${ODIR}/imgfile -u $MDUNIT # Build & install the reference world From owner-svn-src-all@freebsd.org Fri Sep 7 15:52:32 2018 Return-Path: Delivered-To: svn-src-all@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 B2DDFFFE468; Fri, 7 Sep 2018 15:52:32 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DBC6C8EA1F; Fri, 7 Sep 2018 15:52:31 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pf1-x432.google.com with SMTP id j8-v6so7220029pff.6; Fri, 07 Sep 2018 08:52:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=DUggq7dELOtCB5Jdr44+73kgvTHUNyIZ+3kIuenALOU=; b=Idm4M/JQR6d3hFUwNwQj0+hVoDJctfS82ob7O1amreNv1jgo7jQyFVtWzQeqTjjbdP VOkKF1b2oS0lg7kj2PuUuT3/8ekSZJ02rcK6uu/Fkb7uikpHR8KEZClAA7zzRxUCTnp9 /Df4NpGN34YfBvQy/Ogsa5hU8tznMusxUm3i5NtjH/aI+GjSDdcqUQ+SNfNw0vAE8htK YiiO/vLd1Z90sMI0jSPxksFZhR5lFecrYbSxWEW8JEk3gOmuhxteMYMMzN1BMjs6aEKG txmhh4F8uTVQgU5G4AkMv++kuMpaiWV4J3405PC/8Mb+8E9xzed+vE16Dp4JyK3er0qw XSpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=DUggq7dELOtCB5Jdr44+73kgvTHUNyIZ+3kIuenALOU=; b=txb7V5U/V99YZT30B1muvrmtlde/MMFIzkLKe+tcVhU4nR7mAvy9uTGQIF4c9BL728 4oeQhFntKp3xHTFWhosJVhOHQdiB9vs3gjnX0az/hnj0347RaFWWUFNj5hGRCjW+qpEB ug3SUYukXZwJkD/Pf80cvbACrmvG+ZrXIe61NkqT6QOVINwprWGPv6uFAZbJVGutu02F CT+Mj4ppoqpdyAiH++qe1FnUgVAY/8IA77an5jc9VoX9h77j+JwcPT1gDPVFmZap13l7 LEQODVKdQwfpKQjZ0ZBd863OGWORoDEf7t1nvUovCqI7Mik92biLBdrnVgNlaRg69LAV urQA== X-Gm-Message-State: APzg51B4e21Igq2KEJ3CHzoEqzXnWG1YOWYj8KtDQdLsS9eUxxx9oah9 6ek5nP19SbDZk0PdaZeN4vbi0Lkl X-Google-Smtp-Source: ANB0VdaNJ7PHRY+BkawTnr08HN1Z39+57X49xxLx0l4WZpMF0fzYtqAOFoWfcW0yMOeqCRNlun6m5A== X-Received: by 2002:a62:9bc9:: with SMTP id e70-v6mr9018464pfk.95.1536335550509; Fri, 07 Sep 2018 08:52:30 -0700 (PDT) Received: from raichu (toroon0560w-lp130-09-70-52-224-239.dsl.bell.ca. [70.52.224.239]) by smtp.gmail.com with ESMTPSA id g25-v6sm16850043pfd.23.2018.09.07.08.52.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 08:52:29 -0700 (PDT) Sender: Mark Johnston Date: Fri, 7 Sep 2018 11:52:24 -0400 From: Mark Johnston To: Alexander Leidinger Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r338507 - in head/sys: sys vm Message-ID: <20180907155224.GA63224@raichu> References: <201809061928.w86JSrSb067799@repo.freebsd.org> <20180907095010.Horde.LHANrMIgb7RjrRNYbtaBqYT@webmail.leidinger.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180907095010.Horde.LHANrMIgb7RjrRNYbtaBqYT@webmail.leidinger.net> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 15:52:32 -0000 On Fri, Sep 07, 2018 at 09:50:10AM +0200, Alexander Leidinger wrote: > Quoting Mark Johnston (from Thu, 6 Sep 2018 > 19:28:53 +0000 (UTC)): > > > Author: markj > > Date: Thu Sep 6 19:28:52 2018 > > New Revision: 338507 > > URL: https://svnweb.freebsd.org/changeset/base/338507 > > > > Log: > > Avoid resource deadlocks when one domain has exhausted its memory. Attempt > > other allowed domains if the requested domain is below the minimum paging > > threshold. Block in fork only if all domains available to the forking > > thread are below the severe threshold rather than any. > > Could the problem you fixed manifest itself in e.g. a hanging system > due to not enough memory free despite top displaying a lot of memory > free (let's assume 2 memory domains and several gigs in both)? Yes. > I have a system which never went below a specific amount of memory > (before the fix of the no-rebalancing bug in the scheduler) if NUMA > was enabled. With NUMA disabled I see much less memory free. I haven't > tried NUMA after the fix of the scheduler, but would give it a try > again if you think this could be a manifestation of the problem. I think it's worth trying again. From owner-svn-src-all@freebsd.org Fri Sep 7 16:00:25 2018 Return-Path: Delivered-To: svn-src-all@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 B77D5FFE70F; Fri, 7 Sep 2018 16:00:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DB4C8EDEC; Fri, 7 Sep 2018 16:00:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id D675410AFD2; Fri, 7 Sep 2018 12:00:21 -0400 (EDT) Subject: Re: svn commit: r338523 - head/sbin/sysctl To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201809071509.w87F9uEO078085@repo.freebsd.org> From: John Baldwin Message-ID: <8beb57f9-37dc-735c-fa85-78ecb67679ad@FreeBSD.org> Date: Fri, 7 Sep 2018 09:00:20 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <201809071509.w87F9uEO078085@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 07 Sep 2018 12:00:22 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 16:00:25 -0000 On 9/7/18 8:09 AM, Konstantin Belousov wrote: > Author: kib > Date: Fri Sep 7 15:09:56 2018 > New Revision: 338523 > URL: https://svnweb.freebsd.org/changeset/base/338523 > > Log: > Teach sysctl(8) about the Persistent memory type. > > Add PersistentMemory to the list of sysctl's known memory types > when decoding an EFI memory map. > > Submitted by: D Scott Phillips > MFC after: 1 week > Approved by: re (rgrimes) > > Modified: > head/sbin/sysctl/sysctl.c > > Modified: head/sbin/sysctl/sysctl.c > ============================================================================== > --- head/sbin/sysctl/sysctl.c Fri Sep 7 14:37:44 2018 (r338522) > +++ head/sbin/sysctl/sysctl.c Fri Sep 7 15:09:56 2018 (r338523) > @@ -704,7 +704,8 @@ S_efi_map(size_t l2, void *p) > "ACPIMemoryNVS", > "MemoryMappedIO", > "MemoryMappedIOPortSpace", > - "PalCode" > + "PalCode", > + "PersistentMemory" > }; > > /* > @@ -733,7 +734,7 @@ S_efi_map(size_t l2, void *p) > > for (i = 0; i < ndesc; i++, > map = efi_next_descriptor(map, efihdr->descriptor_size)) { > - if (map->md_type <= EFI_MD_TYPE_PALCODE) > + if (map->md_type <= EFI_MD_TYPE_PERSISTENT) Perhaps this should use nitems(types) instead? (And I believe it's my fault it didn't originally.) -- John Baldwin                                                                              From owner-svn-src-all@freebsd.org Fri Sep 7 16:26:20 2018 Return-Path: Delivered-To: svn-src-all@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 63552FFF151; Fri, 7 Sep 2018 16:26:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E20A98FE73; Fri, 7 Sep 2018 16:26:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w87GQ9Db057171 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 7 Sep 2018 19:26:12 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w87GQ9Db057171 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w87GQ8xt057170; Fri, 7 Sep 2018 19:26:08 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 7 Sep 2018 19:26:08 +0300 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r338523 - head/sbin/sysctl Message-ID: <20180907162608.GV3161@kib.kiev.ua> References: <201809071509.w87F9uEO078085@repo.freebsd.org> <8beb57f9-37dc-735c-fa85-78ecb67679ad@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8beb57f9-37dc-735c-fa85-78ecb67679ad@FreeBSD.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 16:26:20 -0000 On Fri, Sep 07, 2018 at 09:00:20AM -0700, John Baldwin wrote: > On 9/7/18 8:09 AM, Konstantin Belousov wrote: > > Author: kib > > Date: Fri Sep 7 15:09:56 2018 > > New Revision: 338523 > > URL: https://svnweb.freebsd.org/changeset/base/338523 > > > > Log: > > Teach sysctl(8) about the Persistent memory type. > > > > Add PersistentMemory to the list of sysctl's known memory types > > when decoding an EFI memory map. > > > > Submitted by: D Scott Phillips > > MFC after: 1 week > > Approved by: re (rgrimes) > > > > Modified: > > head/sbin/sysctl/sysctl.c > > > > Modified: head/sbin/sysctl/sysctl.c > > ============================================================================== > > --- head/sbin/sysctl/sysctl.c Fri Sep 7 14:37:44 2018 (r338522) > > +++ head/sbin/sysctl/sysctl.c Fri Sep 7 15:09:56 2018 (r338523) > > @@ -704,7 +704,8 @@ S_efi_map(size_t l2, void *p) > > "ACPIMemoryNVS", > > "MemoryMappedIO", > > "MemoryMappedIOPortSpace", > > - "PalCode" > > + "PalCode", > > + "PersistentMemory" > > }; > > > > /* > > @@ -733,7 +734,7 @@ S_efi_map(size_t l2, void *p) > > > > for (i = 0; i < ndesc; i++, > > map = efi_next_descriptor(map, efihdr->descriptor_size)) { > > - if (map->md_type <= EFI_MD_TYPE_PALCODE) > > + if (map->md_type <= EFI_MD_TYPE_PERSISTENT) > > Perhaps this should use nitems(types) instead? (And I believe it's my > fault it didn't originally.) For me, it was more an issue that the code assumes contiguous values for the EFI_MD_TYPEs constants. What about the following: diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 427f3e2309b..3a7463ef411 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -691,21 +691,21 @@ S_efi_map(size_t l2, void *p) int ndesc, i; static const char *types[] = { - "Reserved", - "LoaderCode", - "LoaderData", - "BootServicesCode", - "BootServicesData", - "RuntimeServicesCode", - "RuntimeServicesData", - "ConventionalMemory", - "UnusableMemory", - "ACPIReclaimMemory", - "ACPIMemoryNVS", - "MemoryMappedIO", - "MemoryMappedIOPortSpace", - "PalCode", - "PersistentMemory" + [EFI_MD_TYPE_NULL] = "Reserved", + [EFI_MD_TYPE_CODE] = "LoaderCode", + [EFI_MD_TYPE_DATA] = "LoaderData", + [EFI_MD_TYPE_BS_CODE] = "BootServicesCode", + [EFI_MD_TYPE_BS_DATA] = "BootServicesData", + [EFI_MD_TYPE_RT_CODE] = "RuntimeServicesCode", + [EFI_MD_TYPE_RT_DATA] = "RuntimeServicesData", + [EFI_MD_TYPE_FREE] = "ConventionalMemory", + [EFI_MD_TYPE_BAD] = "UnusableMemory", + [EFI_MD_TYPE_RECLAIM] = "ACPIReclaimMemory", + [EFI_MD_TYPE_FIRMWARE] = "ACPIMemoryNVS", + [EFI_MD_TYPE_IOMEM] = "MemoryMappedIO", + [EFI_MD_TYPE_IOPORT] = "MemoryMappedIOPortSpace", + [EFI_MD_TYPE_PALCODE] = "PalCode", + [EFI_MD_TYPE_PERSISTENT] = "PersistentMemory", }; /* @@ -734,9 +734,10 @@ S_efi_map(size_t l2, void *p) for (i = 0; i < ndesc; i++, map = efi_next_descriptor(map, efihdr->descriptor_size)) { - if (map->md_type <= EFI_MD_TYPE_PERSISTENT) + type = NULL; + if (map->md_type < nitems(types)) type = types[map->md_type]; - else + if (type == NULL) type = ""; printf("\n%23s %012jx %12p %08jx ", type, (uintmax_t)map->md_phys, map->md_virt, From owner-svn-src-all@freebsd.org Fri Sep 7 18:05:11 2018 Return-Path: Delivered-To: svn-src-all@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 1FE5F1007E1D; Fri, 7 Sep 2018 18:05:11 +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 C8F4572CBE; Fri, 7 Sep 2018 18:05:10 +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 BFCE91F569; Fri, 7 Sep 2018 18:05:10 +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 w87I5AT3071435; Fri, 7 Sep 2018 18:05:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w87I5AxD071432; Fri, 7 Sep 2018 18:05:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201809071805.w87I5AxD071432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 7 Sep 2018 18:05:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338526 - in head/sys/ofed/drivers/infiniband: core ulp/ipoib X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/ofed/drivers/infiniband: core ulp/ipoib X-SVN-Commit-Revision: 338526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 18:05:11 -0000 Author: hselasky Date: Fri Sep 7 18:05:09 2018 New Revision: 338526 URL: https://svnweb.freebsd.org/changeset/base/338526 Log: Implement get network interface by params function in ipoib. Also fix the validate_ipv4_net_dev() and validate_ipv6_net_dev() functions which had source and destination addresses swapped, and didn't set the scope ID for IPv6 link-local addresses. This allows applications like krping to work using IPoIB devices. MFC after: 3 days Approved by: re (gjb) Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c head/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_cma.c Fri Sep 7 15:52:20 2018 (r338525) +++ head/sys/ofed/drivers/infiniband/core/ib_cma.c Fri Sep 7 18:05:09 2018 (r338526) @@ -1263,10 +1263,10 @@ static bool validate_ipv4_net_dev(struct net_device *n const struct sockaddr_in *src_addr) { #ifdef INET - struct sockaddr_in dst_tmp = *dst_addr; + struct sockaddr_in src_tmp = *src_addr; __be32 daddr = dst_addr->sin_addr.s_addr, saddr = src_addr->sin_addr.s_addr; - struct net_device *src_dev; + struct net_device *dst_dev; struct rtentry *rte; bool ret; @@ -1276,29 +1276,29 @@ static bool validate_ipv4_net_dev(struct net_device *n ipv4_is_loopback(saddr)) return false; - src_dev = ip_dev_find(net_dev->if_vnet, saddr); - if (src_dev != net_dev) { - if (src_dev != NULL) - dev_put(src_dev); + dst_dev = ip_dev_find(net_dev->if_vnet, daddr); + if (dst_dev != net_dev) { + if (dst_dev != NULL) + dev_put(dst_dev); return false; } - dev_put(src_dev); + dev_put(dst_dev); /* * Make sure the socket address length field * is set, else rtalloc1() will fail. */ - dst_tmp.sin_len = sizeof(dst_tmp); + src_tmp.sin_len = sizeof(src_tmp); CURVNET_SET(net_dev->if_vnet); - rte = rtalloc1((struct sockaddr *)&dst_tmp, 1, 0); - CURVNET_RESTORE(); + rte = rtalloc1((struct sockaddr *)&src_tmp, 1, 0); if (rte != NULL) { ret = (rte->rt_ifp == net_dev); RTFREE_LOCKED(rte); } else { ret = false; } + CURVNET_RESTORE(); return ret; #else return false; @@ -1310,31 +1310,42 @@ static bool validate_ipv6_net_dev(struct net_device *n const struct sockaddr_in6 *src_addr) { #ifdef INET6 - struct sockaddr_in6 dst_tmp = *dst_addr; - struct in6_addr in6_addr = src_addr->sin6_addr; - struct net_device *src_dev; + struct sockaddr_in6 src_tmp = *src_addr; + struct in6_addr in6_addr = dst_addr->sin6_addr; + struct net_device *dst_dev; struct rtentry *rte; bool ret; - src_dev = ip6_dev_find(net_dev->if_vnet, in6_addr); - if (src_dev != net_dev) + dst_dev = ip6_dev_find(net_dev->if_vnet, in6_addr); + if (dst_dev != net_dev) { + if (dst_dev != NULL) + dev_put(dst_dev); return false; + } + CURVNET_SET(net_dev->if_vnet); + /* * Make sure the socket address length field * is set, else rtalloc1() will fail. */ - dst_tmp.sin6_len = sizeof(dst_tmp); + src_tmp.sin6_len = sizeof(src_tmp); - CURVNET_SET(net_dev->if_vnet); - rte = rtalloc1((struct sockaddr *)&dst_tmp, 1, 0); - CURVNET_RESTORE(); + /* + * Make sure the scope ID gets embedded, else rtalloc1() will + * resolve to the loopback interface. + */ + src_tmp.sin6_scope_id = net_dev->if_index; + sa6_embedscope(&src_tmp, 0); + + rte = rtalloc1((struct sockaddr *)&src_tmp, 1, 0); if (rte != NULL) { ret = (rte->rt_ifp == net_dev); RTFREE_LOCKED(rte); } else { ret = false; } + CURVNET_RESTORE(); return ret; #else return false; Modified: head/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c Fri Sep 7 15:52:20 2018 (r338525) +++ head/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c Fri Sep 7 18:05:09 2018 (r338526) @@ -149,16 +149,6 @@ roce_gid_enum_netdev_default(struct ib_device *ib_dev, return (hweight_long(gid_type_mask)); } -#define ETH_IPOIB_DRV_NAME "ib" - -static inline int -is_eth_ipoib_intf(struct net_device *dev) -{ - if (strcmp(dev->if_dname, ETH_IPOIB_DRV_NAME)) - return 0; - return 1; -} - static void roce_gid_update_addr_callback(struct ib_device *device, u8 port, struct net_device *ndev, void *cookie) @@ -322,15 +312,15 @@ roce_gid_queue_scan_event(struct net_device *ndev) struct roce_netdev_event_work *work; retry: - if (is_eth_ipoib_intf(ndev)) - return; - - if (ndev->if_type != IFT_ETHER) { - if (ndev->if_type == IFT_L2VLAN) { - ndev = rdma_vlan_dev_real_dev(ndev); - if (ndev != NULL) - goto retry; - } + switch (ndev->if_type) { + case IFT_ETHER: + break; + case IFT_L2VLAN: + ndev = rdma_vlan_dev_real_dev(ndev); + if (ndev != NULL) + goto retry; + /* FALLTHROUGH */ + default: return; } Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Fri Sep 7 15:52:20 2018 (r338525) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Fri Sep 7 18:05:09 2018 (r338526) @@ -54,6 +54,8 @@ static int ipoib_resolvemulti(struct ifnet *, struct s #include #include +#include + MODULE_AUTHOR("Roland Dreier"); MODULE_DESCRIPTION("IP-over-InfiniBand net driver"); MODULE_LICENSE("Dual BSD/GPL"); @@ -90,6 +92,10 @@ struct ib_sa_client ipoib_sa_client; static void ipoib_add_one(struct ib_device *device); static void ipoib_remove_one(struct ib_device *device, void *client_data); +static struct net_device *ipoib_get_net_dev_by_params( + struct ib_device *dev, u8 port, u16 pkey, + const union ib_gid *gid, const struct sockaddr *addr, + void *client_data); static void ipoib_start(struct ifnet *dev); static int ipoib_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, struct route *ro); @@ -163,7 +169,8 @@ ipoib_mtap_proto(struct ifnet *ifp, struct mbuf *mb, u static struct ib_client ipoib_client = { .name = "ipoib", .add = ipoib_add_one, - .remove = ipoib_remove_one + .remove = ipoib_remove_one, + .get_net_dev_by_params = ipoib_get_net_dev_by_params, }; int @@ -1111,6 +1118,156 @@ ipoib_remove_one(struct ib_device *device, void *clien } kfree(dev_list); +} + +static int +ipoib_match_dev_addr(const struct sockaddr *addr, struct net_device *dev) +{ + struct ifaddr *ifa; + int retval = 0; + + CURVNET_SET(dev->if_vnet); + IF_ADDR_RLOCK(dev); + CK_STAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) { + if (ifa->ifa_addr == NULL || + ifa->ifa_addr->sa_family != addr->sa_family || + ifa->ifa_addr->sa_len != addr->sa_len) { + continue; + } + if (memcmp(ifa->ifa_addr, addr, addr->sa_len) == 0) { + retval = 1; + break; + } + } + IF_ADDR_RUNLOCK(dev); + CURVNET_RESTORE(); + + return (retval); +} + +/* + * ipoib_match_gid_pkey_addr - returns the number of IPoIB netdevs on + * top a given ipoib device matching a pkey_index and address, if one + * exists. + * + * @found_net_dev: contains a matching net_device if the return value + * >= 1, with a reference held. + */ +static int +ipoib_match_gid_pkey_addr(struct ipoib_dev_priv *priv, + const union ib_gid *gid, u16 pkey_index, const struct sockaddr *addr, + struct net_device **found_net_dev) +{ + struct ipoib_dev_priv *child_priv; + int matches = 0; + + if (priv->pkey_index == pkey_index && + (!gid || !memcmp(gid, &priv->local_gid, sizeof(*gid)))) { + if (addr == NULL || ipoib_match_dev_addr(addr, priv->dev) != 0) { + if (*found_net_dev == NULL) { + struct net_device *net_dev; + + if (priv->parent != NULL) + net_dev = priv->parent; + else + net_dev = priv->dev; + *found_net_dev = net_dev; + dev_hold(net_dev); + } + matches++; + } + } + + /* Check child interfaces */ + mutex_lock(&priv->vlan_mutex); + list_for_each_entry(child_priv, &priv->child_intfs, list) { + matches += ipoib_match_gid_pkey_addr(child_priv, gid, + pkey_index, addr, found_net_dev); + if (matches > 1) + break; + } + mutex_unlock(&priv->vlan_mutex); + + return matches; +} + +/* + * __ipoib_get_net_dev_by_params - returns the number of matching + * net_devs found (between 0 and 2). Also return the matching + * net_device in the @net_dev parameter, holding a reference to the + * net_device, if the number of matches >= 1 + */ +static int +__ipoib_get_net_dev_by_params(struct list_head *dev_list, u8 port, + u16 pkey_index, const union ib_gid *gid, + const struct sockaddr *addr, struct net_device **net_dev) +{ + struct ipoib_dev_priv *priv; + int matches = 0; + + *net_dev = NULL; + + list_for_each_entry(priv, dev_list, list) { + if (priv->port != port) + continue; + + matches += ipoib_match_gid_pkey_addr(priv, gid, pkey_index, + addr, net_dev); + + if (matches > 1) + break; + } + + return matches; +} + +static struct net_device * +ipoib_get_net_dev_by_params(struct ib_device *dev, u8 port, u16 pkey, + const union ib_gid *gid, const struct sockaddr *addr, void *client_data) +{ + struct net_device *net_dev; + struct list_head *dev_list = client_data; + u16 pkey_index; + int matches; + int ret; + + if (!rdma_protocol_ib(dev, port)) + return NULL; + + ret = ib_find_cached_pkey(dev, port, pkey, &pkey_index); + if (ret) + return NULL; + + if (!dev_list) + return NULL; + + /* See if we can find a unique device matching the L2 parameters */ + matches = __ipoib_get_net_dev_by_params(dev_list, port, pkey_index, + gid, NULL, &net_dev); + + switch (matches) { + case 0: + return NULL; + case 1: + return net_dev; + } + + dev_put(net_dev); + + /* Couldn't find a unique device with L2 parameters only. Use L3 + * address to uniquely match the net device */ + matches = __ipoib_get_net_dev_by_params(dev_list, port, pkey_index, + gid, addr, &net_dev); + switch (matches) { + case 0: + return NULL; + default: + dev_warn_ratelimited(&dev->dev, + "duplicate IP address detected\n"); + /* Fall through */ + case 1: + return net_dev; + } } static void From owner-svn-src-all@freebsd.org Fri Sep 7 21:11:41 2018 Return-Path: Delivered-To: svn-src-all@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 DE49D106C41B; Fri, 7 Sep 2018 21:11:41 +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 94B3F778E0; Fri, 7 Sep 2018 21:11:41 +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 8FA99213DB; Fri, 7 Sep 2018 21:11:41 +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 w87LBfcu066420; Fri, 7 Sep 2018 21:11:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w87LBfpJ066419; Fri, 7 Sep 2018 21:11:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809072111.w87LBfpJ066419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 7 Sep 2018 21:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338527 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 338527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 21:11:42 -0000 Author: markj Date: Fri Sep 7 21:11:41 2018 New Revision: 338527 URL: https://svnweb.freebsd.org/changeset/base/338527 Log: Use ratecheck(9) in in_pcbinslbgrouphash(). Reviewed by: bz, Johannes Lundberg Approved by: re (kib) Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D17065 Modified: head/sys/netinet/in_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Fri Sep 7 18:05:09 2018 (r338526) +++ head/sys/netinet/in_pcb.c Fri Sep 7 21:11:41 2018 (r338527) @@ -301,13 +301,14 @@ in_pcblbgroup_reorder(struct inpcblbgrouphead *hdr, st static int in_pcbinslbgrouphash(struct inpcb *inp) { + const static struct timeval interval = { 60, 0 }; + static struct timeval lastprint; struct inpcbinfo *pcbinfo; struct inpcblbgrouphead *hdr; struct inpcblbgroup *grp; uint16_t hashmask, lport; uint32_t group_index; struct ucred *cred; - static int limit_logged = 0; pcbinfo = inp->inp_pcbinfo; @@ -364,11 +365,9 @@ in_pcbinslbgrouphash(struct inpcb *inp) return (ENOBUFS); } else if (grp->il_inpcnt == grp->il_inpsiz) { if (grp->il_inpsiz >= INPCBLBGROUP_SIZMAX) { - if (!limit_logged) { - limit_logged = 1; + if (ratecheck(&lastprint, &interval)) printf("lb group port %d, limit reached\n", ntohs(grp->il_lport)); - } return (0); } From owner-svn-src-all@freebsd.org Fri Sep 7 21:12:38 2018 Return-Path: Delivered-To: svn-src-all@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 556F6106C641; Fri, 7 Sep 2018 21:12:38 +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 0BB6C77C1B; Fri, 7 Sep 2018 21:12:38 +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 06B9821447; Fri, 7 Sep 2018 21:12:38 +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 w87LCbVq068323; Fri, 7 Sep 2018 21:12:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w87LCbZr068322; Fri, 7 Sep 2018 21:12:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809072112.w87LCbZr068322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 7 Sep 2018 21:12:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338528 - head/sys/dev/intel X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/intel X-SVN-Commit-Revision: 338528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 21:12:38 -0000 Author: markj Date: Fri Sep 7 21:12:37 2018 New Revision: 338528 URL: https://svnweb.freebsd.org/changeset/base/338528 Log: Specify the correct resource type in teardown paths. Submitted by: Yuri Pankov Approved by: re (kib) MFC after: 1 week Modified: head/sys/dev/intel/spi.c Modified: head/sys/dev/intel/spi.c ============================================================================== --- head/sys/dev/intel/spi.c Fri Sep 7 21:11:41 2018 (r338527) +++ head/sys/dev/intel/spi.c Fri Sep 7 21:12:37 2018 (r338528) @@ -480,7 +480,7 @@ error: sc->sc_mem_rid, sc->sc_mem_res); if (sc->sc_irq_res != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, + bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, sc->sc_irq_res); return (ENXIO); @@ -503,7 +503,7 @@ intelspi_detach(device_t dev) sc->sc_mem_rid, sc->sc_mem_res); if (sc->sc_irq_res != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, + bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, sc->sc_irq_res); return (0); From owner-svn-src-all@freebsd.org Fri Sep 7 23:12:18 2018 Return-Path: Delivered-To: svn-src-all@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 32FA5FCCF6B; Fri, 7 Sep 2018 23:12:18 +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 D8E997B675; Fri, 7 Sep 2018 23:12:17 +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 D3DDA22785; Fri, 7 Sep 2018 23:12:17 +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 w87NCHdQ029179; Fri, 7 Sep 2018 23:12:17 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w87NCHDt029178; Fri, 7 Sep 2018 23:12:17 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201809072312.w87NCHDt029178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 7 Sep 2018 23:12:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338529 - head/tools/build/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/tools/build/mk X-SVN-Commit-Revision: 338529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2018 23:12:18 -0000 Author: emaste Date: Fri Sep 7 23:12:17 2018 New Revision: 338529 URL: https://svnweb.freebsd.org/changeset/base/338529 Log: Remove strings from OptionalObsoleteFiles.inc Since r326030 strings is installed unconditionally so should not be removed when WITHOUT_TOOLCHAIN is set. Reported by: Dan McGregor Approved by: re (kib) Sponsored by: The FreeBSD Foundation Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Fri Sep 7 21:12:37 2018 (r338528) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Fri Sep 7 23:12:17 2018 (r338529) @@ -8512,7 +8512,6 @@ OLD_FILES+=usr/bin/nm OLD_FILES+=usr/bin/objcopy OLD_FILES+=usr/bin/readelf OLD_FILES+=usr/bin/size -OLD_FILES+=usr/bin/strings OLD_FILES+=usr/bin/strip OLD_FILES+=usr/bin/yacc OLD_FILES+=usr/share/man/man1/addr2line.1.gz @@ -8520,7 +8519,6 @@ OLD_FILES+=usr/share/man/man1/c++filt.1.gz OLD_FILES+=usr/share/man/man1/nm.1.gz OLD_FILES+=usr/share/man/man1/readelf.1.gz OLD_FILES+=usr/share/man/man1/size.1.gz -OLD_FILES+=usr/share/man/man1/strings.1.gz OLD_FILES+=usr/share/man/man1/strip.1.gz OLD_FILES+=usr/share/man/man1/objcopy.1.gz # lib/libelf From owner-svn-src-all@freebsd.org Sat Sep 8 00:42:37 2018 Return-Path: Delivered-To: svn-src-all@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 C7076FCEBCE; Sat, 8 Sep 2018 00:42:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 725F77E0D7; Sat, 8 Sep 2018 00:42:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 8CCA110A87D; Fri, 7 Sep 2018 20:42:29 -0400 (EDT) Subject: Re: svn commit: r338523 - head/sbin/sysctl To: Konstantin Belousov References: <201809071509.w87F9uEO078085@repo.freebsd.org> <8beb57f9-37dc-735c-fa85-78ecb67679ad@FreeBSD.org> <20180907162608.GV3161@kib.kiev.ua> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: John Baldwin Message-ID: <3748f268-f3fa-bd83-47a1-44fb41c28384@FreeBSD.org> Date: Fri, 7 Sep 2018 17:42:28 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180907162608.GV3161@kib.kiev.ua> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 07 Sep 2018 20:42:30 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Sep 2018 00:42:37 -0000 On 9/7/18 9:26 AM, Konstantin Belousov wrote: > On Fri, Sep 07, 2018 at 09:00:20AM -0700, John Baldwin wrote: >> On 9/7/18 8:09 AM, Konstantin Belousov wrote: >>> Author: kib >>> Date: Fri Sep 7 15:09:56 2018 >>> New Revision: 338523 >>> URL: https://svnweb.freebsd.org/changeset/base/338523 >>> >>> Log: >>> Teach sysctl(8) about the Persistent memory type. >>> >>> Add PersistentMemory to the list of sysctl's known memory types >>> when decoding an EFI memory map. >>> >>> Submitted by: D Scott Phillips >>> MFC after: 1 week >>> Approved by: re (rgrimes) >>> >>> Modified: >>> head/sbin/sysctl/sysctl.c >>> >>> Modified: head/sbin/sysctl/sysctl.c >>> ============================================================================== >>> --- head/sbin/sysctl/sysctl.c Fri Sep 7 14:37:44 2018 (r338522) >>> +++ head/sbin/sysctl/sysctl.c Fri Sep 7 15:09:56 2018 (r338523) >>> @@ -704,7 +704,8 @@ S_efi_map(size_t l2, void *p) >>> "ACPIMemoryNVS", >>> "MemoryMappedIO", >>> "MemoryMappedIOPortSpace", >>> - "PalCode" >>> + "PalCode", >>> + "PersistentMemory" >>> }; >>> >>> /* >>> @@ -733,7 +734,7 @@ S_efi_map(size_t l2, void *p) >>> >>> for (i = 0; i < ndesc; i++, >>> map = efi_next_descriptor(map, efihdr->descriptor_size)) { >>> - if (map->md_type <= EFI_MD_TYPE_PALCODE) >>> + if (map->md_type <= EFI_MD_TYPE_PERSISTENT) >> >> Perhaps this should use nitems(types) instead? (And I believe it's my >> fault it didn't originally.) > > For me, it was more an issue that the code assumes contiguous values for > the EFI_MD_TYPEs constants. > > What about the following: Looks good to me. -- John Baldwin                                                                              From owner-svn-src-all@freebsd.org Sat Sep 8 04:09:35 2018 Return-Path: Delivered-To: svn-src-all@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 BB928FE6D10; Sat, 8 Sep 2018 04:09:34 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 648EB84133; Sat, 8 Sep 2018 04:09:34 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FF6A258B7; Sat, 8 Sep 2018 04:09:34 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8849YkR080106; Sat, 8 Sep 2018 04:09:34 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8849ULG080094; Sat, 8 Sep 2018 04:09:30 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201809080409.w8849ULG080094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 8 Sep 2018 04:09: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: r338530 - in stable/11: contrib/ntp contrib/ntp/html contrib/ntp/include contrib/ntp/libntp contrib/ntp/ntpd contrib/ntp/ntpdate contrib/ntp/ntpdc contrib/ntp/ntpq contrib/ntp/ntpsnmpd ... X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/11: contrib/ntp contrib/ntp/html contrib/ntp/include contrib/ntp/libntp contrib/ntp/ntpd contrib/ntp/ntpdate contrib/ntp/ntpdc contrib/ntp/ntpq contrib/ntp/ntpsnmpd contrib/ntp/scripts contr... X-SVN-Commit-Revision: 338530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Sep 2018 04:09:35 -0000 Author: delphij Date: Sat Sep 8 04:09:30 2018 New Revision: 338530 URL: https://svnweb.freebsd.org/changeset/base/338530 Log: MFC r338126: MFV r338092: ntp 4.2.8p12. Relnotes: yes Modified: stable/11/contrib/ntp/ChangeLog stable/11/contrib/ntp/NEWS stable/11/contrib/ntp/config.h.in stable/11/contrib/ntp/configure stable/11/contrib/ntp/configure.ac stable/11/contrib/ntp/html/authentic.html stable/11/contrib/ntp/html/authopt.html stable/11/contrib/ntp/html/confopt.html stable/11/contrib/ntp/html/keygen.html stable/11/contrib/ntp/html/ntpdate.html stable/11/contrib/ntp/include/ntp.h stable/11/contrib/ntp/include/ntp_md5.h stable/11/contrib/ntp/libntp/a_md5encrypt.c stable/11/contrib/ntp/libntp/ntp_calendar.c stable/11/contrib/ntp/libntp/prettydate.c stable/11/contrib/ntp/libntp/ssl_init.c stable/11/contrib/ntp/libntp/syssignal.c stable/11/contrib/ntp/libntp/work_fork.c stable/11/contrib/ntp/libntp/work_thread.c stable/11/contrib/ntp/ntpd/complete.conf.in stable/11/contrib/ntp/ntpd/invoke-ntp.conf.texi stable/11/contrib/ntp/ntpd/invoke-ntp.keys.texi stable/11/contrib/ntp/ntpd/invoke-ntpd.texi stable/11/contrib/ntp/ntpd/ntp.conf.5man stable/11/contrib/ntp/ntpd/ntp.conf.5mdoc stable/11/contrib/ntp/ntpd/ntp.conf.def stable/11/contrib/ntp/ntpd/ntp.conf.html stable/11/contrib/ntp/ntpd/ntp.conf.man.in stable/11/contrib/ntp/ntpd/ntp.conf.mdoc.in stable/11/contrib/ntp/ntpd/ntp.keys.5man stable/11/contrib/ntp/ntpd/ntp.keys.5mdoc stable/11/contrib/ntp/ntpd/ntp.keys.def stable/11/contrib/ntp/ntpd/ntp.keys.html stable/11/contrib/ntp/ntpd/ntp.keys.man.in stable/11/contrib/ntp/ntpd/ntp.keys.mdoc.in stable/11/contrib/ntp/ntpd/ntp_config.c stable/11/contrib/ntp/ntpd/ntp_control.c stable/11/contrib/ntp/ntpd/ntp_io.c stable/11/contrib/ntp/ntpd/ntp_loopfilter.c stable/11/contrib/ntp/ntpd/ntp_parser.c stable/11/contrib/ntp/ntpd/ntp_parser.h stable/11/contrib/ntp/ntpd/ntp_proto.c stable/11/contrib/ntp/ntpd/ntp_refclock.c stable/11/contrib/ntp/ntpd/ntp_request.c stable/11/contrib/ntp/ntpd/ntpd-opts.c stable/11/contrib/ntp/ntpd/ntpd-opts.h stable/11/contrib/ntp/ntpd/ntpd.1ntpdman stable/11/contrib/ntp/ntpd/ntpd.1ntpdmdoc stable/11/contrib/ntp/ntpd/ntpd.c stable/11/contrib/ntp/ntpd/ntpd.html stable/11/contrib/ntp/ntpd/ntpd.man.in stable/11/contrib/ntp/ntpd/ntpd.mdoc.in stable/11/contrib/ntp/ntpd/rc_cmdlength.c stable/11/contrib/ntp/ntpd/refclock_datum.c stable/11/contrib/ntp/ntpd/refclock_gpsdjson.c stable/11/contrib/ntp/ntpd/refclock_jupiter.c stable/11/contrib/ntp/ntpd/refclock_shm.c stable/11/contrib/ntp/ntpd/refclock_true.c stable/11/contrib/ntp/ntpdate/ntpdate.c stable/11/contrib/ntp/ntpdc/invoke-ntpdc.texi stable/11/contrib/ntp/ntpdc/ntpdc-opts.c stable/11/contrib/ntp/ntpdc/ntpdc-opts.h stable/11/contrib/ntp/ntpdc/ntpdc.1ntpdcman stable/11/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc stable/11/contrib/ntp/ntpdc/ntpdc.c stable/11/contrib/ntp/ntpdc/ntpdc.html stable/11/contrib/ntp/ntpdc/ntpdc.man.in stable/11/contrib/ntp/ntpdc/ntpdc.mdoc.in stable/11/contrib/ntp/ntpq/invoke-ntpq.texi stable/11/contrib/ntp/ntpq/ntpq-opts.c stable/11/contrib/ntp/ntpq/ntpq-opts.h stable/11/contrib/ntp/ntpq/ntpq-subs.c stable/11/contrib/ntp/ntpq/ntpq.1ntpqman stable/11/contrib/ntp/ntpq/ntpq.1ntpqmdoc stable/11/contrib/ntp/ntpq/ntpq.c stable/11/contrib/ntp/ntpq/ntpq.html stable/11/contrib/ntp/ntpq/ntpq.man.in stable/11/contrib/ntp/ntpq/ntpq.mdoc.in stable/11/contrib/ntp/ntpq/ntpq.texi stable/11/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi stable/11/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c stable/11/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h stable/11/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman stable/11/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc stable/11/contrib/ntp/ntpsnmpd/ntpsnmpd.html stable/11/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in stable/11/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in stable/11/contrib/ntp/packageinfo.sh stable/11/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman stable/11/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc stable/11/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html stable/11/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in stable/11/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in stable/11/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi stable/11/contrib/ntp/scripts/invoke-plot_summary.texi stable/11/contrib/ntp/scripts/invoke-summary.texi stable/11/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi stable/11/contrib/ntp/scripts/ntp-wait/ntp-wait-opts stable/11/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman stable/11/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc stable/11/contrib/ntp/scripts/ntp-wait/ntp-wait.html stable/11/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in stable/11/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in stable/11/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi stable/11/contrib/ntp/scripts/ntpsweep/ntpsweep-opts stable/11/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman stable/11/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc stable/11/contrib/ntp/scripts/ntpsweep/ntpsweep.html stable/11/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in stable/11/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in stable/11/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi stable/11/contrib/ntp/scripts/ntptrace/ntptrace-opts stable/11/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman stable/11/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc stable/11/contrib/ntp/scripts/ntptrace/ntptrace.html stable/11/contrib/ntp/scripts/ntptrace/ntptrace.man.in stable/11/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in stable/11/contrib/ntp/scripts/plot_summary-opts stable/11/contrib/ntp/scripts/plot_summary.1plot_summaryman stable/11/contrib/ntp/scripts/plot_summary.1plot_summarymdoc stable/11/contrib/ntp/scripts/plot_summary.html stable/11/contrib/ntp/scripts/plot_summary.man.in stable/11/contrib/ntp/scripts/plot_summary.mdoc.in stable/11/contrib/ntp/scripts/summary-opts stable/11/contrib/ntp/scripts/summary.1summaryman stable/11/contrib/ntp/scripts/summary.1summarymdoc stable/11/contrib/ntp/scripts/summary.html stable/11/contrib/ntp/scripts/summary.man.in stable/11/contrib/ntp/scripts/summary.mdoc.in stable/11/contrib/ntp/scripts/update-leap/invoke-update-leap.texi stable/11/contrib/ntp/scripts/update-leap/update-leap-opts stable/11/contrib/ntp/scripts/update-leap/update-leap.1update-leapman stable/11/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc stable/11/contrib/ntp/scripts/update-leap/update-leap.html stable/11/contrib/ntp/scripts/update-leap/update-leap.man.in stable/11/contrib/ntp/scripts/update-leap/update-leap.mdoc.in stable/11/contrib/ntp/sntp/config.h.in stable/11/contrib/ntp/sntp/configure stable/11/contrib/ntp/sntp/crypto.c stable/11/contrib/ntp/sntp/include/version.def stable/11/contrib/ntp/sntp/include/version.texi stable/11/contrib/ntp/sntp/invoke-sntp.texi stable/11/contrib/ntp/sntp/m4/ntp_libntp.m4 stable/11/contrib/ntp/sntp/m4/ntp_openssl.m4 stable/11/contrib/ntp/sntp/m4/version.m4 stable/11/contrib/ntp/sntp/main.c stable/11/contrib/ntp/sntp/sntp-opts.c stable/11/contrib/ntp/sntp/sntp-opts.h stable/11/contrib/ntp/sntp/sntp.1sntpman stable/11/contrib/ntp/sntp/sntp.1sntpmdoc stable/11/contrib/ntp/sntp/sntp.html stable/11/contrib/ntp/sntp/sntp.man.in stable/11/contrib/ntp/sntp/sntp.mdoc.in stable/11/contrib/ntp/sntp/tests/crypto.c stable/11/contrib/ntp/sntp/tests/packetProcessing.c stable/11/contrib/ntp/sntp/version.c stable/11/contrib/ntp/util/invoke-ntp-keygen.texi stable/11/contrib/ntp/util/ntp-keygen-opts.c stable/11/contrib/ntp/util/ntp-keygen-opts.def stable/11/contrib/ntp/util/ntp-keygen-opts.h stable/11/contrib/ntp/util/ntp-keygen.1ntp-keygenman stable/11/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc stable/11/contrib/ntp/util/ntp-keygen.html stable/11/contrib/ntp/util/ntp-keygen.man.in stable/11/contrib/ntp/util/ntp-keygen.mdoc.in stable/11/contrib/ntp/util/ntp-keygen.texi stable/11/contrib/ntp/util/sht.c stable/11/usr.sbin/ntp/config.h stable/11/usr.sbin/ntp/doc/ntp-keygen.8 stable/11/usr.sbin/ntp/doc/ntp.conf.5 stable/11/usr.sbin/ntp/doc/ntp.keys.5 stable/11/usr.sbin/ntp/doc/ntpd.8 stable/11/usr.sbin/ntp/doc/ntpdc.8 stable/11/usr.sbin/ntp/doc/ntpq.8 stable/11/usr.sbin/ntp/doc/sntp.8 stable/11/usr.sbin/ntp/scripts/mkver Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/ntp/ChangeLog ============================================================================== --- stable/11/contrib/ntp/ChangeLog Fri Sep 7 23:12:17 2018 (r338529) +++ stable/11/contrib/ntp/ChangeLog Sat Sep 8 04:09:30 2018 (r338530) @@ -1,5 +1,69 @@ --- +(4.2.8p12) 2018/08/14 Released by Harlan Stenn +* [Sec 3505] CVE-2018-12327 - Arbitrary Code Execution Vulnerability + - fixed stack buffer overflow in the openhost() command-line call + of NTPQ/NTPDC +* [Sec 3012] noepeer tweaks. +* [Bug 3521] Fix a logic bug in the INVALIDNAK checks. +* [Bug 3509] Add support for running as non-root on FreeBSD, Darwin, + other TrustedBSD platforms + - applied patch by Ian Lepore +* [Bug 3506] Service Control Manager interacts poorly with NTPD + - changed interaction with SCM to signal pending startup +* [Bug 3486] Buffer overflow in ntpq/ntpq.c:tstflags() + - applied patch by Gerry Garvey +* [Bug 3485] Undefined sockaddr used in error messages in ntp_config.c + - applied patch by Gerry Garvey +* [Bug 3484] ntpq response from ntpd is incorrect when REFID is null + - rework of ntpq 'nextvar()' key/value parsing +* [Bug 3482] Fixes for compilation warnings (ntp_io.c & ntpq-subs.c) + - applied patch by Gerry Garvey (with mods) +* [Bug 3480] Refclock sample filter not cleared on clock STEP + - applied patch by Gerry Garvey +* [Bug 3479] ctl_putrefid() allows unsafe characters through to ntpq + - applied patch by Gerry Garvey (with mods) +* [Bug 3476]ctl_putstr() sends empty unquoted string [...] + - applied patch by Gerry Garvey (with mods); not sure if that's bug or feature, though +* [Bug 3475] modify prettydate() to suppress output of zero time + - applied patch by Gerry Garvey +* [Bug 3474] Missing pmode in mode7 peer info response + - applied patch by Gerry Garvey +* [Bug 3471] Check for openssl/[ch]mac.h. HStenn. + - add #define ENABLE_CMAC support in configure. HStenn. +* [Bug 3470] ntpd4.2.8p11 fails to compile without OpenSSL +* [Bug 3469] Incomplete string compare [...] in is_refclk_addr + - patch by Stephen Friedl +* [Bug 3467] Potential memory fault in ntpq [...] + - fixed IO redirection and CTRL-C handling in ntq and ntpdc +* [Bug 3465] Default TTL values cannot be used +* [Bug 3461] refclock_shm.c: clear error status on clock recovery + - initial patch by Hal Murray; also fixed refclock_report() trouble +* [Bug 3460] Fix typo in ntpq.texi, reported by Kenyon Ralph. +* [Bug 3456] Use uintptr_t rather than size_t to store an integer in a pointer + - According to Brooks Davis, there was only one location +* [Bug 3449] ntpq - display "loop" instead of refid [...] + - applied patch by Gerry Garvey +* [Bug 3445] Symmetric peer won't sync on startup + - applied patch by Gerry Garvey +* [Bug 3442] Fixes for ntpdate as suggested by Gerry Garvey, + with modifications + New macro REFID_ISTEXT() which is also used in ntpd/ntp_control.c. +* [Bug 3434] ntpd clears STA_UNSYNC on start + - applied patch by Miroslav Lichvar +* [Bug 3426] ntpdate.html -t default is 2 seconds. Leonid Evdokimov. +* [Bug 3121] Drop root privileges for the forked DNS worker + - integrated patch by Reinhard Max +* [Bug 2821] minor build issues + - applied patches by Christos Zoulas, including real bug fixes +* html/authopt.html: cleanup, from +* ntpd/ntpd.c: DROPROOT cleanup. +* Symmetric key range is 1-65535. Update docs. +* html/authentic.html: cleanup, from + +--- +(4.2.8p11) 2018/02/27 Released by Harlan Stenn + * [Sec 3454] Unauthenticated packet can reset authenticated interleave associations. HStenn. * [Sec 3453] Interleaved symmetric mode cannot recover from bad state. HStenn. @@ -14,16 +78,16 @@ - applied patch by Sean Haugh * [Bug 3452] PARSE driver prints uninitialized memory. * [Bug 3450] Dubious error messages from plausibility checks in get_systime() - - removed error log caused by rounding/slew, ensured postcondition + - removed error log caused by rounding/slew, ensured postcondition * [Bug 3447] AES-128-CMAC (fixes) - refactoring the MAC code, too * [Bug 3441] Validate the assumption that AF_UNSPEC is 0. stenn@ntp.org * [Bug 3439] When running multiple commands / hosts in ntpq... - - applied patch by ggarvey + - applied patch by ggarvey * [Bug 3438] Negative values and values > 999 days in... - - applied patch by ggarvey (with minor mods) + - applied patch by ggarvey (with minor mods) * [Bug 3437] ntpd tries to open socket with AF_UNSPEC domain - - applied patch (with mods) by Miroslav Lichvar + - applied patch (with mods) by Miroslav Lichvar * [Bug 3435] anchor NTP era alignment * [Bug 3433] sntp crashes when run with -a. * [Bug 3430] ntpq dumps core (SIGSEGV) for "keytype md2" Modified: stable/11/contrib/ntp/NEWS ============================================================================== --- stable/11/contrib/ntp/NEWS Fri Sep 7 23:12:17 2018 (r338529) +++ stable/11/contrib/ntp/NEWS Sat Sep 8 04:09:30 2018 (r338530) @@ -1,7 +1,78 @@ -- -NTP 4.2.8p11 (Harlan Stenn , 2018/02/27) +NTP 4.2.8p12 (Harlan Stenn , 2018/14/09) NOTE: this NEWS file will be undergoing more revisions. + +Focus: Security, Bug fixes, enhancements. + +Severity: MEDIUM + +This release fixes a "hole" in the noepeer capability introduced to ntpd +in ntp-4.2.8p11, and a buffer overflow in the openhost() function used by +ntpq and ntpdc. It also provides 26 other bugfixes, and 4 other improvements: + +* [Sec 3505] Buffer overflow in the openhost() call of ntpq and ntpdc. + +* [Sec 3012] Fix a hole in the new "noepeer" processing. + +* Bug Fixes: + [Bug 3521] Fix a logic bug in the INVALIDNAK checks. + [Bug 3509] Add support for running as non-root on FreeBSD, Darwin, + other TrustedBSD platforms + - applied patch by Ian Lepore + [Bug 3506] Service Control Manager interacts poorly with NTPD + - changed interaction with SCM to signal pending startup + [Bug 3486] Buffer overflow in ntpq/ntpq.c:tstflags() + - applied patch by Gerry Garvey + [Bug 3485] Undefined sockaddr used in error messages in ntp_config.c + - applied patch by Gerry Garvey + [Bug 3484] ntpq response from ntpd is incorrect when REFID is null + - rework of ntpq 'nextvar()' key/value parsing + [Bug 3482] Fixes for compilation warnings (ntp_io.c & ntpq-subs.c) + - applied patch by Gerry Garvey (with mods) + [Bug 3480] Refclock sample filter not cleared on clock STEP + - applied patch by Gerry Garvey + [Bug 3479] ctl_putrefid() allows unsafe characters through to ntpq + - applied patch by Gerry Garvey (with mods) + [Bug 3476]ctl_putstr() sends empty unquoted string [...] + - applied patch by Gerry Garvey (with mods); not sure if that's bug or feature, though + [Bug 3475] modify prettydate() to suppress output of zero time + - applied patch by Gerry Garvey + [Bug 3474] Missing pmode in mode7 peer info response + - applied patch by Gerry Garvey + [Bug 3471] Check for openssl/[ch]mac.h. HStenn. + - add #define ENABLE_CMAC support in configure. HStenn. + [Bug 3470] ntpd4.2.8p11 fails to compile without OpenSSL + [Bug 3469] Incomplete string compare [...] in is_refclk_addr + - patch by Stephen Friedl + [Bug 3467] Potential memory fault in ntpq [...] + - fixed IO redirection and CTRL-C handling in ntq and ntpdc + [Bug 3465] Default TTL values cannot be used + [Bug 3461] refclock_shm.c: clear error status on clock recovery + - initial patch by Hal Murray; also fixed refclock_report() trouble + [Bug 3460] Fix typo in ntpq.texi, reported by Kenyon Ralph. + [Bug 3456] Use uintptr_t rather than size_t to store an integer in a pointer + - According to Brooks Davis, there was only one location + [Bug 3449] ntpq - display "loop" instead of refid [...] + - applied patch by Gerry Garvey + [Bug 3445] Symmetric peer won't sync on startup + - applied patch by Gerry Garvey + [Bug 3442] Fixes for ntpdate as suggested by Gerry Garvey, + with modifications + New macro REFID_ISTEXT() which is also used in ntpd/ntp_control.c. + [Bug 3434] ntpd clears STA_UNSYNC on start + - applied patch by Miroslav Lichvar + [Bug 3426] ntpdate.html -t default is 2 seconds. Leonid Evdokimov. + [Bug 3121] Drop root privileges for the forked DNS worker + - integrated patch by Reinhard Max + [Bug 2821] minor build issues + - applied patches by Christos Zoulas, including real bug fixes + html/authopt.html: cleanup, from + ntpd/ntpd.c: DROPROOT cleanup. + Symmetric key range is 1-65535. Update docs. + +-- +NTP 4.2.8p11 (Harlan Stenn , 2018/02/27) Focus: Security, Bug fixes, enhancements. Modified: stable/11/contrib/ntp/config.h.in ============================================================================== --- stable/11/contrib/ntp/config.h.in Fri Sep 7 23:12:17 2018 (r338529) +++ stable/11/contrib/ntp/config.h.in Sat Sep 8 04:09:30 2018 (r338530) @@ -311,6 +311,9 @@ /* Provide the explicit 127.0.0.0/8 martian filter? */ #undef ENABLE_BUG3020_FIX +/* Enable CMAC support? */ +#undef ENABLE_CMAC + /* nls support in libopts */ #undef ENABLE_NLS @@ -372,6 +375,14 @@ /* Define to 1 if you have the `daemon' function. */ #undef HAVE_DAEMON +/* Define to 1 if you have the declaration of `siglongjmp', and to 0 if you + don't. */ +#undef HAVE_DECL_SIGLONGJMP + +/* Define to 1 if you have the declaration of `sigsetjmp', and to 0 if you + don't. */ +#undef HAVE_DECL_SIGSETJMP + /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #undef HAVE_DECL_STRERROR_R @@ -653,6 +664,12 @@ /* if you have NT Threads */ #undef HAVE_NT_THREADS +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_CMAC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_HMAC_H + /* Define to 1 if the system has the type `pid_t'. */ #undef HAVE_PID_T @@ -957,6 +974,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_LOCK_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MAC_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MMAN_H @@ -1116,6 +1136,9 @@ /* Do we have the TIO serial stuff? */ #undef HAVE_TIO_SERIAL_STUFF + +/* Are TrustedBSD MAC policy privileges available? */ +#undef HAVE_TRUSTEDBSD_MAC /* Define to 1 if the system has the type `uint16_t'. */ #undef HAVE_UINT16_T Modified: stable/11/contrib/ntp/configure ============================================================================== --- stable/11/contrib/ntp/configure Fri Sep 7 23:12:17 2018 (r338529) +++ stable/11/contrib/ntp/configure Sat Sep 8 04:09:30 2018 (r338530) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for ntp 4.2.8p11. +# Generated by GNU Autoconf 2.69 for ntp 4.2.8p12. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='ntp' PACKAGE_TARNAME='ntp' -PACKAGE_VERSION='4.2.8p11' -PACKAGE_STRING='ntp 4.2.8p11' +PACKAGE_VERSION='4.2.8p12' +PACKAGE_STRING='ntp 4.2.8p12' PACKAGE_BUGREPORT='http://bugs.ntp.org./' PACKAGE_URL='http://www.ntp.org./' @@ -968,6 +968,7 @@ enable_c99_snprintf enable_clockctl enable_linuxcaps enable_solarisprivs +enable_trustedbsd_mac with_arlib with_net_snmp_config enable_libseccomp @@ -1614,7 +1615,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures ntp 4.2.8p11 to adapt to many kinds of systems. +\`configure' configures ntp 4.2.8p12 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1684,7 +1685,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntp 4.2.8p11:";; + short | recursive ) echo "Configuration of ntp 4.2.8p12:";; esac cat <<\_ACEOF @@ -1731,6 +1732,8 @@ Optional Features and Packages: --enable-clockctl s Use /dev/clockctl for non-root clock control --enable-linuxcaps + Use Linux capabilities for non-root clock control --enable-solarisprivs + Use Solaris privileges for non-root clock control + --enable-trustedbsd-mac s Use TrustedBSD MAC policy for non-root clock + control --with-arlib - deprecated, arlib not distributed --with-net-snmp-config + =net-snmp-config --enable-libseccomp EXPERIMENTAL: enable support for libseccomp @@ -1923,7 +1926,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ntp configure 4.2.8p11 +ntp configure 4.2.8p12 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2632,7 +2635,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by ntp $as_me 4.2.8p11, which was +It was created by ntp $as_me 4.2.8p12, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3633,7 +3636,7 @@ fi # Define the identity of the package. PACKAGE='ntp' - VERSION='4.2.8p11' + VERSION='4.2.8p12' cat >>confdefs.h <<_ACEOF @@ -24026,7 +24029,40 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_have_solarisprivs" >&5 $as_echo "$ntp_have_solarisprivs" >&6; } -case "$ntp_use_dev_clockctl$ntp_have_linuxcaps$ntp_have_solarisprivs" in +for ac_header in sys/mac.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/mac.h" "ac_cv_header_sys_mac_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_mac_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_MAC_H 1 +_ACEOF + +fi + +done + + +# Check whether --enable-trustedbsd_mac was given. +if test "${enable_trustedbsd_mac+set}" = set; then : + enableval=$enable_trustedbsd_mac; ntp_use_trustedbsd_mac=$enableval + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we should use TrustedBSD MAC privileges" >&5 +$as_echo_n "checking if we should use TrustedBSD MAC privileges... " >&6; } + +case "$ntp_use_trustedbsd_mac$ac_cv_header_sys_mac_h" in + yesyes) + +$as_echo "#define HAVE_TRUSTEDBSD_MAC 1" >>confdefs.h + +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_use_trustedbsd_mac" >&5 +$as_echo "$ntp_use_trustedbsd_mac" >&6; } + +case "$ntp_use_dev_clockctl$ntp_have_linuxcaps$ntp_have_solarisprivs$ntp_use_trustedbsd_mac" in *yes*) $as_echo "#define HAVE_DROPROOT 1" >>confdefs.h @@ -30311,7 +30347,20 @@ $as_echo "$ntp_openssl" >&6; } case "$ntp_openssl" in yes) + for ac_header in openssl/cmac.h openssl/hmac.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF +fi + +done + + $as_echo "#define OPENSSL /**/" >>confdefs.h case "$VER_SUFFIX" in @@ -30534,9 +30583,24 @@ LIBS="$NTPO_SAVED_LIBS" { ntp_openssl_from_pkg_config=; unset ntp_openssl_from_pkg_config;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we want to enable CMAC support" >&5 +$as_echo_n "checking if we want to enable CMAC support... " >&6; } +case "$ac_cv_header_openssl_cmac_h" in + yes) +$as_echo "#define ENABLE_CMAC 1" >>confdefs.h + ans="yes" + ;; + *) ans="no" + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ans" >&5 +$as_echo "$ans" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we want to use OpenSSL's crypto random (if available)" >&5 $as_echo_n "checking if we want to use OpenSSL's crypto random (if available)... " >&6; } # Check whether --enable-openssl-random was given. @@ -33223,7 +33287,33 @@ fi ### +ac_fn_c_check_decl "$LINENO" "sigsetjmp" "ac_cv_have_decl_sigsetjmp" "#include +" +if test "x$ac_cv_have_decl_sigsetjmp" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SIGSETJMP $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "siglongjmp" "ac_cv_have_decl_siglongjmp" "#include +" +if test "x$ac_cv_have_decl_siglongjmp" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SIGLONGJMP $ac_have_decl +_ACEOF + + +### + + prefix_NONE= exec_prefix_NONE= test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix @@ -33964,7 +34054,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by ntp $as_me 4.2.8p11, which was +This file was extended by ntp $as_me 4.2.8p12, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -34031,7 +34121,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -ntp config.status 4.2.8p11 +ntp config.status 4.2.8p12 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/11/contrib/ntp/configure.ac ============================================================================== --- stable/11/contrib/ntp/configure.ac Fri Sep 7 23:12:17 2018 (r338529) +++ stable/11/contrib/ntp/configure.ac Sat Sep 8 04:09:30 2018 (r338530) @@ -3014,6 +3014,17 @@ AC_MSG_RESULT([$ans]) NTP_OPENSSL +AC_MSG_CHECKING([if we want to enable CMAC support]) +case "$ac_cv_header_openssl_cmac_h" in + yes) + AC_DEFINE([ENABLE_CMAC], [1], [Enable CMAC support?]) + ans="yes" + ;; + *) ans="no" + ;; +esac +AC_MSG_RESULT([$ans]) + NTP_CRYPTO_RAND # if we are using OpenSSL (--with-crypto), by default Autokey is enabled @@ -4377,6 +4388,10 @@ dnl can't be conditionalized. NTP_GOOGLETEST NTP_PROBLEM_TESTS + +### + +AC_CHECK_DECLS([sigsetjmp,siglongjmp], [], [], [[#include ]]) ### Modified: stable/11/contrib/ntp/html/authentic.html ============================================================================== --- stable/11/contrib/ntp/html/authentic.html Fri Sep 7 23:12:17 2018 (r338529) +++ stable/11/contrib/ntp/html/authentic.html Sat Sep 8 04:09:30 2018 (r338530) @@ -1,91 +1,223 @@ - - - -Authentication Support - - - - -

Authentication Support

-giffrom Alice's Adventures in Wonderland, Lewis Carroll -

Our resident cryptographer; now you see him, now you don't.

-

Last update: - 5-Feb-2016 09:13 - UTC

-
-

Related Links

- - -

Table of Contents

- -
-

Introduction

-

This page describes the various cryptographic authentication provisions in NTPv4. Authentication support allows the NTP client to verify that servers are in fact known and trusted and not intruders intending accidentally or intentionally to masquerade as a legitimate server. A detailed discussion of the NTP multi-layer security model and vulnerability analysis is in the white paper NTP Security Analysis.

-

The NTPv3 specification (RFC-1305) defined an authentication scheme properly described as symmetric key cryptography. It used the Data Encryption Standard (DES) algorithm operating in cipher-block chaining (CBC) mode. Subsequently, this algorithm was replaced by the RSA Message Digest 5 (MD5) algorithm commonly called keyed-MD5. Either algorithm computes a message digest or one-way hash which can be used to verify the client has the same message digest as the server. The MD5 message digest algorithm is included in the distribution, so without further cryptographic support, the distribution can be freely exported.

-

If the OpenSSL cryptographic library is installed prior to building the distribution, all message digest algorithms included in the library may be used, including SHA and SHA1. However, if conformance to FIPS 140-2 is required, only a limited subset of these algorithms can be used. This library is available from http://www.openssl.org and can be installed using the procedures outlined in the Building and Installing the Distribution page. Once installed, the configure and build process automatically detects the library and links the library routines -required.

-

In addition to the symmetric key algorithms, this distribution includes support for the Autokey public key algorithms and protocol specified in RFC-5906 "Network Time Protocol Version 4: Autokey Specification". This support is available only if the OpenSSL library has been installed and the --enable-autokey option is used when the distribution is built.

-

Public key cryptography is generally considered more secure than symmetric key cryptography, since the security is based on private and public values which are generated by each participant and where the private value is never revealed. Autokey uses X.509 public certificates, which can be produced by commercial services, the OpenSSL application program, or the ntp-keygen utility program in the NTP software distribution.

-

Note that according to US law, NTP binaries including OpenSSL library components, including the OpenSSL library itself, cannot be exported outside the US without license from the US Department of Commerce. Builders outside the US are advised to obtain the OpenSSL library directly from OpenSSL, which is outside the US, and build outside the US.

-

Authentication is configured separately for each association using the key or autokey option of the server configuration command, as described in the Server Options page. The ntp-keygen page describes the files required for the various authentication schemes. Further details are in the briefings, papers and reports at the NTP project page linked from www.ntp.org.

-

By default, the client sends non-authenticated packets and the server responds with non-authenticated packets. If the client sends authenticated packets, the server responds with authenticated packets if correct, or a crypto-NAK packet if not. In the case of unsolicited packets which might consume significant resources, such as broadcast or symmetric mode packets, authentication is required, unless overridden by a disable auth command. In the current climate of targeted broadcast or "letterbomb" attacks, defeating this requirement would be decidedly dangerous. In any case, the notrust flag, described on the Access Control Options page, can be used to disable access to all but correctly authenticated clients.

-

Symmetric Key Cryptography

-

The original NTPv3 specification (RFC-1305), as well as the current NTPv4 specification (RFC-5905), allows any one of possibly 65,534 message digest keys (excluding zero), each distinguished by a 32-bit key ID, to authenticate an association. The servers and clients involved must agree on the key ID, key type and key to authenticate NTP packets.

-

The message digest is a cryptographic hash computed by an algorithm such as MD5, SHA, or AES-128 CMAC. When authentication is specified, a message authentication code (MAC) is appended to the NTP packet header. The MAC consists of a 32-bit key identifier (key ID) followed by a 128- or 160-bit message digest. The algorithm computes the digest as the hash of a 128- or 160- bit message digest key concatenated with the NTP packet header fields with the exception of the MAC. On transmit, the message digest is computed and inserted in the MAC. On receive, the message digest is computed and compared with the MAC. The packet is accepted only if the two MACs are identical. If a discrepancy is found by the client, the client ignores the packet, but raises an alarm. If this happens at the server, the server returns a special message called a crypto-NAK. Since the crypto-NAK is protected by the loopback test, an intruder cannot disrupt the protocol by sending a bogus crypto -NAK.

-

Keys and related information are specified in a keys file, which must be distributed and stored using secure means beyond the scope of the NTP protocol itself. Besides the keys used for ordinary NTP associations, additional keys can be used as passwords for the ntpq and ntpdc utility programs. Ordinarily, the ntp.keys file is generated by the ntp-keygen program, but it can be constructed and edited using an ordinary text editor.

-

Each line of the keys file consists of three or four fields: a key ID in the range 1 to 65,534, inclusive, a key type, a message digest key consisting of a printable ASCII string less than 40 characters or a 40-character hex digit string, and an optional comma-separated list of IPs that are allowed to serve time. If the OpenSSL library is installed, the key type can be any message digest algorithm supported by the library. If the OpenSSL library is not installed, the only permitted key type is MD5.

- - -
- Figure 1. Typical Symmetric Key File -
-
-# ntpkey_MD5key_bk.ntp.org.3595864945
-# Thu Dec 12 19:22:25 2013
+  
+    
+    
+    Authentication Support
+    
+    
+    
+  
+  
+    

Authentication Support

+ giffrom Alice's Adventures in Wonderland, Lewis Carroll +

Our resident cryptographer; now you see him, now you don't.

+

Last update: + 24-Jul-2018 09:12 + UTC

+
+

Related Links

+ + +

Table of Contents

+ +
+

Introduction

+

This page describes the various cryptographic authentication + provisions in NTPv4. Authentication support allows the NTP client to + verify that servers are in fact known and trusted and not intruders + intending accidentally or intentionally to masquerade as a legitimate + server. A detailed discussion of the NTP multi-layer security model + and vulnerability analysis is in the white + paper NTP + Security Analysis.

+

The NTPv3 specification (RFC-1305) defined an authentication scheme + properly described as symmetric key cryptography. It used + the Data Encryption Standard (DES) algorithm operating in cipher-block + chaining (CBC) mode. Subsequently, this algorithm was replaced by the + RSA Message Digest 5 (MD5) algorithm commonly called keyed-MD5. + Either algorithm computes a message digest or one-way hash which can + be used to verify the client has the same message digest as the + server. The MD5 message digest algorithm is included in the + distribution, so without further cryptographic support, the + distribution can be freely exported.

+

If the OpenSSL cryptographic library is installed prior to building + the distribution, all message digest algorithms included in the + library may be used, including SHA and SHA1. However, if conformance + to FIPS 140-2 is required, only a limited subset of these algorithms + can be used. This library is available + from http://www.openssl.org and + can be installed using the procedures outlined in + the Building and Installing the Distribution + page. Once installed, the configure and build process automatically + detects the library and links the library routines required.

+

In addition to the symmetric key algorithms, this distribution + includes support for the Autokey public key algorithms and protocol + specified in RFC-5906 "Network Time Protocol Version 4: Autokey + Specification". This support is available only if the OpenSSL + library has been installed and the --enable-autokey option is + used when the distribution is built.

+

Public key cryptography is generally considered more secure than + symmetric key cryptography, since the security is based on private and + public values which are generated by each participant and where the + private value is never revealed. Autokey uses X.509 public + certificates, which can be produced by commercial services, the + OpenSSL application program, or + the ntp-keygen utility program in + the NTP software distribution.

+

Note that according to US law, NTP binaries including OpenSSL library + components, including the OpenSSL library itself, cannot be exported + outside the US without license from the US Department of Commerce. + Builders outside the US are advised to obtain the OpenSSL library + directly from OpenSSL, which is outside the US, and build outside the + US.

+

Authentication is configured separately for each association using + the key or autokey option of the server + configuration command, as described in + the Server Options page. + The ntp-keygen page describes the files + required for the various authentication schemes. Further details are + in the briefings, papers and reports at the NTP project page linked + from www.ntp.org.

+

By default, the client sends non-authenticated packets and the server + responds with non-authenticated packets. If the client sends + authenticated packets, the server responds with authenticated packets + if correct, or a crypto-NAK packet if not. In the case of unsolicited + packets which might consume significant resources, such as broadcast + or symmetric mode packets, authentication is required, unless + overridden by a disable auth command. In the current climate + of targeted broadcast or "letterbomb" attacks, defeating + this requirement would be decidedly dangerous. In any case, + the notrust flag, described on + the Access Control Options page, can be + used to disable access to all but correctly authenticated clients.

+

Symmetric Key Cryptography

+

The original NTPv3 specification (RFC-1305), as well as the current + NTPv4 specification (RFC-5905), allows any one of possibly 65,535 + message digest keys (excluding zero), each distinguished by a 32-bit + key ID, to authenticate an association. The servers and clients + involved must agree on the key ID, key type and key to authenticate + NTP packets.

+

The message digest is a cryptographic hash computed by an algorithm + such as MD5, SHA, or AES-128 CMAC. When authentication is specified, + a message authentication code (MAC) is appended to the NTP packet + header. The MAC consists of a 32-bit key identifier (key ID) followed + by a 128- or 160-bit message digest. The algorithm computes the + digest as the hash of a 128- or 160- bit message digest key + concatenated with the NTP packet header fields with the exception of + the MAC. On transmit, the message digest is computed and inserted in + the MAC. On receive, the message digest is computed and compared with + the MAC. The packet is accepted only if the two MACs are identical. + If a discrepancy is found by the client, the client ignores the + packet, but raises an alarm. If this happens at the server, the + server returns a special message called a crypto-NAK. Since + the crypto-NAK is protected by the loopback test, an intruder cannot + disrupt the protocol by sending a bogus crypto-NAK.

+

Keys and related information are specified in a keys file, which must + be distributed and stored using secure means beyond the scope of the + NTP protocol itself. Besides the keys used for ordinary NTP + associations, additional keys can be used as passwords for + the ntpq + and ntpdc utility programs. + Ordinarily, the ntp.keys file is generated by + the ntp-keygen program, but it can + be constructed and edited using an ordinary text editor.

+

Each line of the keys file consists of three or four fields: a key + ID in the range 1 to 65,535, inclusive, a key type, a message digest + key consisting of a printable ASCII string less than 40 characters or + a 40-character hex digit string, and an optional comma-separated list + of IPs that are allowed to serve time. If the OpenSSL library is + installed, the key type can be any message digest algorithm supported + by the library. If the OpenSSL library is not installed, the only + permitted key type is MD5.

+ + +
+ Figure 1. Typical Symmetric Key File +
+
+	    # ntpkey_MD5key_bk.ntp.org.3595864945
+	    # Thu Dec 12 19:22:25 2013
 
-1  MD5 L";Nw<`.I<f4U0)247"i  # MD5 key
-2  MD5 &>l0%XXK9O'51VwV<xq~  # MD5 key
-3  MD5 lb4zLW~d^!K:]RsD'qb6  # MD5 key
-4  MD5 Yue:tL[+vR)M`n~bY,'?  # MD5 key
-5  MD5 B;fxlKgr/&4ZTbL6=RxA  # MD5 key
-6  MD5 4eYwa`o}3i@@V@..R9!l  # MD5 key
-7  MD5 `A.([h+;wTQ|xfi%Sn_!  # MD5 key
-8  MD5 45:V,r4]l6y^JH6"Sh?F  # MD5 key
-9  MD5 3-5vcn*6l29DS?Xdsg)*  # MD5 key
-10 MD5 2late4Me              # MD5 key
-11 SHA1 a27872d3030a9025b8446c751b4551a7629af65c  # SHA1 key
-12 SHA1 21bc3b4865dbb9e920902abdccb3e04ff97a5e74  # SHA1 key
-13 SHA1 2b7736fe24fef5ba85ae11594132ab5d6f6daba9  # SHA1 key
-14 SHA  a5332809c8878dd3a5b918819108a111509aeceb  # SHA  key
-15 MD2  2fe16c88c760ff2f16d4267e36c1aa6c926e6964  # MD2  key
-16 MD4  b2691811dc19cfc0e2f9bcacd74213f29812183d  # MD4  key
-17 MD5  e4d6735b8bdad58ec5ffcb087300a17f7fef1f7c  # MD5  key
-18 MDC2 a8d5e2315c025bf3a79174c87fbd10477de2eabc  # MDC2 key
-19 RIPEMD160 77ca332cafb30e3cafb174dcd5b80ded7ba9b3d2  # RIPEMD160 key
-20 AES128CMAC f92ff73eee86c1e7dc638d6489a04e4e555af878  # AES128CMAC key
-  
-

Figure 1 shows a typical keys file used by the reference implementation when the OpenSSL library is installed. In this figure, for key IDs in he range 1-10, the key is interpreted as a printable ASCII string. For key IDs in the range 11-20, the key is a 40-character hex digit string. The key is truncated or zero-filled internally to either 128 or 160 bits, depending on the key type. The line can be edited later or new lines can be added to change any field. The key can be changed to a password, such as 2late4Me for key ID 10. Note that two or more keys files can be combined in any order as long as the key IDs are distinct.

-

When ntpd is started, it reads the keys file specified by the keys command and installs the keys in the key cache. However, individual keys must be activated with the trustedkey configuration command before use. This allows, for instance, the installation of possibly several batches of keys and then activating a key remotely using ntpq or ntpdc. The requestkey command selects the key ID used as the password for the ntpdc utility, while the controlkey command selects the key ID used as the password for the ntpq utility.

-

Microsoft Windows Authentication

-

In addition to the above means, ntpd now supports Microsoft Windows MS-SNTP authentication using Active Directory services. This support was contributed by the Samba Team and is still in development. It is enabled using the mssntp flag of the restrict command described on the Access Control Options page. Note: Potential users should be aware that these services involve a TCP connection to another process that could potentially block, denying services to other users. Therefore, this flag should be used only for a dedicated server with no clients other than MS-SNTP.

-

Public Key Cryptography

-

See the Autokey Public-Key Authentication page.

-
- - + 1 MD5 L";Nw<`.I<f4U0)247"i # MD5 key + 2 MD5 &>l0%XXK9O'51VwV<xq~ # MD5 key + 3 MD5 lb4zLW~d^!K:]RsD'qb6 # MD5 key + 4 MD5 Yue:tL[+vR)M`n~bY,'? # MD5 key + 5 MD5 B;fxlKgr/&4ZTbL6=RxA # MD5 key + 6 MD5 4eYwa`o}3i@@V@..R9!l # MD5 key + 7 MD5 `A.([h+;wTQ|xfi%Sn_! # MD5 key + 8 MD5 45:V,r4]l6y^JH6"Sh?F # MD5 key + 9 MD5 3-5vcn*6l29DS?Xdsg)* # MD5 key + 10 MD5 2late4Me # MD5 key + 11 SHA1 a27872d3030a9025b8446c751b4551a7629af65c # SHA1 key + 12 SHA1 21bc3b4865dbb9e920902abdccb3e04ff97a5e74 # SHA1 key + 13 SHA1 2b7736fe24fef5ba85ae11594132ab5d6f6daba9 # SHA1 key + 14 SHA a5332809c8878dd3a5b918819108a111509aeceb # SHA key + 15 MD2 2fe16c88c760ff2f16d4267e36c1aa6c926e6964 # MD2 key + 16 MD4 b2691811dc19cfc0e2f9bcacd74213f29812183d # MD4 key + 17 MD5 e4d6735b8bdad58ec5ffcb087300a17f7fef1f7c # MD5 key + 18 MDC2 a8d5e2315c025bf3a79174c87fbd10477de2eabc # MDC2 key + 19 RIPEMD160 77ca332cafb30e3cafb174dcd5b80ded7ba9b3d2 # RIPEMD160 key + 20 AES128CMAC f92ff73eee86c1e7dc638d6489a04e4e555af878 # AES128CMAC key + 21 MD5 sampo 10.1.2.3/24 +
+

Figure 1 shows a typical symmetric keys file used by the reference + implementation when the OpenSSL library is installed. Each line of + the file contains three or four fields. The first field is an integer + between 1 and 65535, inclusive, representing the key identifier. The + second field is the digest algorithm, which in the absence of the + OpenSSL library must be MD5, which designates the MD5 message + digest algorithm. The third field is the key. The optional fourth + field is one or more comma-separated IPs. An IP may end with an + optional /subnetbits suffix, which limits the acceptance of + the key identifier to packets claiming to be from the described IP + space. In this example, for the key IDs in the range 1-10 the key is + interpreted as a printable ASCII string. For the key IDs in the range + 11-20, the key is a 40-character hex digit string. In either case, + the key is truncated or zero-filled internally to either 128 or 160 + bits, depending on the key type. The line can be edited later or new + lines can be added to change any field. The key can be changed to a + password, such as 2late4Me for key ID 10. Note that two or + more keys files can be combined in any order as long as the key IDs + are distinct.

+

When ntpd is started, it reads the keys file specified by + the keys command and installs the keys in the key cache. + However, individual keys must be activated with + the trustedkey configuration command before use. This + allows, for instance, the installation of possibly several batches of + keys and then activating a key remotely using ntpq + or ntpdc. The requestkey command selects the key ID + used as the password for the ntpdc utility, while + the controlkey command selects the key ID used as the + password for the ntpq utility.

+

Microsoft Windows Authentication

+

In addition to the above means, ntpd now supports Microsoft + Windows MS-SNTP authentication using Active Directory services. This + support was contributed by the Samba Team and is still in development. + It is enabled using the mssntp flag of the restrict + command described on the Access Control + Options page. Note: Potential users should + be aware that these services involve a TCP connection to another + process that could potentially block, denying services to other users. + Therefore, this flag should be used only for a dedicated server with + no clients other than MS-SNTP.

+

Public Key Cryptography

+

See the Autokey Public-Key Authentication + page.

+
+ + Modified: stable/11/contrib/ntp/html/authopt.html ============================================================================== --- stable/11/contrib/ntp/html/authopt.html Fri Sep 7 23:12:17 2018 (r338529) +++ stable/11/contrib/ntp/html/authopt.html Sat Sep 8 04:09:30 2018 (r338530) @@ -4,6 +4,7 @@ Authentication Commands and Options + - - -

Authentication Support

-giffrom Alice's Adventures in Wonderland, Lewis Carroll -

Our resident cryptographer; now you see him, now you don't.

-

Last update: - 5-Feb-2016 09:13 - UTC

-
-

Related Links

- - -

Table of Contents

- -
-

Introduction

-

This page describes the various cryptographic authentication provisions in NTPv4. Authentication support allows the NTP client to verify that servers are in fact known and trusted and not intruders intending accidentally or intentionally to masquerade as a legitimate server. A detailed discussion of the NTP multi-layer security model and vulnerability analysis is in the white paper NTP Security Analysis.

-

The NTPv3 specification (RFC-1305) defined an authentication scheme properly described as symmetric key cryptography. It used the Data Encryption Standard (DES) algorithm operating in cipher-block chaining (CBC) mode. Subsequently, this algorithm was replaced by the RSA Message Digest 5 (MD5) algorithm commonly called keyed-MD5. Either algorithm computes a message digest or one-way hash which can be used to verify the client has the same message digest as the server. The MD5 message digest algorithm is included in the distribution, so without further cryptographic support, the distribution can be freely exported.

-

If the OpenSSL cryptographic library is installed prior to building the distribution, all message digest algorithms included in the library may be used, including SHA and SHA1. However, if conformance to FIPS 140-2 is required, only a limited subset of these algorithms can be used. This library is available from http://www.openssl.org and can be installed using the procedures outlined in the Building and Installing the Distribution page. Once installed, the configure and build process automatically detects the library and links the library routines -required.

-

In addition to the symmetric key algorithms, this distribution includes support for the Autokey public key algorithms and protocol specified in RFC-5906 "Network Time Protocol Version 4: Autokey Specification". This support is available only if the OpenSSL library has been installed and the --enable-autokey option is used when the distribution is built.

-

Public key cryptography is generally considered more secure than symmetric key cryptography, since the security is based on private and public values which are generated by each participant and where the private value is never revealed. Autokey uses X.509 public certificates, which can be produced by commercial services, the OpenSSL application program, or the ntp-keygen utility program in the NTP software distribution.

-

Note that according to US law, NTP binaries including OpenSSL library components, including the OpenSSL library itself, cannot be exported outside the US without license from the US Department of Commerce. Builders outside the US are advised to obtain the OpenSSL library directly from OpenSSL, which is outside the US, and build outside the US.

-

Authentication is configured separately for each association using the key or autokey option of the server configuration command, as described in the Server Options page. The ntp-keygen page describes the files required for the various authentication schemes. Further details are in the briefings, papers and reports at the NTP project page linked from www.ntp.org.

-

By default, the client sends non-authenticated packets and the server responds with non-authenticated packets. If the client sends authenticated packets, the server responds with authenticated packets if correct, or a crypto-NAK packet if not. In the case of unsolicited packets which might consume significant resources, such as broadcast or symmetric mode packets, authentication is required, unless overridden by a disable auth command. In the current climate of targeted broadcast or "letterbomb" attacks, defeating this requirement would be decidedly dangerous. In any case, the notrust flag, described on the Access Control Options page, can be used to disable access to all but correctly authenticated clients.

-

Symmetric Key Cryptography

-

The original NTPv3 specification (RFC-1305), as well as the current NTPv4 specification (RFC-5905), allows any one of possibly 65,534 message digest keys (excluding zero), each distinguished by a 32-bit key ID, to authenticate an association. The servers and clients involved must agree on the key ID, key type and key to authenticate NTP packets.

-

The message digest is a cryptographic hash computed by an algorithm such as MD5, SHA, or AES-128 CMAC. When authentication is specified, a message authentication code (MAC) is appended to the NTP packet header. The MAC consists of a 32-bit key identifier (key ID) followed by a 128- or 160-bit message digest. The algorithm computes the digest as the hash of a 128- or 160- bit message digest key concatenated with the NTP packet header fields with the exception of the MAC. On transmit, the message digest is computed and inserted in the MAC. On receive, the message digest is computed and compared with the MAC. The packet is accepted only if the two MACs are identical. If a discrepancy is found by the client, the client ignores the packet, but raises an alarm. If this happens at the server, the server returns a special message called a crypto-NAK. Since the crypto-NAK is protected by the loopback test, an intruder cannot disrupt the protocol by sending a bogus crypto -NAK.

-

Keys and related information are specified in a keys file, which must be distributed and stored using secure means beyond the scope of the NTP protocol itself. Besides the keys used for ordinary NTP associations, additional keys can be used as passwords for the ntpq and ntpdc utility programs. Ordinarily, the ntp.keys file is generated by the ntp-keygen program, but it can be constructed and edited using an ordinary text editor.

-

Each line of the keys file consists of three or four fields: a key ID in the range 1 to 65,534, inclusive, a key type, a message digest key consisting of a printable ASCII string less than 40 characters or a 40-character hex digit string, and an optional comma-separated list of IPs that are allowed to serve time. If the OpenSSL library is installed, the key type can be any message digest algorithm supported by the library. If the OpenSSL library is not installed, the only permitted key type is MD5.

- - -
- Figure 1. Typical Symmetric Key File -
-
-# ntpkey_MD5key_bk.ntp.org.3595864945
-# Thu Dec 12 19:22:25 2013
+  
+    
+    
+    Authentication Support
+    
+    
+    
+  
+  
+    

Authentication Support

+ giffrom Alice's Adventures in Wonderland, Lewis Carroll +

Our resident cryptographer; now you see him, now you don't.

+

Last update: + 24-Jul-2018 09:12 + UTC

+
+

Related Links

+ + +

Table of Contents

+ +
+

Introduction

+

This page describes the various cryptographic authentication + provisions in NTPv4. Authentication support allows the NTP client to + verify that servers are in fact known and trusted and not intruders + intending accidentally or intentionally to masquerade as a legitimate + server. A detailed discussion of the NTP multi-layer security model + and vulnerability analysis is in the white + paper NTP + Security Analysis.

+

The NTPv3 specification (RFC-1305) defined an authentication scheme + properly described as symmetric key cryptography. It used + the Data Encryption Standard (DES) algorithm operating in cipher-block + chaining (CBC) mode. Subsequently, this algorithm was replaced by the + RSA Message Digest 5 (MD5) algorithm commonly called keyed-MD5. + Either algorithm computes a message digest or one-way hash which can + be used to verify the client has the same message digest as the + server. The MD5 message digest algorithm is included in the + distribution, so without further cryptographic support, the + distribution can be freely exported.

+

If the OpenSSL cryptographic library is installed prior to building + the distribution, all message digest algorithms included in the + library may be used, including SHA and SHA1. However, if conformance + to FIPS 140-2 is required, only a limited subset of these algorithms + can be used. This library is available + from http://www.openssl.org and + can be installed using the procedures outlined in + the Building and Installing the Distribution + page. Once installed, the configure and build process automatically + detects the library and links the library routines required.

+

In addition to the symmetric key algorithms, this distribution + includes support for the Autokey public key algorithms and protocol + specified in RFC-5906 "Network Time Protocol Version 4: Autokey + Specification". This support is available only if the OpenSSL + library has been installed and the --enable-autokey option is + used when the distribution is built.

+

Public key cryptography is generally considered more secure than + symmetric key cryptography, since the security is based on private and + public values which are generated by each participant and where the + private value is never revealed. Autokey uses X.509 public + certificates, which can be produced by commercial services, the + OpenSSL application program, or + the ntp-keygen utility program in + the NTP software distribution.

+

Note that according to US law, NTP binaries including OpenSSL library + components, including the OpenSSL library itself, cannot be exported + outside the US without license from the US Department of Commerce. + Builders outside the US are advised to obtain the OpenSSL library + directly from OpenSSL, which is outside the US, and build outside the + US.

+

Authentication is configured separately for each association using + the key or autokey option of the server + configuration command, as described in + the Server Options page. + The ntp-keygen page describes the files + required for the various authentication schemes. Further details are + in the briefings, papers and reports at the NTP project page linked + from www.ntp.org.

+

By default, the client sends non-authenticated packets and the server + responds with non-authenticated packets. If the client sends + authenticated packets, the server responds with authenticated packets + if correct, or a crypto-NAK packet if not. In the case of unsolicited + packets which might consume significant resources, such as broadcast + or symmetric mode packets, authentication is required, unless + overridden by a disable auth command. In the current climate + of targeted broadcast or "letterbomb" attacks, defeating + this requirement would be decidedly dangerous. In any case, + the notrust flag, described on + the Access Control Options page, can be + used to disable access to all but correctly authenticated clients.

+

Symmetric Key Cryptography

+

The original NTPv3 specification (RFC-1305), as well as the current + NTPv4 specification (RFC-5905), allows any one of possibly 65,535 + message digest keys (excluding zero), each distinguished by a 32-bit + key ID, to authenticate an association. The servers and clients + involved must agree on the key ID, key type and key to authenticate + NTP packets.

+

The message digest is a cryptographic hash computed by an algorithm + such as MD5, SHA, or AES-128 CMAC. When authentication is specified, + a message authentication code (MAC) is appended to the NTP packet + header. The MAC consists of a 32-bit key identifier (key ID) followed + by a 128- or 160-bit message digest. The algorithm computes the + digest as the hash of a 128- or 160- bit message digest key + concatenated with the NTP packet header fields with the exception of + the MAC. On transmit, the message digest is computed and inserted in + the MAC. On receive, the message digest is computed and compared with + the MAC. The packet is accepted only if the two MACs are identical. + If a discrepancy is found by the client, the client ignores the + packet, but raises an alarm. If this happens at the server, the + server returns a special message called a crypto-NAK. Since + the crypto-NAK is protected by the loopback test, an intruder cannot + disrupt the protocol by sending a bogus crypto-NAK.

+

Keys and related information are specified in a keys file, which must + be distributed and stored using secure means beyond the scope of the + NTP protocol itself. Besides the keys used for ordinary NTP + associations, additional keys can be used as passwords for + the ntpq + and ntpdc utility programs. + Ordinarily, the ntp.keys file is generated by + the ntp-keygen program, but it can + be constructed and edited using an ordinary text editor.

+

Each line of the keys file consists of three or four fields: a key + ID in the range 1 to 65,535, inclusive, a key type, a message digest + key consisting of a printable ASCII string less than 40 characters or + a 40-character hex digit string, and an optional comma-separated list + of IPs that are allowed to serve time. If the OpenSSL library is + installed, the key type can be any message digest algorithm supported + by the library. If the OpenSSL library is not installed, the only + permitted key type is MD5.

+ + +
+ Figure 1. Typical Symmetric Key File +
+
+	    # ntpkey_MD5key_bk.ntp.org.3595864945
+	    # Thu Dec 12 19:22:25 2013
 
-1  MD5 L";Nw<`.I<f4U0)247"i  # MD5 key
-2  MD5 &>l0%XXK9O'51VwV<xq~  # MD5 key
-3  MD5 lb4zLW~d^!K:]RsD'qb6  # MD5 key
-4  MD5 Yue:tL[+vR)M`n~bY,'?  # MD5 key
-5  MD5 B;fxlKgr/&4ZTbL6=RxA  # MD5 key
-6  MD5 4eYwa`o}3i@@V@..R9!l  # MD5 key
-7  MD5 `A.([h+;wTQ|xfi%Sn_!  # MD5 key
-8  MD5 45:V,r4]l6y^JH6"Sh?F  # MD5 key
-9  MD5 3-5vcn*6l29DS?Xdsg)*  # MD5 key
-10 MD5 2late4Me              # MD5 key
-11 SHA1 a27872d3030a9025b8446c751b4551a7629af65c  # SHA1 key
-12 SHA1 21bc3b4865dbb9e920902abdccb3e04ff97a5e74  # SHA1 key
-13 SHA1 2b7736fe24fef5ba85ae11594132ab5d6f6daba9  # SHA1 key
-14 SHA  a5332809c8878dd3a5b918819108a111509aeceb  # SHA  key
-15 MD2  2fe16c88c760ff2f16d4267e36c1aa6c926e6964  # MD2  key
-16 MD4  b2691811dc19cfc0e2f9bcacd74213f29812183d  # MD4  key
-17 MD5  e4d6735b8bdad58ec5ffcb087300a17f7fef1f7c  # MD5  key
-18 MDC2 a8d5e2315c025bf3a79174c87fbd10477de2eabc  # MDC2 key
-19 RIPEMD160 77ca332cafb30e3cafb174dcd5b80ded7ba9b3d2  # RIPEMD160 key
-20 AES128CMAC f92ff73eee86c1e7dc638d6489a04e4e555af878  # AES128CMAC key
-  
-

Figure 1 shows a typical keys file used by the reference implementation when the OpenSSL library is installed. In this figure, for key IDs in he range 1-10, the key is interpreted as a printable ASCII string. For key IDs in the range 11-20, the key is a 40-character hex digit string. The key is truncated or zero-filled internally to either 128 or 160 bits, depending on the key type. The line can be edited later or new lines can be added to change any field. The key can be changed to a password, such as 2late4Me for key ID 10. Note that two or more keys files can be combined in any order as long as the key IDs are distinct.

-

When ntpd is started, it reads the keys file specified by the keys command and installs the keys in the key cache. However, individual keys must be activated with the trustedkey configuration command before use. This allows, for instance, the installation of possibly several batches of keys and then activating a key remotely using ntpq or ntpdc. The requestkey command selects the key ID used as the password for the ntpdc utility, while the controlkey command selects the key ID used as the password for the ntpq utility.

-

Microsoft Windows Authentication

-

In addition to the above means, ntpd now supports Microsoft Windows MS-SNTP authentication using Active Directory services. This support was contributed by the Samba Team and is still in development. It is enabled using the mssntp flag of the restrict command described on the Access Control Options page. Note: Potential users should be aware that these services involve a TCP connection to another process that could potentially block, denying services to other users. Therefore, this flag should be used only for a dedicated server with no clients other than MS-SNTP.

-

Public Key Cryptography

-

See the Autokey Public-Key Authentication page.

-
- - + 1 MD5 L";Nw<`.I<f4U0)247"i # MD5 key + 2 MD5 &>l0%XXK9O'51VwV<xq~ # MD5 key + 3 MD5 lb4zLW~d^!K:]RsD'qb6 # MD5 key + 4 MD5 Yue:tL[+vR)M`n~bY,'? # MD5 key + 5 MD5 B;fxlKgr/&4ZTbL6=RxA # MD5 key + 6 MD5 4eYwa`o}3i@@V@..R9!l # MD5 key + 7 MD5 `A.([h+;wTQ|xfi%Sn_! # MD5 key + 8 MD5 45:V,r4]l6y^JH6"Sh?F # MD5 key + 9 MD5 3-5vcn*6l29DS?Xdsg)* # MD5 key + 10 MD5 2late4Me # MD5 key + 11 SHA1 a27872d3030a9025b8446c751b4551a7629af65c # SHA1 key + 12 SHA1 21bc3b4865dbb9e920902abdccb3e04ff97a5e74 # SHA1 key + 13 SHA1 2b7736fe24fef5ba85ae11594132ab5d6f6daba9 # SHA1 key + 14 SHA a5332809c8878dd3a5b918819108a111509aeceb # SHA key + 15 MD2 2fe16c88c760ff2f16d4267e36c1aa6c926e6964 # MD2 key + 16 MD4 b2691811dc19cfc0e2f9bcacd74213f29812183d # MD4 key + 17 MD5 e4d6735b8bdad58ec5ffcb087300a17f7fef1f7c # MD5 key + 18 MDC2 a8d5e2315c025bf3a79174c87fbd10477de2eabc # MDC2 key + 19 RIPEMD160 77ca332cafb30e3cafb174dcd5b80ded7ba9b3d2 # RIPEMD160 key + 20 AES128CMAC f92ff73eee86c1e7dc638d6489a04e4e555af878 # AES128CMAC key + 21 MD5 sampo 10.1.2.3/24 +
+

Figure 1 shows a typical symmetric keys file used by the reference + implementation when the OpenSSL library is installed. Each line of + the file contains three or four fields. The first field is an integer + between 1 and 65535, inclusive, representing the key identifier. The + second field is the digest algorithm, which in the absence of the + OpenSSL library must be MD5, which designates the MD5 message + digest algorithm. The third field is the key. The optional fourth + field is one or more comma-separated IPs. An IP may end with an + optional /subnetbits suffix, which limits the acceptance of + the key identifier to packets claiming to be from the described IP + space. In this example, for the key IDs in the range 1-10 the key is + interpreted as a printable ASCII string. For the key IDs in the range + 11-20, the key is a 40-character hex digit string. In either case, + the key is truncated or zero-filled internally to either 128 or 160 + bits, depending on the key type. The line can be edited later or new + lines can be added to change any field. The key can be changed to a + password, such as 2late4Me for key ID 10. Note that two or + more keys files can be combined in any order as long as the key IDs + are distinct.

+

When ntpd is started, it reads the keys file specified by + the keys command and installs the keys in the key cache. + However, individual keys must be activated with + the trustedkey configuration command before use. This + allows, for instance, the installation of possibly several batches of + keys and then activating a key remotely using ntpq + or ntpdc. The requestkey command selects the key ID + used as the password for the ntpdc utility, while + the controlkey command selects the key ID used as the + password for the ntpq utility.

+

Microsoft Windows Authentication

+

In addition to the above means, ntpd now supports Microsoft + Windows MS-SNTP authentication using Active Directory services. This + support was contributed by the Samba Team and is still in development. + It is enabled using the mssntp flag of the restrict + command described on the Access Control + Options page. Note: Potential users should + be aware that these services involve a TCP connection to another + process that could potentially block, denying services to other users. + Therefore, this flag should be used only for a dedicated server with + no clients other than MS-SNTP.

+

Public Key Cryptography

+

See the Autokey Public-Key Authentication + page.

+
+ + Modified: stable/10/contrib/ntp/html/authopt.html ============================================================================== --- stable/10/contrib/ntp/html/authopt.html Sat Sep 8 04:09:30 2018 (r338530) +++ stable/10/contrib/ntp/html/authopt.html Sat Sep 8 04:10:26 2018 (r338531) @@ -4,6 +4,7 @@ Authentication Commands and Options +