CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kre Date: Wed May 30 05:09:12 UTC 2018 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Log Message: The bytes_transfer_piod_read_auxv test uses 4096 for the size param to bytes_transfer() which asserted that the size is < the size of 512 AuxInfo structs. On a 32 bit system, an AuxInfo is 8 bytes, and 512 AuxInfo structs is thus 4096 bytes, and 4096 is not < 4096, so the assertion failed. It would probably work as a <= assert, but I am not confident enough with this test case to make that call, so instead increase the array size to be 513 instead, 4096 is < 513*8 so happiness should return and all should be right with the world. At least for this one test. (There was no problem on 64 bit systems as AuxInfo is bigger there.) To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.59 src/tests/lib/libc/sys/t_ptrace_wait.c:1.60 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.59 Tue May 29 10:40:54 2018 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Wed May 30 05:09:11 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.59 2018/05/29 10:40:54 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.60 2018/05/30 05:09:11 kre Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.59 2018/05/29 10:40:54 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.60 2018/05/30 05:09:11 kre Exp $"); #include #include @@ -2021,8 +2021,8 @@ bytes_transfer(int operation, size_t siz #if defined(TWAIT_HAVE_STATUS) int status; #endif - /* 512 is more than enough, for the purposes of ATF it's good enough */ - AuxInfo ai[512], *aip; + /* 513 is just enough, for the purposes of ATF it's good enough */ + AuxInfo ai[513], *aip; ATF_REQUIRE(size < sizeof(ai));
CVS commit: src/sys/kern
Module Name:src Committed By: kamil Date: Tue May 29 23:34:18 UTC 2018 Modified Files: src/sys/kern: sys_ptrace_common.c Log Message: Harden PT_ATTACH in ptrace(2) Don't allow to PT_ATTACH from a vfork(2)ed child (before exec(3)/_exit(3)) to its parent. Return error with EPERM errno. This scenario does not have a purpose and there is no clear picture how to route signals. Sponsored by To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/kern/sys_ptrace_common.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/sys_ptrace_common.c diff -u src/sys/kern/sys_ptrace_common.c:1.42 src/sys/kern/sys_ptrace_common.c:1.43 --- src/sys/kern/sys_ptrace_common.c:1.42 Sun May 20 04:00:35 2018 +++ src/sys/kern/sys_ptrace_common.c Tue May 29 23:34:18 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_ptrace_common.c,v 1.42 2018/05/20 04:00:35 kamil Exp $ */ +/* $NetBSD: sys_ptrace_common.c,v 1.43 2018/05/29 23:34:18 kamil Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -118,7 +118,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.42 2018/05/20 04:00:35 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.43 2018/05/29 23:34:18 kamil Exp $"); #ifdef _KERNEL_OPT #include "opt_ptrace.h" @@ -419,13 +419,19 @@ ptrace_allowed(struct lwp *l, int req, s return EPERM; /* - * (4) it's already being traced, or + * (4) it's already being traced, */ if (ISSET(t->p_slflag, PSL_TRACED)) return EBUSY; /* - * (5) the tracer is chrooted, and its root directory is + * (5) it's a vfork(2)ed parent of the current process, or + */ + if (ISSET(p->p_lflag, PL_PPWAIT) && p->p_pptr == t) + return EPERM; + + /* + * (6) the tracer is chrooted, and its root directory is * not at or above the root directory of the tracee */ mutex_exit(t->p_lock); /* XXXSMP */
CVS commit: src/share/wscons/keymaps
Module Name:src Committed By: zafer Date: Tue May 29 19:45:31 UTC 2018 Modified Files: src/share/wscons/keymaps: pckbd.br.abnt2 Log Message: Add AltGr modifier for brazilian abnt2 keymap. Fixes PR misc/50147 by Vicente Chaves. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/share/wscons/keymaps/pckbd.br.abnt2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/wscons/keymaps/pckbd.br.abnt2 diff -u src/share/wscons/keymaps/pckbd.br.abnt2:1.1 src/share/wscons/keymaps/pckbd.br.abnt2:1.2 --- src/share/wscons/keymaps/pckbd.br.abnt2:1.1 Fri Mar 18 17:40:02 2005 +++ src/share/wscons/keymaps/pckbd.br.abnt2 Tue May 29 19:45:31 2018 @@ -1,15 +1,17 @@ -# $NetBSD: pckbd.br.abnt2,v 1.1 2005/03/18 17:40:02 drochner Exp $ +# $NetBSD: pckbd.br.abnt2,v 1.2 2018/05/29 19:45:31 zafer Exp $ # # Brazilian keymap for abnt2 by Felipe Bichued -keycode 1 = Escape keycode 2 = 1 exclam onesuperior keycode 3 = 2 at twosuperior keycode 4 = 3 numbersign threesuperior -keycode 5 = 4 dollar sterling sterling -keycode 6 = 5 percent cent cent -keycode 7 = 6 dead_diaeresis +keycode 5 = 4 dollar sterling +keycode 6 = 5 percent cent +keycode 7 = 6 dead_diaeresis notsign keycode 13 = equal plus section +keycode 16 = q Q slash +keycode 17 = w W question +keycode 18 = e E degree keycode 26 = dead_acute dead_grave keycode 27 = bracketleft braceleft ordfeminine keycode 39 = ccedilla Ccedilla @@ -17,9 +19,8 @@ keycode 40 = dead_tilde dead_circumflex keycode 41 = apostrophe quotedbl keycode 43 = bracketright braceright masculine keycode 53 = semicolon colon -keycode 73 = KP_Prior KP_9 -keycode 81 = KP_Next KP_3 +keycode 83 = KP_Delete KP_Separator keycode 86 = backslash bar keycode 115 = slash question degree -keycode 201 = Prior -keycode 209 = Next +keycode 126 = KP_Decimal +keycode 184 = Mode_switch Multi_key
CVS commit: src/sys/netinet
Module Name:src Committed By: maxv Date: Tue May 29 17:21:57 UTC 2018 Modified Files: src/sys/netinet: ip_output.c Log Message: Fix an XXX of mine, be clearer about what we're doing. Basically we want to preserve the fragment offset and flags. That's necessary if the packet we're fragmenting is itself a fragment. To generate a diff of this commit: cvs rdiff -u -r1.304 -r1.305 src/sys/netinet/ip_output.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/netinet/ip_output.c diff -u src/sys/netinet/ip_output.c:1.304 src/sys/netinet/ip_output.c:1.305 --- src/sys/netinet/ip_output.c:1.304 Sun Apr 29 11:51:08 2018 +++ src/sys/netinet/ip_output.c Tue May 29 17:21:57 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.304 2018/04/29 11:51:08 maxv Exp $ */ +/* $NetBSD: ip_output.c,v 1.305 2018/05/29 17:21:57 maxv Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.304 2018/04/29 11:51:08 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.305 2018/05/29 17:21:57 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -820,16 +820,14 @@ ip_fragment(struct mbuf *m, struct ifnet int sw_csum = m->m_pkthdr.csum_flags; int fragments = 0; int error = 0; - int ipoff; - bool mff; + int ipoff, ipflg; ip = mtod(m, struct ip *); hlen = ip->ip_hl << 2; - /* XXX: Why don't we remove IP_RF? */ - ipoff = ntohs(ip->ip_off) & ~IP_MF; - - mff = (ip->ip_off & htons(IP_MF)) != 0; + /* Preserve the offset and flags. */ + ipoff = ntohs(ip->ip_off) & IP_OFFMASK; + ipflg = ntohs(ip->ip_off) & (IP_RF|IP_DF|IP_MF); if (ifp != NULL) sw_csum &= ~ifp->if_csum_flags_tx; @@ -875,8 +873,7 @@ ip_fragment(struct mbuf *m, struct ifnet m->m_len = mhlen; mhip->ip_off = ((off - hlen) >> 3) + ipoff; - if (mff) - mhip->ip_off |= IP_MF; + mhip->ip_off |= ipflg; if (off + len >= ntohs(ip->ip_len)) len = ntohs(ip->ip_len) - off; else
CVS commit: src/sys/modules/examples
Module Name:src Committed By: kamil Date: Tue May 29 16:53:56 UTC 2018 Modified Files: src/sys/modules/examples: Makefile README Added Files: src/sys/modules/examples/panic_string: Makefile panic_string.c Log Message: Introduce new example kernel module: panic_string The panic_string module accepts input from a device file over the write(2) system call. It prints panic(9) message passed from user space, e.g.: echo "Hello world" > /dev/panic If a string is empty or contain only whitespaces it's ignored and panic(9) is not triggered. If a non printable character is passed within the input buffer, the rest of the string is ignored. This module performs the sync(8) operation before panic(9) to flush cache. Submitted by Harry Pantazis. Simplified and cleaned up by myself. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/modules/examples/Makefile cvs rdiff -u -r1.7 -r1.8 src/sys/modules/examples/README cvs rdiff -u -r0 -r1.1 src/sys/modules/examples/panic_string/Makefile \ src/sys/modules/examples/panic_string/panic_string.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/modules/examples/Makefile diff -u src/sys/modules/examples/Makefile:1.5 src/sys/modules/examples/Makefile:1.6 --- src/sys/modules/examples/Makefile:1.5 Fri Apr 20 00:06:45 2018 +++ src/sys/modules/examples/Makefile Tue May 29 16:53:56 2018 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2018/04/20 00:06:45 kamil Exp $ +# $NetBSD: Makefile,v 1.6 2018/05/29 16:53:56 kamil Exp $ .include @@ -6,6 +6,7 @@ SUBDIR+= executor SUBDIR+= hello #SUBDIR+= luahello # Nothing to build here, only text files SUBDIR+= luareadhappy # Needs an additional Lua script +SUBDIR+= panic_string # Crashes the system SUBDIR+= ping # Needs an additional helper program SUBDIR+= properties SUBDIR+= readhappy Index: src/sys/modules/examples/README diff -u src/sys/modules/examples/README:1.7 src/sys/modules/examples/README:1.8 --- src/sys/modules/examples/README:1.7 Fri Apr 20 00:06:45 2018 +++ src/sys/modules/examples/README Tue May 29 16:53:56 2018 @@ -1,4 +1,4 @@ - $NetBSD: README,v 1.7 2018/04/20 00:06:45 kamil Exp $ + $NetBSD: README,v 1.8 2018/05/29 16:53:56 kamil Exp $ Kernel Developer's Manual @@ -10,8 +10,9 @@ DESCRIPTION * hello - the simplest `hello world' module * luahello- the simplest `hello world' Lua module * luareadhappy- demonstrates calling Lua code from C - * properties - handle incoming properties during the module load + * panic_string- shows how panic is being called through a device * ping- basic ioctl(9) + * properties - handle incoming properties during the module load * readhappy - basic implementation of read(9) with happy numbers * readhappy_mpsafe- demonstrates how to make a module MPSAFE * sysctl - demonstrates adding a sysctl handle dynamically @@ -62,5 +63,8 @@ HISTORY The readhappy_mpsafe, executor and sysctls modules first appeared in NetBSD 9.0 and were authored by Siddharth Muralee. + The panic_string module first appeared in NetBSD 9.0 and was authored by + Harry Pantazis. + AUTHORS This document was written by Kamil Rytarowski. Added files: Index: src/sys/modules/examples/panic_string/Makefile diff -u /dev/null src/sys/modules/examples/panic_string/Makefile:1.1 --- /dev/null Tue May 29 16:53:56 2018 +++ src/sys/modules/examples/panic_string/Makefile Tue May 29 16:53:56 2018 @@ -0,0 +1,9 @@ +# $NetBSD: Makefile,v 1.1 2018/05/29 16:53:56 kamil Exp $ + +.include "../Makefile.inc" + +#S?= /usr/src/sys +KMOD= panic_string +SRCS= panic_string.c + +.include Index: src/sys/modules/examples/panic_string/panic_string.c diff -u /dev/null src/sys/modules/examples/panic_string/panic_string.c:1.1 --- /dev/null Tue May 29 16:53:56 2018 +++ src/sys/modules/examples/panic_string/panic_string.c Tue May 29 16:53:56 2018 @@ -0,0 +1,196 @@ +/* $NetBSD: panic_string.c,v 1.1 2018/05/29 16:53:56 kamil Exp $ */ + +/*- + * Copyright (c) 2018 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
CVS commit: src/sys/netipsec
Module Name:src Committed By: maxv Date: Tue May 29 16:50:38 UTC 2018 Modified Files: src/sys/netipsec: xform_ah.c Log Message: Strengthen and simplify, once more. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/netipsec/xform_ah.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/netipsec/xform_ah.c diff -u src/sys/netipsec/xform_ah.c:1.102 src/sys/netipsec/xform_ah.c:1.103 --- src/sys/netipsec/xform_ah.c:1.102 Tue May 29 09:25:44 2018 +++ src/sys/netipsec/xform_ah.c Tue May 29 16:50:38 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: xform_ah.c,v 1.102 2018/05/29 09:25:44 ozaki-r Exp $ */ +/* $NetBSD: xform_ah.c,v 1.103 2018/05/29 16:50:38 maxv Exp $ */ /* $FreeBSD: xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */ /* $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */ /* @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.102 2018/05/29 09:25:44 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.103 2018/05/29 16:50:38 maxv Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -271,7 +271,7 @@ ah_massage_headers(struct mbuf **m0, int struct ip *ip; #endif #ifdef INET6 - int count; + int count, ip6optlen; struct ip6_ext *ip6e; struct ip6_hdr ip6; int alloc, nxt; @@ -394,11 +394,12 @@ ah_massage_headers(struct mbuf **m0, int /* Done with IPv6 header. */ m_copyback(m, 0, sizeof(struct ip6_hdr), ); + ip6optlen = skip - sizeof(struct ip6_hdr); + /* Let's deal with the remaining headers (if any). */ - if (skip - sizeof(struct ip6_hdr) > 0) { + if (ip6optlen > 0) { if (m->m_len <= skip) { -ptr = malloc(skip - sizeof(struct ip6_hdr), -M_XDATA, M_NOWAIT); +ptr = malloc(ip6optlen, M_XDATA, M_NOWAIT); if (ptr == NULL) { DPRINTF(("%s: failed to allocate " "memory for IPv6 headers\n", @@ -412,7 +413,7 @@ ah_massage_headers(struct mbuf **m0, int * the IPv6 header. */ m_copydata(m, sizeof(struct ip6_hdr), -skip - sizeof(struct ip6_hdr), ptr); +ip6optlen, ptr); alloc = 1; } else { /* No need to allocate memory. */ @@ -425,23 +426,22 @@ ah_massage_headers(struct mbuf **m0, int nxt = ip6.ip6_nxt & 0xff; /* Next header type. */ - for (off = 0; off < skip - sizeof(struct ip6_hdr);) { + for (off = 0; off < ip6optlen;) { int noff; + if (off + sizeof(*ip6e) > ip6optlen) { +goto error6; + } + ip6e = (struct ip6_ext *)(ptr + off); + noff = off + ((ip6e->ip6e_len + 1) << 3); + if (noff > ip6optlen) { +goto error6; + } + switch (nxt) { case IPPROTO_HOPOPTS: case IPPROTO_DSTOPTS: -ip6e = (struct ip6_ext *)(ptr + off); -noff = off + ((ip6e->ip6e_len + 1) << 3); - -/* Sanity check. */ -if (noff > skip - sizeof(struct ip6_hdr)) { - goto error6; -} - -/* - * Zero out mutable options. - */ +/* Zero out mutable options. */ for (count = off + sizeof(struct ip6_ext); count < noff;) { if (ptr[count] == IP6OPT_PAD1) { @@ -464,27 +464,18 @@ ah_massage_headers(struct mbuf **m0, int count += optlen; } - if (count != noff) { goto error6; } - -/* Advance. */ -off += ((ip6e->ip6e_len + 1) << 3); -nxt = ip6e->ip6e_nxt; -break; +/* FALLTHROUGH */ case IPPROTO_ROUTING: -ip6e = (struct ip6_ext *)(ptr + off); - -/* advance */ -off += ((ip6e->ip6e_len + 1) << 3); +/* Advance. */ +off = noff; nxt = ip6e->ip6e_nxt; break; default: -DPRINTF(("%s: unexpected IPv6 header type %d\n", -__func__, off)); error6: if (alloc) free(ptr, M_XDATA); @@ -495,8 +486,7 @@ error6: /* Copyback and free, if we allocated. */ if (alloc) { - m_copyback(m, sizeof(struct ip6_hdr), - skip - sizeof(struct ip6_hdr), ptr); + m_copyback(m, sizeof(struct ip6_hdr), ip6optlen, ptr); free(ptr, M_XDATA); }
CVS commit: src/sys/netatalk
Module Name:src Committed By: maxv Date: Tue May 29 16:29:47 UTC 2018 Modified Files: src/sys/netatalk: aarp.c at_extern.h Log Message: Remove aarp_clean, unused. By the way this function was probably buggy since it didn't reset aat_hold to NULL. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/netatalk/aarp.c cvs rdiff -u -r1.19 -r1.20 src/sys/netatalk/at_extern.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/netatalk/aarp.c diff -u src/sys/netatalk/aarp.c:1.41 src/sys/netatalk/aarp.c:1.42 --- src/sys/netatalk/aarp.c:1.41 Sat Feb 17 19:10:18 2018 +++ src/sys/netatalk/aarp.c Tue May 29 16:29:47 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: aarp.c,v 1.41 2018/02/17 19:10:18 rjs Exp $ */ +/* $NetBSD: aarp.c,v 1.42 2018/05/29 16:29:47 maxv Exp $ */ /* * Copyright (c) 1990,1991 Regents of The University of Michigan. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.41 2018/02/17 19:10:18 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.42 2018/05/29 16:29:47 maxv Exp $"); #include "opt_mbuftrace.h" #include "opt_atalk.h" @@ -673,15 +673,3 @@ aarpprobe(void *arp) aa->aa_probcnt--; mutex_exit(softnet_lock); } - -void -aarp_clean(void) -{ - struct aarptab *aat; - int i; - - callout_stop(_callout); - for (i = 0, aat = aarptab; i < AARPTAB_SIZE; i++, aat++) - if (aat->aat_hold) - m_freem(aat->aat_hold); -} Index: src/sys/netatalk/at_extern.h diff -u src/sys/netatalk/at_extern.h:1.19 src/sys/netatalk/at_extern.h:1.20 --- src/sys/netatalk/at_extern.h:1.19 Wed Jan 20 21:59:19 2016 +++ src/sys/netatalk/at_extern.h Tue May 29 16:29:47 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: at_extern.h,v 1.19 2016/01/20 21:59:19 riastradh Exp $ */ +/* $NetBSD: at_extern.h,v 1.20 2018/05/29 16:29:47 maxv Exp $ */ /* * Copyright (c) 1990,1994 Regents of The University of Michigan. @@ -50,7 +50,6 @@ int aarpresolve(struct ifnet *, struct m u_char *); void aarpinput(struct ifnet *, struct mbuf *); int at_broadcast(const struct sockaddr_at *); -void aarp_clean(void); int at_control(u_long, void *, struct ifnet *); int at_inithead(void **, int); void at_purgeaddr(struct ifaddr *);
CVS commit: src/sys/net
Module Name:src Committed By: maxv Date: Tue May 29 16:24:34 UTC 2018 Modified Files: src/sys/net: if_ethersubr.c Log Message: Remove an XXX of mine, actually it's fine. While here also remove a misleading printf. To generate a diff of this commit: cvs rdiff -u -r1.267 -r1.268 src/sys/net/if_ethersubr.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/net/if_ethersubr.c diff -u src/sys/net/if_ethersubr.c:1.267 src/sys/net/if_ethersubr.c:1.268 --- src/sys/net/if_ethersubr.c:1.267 Tue May 29 08:24:59 2018 +++ src/sys/net/if_ethersubr.c Tue May 29 16:24:34 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ethersubr.c,v 1.267 2018/05/29 08:24:59 maxv Exp $ */ +/* $NetBSD: if_ethersubr.c,v 1.268 2018/05/29 16:24:34 maxv Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.267 2018/05/29 08:24:59 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.268 2018/05/29 16:24:34 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -307,9 +307,6 @@ ether_output(struct ifnet * const ifp0, KERNEL_LOCK(1, NULL); if (!aarpresolve(ifp, m, (const struct sockaddr_at *)dst, edst)) { -#ifdef NETATALKDEBUG - printf("aarpresolve failed\n"); -#endif KERNEL_UNLOCK_ONE(NULL); return 0; } @@ -329,8 +326,6 @@ ether_output(struct ifnet * const ifp0, /* * In the phase 2 case, we need to prepend an mbuf for the * llc header. - * - * XXX XXX: Do we need to preserve the value of m? */ if (aa->aa_flags & AFA_PHASE2) { struct llc llc;
CVS commit: src/sys/netinet6
Module Name:src Committed By: maxv Date: Tue May 29 16:21:30 UTC 2018 Modified Files: src/sys/netinet6: ip6_output.c Log Message: Remove dead code, we don't care. To generate a diff of this commit: cvs rdiff -u -r1.209 -r1.210 src/sys/netinet6/ip6_output.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/netinet6/ip6_output.c diff -u src/sys/netinet6/ip6_output.c:1.209 src/sys/netinet6/ip6_output.c:1.210 --- src/sys/netinet6/ip6_output.c:1.209 Wed May 9 06:35:10 2018 +++ src/sys/netinet6/ip6_output.c Tue May 29 16:21:30 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_output.c,v 1.209 2018/05/09 06:35:10 maxv Exp $ */ +/* $NetBSD: ip6_output.c,v 1.210 2018/05/29 16:21:30 maxv Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.209 2018/05/09 06:35:10 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.210 2018/05/29 16:21:30 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -875,33 +875,10 @@ ip6_output( const int hlen = unfragpartlen; struct ip6_frag *ip6f; u_char nextproto; -#if 0 /* see below */ - struct ip6ctlparam ip6cp; - u_int32_t mtu32; -#endif if (mtu > IPV6_MAXPACKET) mtu = IPV6_MAXPACKET; -#if 0 - /* - * It is believed this code is a leftover from the - * development of the IPV6_RECVPATHMTU sockopt and - * associated work to implement RFC3542. - * It's not entirely clear what the intent of the API - * is at this point, so disable this code for now. - * The IPV6_RECVPATHMTU sockopt and/or IPV6_DONTFRAG - * will send notifications if the application requests. - */ - - /* Notify a proper path MTU to applications. */ - mtu32 = (u_int32_t)mtu; - memset(, 0, sizeof(ip6cp)); - ip6cp.ip6c_cmdarg = (void *) - pfctlinput2(PRC_MSGSIZE, - rtcache_getdst(ro_pmtu), ); -#endif - /* * Must be able to put at least 8 bytes per fragment. */
CVS commit: src/usr.bin/kdump
Module Name:src Committed By: martin Date: Tue May 29 14:29:53 UTC 2018 Modified Files: src/usr.bin/kdump: mkioctls Log Message: Use proper forward declaration for kmutex_t. This makes MKDTRACE=no builds work again. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/usr.bin/kdump/mkioctls Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/kdump/mkioctls diff -u src/usr.bin/kdump/mkioctls:1.49 src/usr.bin/kdump/mkioctls:1.50 --- src/usr.bin/kdump/mkioctls:1.49 Tue May 29 13:10:28 2018 +++ src/usr.bin/kdump/mkioctls Tue May 29 14:29:53 2018 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkioctls,v 1.49 2018/05/29 13:10:28 martin Exp $ +# $NetBSD: mkioctls,v 1.50 2018/05/29 14:29:53 martin Exp $ # # Copyright (c) 1994 # The Regents of the University of California. All rights reserved. @@ -49,7 +49,7 @@ echo "typedef struct crap videomemory_t; echo "typedef struct crap RF_AccTotals_t;" # XXX Raidframe lossage echo "struct rf_test_acc { int _xxx; };" # XXX Raidframe lossage echo "struct map_info { int _xxx[22]; };" # XXX Xorg lossage -echo "typedef void *kmutex_t;" # XXX needed by ZFS headers +echo "typedef struct kmutex kmutex_t;" # XXX needed by ZFS headers echo "#include " echo "#include " echo "#include "
CVS commit: src/usr.bin/kdump
Module Name:src Committed By: martin Date: Tue May 29 13:10:28 UTC 2018 Modified Files: src/usr.bin/kdump: mkioctls Log Message: Ooops, backout previous - it was an update build artifact (or something) To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/usr.bin/kdump/mkioctls Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/kdump/mkioctls diff -u src/usr.bin/kdump/mkioctls:1.48 src/usr.bin/kdump/mkioctls:1.49 --- src/usr.bin/kdump/mkioctls:1.48 Tue May 29 11:18:50 2018 +++ src/usr.bin/kdump/mkioctls Tue May 29 13:10:28 2018 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkioctls,v 1.48 2018/05/29 11:18:50 martin Exp $ +# $NetBSD: mkioctls,v 1.49 2018/05/29 13:10:28 martin Exp $ # # Copyright (c) 1994 # The Regents of the University of California. All rights reserved. @@ -49,6 +49,7 @@ echo "typedef struct crap videomemory_t; echo "typedef struct crap RF_AccTotals_t;" # XXX Raidframe lossage echo "struct rf_test_acc { int _xxx; };" # XXX Raidframe lossage echo "struct map_info { int _xxx[22]; };" # XXX Xorg lossage +echo "typedef void *kmutex_t;" # XXX needed by ZFS headers echo "#include " echo "#include " echo "#include "
CVS commit: src/sys/dev/pckbport
Module Name:src Committed By: ryoon Date: Tue May 29 11:38:24 UTC 2018 Modified Files: src/sys/dev/pckbport: synaptics.c Log Message: Remove trailing tab To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/pckbport/synaptics.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/pckbport/synaptics.c diff -u src/sys/dev/pckbport/synaptics.c:1.36 src/sys/dev/pckbport/synaptics.c:1.37 --- src/sys/dev/pckbport/synaptics.c:1.36 Tue Dec 5 18:04:21 2017 +++ src/sys/dev/pckbport/synaptics.c Tue May 29 11:38:24 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: synaptics.c,v 1.36 2017/12/05 18:04:21 jmcneill Exp $ */ +/* $NetBSD: synaptics.c,v 1.37 2018/05/29 11:38:24 ryoon Exp $ */ /* * Copyright (c) 2005, Steve C. Woodford @@ -48,7 +48,7 @@ #include "opt_pms.h" #include -__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.36 2017/12/05 18:04:21 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.37 2018/05/29 11:38:24 ryoon Exp $"); #include #include @@ -469,7 +469,7 @@ pms_synaptics_enable(void *vsc) aprint_error("synaptics: set mode error\n"); synaptics_poll_cmd(psc, PMS_SET_SAMPLE, SYNAPTICS_CMD_SET_MODE2, 0); - + /* a couple of set scales to clear out pending commands */ for (int i = 0; i < 2; i++) synaptics_poll_cmd(psc, PMS_SET_SCALE11, 0);
CVS commit: src/usr.bin/kdump
Module Name:src Committed By: martin Date: Tue May 29 11:18:50 UTC 2018 Modified Files: src/usr.bin/kdump: mkioctls Log Message: Backout previous: "typedef void *kmutex_t; is incompatible with our kmutex_t and breaks the build. ZFS will need to find a better way to work around this. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/usr.bin/kdump/mkioctls Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/kdump/mkioctls diff -u src/usr.bin/kdump/mkioctls:1.47 src/usr.bin/kdump/mkioctls:1.48 --- src/usr.bin/kdump/mkioctls:1.47 Mon May 28 21:05:02 2018 +++ src/usr.bin/kdump/mkioctls Tue May 29 11:18:50 2018 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkioctls,v 1.47 2018/05/28 21:05:02 chs Exp $ +# $NetBSD: mkioctls,v 1.48 2018/05/29 11:18:50 martin Exp $ # # Copyright (c) 1994 # The Regents of the University of California. All rights reserved. @@ -49,7 +49,6 @@ echo "typedef struct crap videomemory_t; echo "typedef struct crap RF_AccTotals_t;" # XXX Raidframe lossage echo "struct rf_test_acc { int _xxx; };" # XXX Raidframe lossage echo "struct map_info { int _xxx[22]; };" # XXX Xorg lossage -echo "typedef void *kmutex_t;" # XXX needed by ZFS headers echo "#include " echo "#include " echo "#include "
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Tue May 29 10:40:54 UTC 2018 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Log Message: Add new ATF ptrace(2) tests verifying crash signal handling Add new tests: - traceme_crash_trap - traceme_crash_segv - traceme_crash_ill (temporarily disabled) - traceme_crash_fpe - traceme_crash_bus - unrelated_tracer_sees_crash_trap - unrelated_tracer_sees_crash_segv - unrelated_tracer_sees_crash_ill (temporarily disabled) - unrelated_tracer_sees_crash_fpe - unrelated_tracer_sees_crash_bus These tests verify two subtle kernel paths that differ internally: - for a tracer that is a parent of a traced program (and not vforked) real parent == tracer - for a tracer that is an unrelated process of a traced program real parent != tracer Regressions in the signal code can cause to break one of the scenarios, and keep working the other one. It might be propagated to a scenario like: - attaching to a process with a debugger (over pid) - starting a process inside a debugger We can assert on the ATF level that both will be functional. While there, cover all the crash signals as testing is done practically for free. While the Machine Independent signal routing code for crash signals is mostly the same in the kernel, we can verify whether Machine Dependent parts works as expected emitting the proper signal number and signal code (si_code). There have been already caught an unexpected behavior on Alpha, that instead of SIGBUS we receive SIGSEGV. Another benefit is that it's easier to catch races, as they pop up more frequently. (This already helped to catch bugs more quickly) These tests will help assert correctness of future kernel changes in the signal routines. All tests pass. Sponsored by To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.58 src/tests/lib/libc/sys/t_ptrace_wait.c:1.59 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.58 Mon May 28 11:35:50 2018 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue May 29 10:40:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.58 2018/05/28 11:35:50 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.59 2018/05/29 10:40:54 kamil Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.58 2018/05/28 11:35:50 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.59 2018/05/29 10:40:54 kamil Exp $"); #include #include @@ -177,6 +177,114 @@ TRACEME_RAISE(traceme_raise5, SIGCONT) / /// static void +traceme_crash(int sig) +{ + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct ptrace_siginfo info; + memset(, 0, sizeof(info)); + + DPRINTF("Before forking process PID=%d\n", getpid()); + SYSCALL_REQUIRE((child = fork()) != -1); + if (child == 0) { + DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + DPRINTF("Before executing a trap\n"); + switch (sig) { + case SIGTRAP: + trigger_trap(); + break; + case SIGSEGV: + trigger_segv(); + break; + case SIGILL: + trigger_ill(); + break; + case SIGFPE: + trigger_fpe(); + break; + case SIGBUS: + trigger_bus(); + break; + default: + /* NOTREACHED */ + FORKEE_ASSERTX(0 && "This shall not be reached"); + } + + /* NOTREACHED */ + FORKEE_ASSERTX(0 && "This shall not be reached"); + } + DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child); + + validate_status_stopped(status, sig); + + DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child"); + SYSCALL_REQUIRE(ptrace(PT_GET_SIGINFO, child, , sizeof(info)) != -1); + + DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid); + DPRINTF("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n", + info.psi_siginfo.si_signo, info.psi_siginfo.si_code, + info.psi_siginfo.si_errno); + + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sig); + switch (sig) { + case SIGTRAP: + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_BRKPT); + break; + case SIGSEGV: + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SEGV_MAPERR); + break; +// case SIGILL: +// ATF_REQUIRE_EQ(info.psi_siginfo.si_code, ILL_ILLOP); +// break; + case SIGFPE: + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, FPE_INTDIV); + break; + case SIGBUS: + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, BUS_ADRERR); + break; + } + + SYSCALL_REQUIRE(ptrace(PT_KILL, child, NULL, 0) != -1); + + DPRINTF("Before calling %s() for the
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue May 29 09:25:01 UTC 2018 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Only report the things we've passed in the mcontext and leave out flags that are not reported in the mcontext anyway! To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.78 src/sys/arch/usermode/dev/cpu.c:1.79 --- src/sys/arch/usermode/dev/cpu.c:1.78 Tue May 29 07:35:40 2018 +++ src/sys/arch/usermode/dev/cpu.c Tue May 29 09:25:01 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.78 2018/05/29 07:35:40 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.79 2018/05/29 09:25:01 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -30,7 +30,7 @@ #include "opt_hz.h" #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.78 2018/05/29 07:35:40 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.79 2018/05/29 09:25:01 reinoud Exp $"); #include #include @@ -322,9 +322,9 @@ cpu_getmcontext(struct lwp *l, mcontext_ #endif memcpy(mcp, >uc_mcontext, sizeof(mcontext_t)); - /* XXX be overzealous and provide all */ + /* report we have the CPU FPU and TLSBASE registers */ mcp->_mc_tlsbase = (uintptr_t) l->l_private; - *flags = _UC_CPU | _UC_STACK | _UC_SIGMASK | _UC_FPU | _UC_TLSBASE; + *flags = _UC_CPU | _UC_FPU | _UC_TLSBASE; return; } @@ -338,7 +338,7 @@ cpu_mcontext_validate(struct lwp *l, con */ /* XXX NO CHECKING! XXX */ #ifdef CPU_DEBUG - thunk_printf("cpu_mcontext_validate\n"); + thunk_printf_debug("cpu_mcontext_validate\n"); #endif return 0; }
CVS commit: src/sys/netipsec
Module Name:src Committed By: ozaki-r Date: Tue May 29 09:25:44 UTC 2018 Modified Files: src/sys/netipsec: xform_ah.c Log Message: Fix non-INET6 builds To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/netipsec/xform_ah.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/netipsec/xform_ah.c diff -u src/sys/netipsec/xform_ah.c:1.101 src/sys/netipsec/xform_ah.c:1.102 --- src/sys/netipsec/xform_ah.c:1.101 Fri May 18 19:02:49 2018 +++ src/sys/netipsec/xform_ah.c Tue May 29 09:25:44 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: xform_ah.c,v 1.101 2018/05/18 19:02:49 maxv Exp $ */ +/* $NetBSD: xform_ah.c,v 1.102 2018/05/29 09:25:44 ozaki-r Exp $ */ /* $FreeBSD: xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */ /* $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */ /* @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.101 2018/05/18 19:02:49 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.102 2018/05/29 09:25:44 ozaki-r Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -266,11 +266,12 @@ ah_massage_headers(struct mbuf **m0, int { struct mbuf *m = *m0; unsigned char *ptr; - int off, count, optlen; + int off, optlen; #ifdef INET struct ip *ip; #endif #ifdef INET6 + int count; struct ip6_ext *ip6e; struct ip6_hdr ip6; int alloc, nxt;
CVS commit: src/sys/netinet6
Module Name:src Committed By: prlw1 Date: Tue May 29 09:10:39 UTC 2018 Modified Files: src/sys/netinet6: in6.c Log Message: Mark in6m as used for non-DIAGNOSTIC builds. To generate a diff of this commit: cvs rdiff -u -r1.267 -r1.268 src/sys/netinet6/in6.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/netinet6/in6.c diff -u src/sys/netinet6/in6.c:1.267 src/sys/netinet6/in6.c:1.268 --- src/sys/netinet6/in6.c:1.267 Tue May 29 04:37:16 2018 +++ src/sys/netinet6/in6.c Tue May 29 09:10:39 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: in6.c,v 1.267 2018/05/29 04:37:16 ozaki-r Exp $ */ +/* $NetBSD: in6.c,v 1.268 2018/05/29 09:10:39 prlw1 Exp $ */ /* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.267 2018/05/29 04:37:16 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.268 2018/05/29 09:10:39 prlw1 Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1405,7 +1405,7 @@ in6_purgeaddr(struct ifaddr *ifa) again: mutex_enter(_ifaddr_lock); while ((imm = LIST_FIRST(>ia6_memberships)) != NULL) { - struct in6_multi *in6m = imm->i6mm_maddr; + struct in6_multi *in6m __diagused = imm->i6mm_maddr; KASSERT(in6m == NULL || in6m->in6m_ifp == ifp); LIST_REMOVE(imm, i6mm_chain); mutex_exit(_ifaddr_lock);
CVS commit: src/usr.bin/cal
Module Name:src Committed By: wiz Date: Tue May 29 08:37:33 UTC 2018 Modified Files: src/usr.bin/cal: cal.1 Log Message: Remove superfluous Pp. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.bin/cal/cal.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/cal/cal.1 diff -u src/usr.bin/cal/cal.1:1.22 src/usr.bin/cal/cal.1:1.23 --- src/usr.bin/cal/cal.1:1.22 Tue May 29 06:07:26 2018 +++ src/usr.bin/cal/cal.1 Tue May 29 08:37:33 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: cal.1,v 1.22 2018/05/29 06:07:26 kamil Exp $ +.\" $NetBSD: cal.1,v 1.23 2018/05/29 08:37:33 wiz Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -134,7 +134,6 @@ calendar for a very old date. .Nm has a decent built-in list of Gregorian Reform dates and the names of the countries where the reform was adopted: -.Pp .Bd -literal Italy Oct. 5, 1582 Denmark Feb. 19, 1700 Spain Oct. 5, 1582 Great Britain Sep. 3, 1752
CVS commit: src/sys/net
Module Name:src Committed By: maxv Date: Tue May 29 08:24:59 UTC 2018 Modified Files: src/sys/net: if_ethersubr.c Log Message: Replace KASSERT by m_pullup. While the ethernet header is always there when the packet was received on a physical interface, it may not be if the packet was received over L2TP/EtherIP. In particular, if the inner ethernet header ends up on two separate IP fragments. Here the KASSERT is triggered, and on !DIAGNOSTIC we corrupt memory. Note that this is a widespread problem: a lot of L2 code was written with the assumption that "most" headers are present in the first mbuf. Obviously, that's not true if L2 encapsulation is being used. To generate a diff of this commit: cvs rdiff -u -r1.266 -r1.267 src/sys/net/if_ethersubr.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/net/if_ethersubr.c diff -u src/sys/net/if_ethersubr.c:1.266 src/sys/net/if_ethersubr.c:1.267 --- src/sys/net/if_ethersubr.c:1.266 Wed May 9 06:35:10 2018 +++ src/sys/net/if_ethersubr.c Tue May 29 08:24:59 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ethersubr.c,v 1.266 2018/05/09 06:35:10 maxv Exp $ */ +/* $NetBSD: if_ethersubr.c,v 1.267 2018/05/29 08:24:59 maxv Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.266 2018/05/09 06:35:10 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.267 2018/05/29 08:24:59 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -588,12 +588,16 @@ ether_input(struct ifnet *ifp, struct mb KASSERT(!cpu_intr_p()); KASSERT((m->m_flags & M_PKTHDR) != 0); - KASSERT(m->m_len >= sizeof(*eh)); if ((ifp->if_flags & IFF_UP) == 0) { m_freem(m); return; } + if (m->m_len < sizeof(*eh)) { + m = m_pullup(m, sizeof(*eh)); + if (m == NULL) + return; + } #ifdef MBUFTRACE m_claimm(m, >ec_rx_mowner);
CVS commit: src/sys/arch/usermode
Module Name:src Committed By: reinoud Date: Tue May 29 07:35:40 UTC 2018 Modified Files: src/sys/arch/usermode/dev: cpu.c src/sys/arch/usermode/include: types.h Log Message: Implement cpu_lwp_setprivate(). This removes the need for the cpu_switch() hack. Programs with TLS work fine now, including gdb! To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/arch/usermode/dev/cpu.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/include/types.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.77 src/sys/arch/usermode/dev/cpu.c:1.78 --- src/sys/arch/usermode/dev/cpu.c:1.77 Tue May 29 07:09:21 2018 +++ src/sys/arch/usermode/dev/cpu.c Tue May 29 07:35:40 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.77 2018/05/29 07:09:21 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.78 2018/05/29 07:35:40 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -30,7 +30,7 @@ #include "opt_hz.h" #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.77 2018/05/29 07:09:21 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.78 2018/05/29 07:35:40 reinoud Exp $"); #include #include @@ -193,6 +193,22 @@ cpu_need_proftick(struct lwp *l) { } +int +cpu_lwp_setprivate(lwp_t *l, void *ptr) +{ + struct pcb *pcb = lwp_getpcb(l); + + /* set both ucontexts up for TLS just in case */ + pcb->pcb_ucp.uc_mcontext._mc_tlsbase = + (uintptr_t) ptr; + pcb->pcb_ucp.uc_flags |= _UC_TLSBASE; + + pcb->pcb_userret_ucp.uc_mcontext._mc_tlsbase = + (uintptr_t) ptr; + pcb->pcb_userret_ucp.uc_flags |= _UC_TLSBASE; + + return 0; +} static void @@ -214,18 +230,8 @@ cpu_switchto_atomic(lwp_t *oldlwp, lwp_t oldpcb->pcb_errno = thunk_geterrno(); thunk_seterrno(newpcb->pcb_errno); - - /* set both ucontexts up for TLS just in case */ - - newpcb->pcb_ucp.uc_mcontext._mc_tlsbase = - (uintptr_t) newlwp->l_private; - newpcb->pcb_ucp.uc_flags |= _UC_TLSBASE; - - newpcb->pcb_userret_ucp.uc_mcontext._mc_tlsbase = - (uintptr_t) newlwp->l_private; - newpcb->pcb_userret_ucp.uc_flags |= _UC_TLSBASE; - curlwp = newlwp; + splx(s); if (thunk_setcontext(>pcb_ucp)) Index: src/sys/arch/usermode/include/types.h diff -u src/sys/arch/usermode/include/types.h:1.12 src/sys/arch/usermode/include/types.h:1.13 --- src/sys/arch/usermode/include/types.h:1.12 Thu Jan 26 15:55:10 2017 +++ src/sys/arch/usermode/include/types.h Tue May 29 07:35:39 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.12 2017/01/26 15:55:10 christos Exp $ */ +/* $NetBSD: types.h,v 1.13 2018/05/29 07:35:39 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -67,6 +67,7 @@ typedef long int __register_t; #endif #define __HAVE_CPU_DATA_FIRST +#define __HAVE_CPU_LWP_SETPRIVATE #define __HAVE_MM_MD_KERNACC #define __HAVE_COMPAT_NETBSD32
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue May 29 07:09:22 UTC 2018 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Only set requested parts of the mcontext in cpu_setmcontext() Make the atomic switcher `atomic' by using splhigh() To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.76 src/sys/arch/usermode/dev/cpu.c:1.77 --- src/sys/arch/usermode/dev/cpu.c:1.76 Thu May 24 19:39:04 2018 +++ src/sys/arch/usermode/dev/cpu.c Tue May 29 07:09:21 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.76 2018/05/24 19:39:04 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.77 2018/05/29 07:09:21 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -30,7 +30,7 @@ #include "opt_hz.h" #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.76 2018/05/24 19:39:04 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.77 2018/05/29 07:09:21 reinoud Exp $"); #include #include @@ -194,7 +194,6 @@ cpu_need_proftick(struct lwp *l) } -/* XXX make sure this is atomic? */ static void cpu_switchto_atomic(lwp_t *oldlwp, lwp_t *newlwp) @@ -202,19 +201,22 @@ cpu_switchto_atomic(lwp_t *oldlwp, lwp_t struct pcb *oldpcb; struct pcb *newpcb; struct cpu_info *ci; + int s; oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL; newpcb = lwp_getpcb(newlwp); ci = curcpu(); - ci->ci_stash = oldlwp; + s = splhigh(); + ci->ci_stash = oldlwp; if (oldpcb) oldpcb->pcb_errno = thunk_geterrno(); thunk_seterrno(newpcb->pcb_errno); /* set both ucontexts up for TLS just in case */ + newpcb->pcb_ucp.uc_mcontext._mc_tlsbase = (uintptr_t) newlwp->l_private; newpcb->pcb_ucp.uc_flags |= _UC_TLSBASE; @@ -224,8 +226,11 @@ cpu_switchto_atomic(lwp_t *oldlwp, lwp_t newpcb->pcb_userret_ucp.uc_flags |= _UC_TLSBASE; curlwp = newlwp; + splx(s); + if (thunk_setcontext(>pcb_ucp)) panic("setcontext failed"); + /* not reached */ } @@ -341,11 +346,28 @@ cpu_setmcontext(struct lwp *l, const mco #ifdef CPU_DEBUG thunk_printf_debug("cpu_setmcontext\n"); #endif - ucp->uc_flags = flags; - memcpy(>uc_mcontext, mcp, sizeof(mcontext_t)); + if ((flags & _UC_CPU) != 0) + memcpy(>uc_mcontext.__gregs, mcp->__gregs, sizeof(__gregset_t)); + if ((flags & _UC_FPU) != 0) + memcpy(>uc_mcontext.__fpregs, mcp->__fpregs, sizeof(__fpregset_t)); + if ((flags & _UC_TLSBASE) != 0) + lwp_setprivate(l, (void *) (uintptr_t) mcp->_mc_tlsbase); - /* update our private, it might be altered in userland */ - l->l_private = (void *) ucp->uc_mcontext._mc_tlsbase; +#if 0 + /* + * XXX we ignore the set and clear stack since signals are done + * slightly differently. + */ +thunk_printf("%s: flags %x\n", __func__, flags); + mutex_enter(l->l_proc->p_lock); + if (flags & _UC_SETSTACK) + l->l_sigstk.ss_flags |= SS_ONSTACK; + if (flags & _UC_CLRSTACK) + l->l_sigstk.ss_flags &= ~SS_ONSTACK; + mutex_exit(l->l_proc->p_lock); +#endif + + ucp->uc_flags |= (flags & (_UC_CPU | _UC_FPU | _UC_TLSBASE)); return 0; } @@ -410,7 +432,6 @@ cpu_lwp_fork(struct lwp *l1, struct lwp l2 ? l2->l_name : "none", l2, stack, (int)stacksize); #endif - if (stack) panic("%s: stack passed, can't handle\n", __func__);
CVS commit: src/sys/dev/isa
Module Name:src Committed By: jdolecek Date: Tue May 29 06:14:34 UTC 2018 Modified Files: src/sys/dev/isa: isadma.c isadmareg.h isareg.h Log Message: fix off-by-one in the mapping of the ISA DMA page registers, they actually start at 0x81; the code used bus_space_map() starting from 0x80 but used +1 offset for actual I/O, now it maps starting 0x81 and does I/O without offset the reads and writes work exactly the same as before, but this frees 0x80 for being mapped independantly patch provided in PR kern/52468 by Jonathan Chapman; checked against the spec and also FreeBSD sys/x86/isa/isa_dma.c To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/dev/isa/isadma.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/isa/isadmareg.h cvs rdiff -u -r1.9 -r1.10 src/sys/dev/isa/isareg.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/dev/isa/isadma.c diff -u src/sys/dev/isa/isadma.c:1.66 src/sys/dev/isa/isadma.c:1.67 --- src/sys/dev/isa/isadma.c:1.66 Sat Nov 13 13:52:03 2010 +++ src/sys/dev/isa/isadma.c Tue May 29 06:14:33 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: isadma.c,v 1.66 2010/11/13 13:52:03 uebayasi Exp $ */ +/* $NetBSD: isadma.c,v 1.67 2018/05/29 06:14:33 jdolecek Exp $ */ /*- * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isadma.c,v 1.66 2010/11/13 13:52:03 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isadma.c,v 1.67 2018/05/29 06:14:33 jdolecek Exp $"); #include #include @@ -53,15 +53,19 @@ __KERNEL_RCSID(0, "$NetBSD: isadma.c,v 1 struct isa_mem *isa_mem_head; /* - * High byte of DMA address is stored in this DMAPG register for - * the Nth DMA channel. + * DMA Channel to Address Page Register offset mapping + * + * Offset from IO_DMAPG is stored in this 2D array -- first dimension is + * the DMA controller, second dimension is the DMA channel. + * + * e.g. dmapageport[0][1] gives us the offset for DMA ch 1 on DMA1 */ -static int dmapageport[2][4] = { - {0x7, 0x3, 0x1, 0x2}, - {0xf, 0xb, 0x9, 0xa} +static const int dmapageport[2][4] = { + {0x6, 0x2, 0x0, 0x1}, + {0xe, 0xa, 0x8, 0x9} }; -static u_int8_t dmamode[] = { +static const u_int8_t dmamode[] = { /* write to device/read from device */ DMA37MD_READ | DMA37MD_SINGLE, DMA37MD_WRITE | DMA37MD_SINGLE, @@ -169,7 +173,7 @@ _isa_dmainit(struct isa_dma_state *ids, if (bus_space_map(ids->ids_bst, IO_DMA2, DMA2_IOSIZE, 0, >ids_dma2h)) panic("_isa_dmainit: unable to map DMA controller #2"); - if (bus_space_map(ids->ids_bst, IO_DMAPG, 0xf, 0, + if (bus_space_map(ids->ids_bst, IO_DMAPG, DMAPG_IOSIZE, 0, >ids_dmapgh)) panic("_isa_dmainit: unable to map DMA page registers"); @@ -211,7 +215,7 @@ _isa_dmadestroy(struct isa_dma_state *id /* * Unmap the registers used by the ISA DMA controller. */ - bus_space_unmap(ids->ids_bst, ids->ids_dmapgh, 0xf); + bus_space_unmap(ids->ids_bst, ids->ids_dmapgh, DMAPG_IOSIZE); bus_space_unmap(ids->ids_bst, ids->ids_dma2h, DMA2_IOSIZE); bus_space_unmap(ids->ids_bst, ids->ids_dma1h, DMA1_IOSIZE); Index: src/sys/dev/isa/isadmareg.h diff -u src/sys/dev/isa/isadmareg.h:1.8 src/sys/dev/isa/isadmareg.h:1.9 --- src/sys/dev/isa/isadmareg.h:1.8 Mon Apr 28 20:23:52 2008 +++ src/sys/dev/isa/isadmareg.h Tue May 29 06:14:33 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: isadmareg.h,v 1.8 2008/04/28 20:23:52 martin Exp $ */ +/* $NetBSD: isadmareg.h,v 1.9 2018/05/29 06:14:33 jdolecek Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -47,6 +47,9 @@ #define ISA_DMA_MAXSIZE_DEFAULT(chan) \ (((chan) & 4) ? ISA_DMA_MAXSIZE_16BIT : ISA_DMA_MAXSIZE_8BIT) +/* DMA Page Address Registers size */ +#define DMAPG_IOSIZE (1*15) + /* * Register definitions for DMA controller 1 (channels 0..3): */ Index: src/sys/dev/isa/isareg.h diff -u src/sys/dev/isa/isareg.h:1.9 src/sys/dev/isa/isareg.h:1.10 --- src/sys/dev/isa/isareg.h:1.9 Sun Dec 11 12:22:02 2005 +++ src/sys/dev/isa/isareg.h Tue May 29 06:14:33 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: isareg.h,v 1.9 2005/12/11 12:22:02 christos Exp $ */ +/* $NetBSD: isareg.h,v 1.10 2018/05/29 06:14:33 jdolecek Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -55,7 +55,7 @@ #define IO_PPI 0x061 /* Programmable Peripheral Interface */ #define IO_RTC 0x070 /* RTC */ #define IO_NMI IO_RTC /* NMI Control */ -#define IO_DMAPG 0x080 /* DMA Page Registers */ +#define IO_DMAPG 0x081 /* DMA Page Registers */ #define IO_ICU2 0x0A0 /* 8259A Interrupt Controller #2 */ #define IO_DMA2 0x0C0 /* 8237A DMA Controller #2 */ #define IO_NPX 0x0F0 /* Numeric Coprocessor */
CVS commit: src/usr.bin/cal
Module Name:src Committed By: kamil Date: Tue May 29 06:07:26 UTC 2018 Modified Files: src/usr.bin/cal: cal.1 Log Message: After Todd C. Miller[0] - cal(1) first appeared in Version 1 AT UNIX[1][2]. [0] http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/cal/cal.1?rev=1.28=text/x-cvsweb-markup [1] https://www.bell-labs.com/usr/dmr/www/1stEdman.html [2] https://www.bell-labs.com/usr/dmr/www/man61.pdf Patch submitted by @rjc via https://github.com/NetBSD/src/pull/3 To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/usr.bin/cal/cal.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/cal/cal.1 diff -u src/usr.bin/cal/cal.1:1.21 src/usr.bin/cal/cal.1:1.22 --- src/usr.bin/cal/cal.1:1.21 Thu Jan 8 03:56:33 2015 +++ src/usr.bin/cal/cal.1 Tue May 29 06:07:26 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: cal.1,v 1.21 2015/01/08 03:56:33 christos Exp $ +.\" $NetBSD: cal.1,v 1.22 2018/05/29 06:07:26 kamil Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" @(#)cal.1 8.2 (Berkeley) 4/28/95 .\" -.Dd January 7, 2015 +.Dd May 29, 2018 .Dt CAL 1 .Os .Sh NAME @@ -162,4 +162,4 @@ slight to anyone involved. A .Nm command appeared in -.At v6 . +.At v1 .