svn commit: r338441 - stable/10/usr.sbin/tzsetup
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.cMon Sep 3 06:55:38 2018 (r338440) +++ stable/10/usr.sbin/tzsetup/tzsetup.cMon Sep 3 06:57:25 2018 (r338441) @@ -481,7 +481,7 @@ read_zones(void) charcontbuf[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, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338440 - stable/11/usr.sbin/tzsetup
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.cMon Sep 3 06:36:28 2018 (r338439) +++ stable/11/usr.sbin/tzsetup/tzsetup.cMon Sep 3 06:55:38 2018 (r338440) @@ -481,7 +481,7 @@ read_zones(void) charcontbuf[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, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338439 - in stable/11/usr.bin/diff: . tests
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.cMon Sep 3 03:23:09 2018 (r338438) +++ stable/11/usr.bin/diff/diffreg.cMon 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 -u -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 } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338438 - head/stand/lua
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 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338437 - in head/sys: amd64/amd64 amd64/include arm64/arm64 arm64/include conf dev/efidev modules/efirt sys
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.cSun Sep 2 21:16:43 2018 (r338436) +++ head/sys/amd64/amd64/efirt_machdep.cSun 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.SSun 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) + movqPCPU(CURTHREAD), %rax + movq%rdi, TD_MD+MD_EFIRT_TMP(%rax) + movqPCPU(CURPCB), %rsi + + movlEC_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 + movqEC_ARG1(%rdi), %rcx + decl%ebx + jz 1f + movqEC_ARG2(%rdi), %rdx + decl%ebx + jz 1f + movqEC_ARG3(%rdi), %r8 + decl%ebx + jz 1f + movqEC_ARG4(%rdi), %r9 + decl%ebx + jz 1f + movqEC_ARG5(%rdi), %rax + movq%rax, 4*8(%rsp) + decl%ebx + jz 1f + movq$
svn commit: r338436 - in head/sys: amd64/include kern
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"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338435 - in head/sys: dev/efidev kern
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.cSun Sep 2 20:07:36 2018 (r338434) +++ head/sys/dev/efidev/efirtc.cSun 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.cSun Sep 2 20:07:36 2018(r338434) +++ head/sys/kern/subr_rtc.cSun 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 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338434 - head/sys/amd64/amd64
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)== ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338433 - in head/sys: amd64/include dev/efidev
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.hSun Sep 2 18:40:18 2018 (r338432) +++ head/sys/amd64/include/efi.hSun Sep 2 19:48:41 2018 (r338433) @@ -48,9 +48,9 @@ #ifdef _KERNEL #include -#defineEFI_TIME_LOCK() mtx_lock(&atrtc_time_lock); -#defineEFI_TIME_UNLOCK() mtx_unlock(&atrtc_time_lock); -#defineEFI_TIME_OWNED()mtx_assert(&atrtc_time_lock, MA_OWNED); +#defineEFI_TIME_LOCK() mtx_lock(&atrtc_time_lock) +#defineEFI_TIME_UNLOCK() mtx_unlock(&atrtc_time_lock) +#defineEFI_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); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338432 - head/usr.sbin/efibootmgr
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) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338431 - head/sys/vm
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++; + } } /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338430 - head/sys/cddl/dev/fbt
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; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r324815 - in head: lib/libc/gen sys/sys
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 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338429 - head/usr.sbin/periodic
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 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338428 - head/libexec/rtld-elf
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;
Re: svn commit: r324815 - in head: lib/libc/gen sys/sys
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 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338427 - in stable/11/sys/amd64: amd64 include vmm/intel
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 + callflush_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) +#defineL1D_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: movbL1D_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: movbL1D_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.cSat Sep 1 16:16:40 2018 (r338426) +++ stable/11/sys/amd64/amd64/trap.cSun 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.hSat Sep 1 16:16:40 2018 (r338426) +++ stable/11/sys/amd64/include/md_var.hSun 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