CVS commit: src/sys/arch
Module Name:src Committed By: maxv Date: Tue Oct 17 06:58:15 UTC 2017 Modified Files: src/sys/arch/amd64/amd64: copy.S trap.c src/sys/arch/amd64/include: frameasm.h src/sys/arch/x86/x86: cpu.c patch.c Log Message: Add support for SMAP on amd64. PSL_AC is cleared from %rflags in each kernel entry point. In the copy sections, a copy window is opened and the kernel can touch userland pages. This window is closed when the kernel is done, either at the end of the copy sections or in the fault-recover functions. This implementation is not optimized yet, due to the fact that INTRENTRY is a macro, and we can't hotpatch macros. Sent on tech-kern@ a month or two ago, tested on a Kabylake. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/amd64/amd64/copy.S cvs rdiff -u -r1.101 -r1.102 src/sys/arch/amd64/amd64/trap.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/include/frameasm.h cvs rdiff -u -r1.136 -r1.137 src/sys/arch/x86/x86/cpu.c cvs rdiff -u -r1.22 -r1.23 src/sys/arch/x86/x86/patch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/copy.S diff -u src/sys/arch/amd64/amd64/copy.S:1.24 src/sys/arch/amd64/amd64/copy.S:1.25 --- src/sys/arch/amd64/amd64/copy.S:1.24 Fri Aug 25 11:35:03 2017 +++ src/sys/arch/amd64/amd64/copy.S Tue Oct 17 06:58:15 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: copy.S,v 1.24 2017/08/25 11:35:03 maxv Exp $ */ +/* $NetBSD: copy.S,v 1.25 2017/10/17 06:58:15 maxv Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -107,6 +107,24 @@ ENTRY(do_pmap_load) ret /* + * SMAP functions. ret+int3+int3 is patched dynamically to STAC/CLAC. + */ + +ENTRY(smap_enable) +.Lclacpatch: + ret + int3 + int3 + ret + +ENTRY(smap_disable) +.Lstacpatch: + ret + int3 + int3 + ret + +/* * Copy routines from and to userland, plus a few more. See the * section 9 manpages for info. Some cases can be optimized more. * @@ -185,6 +203,7 @@ ENTRY(copyout) cmpq %r8,%rdx ja _C_LABEL(copy_efault) /* jump if end in kernel space */ + callq smap_disable .Lcopyout_start: movq %rax,%rcx /* length */ shrq $3,%rcx /* count of 8-byte words */ @@ -195,6 +214,7 @@ ENTRY(copyout) rep movsb/* copy remaining bytes */ .Lcopyout_end: + callq smap_enable xorl %eax,%eax ret @@ -212,6 +232,7 @@ ENTRY(copyin) cmpq %r8,%rdx ja _C_LABEL(copy_efault) /* j if end in kernel space */ + callq smap_disable .Lcopyin_start: 3: /* bcopy(%rsi, %rdi, %rax); */ movq %rax,%rcx @@ -223,6 +244,7 @@ ENTRY(copyin) rep movsb .Lcopyin_end: + callq smap_enable xorl %eax,%eax ret @@ -241,6 +263,7 @@ NENTRY(kcopy_fault) ret NENTRY(copy_fault) + callq smap_enable ret ENTRY(copyoutstr) @@ -261,6 +284,7 @@ ENTRY(copyoutstr) movq %rax,%r8 1: incq %rdx + callq smap_disable .Lcopyoutstr_start: 1: decq %rdx jz 2f @@ -269,6 +293,7 @@ ENTRY(copyoutstr) testb %al,%al jnz 1b .Lcopyoutstr_end: + callq smap_enable /* Success -- 0 byte reached. */ decq %rdx @@ -276,6 +301,7 @@ ENTRY(copyoutstr) jmp copystr_return 2: /* rdx is zero -- return EFAULT or ENAMETOOLONG. */ + callq smap_enable movq $VM_MAXUSER_ADDRESS,%r11 cmpq %r11,%rdi jae _C_LABEL(copystr_efault) @@ -301,6 +327,7 @@ ENTRY(copyinstr) movq %rax,%r8 1: incq %rdx + callq smap_disable .Lcopyinstr_start: 1: decq %rdx jz 2f @@ -309,6 +336,7 @@ ENTRY(copyinstr) testb %al,%al jnz 1b .Lcopyinstr_end: + callq smap_enable /* Success -- 0 byte reached. */ decq %rdx @@ -316,6 +344,7 @@ ENTRY(copyinstr) jmp copystr_return 2: /* edx is zero -- return EFAULT or ENAMETOOLONG. */ + callq smap_enable movq $VM_MAXUSER_ADDRESS,%r11 cmpq %r11,%rsi jae _C_LABEL(copystr_efault) @@ -327,6 +356,7 @@ ENTRY(copystr_efault) movl $EFAULT,%eax ENTRY(copystr_fault) + callq smap_enable copystr_return: /* Set *lencopied and return %eax. */ testq %r9,%r9 @@ -376,7 +406,9 @@ ENTRY(fuswintr) leaq _C_LABEL(fusuintrfailure)(%rip),%r11 movq %r11,PCB_ONFAULT(%rcx) + callq smap_disable movzwl (%rdi),%eax + callq smap_enable movq $0,PCB_ONFAULT(%rcx) ret @@ -390,7 +422,9 @@ ENTRY(fubyte) leaq _C_LABEL(fusufailure)(%rip),%r11 movq %r11,PCB_ONFAULT(%rcx) + callq smap_disable movzbl (%rdi),%eax + callq smap_enable movq $0,PCB_ONFAULT(%rcx) ret @@ -406,7 +440,9 @@ ENTRY(suswintr) leaq _C_LABEL(fusuintrfailure)(%rip),%r11 movq %r11,PCB_ONFAULT(%rcx) + callq smap_disable movw %si,(%rdi) + callq smap_enable xorq %rax,%rax movq %rax,PCB_ONFAULT(%rcx) @@ -422,7 +458,9 @@ ENTRY(subyte) leaq _C_LABEL(fusufailure)(%rip),%r11 movq %r11,PCB_ONFAULT(%rcx) + callq smap_disable movb %sil,(%rdi) + callq smap_enable xorq %rax,%rax movq %rax,PCB_ONFAULT(%rcx) @@ -434,11 +472,13 @@ ENTRY(subyte) * because trap.c checks for them. */ ENTRY(fusuintrfailure) + callq smap_enable movq $0,PCB_ONFAULT(%rcx)
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: maya Date: Tue Oct 17 06:50:00 UTC 2017 Modified Files: src/sys/arch/x86/x86: vmt.c vmtreg.h Log Message: Update protocol reverse engineering URL to a working one only mention it once. >From openbsd by Seth Jackson To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/x86/vmt.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/x86/vmtreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/vmt.c diff -u src/sys/arch/x86/x86/vmt.c:1.18 src/sys/arch/x86/x86/vmt.c:1.19 --- src/sys/arch/x86/x86/vmt.c:1.18 Tue Oct 17 05:47:09 2017 +++ src/sys/arch/x86/x86/vmt.c Tue Oct 17 06:50:00 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vmt.c,v 1.18 2017/10/17 05:47:09 maya Exp $ */ +/* $NetBSD: vmt.c,v 1.19 2017/10/17 06:50:00 maya Exp $ */ /* $OpenBSD: vmt.c,v 1.11 2011/01/27 21:29:25 dtucker Exp $ */ /* @@ -20,7 +20,7 @@ /* * Protocol reverse engineered by Ken Kato: - * http://chitchat.at.infoseek.co.jp/vmware/backdoor.html + * https://sites.google.com/site/chitchatvmback/backdoor */ #include Index: src/sys/arch/x86/x86/vmtreg.h diff -u src/sys/arch/x86/x86/vmtreg.h:1.1 src/sys/arch/x86/x86/vmtreg.h:1.2 --- src/sys/arch/x86/x86/vmtreg.h:1.1 Tue May 23 08:48:34 2017 +++ src/sys/arch/x86/x86/vmtreg.h Tue Oct 17 06:50:00 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vmtreg.h,v 1.1 2017/05/23 08:48:34 nonaka Exp $ */ +/* $NetBSD: vmtreg.h,v 1.2 2017/10/17 06:50:00 maya Exp $ */ /* NetBSD: vmt.c,v 1.15 2016/11/10 03:32:04 ozaki-r Exp */ /* $OpenBSD: vmt.c,v 1.11 2011/01/27 21:29:25 dtucker Exp $ */ @@ -19,11 +19,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* - * Protocol reverse engineered by Ken Kato: - * http://chitchat.at.infoseek.co.jp/vmware/backdoor.html - */ - /* OS name to report to host */ #ifdef __i386__ #define VM_OS_NAME "other"
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: maya Date: Tue Oct 17 05:47:09 UTC 2017 Modified Files: src/sys/arch/x86/x86: vmt.c Log Message: Check that the host supports GET_SPEED as well as GET_VERSION before deciding vmt_probe has succeeded. qemu supports GET_VERSION but not the RPC protocol so the probe succeeds but the attach fails, resulting in "vmt0: failed to open backdoor RPC channel (TCLO protocol)". All known versions of vmware support GET_SPEED and no known qemu versions do, so this prevents it from attempting to attach (and failing) on qemu while still working on vmware. stop checking vmt_type to avoid having to adapt this code. - Taken from openbsd To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/x86/vmt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/vmt.c diff -u src/sys/arch/x86/x86/vmt.c:1.17 src/sys/arch/x86/x86/vmt.c:1.18 --- src/sys/arch/x86/x86/vmt.c:1.17 Thu Jun 1 02:45:08 2017 +++ src/sys/arch/x86/x86/vmt.c Tue Oct 17 05:47:09 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vmt.c,v 1.17 2017/06/01 02:45:08 chs Exp $ */ +/* $NetBSD: vmt.c,v 1.18 2017/10/17 05:47:09 maya Exp $ */ /* $OpenBSD: vmt.c,v 1.11 2011/01/27 21:29:25 dtucker Exp $ */ /* @@ -126,28 +126,34 @@ static void vmt_pswitch_event(void *); extern char hostname[MAXHOSTNAMELEN]; -static bool -vmt_probe(uint32_t *type) +static void +vmt_probe_cmd(struct vm_backdoor *frame, uint16_t cmd) { - struct vm_backdoor frame; + memset(frame, 0, sizeof(*frame)); - memset(&frame, 0, sizeof(frame)); + (frame->eax).word = VM_MAGIC; + (frame->ebx).word = ~VM_MAGIC; + (frame->ecx).part.low = cmd; + (frame->ecx).part.high = 0x; + (frame->edx).part.low = VM_PORT_CMD; + (frame->edx).part.high = 0; - frame.eax.word = VM_MAGIC; - frame.ebx.word = ~VM_MAGIC; - frame.ecx.part.low = VM_CMD_GET_VERSION; - frame.ecx.part.high = 0x; - frame.edx.part.low = VM_PORT_CMD; - frame.edx.part.high = 0; + vm_cmd(frame); +} - vm_cmd(&frame); +static bool +vmt_probe(void) +{ + struct vm_backdoor frame; + vmt_probe_cmd(&frame, VM_CMD_GET_VERSION); if (frame.eax.word == 0x || frame.ebx.word != VM_MAGIC) return false; - if (type) - *type = frame.ecx.word; + vmt_probe_cmd(&frame, VM_CMD_GET_SPEED); + if (frame.eax.word == VM_MAGIC) + return false; return true; } @@ -163,23 +169,7 @@ vmt_match(device_t parent, cfdata_t matc if ((ci->ci_flags & (CPUF_BSP|CPUF_SP|CPUF_PRIMARY)) == 0) return 0; - return vmt_probe(NULL); -} - -static const char * -vmt_type(void) -{ - uint32_t vmwaretype = 0; - - vmt_probe(&vmwaretype); - - switch (vmwaretype) { - case 1: return "Express"; - case 2: return "ESX Server"; - case 3: return "VMware Server"; - case 4: return "Workstation"; - default: return "Unknown"; - } + return vmt_probe(); } static void @@ -189,7 +179,6 @@ vmt_attach(device_t parent, device_t sel struct vmt_softc *sc = device_private(self); aprint_naive("\n"); - aprint_normal(": %s\n", vmt_type()); sc->sc_dev = self; sc->sc_log = NULL;
CVS commit: src/sys/arch/alpha/include
Module Name:src Committed By: maya Date: Tue Oct 17 00:26:35 UTC 2017 Modified Files: src/sys/arch/alpha/include: fpu.h Log Message: Explain our implementation choice for implementation-defined values To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/include/fpu.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/alpha/include/fpu.h diff -u src/sys/arch/alpha/include/fpu.h:1.6 src/sys/arch/alpha/include/fpu.h:1.7 --- src/sys/arch/alpha/include/fpu.h:1.6 Sat May 10 15:31:04 2008 +++ src/sys/arch/alpha/include/fpu.h Tue Oct 17 00:26:35 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: fpu.h,v 1.6 2008/05/10 15:31:04 martin Exp $ */ +/* $NetBSD: fpu.h,v 1.7 2017/10/17 00:26:35 maya Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -91,8 +91,8 @@ #define IEEE_TRAP_ENABLE_INV _FP_C_DEF(1) #define IEEE_INHERIT _FP_C_DEF(14) -#define IEEE_MAP_UMZ _FP_C_DEF(13) -#define IEEE_MAP_DMZ _FP_C_DEF(12) +#define IEEE_MAP_UMZ _FP_C_DEF(13) /* Map underflowed outputs to zero */ +#define IEEE_MAP_DMZ _FP_C_DEF(12) /* Map denormal inputs to zero */ #define FP_C_MIRRORED (IEEE_STATUS_INE | IEEE_STATUS_UNF | IEEE_STATUS_OVF\ | IEEE_STATUS_DZE | IEEE_STATUS_INV)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Mon Oct 16 17:52:10 UTC 2017 Modified Files: src/sys/dev/ic: spdmem.c Log Message: simplify previous. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/ic/spdmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/spdmem.c diff -u src/sys/dev/ic/spdmem.c:1.26 src/sys/dev/ic/spdmem.c:1.27 --- src/sys/dev/ic/spdmem.c:1.26 Mon Oct 16 07:37:20 2017 +++ src/sys/dev/ic/spdmem.c Mon Oct 16 13:52:10 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: spdmem.c,v 1.26 2017/10/16 11:37:20 christos Exp $ */ +/* $NetBSD: spdmem.c,v 1.27 2017/10/16 17:52:10 christos Exp $ */ /* * Copyright (c) 2007 Nicolas Joly @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.26 2017/10/16 11:37:20 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.27 2017/10/16 17:52:10 christos Exp $"); #include #include @@ -750,19 +750,10 @@ decode_ddr2(const struct sysctlnode *nod static void print_part(const char *part, size_t pnsize) { - char buf[64]; /* big enough */ - - KASSERT(pnsize < sizeof(buf)); - - memcpy(buf, part, pnsize); - buf[pnsize] = '\0'; /* Terminate for full string */ - for (size_t i = pnsize; i-- > 0;) { - if (buf[i] == 0x20) /* remove trailing spaces */ - buf[i] = '\0'; - else - break; - } - aprint_normal(": %s\n", buf); + const char *p = memchr(part, ' ', pnsize); + if (p == NULL) + p = part + pnsize; + aprint_normal(": %.*s\n", (int)(p - part), part); } static void
CVS commit: src/external/bsd/wpa/dist
Module Name:src Committed By: spz Date: Mon Oct 16 17:36:16 UTC 2017 Modified Files: src/external/bsd/wpa/dist/src/ap: ieee802_11.c wpa_auth.c wpa_auth.h wpa_auth_ft.c wpa_auth_i.h src/external/bsd/wpa/dist/src/common: wpa_common.h src/external/bsd/wpa/dist/src/rsn_supp: tdls.c wpa.c wpa_ft.c wpa_i.h src/external/bsd/wpa/dist/wpa_supplicant: wnm_sta.c Log Message: apply patches from upstream, namely from https://w1.fi/security/2017-1/ : rebased-v2.6-0001-hostapd-Avoid-key-reinstallation-in-FT-handshake.patch 02-Oct-2017 16:19 6.1K rebased-v2.6-0002-Prevent-reinstallation-of-an-already-in-use-group-ke.patch 02-Oct-2017 16:19 7.7K rebased-v2.6-0003-Extend-protection-of-GTK-IGTK-reinstallation-of-WNM-.patch 02-Oct-2017 16:19 6.7K rebased-v2.6-0004-Prevent-installation-of-an-all-zero-TK.patch 02-Oct-2017 16:19 2.5K rebased-v2.6-0005-Fix-PTK-rekeying-to-generate-a-new-ANonce.patch 02-Oct-2017 16:19 1.9K rebased-v2.6-0006-TDLS-Reject-TPK-TK-reconfiguration.patch 02-Oct-2017 16:19 4.2K rebased-v2.6-0007-WNM-Ignore-WNM-Sleep-Mode-Response-without-pending-r.patch 02-Oct-2017 16:19 1.6K rebased-v2.6-0008-FT-Do-not-allow-multiple-Reassociation-Response-fram.patch 02-Oct-2017 16:19 2.7K for CVE-2017-13077 CVE-2017-13078 CVE-2017-13079 CVE-2017-13080 CVE-2017-13081 CVE-2017-13082 CVE-2017-13086 CVE-2017-13087 CVE-2017-13088 (see https://w1.fi/security/2017-1/wpa-packet-number-reuse-with-replayed-messages.txt for details) To generate a diff of this commit: cvs rdiff -u -r1.1.1.7 -r1.2 src/external/bsd/wpa/dist/src/ap/ieee802_11.c \ src/external/bsd/wpa/dist/src/ap/wpa_auth_ft.c cvs rdiff -u -r1.9 -r1.10 src/external/bsd/wpa/dist/src/ap/wpa_auth.c cvs rdiff -u -r1.1.1.6 -r1.2 src/external/bsd/wpa/dist/src/ap/wpa_auth.h \ src/external/bsd/wpa/dist/src/ap/wpa_auth_i.h cvs rdiff -u -r1.2 -r1.3 src/external/bsd/wpa/dist/src/common/wpa_common.h cvs rdiff -u -r1.1.1.5 -r1.2 src/external/bsd/wpa/dist/src/rsn_supp/tdls.c cvs rdiff -u -r1.1.1.8 -r1.2 src/external/bsd/wpa/dist/src/rsn_supp/wpa.c cvs rdiff -u -r1.1.1.6 -r1.2 src/external/bsd/wpa/dist/src/rsn_supp/wpa_ft.c \ src/external/bsd/wpa/dist/src/rsn_supp/wpa_i.h cvs rdiff -u -r1.3 -r1.4 src/external/bsd/wpa/dist/wpa_supplicant/wnm_sta.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/wpa/dist/src/ap/ieee802_11.c diff -u src/external/bsd/wpa/dist/src/ap/ieee802_11.c:1.1.1.7 src/external/bsd/wpa/dist/src/ap/ieee802_11.c:1.2 --- src/external/bsd/wpa/dist/src/ap/ieee802_11.c:1.1.1.7 Mon Nov 21 16:42:50 2016 +++ src/external/bsd/wpa/dist/src/ap/ieee802_11.c Mon Oct 16 17:36:16 2017 @@ -1841,6 +1841,7 @@ static int add_associated_sta(struct hos { struct ieee80211_ht_capabilities ht_cap; struct ieee80211_vht_capabilities vht_cap; + int set = 1; /* * Remove the STA entry to ensure the STA PS state gets cleared and @@ -1848,9 +1849,18 @@ static int add_associated_sta(struct hos * FT-over-the-DS, where a station re-associates back to the same AP but * skips the authentication flow, or if working with a driver that * does not support full AP client state. + * + * Skip this if the STA has already completed FT reassociation and the + * TK has been configured since the TX/RX PN must not be reset to 0 for + * the same key. */ - if (!sta->added_unassoc) + if (!sta->added_unassoc && + (!(sta->flags & WLAN_STA_AUTHORIZED) || + !wpa_auth_sta_ft_tk_already_set(sta->wpa_sm))) { hostapd_drv_sta_remove(hapd, sta->addr); + wpa_auth_sm_event(sta->wpa_sm, WPA_DRV_STA_REMOVED); + set = 0; + } #ifdef CONFIG_IEEE80211N if (sta->flags & WLAN_STA_HT) @@ -1873,11 +1883,11 @@ static int add_associated_sta(struct hos sta->flags & WLAN_STA_VHT ? &vht_cap : NULL, sta->flags | WLAN_STA_ASSOC, sta->qosinfo, sta->vht_opmode, sta->p2p_ie ? 1 : 0, - sta->added_unassoc)) { + set)) { hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_NOTICE, "Could not %s STA to kernel driver", - sta->added_unassoc ? "set" : "add"); + set ? "set" : "add"); if (sta->added_unassoc) { hostapd_drv_sta_remove(hapd, sta->addr); Index: src/external/bsd/wpa/dist/src/ap/wpa_auth_ft.c diff -u src/external/bsd/wpa/dist/src/ap/wpa_auth_ft.c:1.1.1.7 src/external/bsd/wpa/dist/src/ap/wpa_auth_ft.c:1.2 --- src/external/bsd/wpa/dist/src/ap/wpa_auth_ft.c:1.1.1.7 Mon Nov 21 16:42:50 2016 +++ src/external/bsd/wpa/dist/src/ap/wpa_auth_ft.c Mon Oct 16 17:36:16 2017 @@ -780,6 +780,14 @@ void wpa_ft_install_ptk(struct wpa_state return; } + if (sm->tk_already_set) { + /* Must avoid TK reconfiguration to prevent clearing of TX/RX + * PN in the driver */ + wpa_printf(MSG_DEBUG, + "FT: Do not re-install same PTK to the driver"); + return;
CVS commit: src/bin/chio
Module Name:src Committed By: jnemeth Date: Mon Oct 16 17:08:35 UTC 2017 Modified Files: src/bin/chio: chio.c Log Message: typo: unvalid -> invalid To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/bin/chio/chio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/chio/chio.c diff -u src/bin/chio/chio.c:1.32 src/bin/chio/chio.c:1.33 --- src/bin/chio/chio.c:1.32 Tue Aug 23 21:07:40 2016 +++ src/bin/chio/chio.c Mon Oct 16 17:08:35 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: chio.c,v 1.32 2016/08/23 21:07:40 sevan Exp $ */ +/* $NetBSD: chio.c,v 1.33 2017/10/16 17:08:35 jnemeth Exp $ */ /*- * Copyright (c) 1996, 1998, 1999 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ __COPYRIGHT( "@(#) Copyright (c) 1996, 1998, 1999\ The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: chio.c,v 1.32 2016/08/23 21:07:40 sevan Exp $"); +__RCSID("$NetBSD: chio.c,v 1.33 2017/10/16 17:08:35 jnemeth Exp $"); #endif #include @@ -620,7 +620,7 @@ do_status(const char *cname, int argc, c } if ((unit + ucount) > count) - errx(EXIT_FAILURE, "%s: unvalid unit/count %d/%d", + errx(EXIT_FAILURE, "%s: invalid unit/count %d/%d", cname, unit, ucount); /* NOTREACHED */
CVS commit: src/share/man/man9
Module Name:src Committed By: christos Date: Mon Oct 16 15:48:14 UTC 2017 Modified Files: src/share/man/man9: byteorder.9 Log Message: revert; this is section 9 and userland headers are not available in kernel context. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/share/man/man9/byteorder.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/byteorder.9 diff -u src/share/man/man9/byteorder.9:1.10 src/share/man/man9/byteorder.9:1.11 --- src/share/man/man9/byteorder.9:1.10 Mon Oct 16 08:50:43 2017 +++ src/share/man/man9/byteorder.9 Mon Oct 16 11:48:14 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: byteorder.9,v 1.10 2017/10/16 12:50:43 wiz Exp $ +.\" $NetBSD: byteorder.9,v 1.11 2017/10/16 15:48:14 christos Exp $ .\" .\" Copyright (c) 2002 Mike Barcroft .\" All rights reserved. @@ -59,7 +59,7 @@ .Nm le64dec .Nd byte order operations .Sh SYNOPSIS -.In endian.h +.In sys/endian.h .Ft uint16_t .Fn bswap16 "uint16_t int16" .Ft uint32_t
CVS commit: src/sys/arch/arm/vfp
Module Name:src Committed By: bouyer Date: Mon Oct 16 15:13:01 UTC 2017 Modified Files: src/sys/arch/arm/vfp: vfp_init.c Log Message: We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so enabled is always false. remove. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/arch/arm/vfp/vfp_init.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/vfp/vfp_init.c diff -u src/sys/arch/arm/vfp/vfp_init.c:1.54 src/sys/arch/arm/vfp/vfp_init.c:1.55 --- src/sys/arch/arm/vfp/vfp_init.c:1.54 Mon Oct 16 15:08:24 2017 +++ src/sys/arch/arm/vfp/vfp_init.c Mon Oct 16 15:13:00 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vfp_init.c,v 1.54 2017/10/16 15:08:24 bouyer Exp $ */ +/* $NetBSD: vfp_init.c,v 1.55 2017/10/16 15:13:00 bouyer Exp $ */ /* * Copyright (c) 2008 ARM Ltd @@ -535,17 +535,8 @@ vfp_state_load(lwp_t *l, u_int flags) /* * Load and Enable the VFP (so that we can write the registers). */ - bool enabled = fregs->vfp_fpexc & VFP_FPEXC_EN; fregs->vfp_fpexc |= VFP_FPEXC_EN; armreg_fpexc_write(fregs->vfp_fpexc); - if (enabled) { - /* - * If we think the VFP is enabled, it must have be - * disabled by vfp_state_release for another LWP so - * we can now just return. - */ - return; - } KASSERT(curcpu()->ci_pcu_curlwp[PCU_FPU] == NULL); KASSERT(l->l_pcu_cpu[PCU_FPU] == NULL);
CVS commit: src/sys/arch/arm/vfp
Module Name:src Committed By: bouyer Date: Mon Oct 16 15:08:24 UTC 2017 Modified Files: src/sys/arch/arm/vfp: vfp_init.c Log Message: In the REENABLE case, make sur the fpexc copy in the pcb also has VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if the CPU already has the VFP state. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/arch/arm/vfp/vfp_init.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/vfp/vfp_init.c diff -u src/sys/arch/arm/vfp/vfp_init.c:1.53 src/sys/arch/arm/vfp/vfp_init.c:1.54 --- src/sys/arch/arm/vfp/vfp_init.c:1.53 Fri May 26 21:17:46 2017 +++ src/sys/arch/arm/vfp/vfp_init.c Mon Oct 16 15:08:24 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vfp_init.c,v 1.53 2017/05/26 21:17:46 jmcneill Exp $ */ +/* $NetBSD: vfp_init.c,v 1.54 2017/10/16 15:08:24 bouyer Exp $ */ /* * Copyright (c) 2008 ARM Ltd @@ -520,14 +520,17 @@ vfp_state_load(lwp_t *l, u_int flags) curcpu()->ci_vfp_evs[1].ev_count++; } + KASSERT((armreg_fpexc_read() & VFP_FPEXC_EN) == 0); /* * If the VFP is already enabled we must be bouncing an instruction. */ if (flags & PCU_REENABLE) { uint32_t fpexc = armreg_fpexc_read(); armreg_fpexc_write(fpexc | VFP_FPEXC_EN); + fregs->vfp_fpexc |= VFP_FPEXC_EN; return; } + KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0); /* * Load and Enable the VFP (so that we can write the registers). @@ -543,6 +546,8 @@ vfp_state_load(lwp_t *l, u_int flags) */ return; } + KASSERT(curcpu()->ci_pcu_curlwp[PCU_FPU] == NULL); + KASSERT(l->l_pcu_cpu[PCU_FPU] == NULL); load_vfpregs(fregs); armreg_fpscr_write(fregs->vfp_fpscr); @@ -562,6 +567,9 @@ vfp_state_save(lwp_t *l) struct vfpreg * const fregs = &pcb->pcb_vfp; uint32_t fpexc = armreg_fpexc_read(); + KASSERT(curcpu()->ci_pcu_curlwp[PCU_FPU] == l); + KASSERT(curcpu() == l->l_pcu_cpu[PCU_FPU]); + KASSERT(curlwp == l || curlwp->l_pcu_cpu[PCU_FPU] != curcpu()); /* * Enable the VFP (so we can read the registers). * Make sure the exception bit is cleared so that we can
CVS commit: src/sys/kern
Module Name:src Committed By: bouyer Date: Mon Oct 16 15:03:57 UTC 2017 Modified Files: src/sys/kern: subr_pcu.c Log Message: PR port-arm/52603: There is a race here, as seen on arm with FPU: LWP L is running but not on CPU, has its FPU state on CPU2 which has not been released yet, so fpexc still has VFP_FPEXC_EN set in the PCB copy. LWP L is scheduled on CPU1, CPU1 calls cpu_switchto() for L in mi_switch(). cpu_switchto() will set VFP_FPEXC_EN in the FPU's fpexc register per the PCB fpexc copy. Before CPU1 calls pcu_switchpoint() for L, CPU2 calls pcu_do_op(PCU_CMD_SAVE | PCU_CMD_RELEASE) for L because it still holds its FPU state and wants to load another lwp. This cause VFP_FPEXC_EN to be cleared in the PCB copy, but not in CPU1's register. L's l_pcu_cpu is set to NULL. When CPU1 calls pcu_switchpoint() for L it see l_pcu_cpu is NULL, and doesn't call the release callback. Now CPU1 has its FPU enabled but with the wrong FPU state. Fix by releasing the PCU even if l_pcu_cpu is NULL. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/kern/subr_pcu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/subr_pcu.c diff -u src/sys/kern/subr_pcu.c:1.20 src/sys/kern/subr_pcu.c:1.21 --- src/sys/kern/subr_pcu.c:1.20 Thu Mar 16 16:13:21 2017 +++ src/sys/kern/subr_pcu.c Mon Oct 16 15:03:57 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_pcu.c,v 1.20 2017/03/16 16:13:21 chs Exp $ */ +/* $NetBSD: subr_pcu.c,v 1.21 2017/10/16 15:03:57 bouyer Exp $ */ /*- * Copyright (c) 2011, 2014 The NetBSD Foundation, Inc. @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_pcu.c,v 1.20 2017/03/16 16:13:21 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_pcu.c,v 1.21 2017/10/16 15:03:57 bouyer Exp $"); #include #include @@ -110,7 +110,8 @@ pcu_switchpoint(lwp_t *l) continue; } struct cpu_info * const pcu_ci = l->l_pcu_cpu[id]; - if (pcu_ci == NULL || pcu_ci == l->l_cpu) { + if (pcu_ci == l->l_cpu) { + KASSERT(pcu_ci->ci_pcu_curlwp[id] == l); continue; } const pcu_ops_t * const pcu = pcu_ops_md_defs[id];
CVS commit: src/share/man/man9
Module Name:src Committed By: wiz Date: Mon Oct 16 12:50:43 UTC 2017 Modified Files: src/share/man/man9: byteorder.9 Log Message: Remove Tn. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/share/man/man9/byteorder.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/byteorder.9 diff -u src/share/man/man9/byteorder.9:1.9 src/share/man/man9/byteorder.9:1.10 --- src/share/man/man9/byteorder.9:1.9 Mon Oct 16 11:53:00 2017 +++ src/share/man/man9/byteorder.9 Mon Oct 16 12:50:43 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: byteorder.9,v 1.9 2017/10/16 11:53:00 maya Exp $ +.\" $NetBSD: byteorder.9,v 1.10 2017/10/16 12:50:43 wiz Exp $ .\" .\" Copyright (c) 2002 Mike Barcroft .\" All rights reserved. @@ -26,7 +26,7 @@ .\" .\" $FreeBSD: src/share/man/man9/byteorder.9,v 1.6 2003/05/21 17:32:55 ru Exp $ .\" -.Dd Oct 16, 2017 +.Dd October 16, 2017 .Dt BYTEORDER 9 .Os .Sh NAME @@ -188,11 +188,9 @@ functions first appeared in .Nx 1.5 . These were later ported to .Fx 5.0 . -These functions were originally introduced to handle -.Tn PCI -bus master devices that -.Pq via Tn DMA -transfer little endian data even on big endian systems. +These functions were originally introduced to handle PCI bus master +devices that (via DMA) transfer little endian data even on big +endian systems. .Pp The encode/decode functions first appeared in .Fx 5.1 .
CVS commit: src/share/man/man4
Module Name:src Committed By: wiz Date: Mon Oct 16 12:48:24 UTC 2017 Modified Files: src/share/man/man4: slhci.4 Log Message: remove Tn, bump date for previous To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/share/man/man4/slhci.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/slhci.4 diff -u src/share/man/man4/slhci.4:1.11 src/share/man/man4/slhci.4:1.12 --- src/share/man/man4/slhci.4:1.11 Sat Oct 14 08:22:38 2017 +++ src/share/man/man4/slhci.4 Mon Oct 16 12:48:24 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: slhci.4,v 1.11 2017/10/14 08:22:38 flxd Exp $ +.\" $NetBSD: slhci.4,v 1.12 2017/10/16 12:48:24 wiz Exp $ .\" .\" Not (c) 2007 Matthew Orgass .\" This file is public domain, meaning anyone can make any use of part or all @@ -7,7 +7,7 @@ .\" part of a collection then use in the collection is governed by the terms of .\" the collection. .\" -.Dd April 28, 2013 +.Dd October 14, 2017 .Dt SLHCI 4 .Os .Sh NAME @@ -95,17 +95,13 @@ Hardware supported by the driver includes: .Bl -item -offset indent .It -.Tn Ratoc -.Em CFU1U +Ratoc CFU1U .It -.Tn Nereid -Ethernet/USB/Memory board +Nereid Ethernet/USB/Memory board .It -.Tn Thylacine -USB Host Controller +Thylacine USB Host Controller .It -.Tn flxd -.Em TC-USB +flxd TC-USB .El .Sh SEE ALSO .Xr config 1 ,
CVS commit: src/share/man/man9
Module Name:src Committed By: maya Date: Mon Oct 16 11:53:00 UTC 2017 Modified Files: src/share/man/man9: byteorder.9 Log Message: Suggest to include the POSIX rather than BSD To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/share/man/man9/byteorder.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/byteorder.9 diff -u src/share/man/man9/byteorder.9:1.8 src/share/man/man9/byteorder.9:1.9 --- src/share/man/man9/byteorder.9:1.8 Fri May 14 05:23:35 2010 +++ src/share/man/man9/byteorder.9 Mon Oct 16 11:53:00 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: byteorder.9,v 1.8 2010/05/14 05:23:35 dholland Exp $ +.\" $NetBSD: byteorder.9,v 1.9 2017/10/16 11:53:00 maya Exp $ .\" .\" Copyright (c) 2002 Mike Barcroft .\" All rights reserved. @@ -26,7 +26,7 @@ .\" .\" $FreeBSD: src/share/man/man9/byteorder.9,v 1.6 2003/05/21 17:32:55 ru Exp $ .\" -.Dd May 5, 2010 +.Dd Oct 16, 2017 .Dt BYTEORDER 9 .Os .Sh NAME @@ -59,7 +59,7 @@ .Nm le64dec .Nd byte order operations .Sh SYNOPSIS -.In sys/endian.h +.In endian.h .Ft uint16_t .Fn bswap16 "uint16_t int16" .Ft uint32_t
CVS commit: src
Module Name:src Committed By: maya Date: Mon Oct 16 11:38:25 UTC 2017 Modified Files: src/distrib/sets/lists/comp: mi src/include: Makefile Added Files: src/include: endian.h Log Message: Add endian.h header. Simply includes sys/endian.h has been accepted by the austin group. To generate a diff of this commit: cvs rdiff -u -r1.2151 -r1.2152 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.143 -r1.144 src/include/Makefile cvs rdiff -u -r0 -r1.1 src/include/endian.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.2151 src/distrib/sets/lists/comp/mi:1.2152 --- src/distrib/sets/lists/comp/mi:1.2151 Tue Oct 10 19:31:56 2017 +++ src/distrib/sets/lists/comp/mi Mon Oct 16 11:38:25 2017 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2151 2017/10/10 19:31:56 christos Exp $ +# $NetBSD: mi,v 1.2152 2017/10/16 11:38:25 maya Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.compcomp-sys-root @@ -777,6 +777,7 @@ ./usr/include/dns_sd.hcomp-mdns-include mdns ./usr/include/dwarf.hcomp-c-include ./usr/include/elf.hcomp-c-include +./usr/include/endian.hcomp-c-include ./usr/include/err.hcomp-c-include ./usr/include/errno.hcomp-c-include ./usr/include/eti.hcomp-c-include Index: src/include/Makefile diff -u src/include/Makefile:1.143 src/include/Makefile:1.144 --- src/include/Makefile:1.143 Sun Oct 2 17:19:00 2016 +++ src/include/Makefile Mon Oct 16 11:38:25 2017 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.143 2016/10/02 17:19:00 kamil Exp $ +# $NetBSD: Makefile,v 1.144 2017/10/16 11:38:25 maya Exp $ # @(#)Makefile 8.2 (Berkeley) 1/4/94 # Doing a make includes builds /usr/include @@ -8,8 +8,8 @@ NOOBJ= # defined # Missing: mp.h INCS= a.out.h aio.h ar.h assert.h atomic.h \ - bitstring.h bm.h cdbw.h complex.h cpio.h ctype.h \ - db.h dirent.h disktab.h dlfcn.h err.h errno.h fenv.h fmtmsg.h fnmatch.h \ + bitstring.h bm.h cdbw.h complex.h cpio.h ctype.h db.h dirent.h \ + disktab.h dlfcn.h endian.h err.h errno.h fenv.h fmtmsg.h fnmatch.h \ fstab.h fts.h ftw.h getopt.h glob.h grp.h ifaddrs.h iconv.h \ inttypes.h iso646.h kvm.h langinfo.h libgen.h \ limits.h link.h link_aout.h link_elf.h locale.h \ Added files: Index: src/include/endian.h diff -u /dev/null src/include/endian.h:1.1 --- /dev/null Mon Oct 16 11:38:25 2017 +++ src/include/endian.h Mon Oct 16 11:38:25 2017 @@ -0,0 +1,34 @@ +/* $NetBSD: endian.h,v 1.1 2017/10/16 11:38:25 maya Exp $ */ + +/*- + * Copyright (c) 2017 The NetBSD Foundation, Inc. + * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ENDIAN_H_ +#define _ENDIAN_H_ + +#include + +#endif /* !_ENDIAN_H_ */
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Mon Oct 16 11:37:20 UTC 2017 Modified Files: src/sys/dev/ic: spdmem.c Log Message: dedup To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/ic/spdmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/spdmem.c diff -u src/sys/dev/ic/spdmem.c:1.25 src/sys/dev/ic/spdmem.c:1.26 --- src/sys/dev/ic/spdmem.c:1.25 Mon Oct 16 04:33:48 2017 +++ src/sys/dev/ic/spdmem.c Mon Oct 16 07:37:20 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: spdmem.c,v 1.25 2017/10/16 08:33:48 msaitoh Exp $ */ +/* $NetBSD: spdmem.c,v 1.26 2017/10/16 11:37:20 christos Exp $ */ /* * Copyright (c) 2007 Nicolas Joly @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.25 2017/10/16 08:33:48 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.26 2017/10/16 11:37:20 christos Exp $"); #include #include @@ -748,23 +748,30 @@ decode_ddr2(const struct sysctlnode *nod } static void -decode_ddr3(const struct sysctlnode *node, device_t self, struct spdmem *s) +print_part(const char *part, size_t pnsize) { - int dimm_size, cycle_time, bits; - unsigned char buf[sizeof(s->sm_ddr3.ddr3_part) + 1]; - int i, pnsize; + char buf[64]; /* big enough */ + + KASSERT(pnsize < sizeof(buf)); - pnsize = sizeof(s->sm_ddr3.ddr3_part); - memcpy(buf, s->sm_ddr3.ddr3_part, pnsize); - buf[pnsize] = 0; /* Terminate for full string */ - for (i = pnsize - 1; i >= 0; i--) { + memcpy(buf, part, pnsize); + buf[pnsize] = '\0'; /* Terminate for full string */ + for (size_t i = pnsize; i-- > 0;) { if (buf[i] == 0x20) /* remove trailing spaces */ - buf[i] = 0; + buf[i] = '\0'; else break; } - aprint_naive("\n"); aprint_normal(": %s\n", buf); +} + +static void +decode_ddr3(const struct sysctlnode *node, device_t self, struct spdmem *s) +{ + int dimm_size, cycle_time, bits; + + aprint_naive("\n"); + print_part(s->sm_ddr3.ddr3_part, sizeof(s->sm_ddr3.ddr3_part)); aprint_normal_dev(self, "%s", spdmem_basic_types[s->sm_type]); if (s->sm_ddr3.ddr3_mod_type == @@ -873,21 +880,10 @@ decode_ddr4(const struct sysctlnode *nod { int dimm_size, cycle_time; int tAA_clocks, tRCD_clocks,tRP_clocks, tRAS_clocks; - unsigned char buf[sizeof(s->sm_ddr4.ddr4_part_number) + 1]; - int i, pnsize; - - pnsize = sizeof(s->sm_ddr4.ddr4_part_number); - memcpy(buf, s->sm_ddr4.ddr4_part_number, pnsize); - buf[pnsize] = 0; /* Terminate for full string */ - for (i = pnsize - 1; i >= 0; i--) { - if (buf[i] == 0x20) /* remove trailing spaces */ - buf[i] = 0; - else - break; - } aprint_naive("\n"); - aprint_normal(": %s\n", buf); + print_part(s->sm_ddr4.ddr4_part_number, + sizeof(s->sm_ddr4.ddr4_part_number)); aprint_normal_dev(self, "%s", spdmem_basic_types[s->sm_type]); if (s->sm_ddr4.ddr4_mod_type < __arraycount(spdmem_ddr4_module_types)) aprint_normal(" (%s)",
CVS commit: src/usr.sbin/npf/npfd
Module Name:src Committed By: christos Date: Mon Oct 16 11:18:43 UTC 2017 Modified Files: src/usr.sbin/npf/npfd: npfd.c Log Message: Treat EOF as a condition to re-open the pcap socket. Since we've been woken up by poll(2), there must be data to read. If there is not, our socket might not be ok anymore. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/npf/npfd/npfd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/npf/npfd/npfd.c diff -u src/usr.sbin/npf/npfd/npfd.c:1.8 src/usr.sbin/npf/npfd/npfd.c:1.9 --- src/usr.sbin/npf/npfd/npfd.c:1.8 Sun Oct 15 11:26:10 2017 +++ src/usr.sbin/npf/npfd/npfd.c Mon Oct 16 07:18:43 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: npfd.c,v 1.8 2017/10/15 15:26:10 christos Exp $ */ +/* $NetBSD: npfd.c,v 1.9 2017/10/16 11:18:43 christos Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: npfd.c,v 1.8 2017/10/15 15:26:10 christos Exp $"); +__RCSID("$NetBSD: npfd.c,v 1.9 2017/10/16 11:18:43 christos Exp $"); #include #include @@ -110,7 +110,7 @@ npfd_event_loop(npfd_log_t *log, int del npfd_log_flush(log); count = 0; } - if (npfd_log(log) < 0) + if (npfd_log(log) <= 0) npfd_log_pcap_reopen(log); }
CVS commit: src/usr.sbin/npf/npfd
Module Name:src Committed By: christos Date: Mon Oct 16 11:17:45 UTC 2017 Modified Files: src/usr.sbin/npf/npfd: npfd_log.c Log Message: Add a message when we are re-opening the pcap socket. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/npf/npfd/npfd_log.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/npf/npfd/npfd_log.c diff -u src/usr.sbin/npf/npfd/npfd_log.c:1.11 src/usr.sbin/npf/npfd/npfd_log.c:1.12 --- src/usr.sbin/npf/npfd/npfd_log.c:1.11 Sun Oct 15 11:26:10 2017 +++ src/usr.sbin/npf/npfd/npfd_log.c Mon Oct 16 07:17:45 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: npfd_log.c,v 1.11 2017/10/15 15:26:10 christos Exp $ */ +/* $NetBSD: npfd_log.c,v 1.12 2017/10/16 11:17:45 christos Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: npfd_log.c,v 1.11 2017/10/15 15:26:10 christos Exp $"); +__RCSID("$NetBSD: npfd_log.c,v 1.12 2017/10/16 11:17:45 christos Exp $"); #include #include @@ -247,6 +247,8 @@ npfd_log_pcap_reopen(npfd_log_t *ctx) if (ctx->pcap != NULL) pcap_close(ctx->pcap); + else + syslog(LOG_INFO, "reopening pcap socket"); ctx->pcap = pcap_create(ctx->ifname, errbuf); if (ctx->pcap == NULL)
CVS commit: src/usr.sbin/cpuctl/arch
Module Name:src Committed By: msaitoh Date: Mon Oct 16 10:10:48 UTC 2017 Modified Files: src/usr.sbin/cpuctl/arch: i386.c Log Message: - Print ci_feat_val[5] (Structured Extended Feature leaf Fn_0007 %ebx) on AMD, too. - Print ci_feat_val[6] (Fn_0007 %ecx) on Intel. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/usr.sbin/cpuctl/arch/i386.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/cpuctl/arch/i386.c diff -u src/usr.sbin/cpuctl/arch/i386.c:1.75 src/usr.sbin/cpuctl/arch/i386.c:1.76 --- src/usr.sbin/cpuctl/arch/i386.c:1.75 Thu Sep 7 06:40:42 2017 +++ src/usr.sbin/cpuctl/arch/i386.c Mon Oct 16 10:10:48 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: i386.c,v 1.75 2017/09/07 06:40:42 msaitoh Exp $ */ +/* $NetBSD: i386.c,v 1.76 2017/10/16 10:10:48 msaitoh Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ #include #ifndef lint -__RCSID("$NetBSD: i386.c,v 1.75 2017/09/07 06:40:42 msaitoh Exp $"); +__RCSID("$NetBSD: i386.c,v 1.76 2017/10/16 10:10:48 msaitoh Exp $"); #endif /* not lint */ #include @@ -1892,7 +1892,12 @@ identifycpu(int fd, const char *cpuname) print_bits(cpuname, "padloack features", CPUID_FLAGS_PADLOCK, ci->ci_feat_val[4]); - + if ((cpu_vendor == CPUVENDOR_INTEL) || (cpu_vendor == CPUVENDOR_AMD)) + print_bits(cpuname, "features5", CPUID_SEF_FLAGS, + ci->ci_feat_val[5]); + if (cpu_vendor == CPUVENDOR_INTEL) + print_bits(cpuname, "features6", CPUID_SEF_FLAGS1, + ci->ci_feat_val[6]); print_bits(cpuname, "xsave features", XCR0_FLAGS1, ci->ci_feat_val[7]); print_bits(cpuname, "xsave instructions", CPUID_PES1_FLAGS, ci->ci_feat_val[8]); @@ -1977,8 +1982,6 @@ identifycpu(int fd, const char *cpuname) case 7: aprint_verbose("%s: SEF highest subleaf %08x\n", cpuname, data[0]); -print_bits(cpuname, "SEF-main", CPUID_SEF_FLAGS, -data[1]); break; #if 0 default:
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Mon Oct 16 08:33:48 UTC 2017 Modified Files: src/sys/dev/ic: spdmem.c Log Message: A part number field of DDR3 and DDR4 is not NUL terminated. All unused chars are filled by 0x20. Print it correctly. Before: spdmem0 at iic0 addr 0x50: 8KTF51264AZ-1G6E1 E1M^@,DPAFEQZ021 spdmem1 at iic0 addr 0x51: ACR256X64D3U1333C9BA^AM^X spdmem2 at iic0 addr 0x52: KP223C-ELDBA^BM-~ After: spdmem0 at iic0 addr 0x50: 8KTF51264AZ-1G6E1 spdmem1 at iic0 addr 0x51: ACR256X64D3U1333C9 spdmem2 at iic0 addr 0x52: KP223C-ELD To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ic/spdmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/spdmem.c diff -u src/sys/dev/ic/spdmem.c:1.24 src/sys/dev/ic/spdmem.c:1.25 --- src/sys/dev/ic/spdmem.c:1.24 Wed Jan 18 06:02:50 2017 +++ src/sys/dev/ic/spdmem.c Mon Oct 16 08:33:48 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: spdmem.c,v 1.24 2017/01/18 06:02:50 msaitoh Exp $ */ +/* $NetBSD: spdmem.c,v 1.25 2017/10/16 08:33:48 msaitoh Exp $ */ /* * Copyright (c) 2007 Nicolas Joly @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.24 2017/01/18 06:02:50 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.25 2017/10/16 08:33:48 msaitoh Exp $"); #include #include @@ -751,9 +751,20 @@ static void decode_ddr3(const struct sysctlnode *node, device_t self, struct spdmem *s) { int dimm_size, cycle_time, bits; + unsigned char buf[sizeof(s->sm_ddr3.ddr3_part) + 1]; + int i, pnsize; + pnsize = sizeof(s->sm_ddr3.ddr3_part); + memcpy(buf, s->sm_ddr3.ddr3_part, pnsize); + buf[pnsize] = 0; /* Terminate for full string */ + for (i = pnsize - 1; i >= 0; i--) { + if (buf[i] == 0x20) /* remove trailing spaces */ + buf[i] = 0; + else + break; + } aprint_naive("\n"); - aprint_normal(": %18s\n", s->sm_ddr3.ddr3_part); + aprint_normal(": %s\n", buf); aprint_normal_dev(self, "%s", spdmem_basic_types[s->sm_type]); if (s->sm_ddr3.ddr3_mod_type == @@ -862,9 +873,21 @@ decode_ddr4(const struct sysctlnode *nod { int dimm_size, cycle_time; int tAA_clocks, tRCD_clocks,tRP_clocks, tRAS_clocks; + unsigned char buf[sizeof(s->sm_ddr4.ddr4_part_number) + 1]; + int i, pnsize; + + pnsize = sizeof(s->sm_ddr4.ddr4_part_number); + memcpy(buf, s->sm_ddr4.ddr4_part_number, pnsize); + buf[pnsize] = 0; /* Terminate for full string */ + for (i = pnsize - 1; i >= 0; i--) { + if (buf[i] == 0x20) /* remove trailing spaces */ + buf[i] = 0; + else + break; + } aprint_naive("\n"); - aprint_normal(": %20s\n", s->sm_ddr4.ddr4_part_number); + aprint_normal(": %s\n", buf); aprint_normal_dev(self, "%s", spdmem_basic_types[s->sm_type]); if (s->sm_ddr4.ddr4_mod_type < __arraycount(spdmem_ddr4_module_types)) aprint_normal(" (%s)",