CVS commit: src/lib/libc/net

2018-08-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 22 03:12:31 UTC 2018

Modified Files:
src/lib/libc/net: if_nametoindex.c

Log Message:
- SIOCGIFINDEX was added in 2013, but if_freenameindex(3) have not used it
  for years. Use it to improve performance. Same as FreeBSD.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/net/if_nametoindex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/net/if_nametoindex.c
diff -u src/lib/libc/net/if_nametoindex.c:1.5 src/lib/libc/net/if_nametoindex.c:1.6
--- src/lib/libc/net/if_nametoindex.c:1.5	Tue Sep  1 09:54:34 2015
+++ src/lib/libc/net/if_nametoindex.c	Wed Aug 22 03:12:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_nametoindex.c,v 1.5 2015/09/01 09:54:34 ozaki-r Exp $	*/
+/*	$NetBSD: if_nametoindex.c,v 1.6 2018/08/22 03:12:31 msaitoh Exp $	*/
 /*	$KAME: if_nametoindex.c,v 1.6 2000/11/24 08:18:54 itojun Exp $	*/
 
 /*-
@@ -28,19 +28,21 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: if_nametoindex.c,v 1.5 2015/09/01 09:54:34 ozaki-r Exp $");
+__RCSID("$NetBSD: if_nametoindex.c,v 1.6 2018/08/22 03:12:31 msaitoh Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifndef RUMP_ACTION
 #include "namespace.h"
 #endif
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #ifndef RUMP_ACTION
@@ -71,11 +73,24 @@ __weak_alias(if_nametoindex,_if_nametoin
 unsigned int
 if_nametoindex(const char *ifname)
 {
+	int s;
+	struct ifreq ifr;
 	struct ifaddrs *ifaddrs, *ifa;
 	unsigned int ni;
 
+	s = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
+	if (s != -1) {
+		memset(, 0, sizeof(ifr));
+		strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+		if (ioctl(s, SIOCGIFINDEX, ) != -1) {
+			close(s);
+			return (ifr.ifr_index);
+		}
+		close(s);
+	}
+
 	if (getifaddrs() < 0)
-		return(0);
+		return 0;
 
 	ni = 0;
 
@@ -92,5 +107,5 @@ if_nametoindex(const char *ifname)
 	freeifaddrs(ifaddrs);
 	if (!ni)
 		errno = ENXIO;
-	return(ni);
+	return ni;
 }



CVS commit: src/lib/libc/net

2018-08-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 22 03:12:31 UTC 2018

Modified Files:
src/lib/libc/net: if_nametoindex.c

Log Message:
- SIOCGIFINDEX was added in 2013, but if_freenameindex(3) have not used it
  for years. Use it to improve performance. Same as FreeBSD.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/net/if_nametoindex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2018-08-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 22 01:05:24 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: ad.m68k
src/sys/arch/alpha/include: cpu.h
src/sys/arch/amiga/include: cpu.h
src/sys/arch/arm/include: cpu.h
src/sys/arch/atari/include: cpu.h
src/sys/arch/cesfic/include: cpu.h
src/sys/arch/evbcf/include: cpu.h
src/sys/arch/hp300/include: cpu.h
src/sys/arch/hppa/include: cpu.h
src/sys/arch/luna68k/include: cpu.h
src/sys/arch/m68k/include: Makefile cpu.h
src/sys/arch/mac68k/include: cpu.h
src/sys/arch/mips/include: cpu.h
src/sys/arch/mvme68k/include: cpu.h
src/sys/arch/news68k/include: cpu.h
src/sys/arch/powerpc/include: cpu.h
src/sys/arch/sh3/include: cpu.h
src/sys/arch/sparc/include: cpu.h
src/sys/arch/sparc64/include: cpu.h
src/sys/arch/vax/include: cpu.h
src/sys/arch/x68k/include: cpu.h
src/sys/arch/x86/include: cpu.h
src/sys/compat/linux/common: linux_exec.h
src/sys/compat/linux32/common: linux32_sysctl.h
src/sys/fs/cd9660: cd9660_extern.h
src/sys/kern: init_sysctl.c
src/sys/net: if.h
src/sys/netinet: dccp_var.h icmp6.h icmp_var.h in.h ip_carp.h pim_var.h
sctp_var.h tcp_var.h udp_var.h
src/sys/netinet6: in6.h pim6_var.h raw_ip6.h udp6_var.h
src/sys/netipsec: ipsec_var.h
src/sys/nfs: nfs.h
src/sys/sys: mbuf.h mount.h pipe.h socket.h sysctl.h
src/sys/ufs/ffs: ffs_extern.h
src/sys/ufs/lfs: lfs_extern.h
src/sys/uvm: uvm_param.h
Removed Files:
src/sys/arch/m68k/include: sysctl.h

Log Message:
- Cleanup for dynamic sysctl:
  - Remove unused *_NAMES macros for sysctl.
  - Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
  use them on all m68k machines.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/distrib/sets/lists/comp/ad.m68k
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/alpha/include/cpu.h
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/amiga/include/cpu.h
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/arm/include/cpu.h
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/atari/include/cpu.h
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/cesfic/include/cpu.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbcf/include/cpu.h
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/hp300/include/cpu.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/include/cpu.h
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/luna68k/include/cpu.h
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/m68k/include/Makefile
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/m68k/include/cpu.h
cvs rdiff -u -r1.2 -r0 src/sys/arch/m68k/include/sysctl.h
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/mac68k/include/cpu.h
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/mvme68k/include/cpu.h
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/news68k/include/cpu.h
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/powerpc/include/cpu.h
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/sh3/include/cpu.h
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/sparc/include/cpu.h
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/sparc64/include/cpu.h
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/vax/include/cpu.h
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x68k/include/cpu.h
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.52 -r1.53 src/sys/compat/linux/common/linux_exec.h
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/linux32/common/linux32_sysctl.h
cvs rdiff -u -r1.26 -r1.27 src/sys/fs/cd9660/cd9660_extern.h
cvs rdiff -u -r1.214 -r1.215 src/sys/kern/init_sysctl.c
cvs rdiff -u -r1.264 -r1.265 src/sys/net/if.h
cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/dccp_var.h
cvs rdiff -u -r1.51 -r1.52 src/sys/netinet/icmp6.h
cvs rdiff -u -r1.30 -r1.31 src/sys/netinet/icmp_var.h
cvs rdiff -u -r1.106 -r1.107 src/sys/netinet/in.h
cvs rdiff -u -r1.8 -r1.9 src/sys/netinet/ip_carp.h
cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/pim_var.h
cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctp_var.h
cvs rdiff -u -r1.186 -r1.187 src/sys/netinet/tcp_var.h
cvs rdiff -u -r1.43 -r1.44 src/sys/netinet/udp_var.h
cvs rdiff -u -r1.92 -r1.93 src/sys/netinet6/in6.h
cvs rdiff -u -r1.14 -r1.15 src/sys/netinet6/pim6_var.h
cvs rdiff -u -r1.4 -r1.5 src/sys/netinet6/raw_ip6.h
cvs rdiff -u -r1.28 -r1.29 src/sys/netinet6/udp6_var.h
cvs rdiff -u -r1.7 -r1.8 src/sys/netipsec/ipsec_var.h
cvs rdiff -u -r1.77 -r1.78 src/sys/nfs/nfs.h
cvs rdiff -u -r1.209 -r1.210 src/sys/sys/mbuf.h
cvs rdiff -u -r1.230 -r1.231 src/sys/sys/mount.h
cvs rdiff -u -r1.35 -r1.36 src/sys/sys/pipe.h
cvs rdiff -u -r1.126 -r1.127 src/sys/sys/socket.h
cvs rdiff -u -r1.227 -r1.228 src/sys/sys/sysctl.h
cvs rdiff -u -r1.84 -r1.85 src/sys/ufs/ffs/ffs_extern.h
cvs rdiff -u -r1.113 -r1.114 src/sys/ufs/lfs/lfs_extern.h
cvs rdiff -u -r1.37 -r1.38 src/sys/uvm/uvm_param.h

Please note that diffs are not public domain; 

CVS commit: src

2018-08-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 22 01:05:24 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: ad.m68k
src/sys/arch/alpha/include: cpu.h
src/sys/arch/amiga/include: cpu.h
src/sys/arch/arm/include: cpu.h
src/sys/arch/atari/include: cpu.h
src/sys/arch/cesfic/include: cpu.h
src/sys/arch/evbcf/include: cpu.h
src/sys/arch/hp300/include: cpu.h
src/sys/arch/hppa/include: cpu.h
src/sys/arch/luna68k/include: cpu.h
src/sys/arch/m68k/include: Makefile cpu.h
src/sys/arch/mac68k/include: cpu.h
src/sys/arch/mips/include: cpu.h
src/sys/arch/mvme68k/include: cpu.h
src/sys/arch/news68k/include: cpu.h
src/sys/arch/powerpc/include: cpu.h
src/sys/arch/sh3/include: cpu.h
src/sys/arch/sparc/include: cpu.h
src/sys/arch/sparc64/include: cpu.h
src/sys/arch/vax/include: cpu.h
src/sys/arch/x68k/include: cpu.h
src/sys/arch/x86/include: cpu.h
src/sys/compat/linux/common: linux_exec.h
src/sys/compat/linux32/common: linux32_sysctl.h
src/sys/fs/cd9660: cd9660_extern.h
src/sys/kern: init_sysctl.c
src/sys/net: if.h
src/sys/netinet: dccp_var.h icmp6.h icmp_var.h in.h ip_carp.h pim_var.h
sctp_var.h tcp_var.h udp_var.h
src/sys/netinet6: in6.h pim6_var.h raw_ip6.h udp6_var.h
src/sys/netipsec: ipsec_var.h
src/sys/nfs: nfs.h
src/sys/sys: mbuf.h mount.h pipe.h socket.h sysctl.h
src/sys/ufs/ffs: ffs_extern.h
src/sys/ufs/lfs: lfs_extern.h
src/sys/uvm: uvm_param.h
Removed Files:
src/sys/arch/m68k/include: sysctl.h

Log Message:
- Cleanup for dynamic sysctl:
  - Remove unused *_NAMES macros for sysctl.
  - Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
  use them on all m68k machines.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/distrib/sets/lists/comp/ad.m68k
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/alpha/include/cpu.h
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/amiga/include/cpu.h
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/arm/include/cpu.h
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/atari/include/cpu.h
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/cesfic/include/cpu.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbcf/include/cpu.h
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/hp300/include/cpu.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/include/cpu.h
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/luna68k/include/cpu.h
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/m68k/include/Makefile
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/m68k/include/cpu.h
cvs rdiff -u -r1.2 -r0 src/sys/arch/m68k/include/sysctl.h
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/mac68k/include/cpu.h
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/mvme68k/include/cpu.h
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/news68k/include/cpu.h
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/powerpc/include/cpu.h
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/sh3/include/cpu.h
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/sparc/include/cpu.h
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/sparc64/include/cpu.h
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/vax/include/cpu.h
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x68k/include/cpu.h
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.52 -r1.53 src/sys/compat/linux/common/linux_exec.h
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/linux32/common/linux32_sysctl.h
cvs rdiff -u -r1.26 -r1.27 src/sys/fs/cd9660/cd9660_extern.h
cvs rdiff -u -r1.214 -r1.215 src/sys/kern/init_sysctl.c
cvs rdiff -u -r1.264 -r1.265 src/sys/net/if.h
cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/dccp_var.h
cvs rdiff -u -r1.51 -r1.52 src/sys/netinet/icmp6.h
cvs rdiff -u -r1.30 -r1.31 src/sys/netinet/icmp_var.h
cvs rdiff -u -r1.106 -r1.107 src/sys/netinet/in.h
cvs rdiff -u -r1.8 -r1.9 src/sys/netinet/ip_carp.h
cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/pim_var.h
cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctp_var.h
cvs rdiff -u -r1.186 -r1.187 src/sys/netinet/tcp_var.h
cvs rdiff -u -r1.43 -r1.44 src/sys/netinet/udp_var.h
cvs rdiff -u -r1.92 -r1.93 src/sys/netinet6/in6.h
cvs rdiff -u -r1.14 -r1.15 src/sys/netinet6/pim6_var.h
cvs rdiff -u -r1.4 -r1.5 src/sys/netinet6/raw_ip6.h
cvs rdiff -u -r1.28 -r1.29 src/sys/netinet6/udp6_var.h
cvs rdiff -u -r1.7 -r1.8 src/sys/netipsec/ipsec_var.h
cvs rdiff -u -r1.77 -r1.78 src/sys/nfs/nfs.h
cvs rdiff -u -r1.209 -r1.210 src/sys/sys/mbuf.h
cvs rdiff -u -r1.230 -r1.231 src/sys/sys/mount.h
cvs rdiff -u -r1.35 -r1.36 src/sys/sys/pipe.h
cvs rdiff -u -r1.126 -r1.127 src/sys/sys/socket.h
cvs rdiff -u -r1.227 -r1.228 src/sys/sys/sysctl.h
cvs rdiff -u -r1.84 -r1.85 src/sys/ufs/ffs/ffs_extern.h
cvs rdiff -u -r1.113 -r1.114 src/sys/ufs/lfs/lfs_extern.h
cvs rdiff -u -r1.37 -r1.38 src/sys/uvm/uvm_param.h

Please note that diffs are not public domain; 

CVS commit: src/doc

2018-08-21 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Aug 21 23:34:56 UTC 2018

Modified Files:
src/doc: TODO.sanitizers

Log Message:
Mark kernel-asan as done (by maxv)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/doc/TODO.sanitizers

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/TODO.sanitizers
diff -u src/doc/TODO.sanitizers:1.4 src/doc/TODO.sanitizers:1.5
--- src/doc/TODO.sanitizers:1.4	Sun Aug  5 13:10:04 2018
+++ src/doc/TODO.sanitizers	Tue Aug 21 23:34:56 2018
@@ -4,7 +4,6 @@ Short term:
  - compiler-rt import and integration with base
  - merge TSan, MSan and libFuzzer ATF tests
  - prepare MKSANITIZER readme
- - kernel-asan port
  - switch syscall(2)/__syscall(2) to libc calls
  - upstream local patches, mostly to compiler-rt
  - develop fts(3) interceptors (MSan, for ls(1), find(1), mtree(8)



CVS commit: src/doc

2018-08-21 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Aug 21 23:34:56 UTC 2018

Modified Files:
src/doc: TODO.sanitizers

Log Message:
Mark kernel-asan as done (by maxv)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/doc/TODO.sanitizers

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/evbarm/include

2018-08-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 21 20:13:13 UTC 2018

Modified Files:
src/sys/arch/evbarm/include: loadfile_machdep.h

Log Message:
Define BOOT_ELF64 for aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/include/loadfile_machdep.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/evbarm/include/loadfile_machdep.h
diff -u src/sys/arch/evbarm/include/loadfile_machdep.h:1.2 src/sys/arch/evbarm/include/loadfile_machdep.h:1.3
--- src/sys/arch/evbarm/include/loadfile_machdep.h:1.2	Wed Aug  6 21:57:49 2014
+++ src/sys/arch/evbarm/include/loadfile_machdep.h	Tue Aug 21 20:13:13 2018
@@ -1,5 +1,9 @@
 
+#if defined(__aarch64__)
+#define BOOT_ELF64
+#else
 #define BOOT_ELF32
+#endif
 
 #define LOAD_KERNEL	(LOAD_ALL & ~LOAD_TEXTA)
 #define COUNT_KERNEL	(COUNT_ALL & ~COUNT_TEXTA)



CVS commit: src/sys/arch/evbarm/include

2018-08-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 21 20:13:13 UTC 2018

Modified Files:
src/sys/arch/evbarm/include: loadfile_machdep.h

Log Message:
Define BOOT_ELF64 for aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/include/loadfile_machdep.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/xen/xen

2018-08-21 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Aug 21 18:55:09 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
(only commit message for rev 1.85, no actual change)

shuffle code in xbd_handler() response loop so that req_bp is never
touched for non I/O responses; unknown commands are now just skipped, also
without touching neither xbdreq, nor req_bp

add some KASSERTS() for xbdreq->req_nr_segments and xbdreq->req_bp,
and reset req_bp after it's processed to ensure the buf can never
be processed twice

intended to simplify debugging in cases like PR port-xen/53506


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/xen/xen/xbd_xenbus.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/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.85 src/sys/arch/xen/xen/xbd_xenbus.c:1.86
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.85	Tue Aug 21 18:45:16 2018
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Tue Aug 21 18:55:08 2018
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.85 2018/08/21 18:45:16 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.86 2018/08/21 18:55:08 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.85 2018/08/21 18:45:16 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.86 2018/08/21 18:55:08 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -693,6 +693,7 @@ again:
 		KASSERT(xbdreq->req_nr_segments == 0);
 
 		bp = xbdreq->req_bp;
+		KASSERT(bp != NULL);
 		xbdreq->req_bp = NULL;
 		DPRINTF(("%s(%p): b_bcount = %ld\n", __func__,
 		bp, (long)bp->b_bcount));



CVS commit: src/sys/arch/xen/xen

2018-08-21 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Aug 21 18:55:09 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
(only commit message for rev 1.85, no actual change)

shuffle code in xbd_handler() response loop so that req_bp is never
touched for non I/O responses; unknown commands are now just skipped, also
without touching neither xbdreq, nor req_bp

add some KASSERTS() for xbdreq->req_nr_segments and xbdreq->req_bp,
and reset req_bp after it's processed to ensure the buf can never
be processed twice

intended to simplify debugging in cases like PR port-xen/53506


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/xen/xen/xbd_xenbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/xen/xen

2018-08-21 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Aug 21 18:45:16 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/xen/xen/xbd_xenbus.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/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.84 src/sys/arch/xen/xen/xbd_xenbus.c:1.85
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.84	Tue Aug 21 18:31:55 2018
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Tue Aug 21 18:45:16 2018
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.84 2018/08/21 18:31:55 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.85 2018/08/21 18:45:16 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.84 2018/08/21 18:31:55 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.85 2018/08/21 18:45:16 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -661,16 +661,23 @@ again:
 	for (i = sc->sc_ring.rsp_cons; i != resp_prod; i++) {
 		blkif_response_t *rep = RING_GET_RESPONSE(>sc_ring, i);
 		struct xbd_req *xbdreq = >sc_reqs[rep->id];
-		bp = xbdreq->req_bp;
-		DPRINTF(("xbd_handler(%p): b_bcount = %ld\n",
-		xbdreq->req_bp, (long)bp->b_bcount));
+
 		if (rep->operation == BLKIF_OP_FLUSH_DISKCACHE) {
+			KASSERT(xbdreq->req_bp == NULL);
 			xbdreq->req_sync.s_error = rep->status;
 			xbdreq->req_sync.s_done = 1;
 			wakeup(xbdreq); /* XXXSMP */
 			/* caller will free the req */
 			continue;
 		}
+
+		if (rep->operation != BLKIF_OP_READ &&
+		rep->operation != BLKIF_OP_WRITE) {
+			aprint_error_dev(sc->sc_dksc.sc_dev,
+			"bad operation %d from backend\n", rep->operation);
+			continue;
+		}
+
 		for (seg = xbdreq->req_nr_segments - 1; seg >= 0; seg--) {
 			if (__predict_false(
 			xengnt_status(xbdreq->req_gntref[seg]))) {
@@ -683,14 +690,13 @@ again:
 			xengnt_revoke_access(xbdreq->req_gntref[seg]);
 			xbdreq->req_nr_segments--;
 		}
-		if (rep->operation != BLKIF_OP_READ &&
-		rep->operation != BLKIF_OP_WRITE) {
-			aprint_error_dev(sc->sc_dksc.sc_dev,
-			"bad operation %d from backend\n", rep->operation);
-			bp->b_error = EIO;
-			bp->b_resid = bp->b_bcount;
-			goto next;
-		}
+		KASSERT(xbdreq->req_nr_segments == 0);
+
+		bp = xbdreq->req_bp;
+		xbdreq->req_bp = NULL;
+		DPRINTF(("%s(%p): b_bcount = %ld\n", __func__,
+		bp, (long)bp->b_bcount));
+
 		if (rep->status != BLKIF_RSP_OKAY) {
 			bp->b_error = EIO;
 			bp->b_resid = bp->b_bcount;



CVS commit: src/sys/arch/xen/xen

2018-08-21 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Aug 21 18:45:16 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/xen/xen/xbd_xenbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/xen/xen

2018-08-21 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Aug 21 18:31:55 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
remove code handling buffers not aligned to 512-byte boundary, simply return
EINVAL straight away

the condition doesn't seem to be actually hit for normal boots and
tools like fsck, which is good thing since it allocated memory
separately for each such I/O


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/xen/xen/xbd_xenbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/xen/xen

2018-08-21 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Aug 21 18:31:55 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
remove code handling buffers not aligned to 512-byte boundary, simply return
EINVAL straight away

the condition doesn't seem to be actually hit for normal boots and
tools like fsck, which is good thing since it allocated memory
separately for each such I/O


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/xen/xen/xbd_xenbus.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/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.83 src/sys/arch/xen/xen/xbd_xenbus.c:1.84
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.83	Tue Aug 21 18:11:10 2018
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Tue Aug 21 18:31:55 2018
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.83 2018/08/21 18:11:10 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.84 2018/08/21 18:31:55 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.83 2018/08/21 18:11:10 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.84 2018/08/21 18:31:55 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -105,7 +105,6 @@ struct xbd_req {
 		grant_ref_t req_gntref[BLKIF_MAX_SEGMENTS_PER_REQUEST];
 		int req_nr_segments; /* number of segments in this request */
 		struct buf *req_bp; /* buffer associated with this request */
-		void *req_data; /* pointer to the data buffer */
 	} req_rw;
 	struct {
 		int s_error;
@@ -116,7 +115,6 @@ struct xbd_req {
 #define req_gntref	u.req_rw.req_gntref
 #define req_nr_segments	u.req_rw.req_nr_segments
 #define req_bp		u.req_rw.req_bp
-#define req_data	u.req_rw.req_data
 #define req_sync	u.req_sync
 
 struct xbd_xenbus_softc {
@@ -171,9 +169,6 @@ static int  xbd_diskstart(device_t, stru
 static void xbd_backend_changed(void *, XenbusState);
 static void xbd_connect(struct xbd_xenbus_softc *);
 
-static int  xbd_map_align(struct xbd_req *);
-static void xbd_unmap_align(struct xbd_req *);
-
 static void xbdminphys(struct buf *);
 
 CFATTACH_DECL3_NEW(xbd, sizeof(struct xbd_xenbus_softc),
@@ -703,9 +698,6 @@ again:
 		}
 		/* b_resid was set in dk_start */
 next:
-		if (bp->b_data != xbdreq->req_data)
-			xbd_unmap_align(xbdreq);
-
 		dk_done(>sc_dksc, bp);
 
 		SLIST_INSERT_HEAD(>sc_xbdreq_head, xbdreq, req_next);
@@ -972,16 +964,14 @@ xbd_diskstart(device_t self, struct buf 
 		goto out;
 	}
 
-	xbdreq->req_bp = bp;
-	xbdreq->req_data = bp->b_data;
 	if ((vaddr_t)bp->b_data & (XEN_BSIZE - 1)) {
-		if (__predict_false(xbd_map_align(xbdreq) != 0)) {
-			DPRINTF(("xbd_diskstart: no align\n"));
-			error = EAGAIN;
-			goto out;
-		}
+		DPRINTF(("xbd_diskstart: no align\n"));
+		error = EINVAL;
+		goto out;
 	}
 
+	xbdreq->req_bp = bp;
+
 	SLIST_REMOVE_HEAD(>sc_xbdreq_head, req_next);
 	req = RING_GET_REQUEST(>sc_ring, sc->sc_ring.req_prod_pvt);
 	req->id = xbdreq->req_id;
@@ -990,8 +980,8 @@ xbd_diskstart(device_t self, struct buf 
 	req->sector_number = bp->b_rawblkno;
 	req->handle = sc->sc_handle;
 
-	va = (vaddr_t)xbdreq->req_data & ~PAGE_MASK;
-	off = (vaddr_t)xbdreq->req_data & PAGE_MASK;
+	va = (vaddr_t)bp->b_data & ~PAGE_MASK;
+	off = (vaddr_t)bp->b_data & PAGE_MASK;
 	bcount = bp->b_bcount;
 	bp->b_resid = 0;
 	for (seg = 0; bcount > 0;) {
@@ -1031,33 +1021,3 @@ out:
 err:
 	return error;
 }
-
-static int
-xbd_map_align(struct xbd_req *req)
-{
-	int s = splvm(); /* XXXSMP - bogus? */
-	int rc;
-
-	rc = uvm_km_kmem_alloc(kmem_va_arena,
-	req->req_bp->b_bcount, (VM_NOSLEEP | VM_INSTANTFIT),
-	(vmem_addr_t *)>req_data);
-	splx(s);
-	if (__predict_false(rc != 0))
-		return ENOMEM;
-	if ((req->req_bp->b_flags & B_READ) == 0)
-		memcpy(req->req_data, req->req_bp->b_data,
-		req->req_bp->b_bcount);
-	return 0;
-}
-
-static void
-xbd_unmap_align(struct xbd_req *req)
-{
-	int s;
-	if (req->req_bp->b_flags & B_READ)
-		memcpy(req->req_bp->b_data, req->req_data,
-		req->req_bp->b_bcount);
-	s = splvm(); /* XXXSMP - bogus? */
-	uvm_km_kmem_free(kmem_va_arena, (vaddr_t)req->req_data, req->req_bp->b_bcount);
-	splx(s);
-}



CVS commit: src/sys/arch/xen/xen

2018-08-21 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Aug 21 18:11:10 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
avoid race condition between I/O submission in xbd_diskstart() and
interrupt handling in xbd_handler() - need to protect it with splbio()

fixes PR port-xen/53506 by Emmanuel Dreyfus, and likely also port-xen/53074
by Brad Spencer


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/xen/xen/xbd_xenbus.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/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.82 src/sys/arch/xen/xen/xbd_xenbus.c:1.83
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.82	Wed Aug 15 15:49:15 2018
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Tue Aug 21 18:11:10 2018
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.82 2018/08/15 15:49:15 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.83 2018/08/21 18:11:10 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.82 2018/08/15 15:49:15 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.83 2018/08/21 18:11:10 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -932,6 +932,7 @@ xbd_diskstart(device_t self, struct buf 
 	vaddr_t va;
 	int nsects, nbytes, seg;
 	int notify, error = 0;
+	int s;
 
 	DPRINTF(("xbd_diskstart(%p): b_bcount = %ld\n",
 	bp, (long)bp->b_bcount));
@@ -947,6 +948,8 @@ xbd_diskstart(device_t self, struct buf 
 		goto err;
 	}
 
+	s = splbio();	/* XXX SMP */
+
 	if (__predict_false(
 	sc->sc_backend_status == BLKIF_STATE_SUSPENDED)) {
 		/* device is suspended, do not consume buffer */
@@ -1024,6 +1027,7 @@ out:
 	RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(>sc_ring, notify);
 	if (notify)
 		hypervisor_notify_via_evtchn(sc->sc_evtchn);
+	splx(s);	/* XXXSMP */
 err:
 	return error;
 }



CVS commit: src/sys/arch/xen/xen

2018-08-21 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Aug 21 18:11:10 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
avoid race condition between I/O submission in xbd_diskstart() and
interrupt handling in xbd_handler() - need to protect it with splbio()

fixes PR port-xen/53506 by Emmanuel Dreyfus, and likely also port-xen/53074
by Brad Spencer


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/xen/xen/xbd_xenbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl2/xcvs/dist/src

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 15:37:34 UTC 2018

Modified Files:
src/external/gpl2/xcvs/dist/src: main.c run.c

Log Message:
support SIGINFO


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/gpl2/xcvs/dist/src/main.c
cvs rdiff -u -r1.3 -r1.4 src/external/gpl2/xcvs/dist/src/run.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/gpl2/xcvs/dist/src/main.c
diff -u src/external/gpl2/xcvs/dist/src/main.c:1.6 src/external/gpl2/xcvs/dist/src/main.c:1.7
--- src/external/gpl2/xcvs/dist/src/main.c:1.6	Tue May 17 10:00:09 2016
+++ src/external/gpl2/xcvs/dist/src/main.c	Tue Aug 21 11:37:33 2018
@@ -17,7 +17,7 @@
  *
  */
 #include 
-__RCSID("$NetBSD: main.c,v 1.6 2016/05/17 14:00:09 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.7 2018/08/21 15:37:33 christos Exp $");
 
 #include "cvs.h"
 
@@ -498,6 +498,32 @@ divide_by (unsigned char buf[COMMITID_RA
 return carry;
 }
 
+#ifdef SIGINFO
+#include 
+
+static void
+show_status (int n)
+{
+	char wd[PATH_MAX];
+	char buf[2048];
+	static int ttyfd = -2;
+
+	if (ttyfd == -2)
+		ttyfd = open(_PATH_TTY, O_RDWR, O_CLOEXEC);
+
+	if (ttyfd == -1)
+		return;
+
+	if (getcwd(wd, sizeof(wd)) == NULL)
+		return;
+	n = snprintf(buf, sizeof(buf), "%s[%d]: working in %s\n", getprogname(),
+	(int)getpid(), wd);
+	if (n <= 0)
+		return;
+	write(ttyfd, buf, (size_t)n);
+}
+#endif
+
 static void
 convert (char const input[COMMITID_RAW_SIZE], char *output)
 {
@@ -967,6 +993,9 @@ cause intermittent sandbox corruption.")
 
 	/* make sure we clean up on error */
 	signals_register (main_cleanup);
+#ifdef SIGINFO
+	signal (SIGINFO, show_status);
+#endif
 
 #ifdef KLUDGE_FOR_WNT_TESTSUITE
 	/* Probably the need for this will go away at some point once

Index: src/external/gpl2/xcvs/dist/src/run.c
diff -u src/external/gpl2/xcvs/dist/src/run.c:1.3 src/external/gpl2/xcvs/dist/src/run.c:1.4
--- src/external/gpl2/xcvs/dist/src/run.c:1.3	Tue May 17 10:00:09 2016
+++ src/external/gpl2/xcvs/dist/src/run.c	Tue Aug 21 11:37:33 2018
@@ -12,7 +12,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.  */
 #include 
-__RCSID("$NetBSD: run.c,v 1.3 2016/05/17 14:00:09 christos Exp $");
+__RCSID("$NetBSD: run.c,v 1.4 2018/08/21 15:37:33 christos Exp $");
 
 #include "cvs.h"
 
@@ -239,6 +239,9 @@ run_exec (const char *stin, const char *
 #endif
 if (pid == 0)
 {
+#ifdef SIGINFO
+   signal (SIGINFO, SIG_DFL);
+#endif
 #ifdef SETXID_SUPPORT
 	if (flags & RUN_UNSETXID) {
 	(void) setgid (getgid ());
@@ -570,6 +573,9 @@ piped_child (char *const *command, int *
 	error (1, errno, "cannot fork");
 if (pid == 0)
 {
+#ifdef SIGINFO
+	signal (SIGINFO, SIG_DFL);
+#endif
 	if (dup2 (to_child_pipe[0], STDIN_FILENO) < 0)
 	error (1, errno, "cannot dup2 pipe");
 	if (close (to_child_pipe[1]) < 0)



CVS commit: src/external/gpl2/xcvs/dist/src

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 15:37:34 UTC 2018

Modified Files:
src/external/gpl2/xcvs/dist/src: main.c run.c

Log Message:
support SIGINFO


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/gpl2/xcvs/dist/src/main.c
cvs rdiff -u -r1.3 -r1.4 src/external/gpl2/xcvs/dist/src/run.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netbt

2018-08-21 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Tue Aug 21 14:59:13 UTC 2018

Modified Files:
src/sys/netbt: hci_event.c l2cap_signal.c

Log Message:
Result of audit to check that mbuf length is checked before m_copydata()
and that any data supposedly copied out is valid before use.

prompted by maxv@, I have checked every usage of m_copydata() and made
the following corrections

hci_event.c:
hci_event_command_compl()
check that the packet does contain enough data for there to
be a status code before noting possible failures.

hci_event_num_compl_pkts()
check that the packet does contain data to cover the
stated number of handle/num pairs

l2cap_signal.c:
l2cap_recv_signal()
just ignore packets with not enough data rather than
trying to reject them (may not have cmd.ident)

l2cap_recv_command_rej()
check we have a valid reason and/or data before use


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/netbt/hci_event.c
cvs rdiff -u -r1.18 -r1.19 src/sys/netbt/l2cap_signal.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/netbt/hci_event.c
diff -u src/sys/netbt/hci_event.c:1.24 src/sys/netbt/hci_event.c:1.25
--- src/sys/netbt/hci_event.c:1.24	Sat Nov 28 09:04:34 2015
+++ src/sys/netbt/hci_event.c	Tue Aug 21 14:59:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_event.c,v 1.24 2015/11/28 09:04:34 plunky Exp $	*/
+/*	$NetBSD: hci_event.c,v 1.25 2018/08/21 14:59:13 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.24 2015/11/28 09:04:34 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.25 2018/08/21 14:59:13 plunky Exp $");
 
 #include 
 #include 
@@ -316,12 +316,14 @@ hci_event_command_compl(struct hci_unit 
 	 * that a command_complete packet will contain the status though most
 	 * do seem to.
 	 */
-	m_copydata(m, 0, sizeof(rp), );
-	if (rp.status > 0)
-		aprint_error_dev(unit->hci_dev,
-		"CommandComplete opcode (%03x|%04x) failed (status=0x%02x)\n",
-		HCI_OGF(le16toh(ep.opcode)), HCI_OCF(le16toh(ep.opcode)),
-		rp.status);
+	if (m->m_pkthdr.len >= sizeof(rp)) {
+		m_copydata(m, 0, sizeof(rp), );
+		if (rp.status > 0)
+			aprint_error_dev(unit->hci_dev,
+			"CommandComplete opcode (%03x|%04x) failed (status=0x%02x)\n",
+			HCI_OGF(le16toh(ep.opcode)), HCI_OCF(le16toh(ep.opcode)),
+			rp.status);
+	}
 
 	/*
 	 * post processing of completed commands
@@ -383,6 +385,9 @@ hci_event_num_compl_pkts(struct hci_unit
 	m_copydata(m, 0, sizeof(ep), );
 	m_adj(m, sizeof(ep));
 
+	if (m->m_pkthdr.len < ep.num_con_handles * (sizeof(handle) + sizeof(num)))
+		return;
+
 	while (ep.num_con_handles--) {
 		m_copydata(m, 0, sizeof(handle), );
 		m_adj(m, sizeof(handle));

Index: src/sys/netbt/l2cap_signal.c
diff -u src/sys/netbt/l2cap_signal.c:1.18 src/sys/netbt/l2cap_signal.c:1.19
--- src/sys/netbt/l2cap_signal.c:1.18	Tue Oct  4 14:13:46 2016
+++ src/sys/netbt/l2cap_signal.c	Tue Aug 21 14:59:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: l2cap_signal.c,v 1.18 2016/10/04 14:13:46 joerg Exp $	*/
+/*	$NetBSD: l2cap_signal.c,v 1.19 2018/08/21 14:59:13 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: l2cap_signal.c,v 1.18 2016/10/04 14:13:46 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: l2cap_signal.c,v 1.19 2018/08/21 14:59:13 plunky Exp $");
 
 #include 
 #include 
@@ -64,7 +64,8 @@ static void l2cap_qos_htob(void *, l2cap
 
 /*
  * process incoming signal packets (CID 0x0001). Can contain multiple
- * requests/responses.
+ * requests/responses. The signal hander should clear the command from
+ * the mbuf before returning.
  */
 void
 l2cap_recv_signal(struct mbuf *m, struct hci_link *link)
@@ -72,11 +73,8 @@ l2cap_recv_signal(struct mbuf *m, struct
 	l2cap_cmd_hdr_t cmd;
 
 	for(;;) {
-		if (m->m_pkthdr.len == 0)
-			goto finish;
-
 		if (m->m_pkthdr.len < sizeof(cmd))
-			goto reject;
+			goto finish;
 
 		m_copydata(m, 0, sizeof(cmd), );
 		cmd.length = le16toh(cmd.length);
@@ -183,32 +181,42 @@ l2cap_recv_command_rej(struct mbuf *m, s
 
 	cmd.length = le16toh(cmd.length);
 
+	/* The length here must contain the reason (2 octets) plus
+	 * any data (0 or more octets) but we already know it is not
+	 * bigger than l2cap_cmd_rej_cp
+	 */
 	m_copydata(m, 0, cmd.length, );
 	m_adj(m, cmd.length);
 
+	if (cmd.length < 2)
+		return;
+
 	req = l2cap_request_lookup(link, cmd.ident);
 	if (req == NULL)
 		return;
 
 	switch (le16toh(cp.reason)) {
-	case L2CAP_REJ_NOT_UNDERSTOOD:
+	case L2CAP_REJ_NOT_UNDERSTOOD:	/* data length = 0 octets */
 		/*
 		 * I dont know what to do, just move up the timeout
 		 */
 		callout_schedule(>lr_rtx, 0);
 		break;
 
-	case 

CVS commit: src/sys/netbt

2018-08-21 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Tue Aug 21 14:59:13 UTC 2018

Modified Files:
src/sys/netbt: hci_event.c l2cap_signal.c

Log Message:
Result of audit to check that mbuf length is checked before m_copydata()
and that any data supposedly copied out is valid before use.

prompted by maxv@, I have checked every usage of m_copydata() and made
the following corrections

hci_event.c:
hci_event_command_compl()
check that the packet does contain enough data for there to
be a status code before noting possible failures.

hci_event_num_compl_pkts()
check that the packet does contain data to cover the
stated number of handle/num pairs

l2cap_signal.c:
l2cap_recv_signal()
just ignore packets with not enough data rather than
trying to reject them (may not have cmd.ident)

l2cap_recv_command_rej()
check we have a valid reason and/or data before use


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/netbt/hci_event.c
cvs rdiff -u -r1.18 -r1.19 src/sys/netbt/l2cap_signal.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/sunxi

2018-08-21 Thread Benny Siegert
Module Name:src
Committed By:   bsiegert
Date:   Tue Aug 21 14:09:41 UTC 2018

Modified Files:
src/sys/arch/arm/sunxi: sunxi_thermal.c

Log Message:
Fix two typos in the Sunxi thermal driver.

Noticed by rudolf in PR port-arm/53537.

ok jmcneill@


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sunxi_thermal.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/sunxi/sunxi_thermal.c
diff -u src/sys/arch/arm/sunxi/sunxi_thermal.c:1.5 src/sys/arch/arm/sunxi/sunxi_thermal.c:1.6
--- src/sys/arch/arm/sunxi/sunxi_thermal.c:1.5	Sun Jan 28 18:24:50 2018
+++ src/sys/arch/arm/sunxi/sunxi_thermal.c	Tue Aug 21 14:09:41 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_thermal.c,v 1.5 2018/01/28 18:24:50 jmcneill Exp $ */
+/* $NetBSD: sunxi_thermal.c,v 1.6 2018/08/21 14:09:41 bsiegert Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_thermal.c,v 1.5 2018/01/28 18:24:50 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_thermal.c,v 1.6 2018/08/21 14:09:41 bsiegert Exp $");
 
 #include 
 #include 
@@ -259,7 +259,7 @@ h5_to_temp(u_int sensor, uint32_t val)
 		mul = H5_TEMP_MUL_L;
 	} else {
 		base = sensor == 0 ? H5_TEMP_BASE_H_0 : H5_TEMP_BASE_H_1;
-		mul = sensor == 0 ? H5_TEMP_MUL_H_1 : H5_TEMP_MUL_H_1;
+		mul = sensor == 0 ? H5_TEMP_MUL_H_0 : H5_TEMP_MUL_H_1;
 	}
 
 	return (base - val * mul) >> H5_TEMP_DIV;
@@ -275,7 +275,7 @@ h5_to_reg(u_int sensor, int val)
 		mul = H5_TEMP_MUL_L;
 	} else {
 		base = sensor == 0 ? H5_TEMP_BASE_H_0 : H5_TEMP_BASE_H_1;
-		mul = sensor == 0 ? H5_TEMP_MUL_H_1 : H5_TEMP_MUL_H_1;
+		mul = sensor == 0 ? H5_TEMP_MUL_H_0 : H5_TEMP_MUL_H_1;
 	}
 
 	return (base - (val << H5_TEMP_DIV)) / mul;



CVS commit: src/sys/arch/arm/sunxi

2018-08-21 Thread Benny Siegert
Module Name:src
Committed By:   bsiegert
Date:   Tue Aug 21 14:09:41 UTC 2018

Modified Files:
src/sys/arch/arm/sunxi: sunxi_thermal.c

Log Message:
Fix two typos in the Sunxi thermal driver.

Noticed by rudolf in PR port-arm/53537.

ok jmcneill@


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sunxi_thermal.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/distrib/sets/lists/comp

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 13:00:17 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
Add missing lint library, sort


To generate a diff of this commit:
cvs rdiff -u -r1.2221 -r1. src/distrib/sets/lists/comp/mi

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.2221 src/distrib/sets/lists/comp/mi:1.
--- src/distrib/sets/lists/comp/mi:1.2221	Tue Aug 21 02:49:21 2018
+++ src/distrib/sets/lists/comp/mi	Tue Aug 21 09:00:16 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2221 2018/08/21 06:49:21 kre Exp $
+#	$NetBSD: mi,v 1. 2018/08/21 13:00:16 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -2391,8 +2391,8 @@
 ./usr/include/netinet/igmp_var.h		comp-c-include
 ./usr/include/netinet/in.h			comp-c-include
 ./usr/include/netinet/in_gif.h			comp-c-include
-./usr/include/netinet/in_offload.h		comp-c-include
 ./usr/include/netinet/in_l2tp.h			comp-c-include
+./usr/include/netinet/in_offload.h		comp-c-include
 ./usr/include/netinet/in_pcb.h			comp-c-include
 ./usr/include/netinet/in_pcb_hdr.h		comp-c-include
 ./usr/include/netinet/in_route.h		comp-obsolete		obsolete
@@ -3464,10 +3464,10 @@
 ./usr/lib/libnetpgpverify_p.a			comp-c-proflib		compatfile,profile
 ./usr/lib/libnpf.acomp-npf-lib		compatfile,npf
 ./usr/lib/libnpf_p.acomp-npf-proflib	compatfile,npf,profile
-./usr/lib/libntp.acomp-obsolete		obsolete
-./usr/lib/libntp_p.acomp-obsolete		obsolete
 ./usr/lib/libns.acomp-bind-lib		compatfile
 ./usr/lib/libns_p.acomp-bind-proflib	compatfile,profile
+./usr/lib/libntp.acomp-obsolete		obsolete
+./usr/lib/libntp_p.acomp-obsolete		obsolete
 ./usr/lib/libnvpair.acomp-zfs-lib		compatfile,zfs
 ./usr/lib/libnvpair_p.acomp-zfs-proflib	compatfile,zfs,profile
 ./usr/lib/libobjc.acomp-objc-lib		compatfile,gcc
@@ -3779,9 +3779,9 @@
 ./usr/lib/libz.acomp-c-lib		compatfile
 ./usr/lib/libz_p.acomp-c-proflib		compatfile,profile
 ./usr/lib/libzfs.acomp-zfs-lib		compatfile,zfs
-./usr/lib/libzfs_p.acomp-zfs-proflib	compatfile,zfs,profile
 ./usr/lib/libzfs_core.acomp-zfs-lib		compatfile,zfs
 ./usr/lib/libzfs_core_p.a			comp-zfs-proflib	compatfile,zfs,profile
+./usr/lib/libzfs_p.acomp-zfs-proflib	compatfile,zfs,profile
 ./usr/lib/libzpool.acomp-zfs-lib		compatfile,zfs
 ./usr/lib/libzpool_p.acomp-zfs-proflib	compatfile,zfs,profile
 ./usr/lib/pkgconfigcomp-c-lib
@@ -3866,6 +3866,7 @@
 ./usr/libdata/lint/llib-lnetpgp.ln		comp-c-lintlib		lint
 ./usr/libdata/lint/llib-lnetpgpverify.ln	comp-c-lintlib		lint
 ./usr/libdata/lint/llib-lnpf.ln			comp-npf-lintlib	lint,npf
+./usr/libdata/lint/llib-lns.ln			comp-bind-lintlib		lint
 ./usr/libdata/lint/llib-lntp.ln			comp-obsolete		obsolete
 ./usr/libdata/lint/llib-lopenpgpsdk.ln		comp-obsolete		obsolete
 ./usr/libdata/lint/llib-lossaudio.ln		comp-c-lintlib		lint
@@ -9207,6 +9208,9 @@
 ./usr/share/man/cat3/sched_setparam.0		comp-c-catman		.cat
 ./usr/share/man/cat3/sched_setscheduler.0	comp-c-catman		.cat
 ./usr/share/man/cat3/sched_yield.0		comp-c-catman		.cat
+./usr/share/man/cat3/scrl.0			comp-c-catman		.cat
+./usr/share/man/cat3/scroll.0			comp-c-catman		.cat
+./usr/share/man/cat3/scrollok.0			comp-c-catman		.cat
 ./usr/share/man/cat3/sctp_bindx.0		comp-c-catman		.cat
 ./usr/share/man/cat3/sctp_connectx.0		comp-c-catman		.cat
 ./usr/share/man/cat3/sctp_freepaddrs.0		comp-c-catman		.cat
@@ -9218,9 +9222,6 @@
 ./usr/share/man/cat3/sctp_recvmsg.0		comp-c-catman		.cat
 ./usr/share/man/cat3/sctp_send.0		comp-c-catman		.cat
 ./usr/share/man/cat3/sctp_sendmsg.0		comp-c-catman		.cat
-./usr/share/man/cat3/scrl.0			comp-c-catman		.cat
-./usr/share/man/cat3/scroll.0			comp-c-catman		.cat
-./usr/share/man/cat3/scrollok.0			comp-c-catman		.cat
 ./usr/share/man/cat3/sdp.0			comp-c-catman		.cat
 ./usr/share/man/cat3/sdp_attr2desc.0		comp-obsolete		obsolete
 ./usr/share/man/cat3/sdp_change_service.0	comp-obsolete		obsolete
@@ -11145,12 +11146,12 @@
 ./usr/share/man/cat9/module_hold.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/module_init.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/module_init_class.0	comp-sys-catman		.cat
-./usr/share/man/cat9/module_load.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/module_kernel.0		comp-sys-catman		.cat
+./usr/share/man/cat9/module_load.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/module_load_vfs_init.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/module_name.0		comp-sys-catman		.cat
-./usr/share/man/cat9/module_rele.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/module_register_callbacks.0 	comp-sys-catman		.cat
+./usr/share/man/cat9/module_rele.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/module_setspecific.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/module_source.0		

CVS commit: src/distrib/sets/lists/comp

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 13:00:17 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
Add missing lint library, sort


To generate a diff of this commit:
cvs rdiff -u -r1.2221 -r1. src/distrib/sets/lists/comp/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/rump/include/rump

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 11:47:37 UTC 2018

Modified Files:
src/sys/rump/include/rump: rumpdefs.h rumperr.h rumperrno2host.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/rump/include/rump/rumpdefs.h
cvs rdiff -u -r1.7 -r1.8 src/sys/rump/include/rump/rumperr.h
cvs rdiff -u -r1.4 -r1.5 src/sys/rump/include/rump/rumperrno2host.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/rump/include/rump

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 11:47:37 UTC 2018

Modified Files:
src/sys/rump/include/rump: rumpdefs.h rumperr.h rumperrno2host.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/rump/include/rump/rumpdefs.h
cvs rdiff -u -r1.7 -r1.8 src/sys/rump/include/rump/rumperr.h
cvs rdiff -u -r1.4 -r1.5 src/sys/rump/include/rump/rumperrno2host.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/rump/include/rump/rumpdefs.h
diff -u src/sys/rump/include/rump/rumpdefs.h:1.37 src/sys/rump/include/rump/rumpdefs.h:1.38
--- src/sys/rump/include/rump/rumpdefs.h:1.37	Sat May 27 17:02:56 2017
+++ src/sys/rump/include/rump/rumpdefs.h	Tue Aug 21 07:47:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpdefs.h,v 1.37 2017/05/27 21:02:56 bouyer Exp $	*/
+/*	$NetBSD: rumpdefs.h,v 1.38 2018/08/21 11:47:37 christos Exp $	*/
 
 /*
  *	AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -9,7 +9,7 @@
 
 #include 
 
-/*	NetBSD: fcntl.h,v 1.46 2013/09/15 10:41:20 njoly Exp 	*/
+/*	NetBSD: fcntl.h,v 1.50 2018/02/20 18:20:05 kamil Exp 	*/
 #define	RUMP_O_RDONLY	0x	/* open for reading only */
 #define	RUMP_O_WRONLY	0x0001	/* open for writing only */
 #define	RUMP_O_RDWR		0x0002	/* open for reading and writing */
@@ -32,6 +32,7 @@
 #define	RUMP_O_CLOEXEC	0x0040	/* set close on exec */
 #define	RUMP_O_SEARCH	0x0080	/* skip search permission checks */
 #define	RUMP_O_NOSIGPIPE	0x0100	/* don't deliver sigpipe */
+#define	RUMP_O_REGULAR	0x0200	/* fail if not a regular file */
 #define	RUMP_F_WAIT		0x010		/* Wait until lock is granted */
 #define	RUMP_F_FLOCK		0x020	 	/* Use flock(2) semantics for lock */
 #define	RUMP_F_POSIX		0x040	 	/* Use POSIX semantics for lock */
@@ -58,7 +59,7 @@
 #define	RUMP__FCNW_FSPRIV(f, c, t)	RUMP__FCN_FSPRIV(RUMP_F_FSOUT,   (f), (c), (int)sizeof(t))
 #define	RUMP__FCNRW_FSPRIV(f, c, t)	RUMP__FCN_FSPRIV(RUMP_F_FSINOUT, (f), (c), (int)sizeof(t))
 
-/*	NetBSD: vnode.h,v 1.259 2016/01/23 16:08:20 christos Exp 	*/
+/*	NetBSD: vnode.h,v 1.280 2018/04/19 21:19:07 christos Exp 	*/
 enum rump_vtype	{ RUMP_VNON, RUMP_VREG, RUMP_VDIR, RUMP_VBLK, RUMP_VCHR, RUMP_VLNK, RUMP_VSOCK, RUMP_VFIFO, RUMP_VBAD };
 #define	RUMP_LK_SHARED	0x0001	
 #define	RUMP_LK_EXCLUSIVE	0x0002	
@@ -195,7 +196,7 @@ enum rump_vtype	{ RUMP_VNON, RUMP_VREG, 
 #define	RUMP_AB_SILENT	0x0004	
 #define	RUMP_AB_DEBUG	0x0008	
 
-/*	NetBSD: socket.h,v 1.118 2015/10/13 21:28:34 rjs Exp 	*/
+/*	NetBSD: socket.h,v 1.126 2018/07/31 13:20:34 rjs Exp 	*/
 #define	RUMP_SOCK_STREAM	1		
 #define	RUMP_SOCK_DGRAM	2		
 #define	RUMP_SOCK_RAW	3		
@@ -241,7 +242,8 @@ enum rump_vtype	{ RUMP_VNON, RUMP_VREG, 
 #define	RUMP_AF_MPLS		33		
 #define	RUMP_AF_ROUTE	34		
 #define	RUMP_AF_CAN		35
-#define	RUMP_AF_MAX		36
+#define	RUMP_AF_ETHER	36
+#define	RUMP_AF_MAX		37
 #define	RUMP_PF_UNSPEC	RUMP_AF_UNSPEC
 #define	RUMP_PF_LOCAL	RUMP_AF_LOCAL
 #define	RUMP_PF_UNIX		RUMP_PF_LOCAL	
@@ -279,6 +281,7 @@ enum rump_vtype	{ RUMP_VNON, RUMP_VREG, 
 #define	RUMP_PF_MPLS		RUMP_AF_MPLS
 #define	RUMP_PF_ROUTE	RUMP_AF_ROUTE
 #define	RUMP_PF_CAN		RUMP_AF_CAN
+#define	RUMP_PF_ETHER	RUMP_AF_ETHER
 #define	RUMP_PF_MAX		RUMP_AF_MAX
 #define	RUMP_SO_DEBUG	0x0001		
 #define	RUMP_SO_ACCEPTCONN	0x0002		
@@ -325,7 +328,7 @@ enum rump_vtype	{ RUMP_VNON, RUMP_VREG, 
 #define RUMP_MSG_IOVUSRSPACE	0x400	
 #define RUMP_MSG_LENUSRSPACE	0x800	
 
-/*	NetBSD: in.h,v 1.98 2015/10/13 21:28:35 rjs Exp 	*/
+/*	NetBSD: in.h,v 1.106 2018/07/11 05:25:45 maxv Exp 	*/
 #define	RUMP_IP_OPTIONS		1
 #define	RUMP_IP_HDRINCL		2
 #define	RUMP_IP_TOS			3
@@ -348,6 +351,7 @@ enum rump_vtype	{ RUMP_VNON, RUMP_VREG, 
 #define	RUMP_IP_MINTTL		24   
 #define	RUMP_IP_PKTINFO		25   
 #define	RUMP_IP_RECVPKTINFO		26   
+#define RUMP_IP_SENDSRCADDR RUMP_IP_RECVDSTADDR 
 #define	RUMP_IP_DEFAULT_MULTICAST_TTL  1	
 #define	RUMP_IP_DEFAULT_MULTICAST_LOOP 1	
 #define	RUMP_IP_MAX_MEMBERSHIPS	20	
@@ -387,6 +391,7 @@ enum rump_vtype	{ RUMP_VNON, RUMP_VREG, 
 #define	RUMP_IPPROTO_IPCOMP		108		
 #define	RUMP_IPPROTO_VRRP		112		
 #define	RUMP_IPPROTO_CARP		112		
+#define	RUMP_IPPROTO_L2TP		115		
 #define	RUMP_IPPROTO_SCTP		132		
 #define RUMP_IPPROTO_PFSYNC  240 
 #define	RUMP_IPPROTO_RAW		255		
@@ -394,7 +399,7 @@ enum rump_vtype	{ RUMP_VNON, RUMP_VREG, 
 #define	RUMP_IPPROTO_DONE		257
 #define	RUMP_IPPROTO_MAXID	(RUMP_IPPROTO_AH + 1)	
 
-/*	NetBSD: tcp.h,v 1.31 2015/02/14 12:57:53 he Exp 	*/
+/*	NetBSD: tcp.h,v 1.33 2017/01/10 20:32:27 christos Exp 	*/
 #define	RUMP_TCP_MSS		536
 #define	RUMP_TCP_MINMSS	216
 #define	RUMP_TCP_MAXWIN	65535	
@@ -412,7 +417,7 @@ enum rump_vtype	{ RUMP_VNON, RUMP_VREG, 
 #define	RUMP_TCP_MD5SIG	0x10	
 #define	RUMP_TCP_CONGCTL	0x20	
 
-/*	NetBSD: mount.h,v 1.218 2015/10/23 19:40:10 maxv Exp 	*/
+/*	NetBSD: mount.h,v 1.230 2018/01/09 03:31:13 christos Exp 	*/
 #define	RUMP_MOUNT_FFS	

CVS commit: src/sys/rump/include/rump

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 11:45:23 UTC 2018

Modified Files:
src/sys/rump/include/rump: makerumpdefs.sh

Log Message:
Unlike gnu sed our sed does not recognize inline labels (separated by
semi-colons) so split the lines, and make sure that command lists end
with a semi-colon.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/rump/include/rump/makerumpdefs.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/include/rump/makerumpdefs.sh
diff -u src/sys/rump/include/rump/makerumpdefs.sh:1.30 src/sys/rump/include/rump/makerumpdefs.sh:1.31
--- src/sys/rump/include/rump/makerumpdefs.sh:1.30	Tue Aug 21 04:22:33 2018
+++ src/sys/rump/include/rump/makerumpdefs.sh	Tue Aug 21 07:45:23 2018
@@ -8,7 +8,7 @@ echo Generating rumpdefs.h
 rm -f rumpdefs.h
 exec 3>&1 > rumpdefs.h
 
-printf '/*	$NetBSD: makerumpdefs.sh,v 1.30 2018/08/21 08:22:33 msaitoh Exp $	*/\n\n'
+printf '/*	$NetBSD: makerumpdefs.sh,v 1.31 2018/08/21 11:45:23 christos Exp $	*/\n\n'
 printf '/*\n *\tAUTOMATICALLY GENERATED.  DO NOT EDIT.\n */\n\n'
 printf '#ifndef _RUMP_RUMPDEFS_H_\n'
 printf '#define _RUMP_RUMPDEFS_H_\n\n'
@@ -57,7 +57,13 @@ sed -n '/#define	F_[A-Z_]*	*0x/s/F_/RUMP
 < ../../../sys/fcntl.h
 sed -n '/#define	F_[A-Z_]*	*(/s/F_/RUMP_F_/gp' \
 < ../../../sys/fcntl.h
-sed -n '/#define[ 	]*_FCN/{:t;N;/\\$/bt;s/_FCN/RUMP__FCN/g;s/F_[A-Z]/RUMP_&/gp}' <../../../sys/fcntl.h | sed 's,/\*.*$,,'
+sed -n '/#define[ 	]*_FCN/{
+:t
+N
+/\\$/bt
+s/_FCN/RUMP__FCN/g
+s/F_[A-Z]/RUMP_&/gp
+}' <../../../sys/fcntl.h | sed 's,/\*.*$,,'
 
 fromvers ../../../sys/vnode.h
 sed -n '/enum vtype.*{/{s/vtype/rump_&/;s/ V/ RUMP_V/gp;}' <../../../sys/vnode.h
@@ -104,9 +110,15 @@ sed -n '/#define[ 	]*MNT_[A-Z].*[^\]$/s/
 
 fromvers ../../../sys/ioccom.h
 sed -n '/#define[ 	]*IOC[A-Z_].*[^\\]$/s/IOC/RUMP_&/gp' <../../../sys/ioccom.h | sed 's,/\*.*$,,'
-sed -n '/#define[ 	]*_IO.*\\$/{:t;N;/\\$/bt;s/_IOC/_RUMP_IOC/g;s/IOC[A-Z]/RUMP_&/gp}' <../../../sys/ioccom.h \
+sed -n '/#define[ 	]*_IO.*\\$/{
+:t
+N
+/\\$/bt
+s/_IOC/_RUMP_IOC/g
+s/IOC[A-Z]/RUMP_&/gp
+}' <../../../sys/ioccom.h \
 | sed 's,/\*.*$,,'
-sed -n '/#define[ 	]*_IO.*[^\]$/{s/_IO/_RUMP_IO/g;s/IOC_/RUMP_IOC_/gp}' <../../../sys/ioccom.h \
+sed -n '/#define[ 	]*_IO.*[^\]$/{s/_IO/_RUMP_IO/g;s/IOC_/RUMP_IOC_/gp;}' <../../../sys/ioccom.h \
 | sed 's,/\*.*$,,'
 
 fromvers ../../../sys/ktrace.h
@@ -135,7 +147,7 @@ exec 1>&3
 echo Generating rumperr.h
 rm -f rumperr.h
 exec > rumperr.h
-printf '/*	$NetBSD: makerumpdefs.sh,v 1.30 2018/08/21 08:22:33 msaitoh Exp $	*/\n\n'
+printf '/*	$NetBSD: makerumpdefs.sh,v 1.31 2018/08/21 11:45:23 christos Exp $	*/\n\n'
 printf '/*\n *\tAUTOMATICALLY GENERATED.  DO NOT EDIT.\n */\n'
 
 fromvers ../../../sys/errno.h
@@ -176,7 +188,7 @@ fi
 echo Generating rumperrno2host.h 1>&3
 rm -f rumperrno2host.h
 exec > rumperrno2host.h
-printf '/*	$NetBSD: makerumpdefs.sh,v 1.30 2018/08/21 08:22:33 msaitoh Exp $	*/\n\n'
+printf '/*	$NetBSD: makerumpdefs.sh,v 1.31 2018/08/21 11:45:23 christos Exp $	*/\n\n'
 printf '/*\n *\tAUTOMATICALLY GENERATED.  DO NOT EDIT.\n */\n'
 
 fromvers ../../../sys/errno.h



CVS commit: src/sys/rump/include/rump

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 11:45:23 UTC 2018

Modified Files:
src/sys/rump/include/rump: makerumpdefs.sh

Log Message:
Unlike gnu sed our sed does not recognize inline labels (separated by
semi-colons) so split the lines, and make sure that command lists end
with a semi-colon.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/rump/include/rump/makerumpdefs.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/distrib/sets/lists/debug

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 11:09:18 UTC 2018

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
add new tests, sort


To generate a diff of this commit:
cvs rdiff -u -r1.262 -r1.263 src/distrib/sets/lists/debug/mi

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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.262 src/distrib/sets/lists/debug/mi:1.263
--- src/distrib/sets/lists/debug/mi:1.262	Sun Aug 12 13:11:55 2018
+++ src/distrib/sets/lists/debug/mi	Tue Aug 21 07:09:18 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.262 2018/08/12 17:11:55 christos Exp $
+# $NetBSD: mi,v 1.263 2018/08/21 11:09:18 christos Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -266,8 +266,8 @@
 ./usr/lib/libwrap_g.acomp-c-debuglib		debuglib,compatfile
 ./usr/lib/liby_g.acomp-c-debuglib		debuglib,compatfile
 ./usr/lib/libz_g.acomp-c-debuglib		debuglib,compatfile
-./usr/lib/libzfs_g.acomp-c-debuglib		debuglib,compatfile,zfs
 ./usr/lib/libzfs_core_g.a			comp-c-debuglib		debuglib,compatfile,zfs
+./usr/lib/libzfs_g.acomp-c-debuglib		debuglib,compatfile,zfs
 ./usr/lib/libzpool_g.acomp-c-debuglib		debuglib,compatfile,zfs
 ./usr/libdata/debug/bin/cat.debug		comp-util-debug		debug
 ./usr/libdata/debug/bin/chio.debug		comp-util-debug		debug
@@ -546,8 +546,8 @@
 ./usr/libdata/debug/usr/bin/g77.debug		comp-obsolete	obsolete
 ./usr/libdata/debug/usr/bin/gcc.debug		comp-c-debug		gcccmds,debug
 ./usr/libdata/debug/usr/bin/gcore.debug		comp-debug-debug	debug
-./usr/libdata/debug/usr/bin/gcov.debug		comp-debug-debug	gcccmds,debug
 ./usr/libdata/debug/usr/bin/gcov-dump.debug	comp-debug-debug	gcccmds,debug,gcc=6
+./usr/libdata/debug/usr/bin/gcov.debug		comp-debug-debug	gcccmds,debug
 ./usr/libdata/debug/usr/bin/gdb.debug		comp-debug-debug	gdb,debug
 ./usr/libdata/debug/usr/bin/gdbtui.debug	comp-debug-debug	gdb,debug
 ./usr/libdata/debug/usr/bin/gencat.debug	comp-locale-debug	debug
@@ -2128,6 +2128,8 @@
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_recvmmsg.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_revoke.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_select.debug		tests-lib-debug		debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_sendmmsg.debug		tests-lib-debug		debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_sendrecv.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_setrlimit.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_setuid.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_sigaction.debug		tests-lib-debug		debug,atf,compattestfile



CVS commit: src/distrib/sets/lists/debug

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 11:09:18 UTC 2018

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
add new tests, sort


To generate a diff of this commit:
cvs rdiff -u -r1.262 -r1.263 src/distrib/sets/lists/debug/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/distrib/sets/lists/tests

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 11:07:40 UTC 2018

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
add new tests, sort


To generate a diff of this commit:
cvs rdiff -u -r1.792 -r1.793 src/distrib/sets/lists/tests/mi

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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.792 src/distrib/sets/lists/tests/mi:1.793
--- src/distrib/sets/lists/tests/mi:1.792	Mon Aug  6 03:14:02 2018
+++ src/distrib/sets/lists/tests/mi	Tue Aug 21 07:07:40 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.792 2018/08/06 07:14:02 msaitoh Exp $
+# $NetBSD: mi,v 1.793 2018/08/21 11:07:40 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2813,6 +2813,8 @@
 ./usr/tests/lib/libc/sys/t_recvmmsg		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/sys/t_revoke		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/sys/t_select		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libc/sys/t_sendmmsg		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libc/sys/t_sendrecv		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/sys/t_setrlimit		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/sys/t_setuid		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/sys/t_sigaction		tests-lib-tests		compattestfile,atf
@@ -3655,31 +3657,31 @@
 ./usr/tests/usr.bin/c++/t_asan_off_by_one	tests-usr.bin-tests	compattestfile,atf,cxx
 ./usr/tests/usr.bin/c++/t_asan_poison		tests-usr.bin-tests	compattestfile,atf,cxx
 ./usr/tests/usr.bin/c++/t_asan_uaf		tests-usr.bin-tests	compattestfile,atf,cxx
-./usr/tests/usr.bin/c++/t_ubsan_int_add_overflow	tests-usr.bin-tests	compattestfile,atf,cxx
-./usr/tests/usr.bin/c++/t_ubsan_int_sub_overflow	tests-usr.bin-tests	compattestfile,atf,cxx
-./usr/tests/usr.bin/c++/t_ubsan_int_neg_overflow	tests-usr.bin-tests	compattestfile,atf,cxx
-./usr/tests/usr.bin/c++/t_ubsan_int_divzero	tests-usr.bin-tests	compattestfile,atf,cxx
-./usr/tests/usr.bin/c++/t_ubsan_vla_out_of_bounds	tests-usr.bin-tests	compattestfile,atf,cxx
 ./usr/tests/usr.bin/c++/t_call_once		tests-usr.bin-tests	compattestfile,atf,cxx
 ./usr/tests/usr.bin/c++/t_call_once2		tests-usr.bin-tests	compattestfile,atf,cxx
 ./usr/tests/usr.bin/c++/t_cxxruntime		tests-usr.bin-tests	compattestfile,atf,cxx
 ./usr/tests/usr.bin/c++/t_hello			tests-usr.bin-tests	compattestfile,atf,cxx
 ./usr/tests/usr.bin/c++/t_pthread_once		tests-usr.bin-tests	compattestfile,atf,cxx
 ./usr/tests/usr.bin/c++/t_static_destructor	tests-usr.bin-tests	compattestfile,atf,cxx
+./usr/tests/usr.bin/c++/t_ubsan_int_add_overflow	tests-usr.bin-tests	compattestfile,atf,cxx
+./usr/tests/usr.bin/c++/t_ubsan_int_divzero	tests-usr.bin-tests	compattestfile,atf,cxx
+./usr/tests/usr.bin/c++/t_ubsan_int_neg_overflow	tests-usr.bin-tests	compattestfile,atf,cxx
+./usr/tests/usr.bin/c++/t_ubsan_int_sub_overflow	tests-usr.bin-tests	compattestfile,atf,cxx
+./usr/tests/usr.bin/c++/t_ubsan_vla_out_of_bounds	tests-usr.bin-tests	compattestfile,atf,cxx
 ./usr/tests/usr.bin/cctests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cc/Atffile			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cc/Kyuafile			tests-usr.bin-tests	compattestfile,atf,kyua
-./usr/tests/usr.bin/cc/t_hello			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cc/t_asan_double_free	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cc/t_asan_global_buffer_overflow	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cc/t_asan_heap_overflow	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cc/t_asan_off_by_one	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cc/t_asan_poison		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cc/t_asan_uaf		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/cc/t_hello			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cc/t_ubsan_int_add_overflow		tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/cc/t_ubsan_int_sub_overflow		tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/cc/t_ubsan_int_neg_overflow		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cc/t_ubsan_int_divzero		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/cc/t_ubsan_int_neg_overflow		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/cc/t_ubsan_int_sub_overflow		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cmptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cmp/Atffile			tests-usr.bin-tests	compattestfile,atf



CVS commit: src/distrib/sets/lists/tests

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 11:07:40 UTC 2018

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
add new tests, sort


To generate a diff of this commit:
cvs rdiff -u -r1.792 -r1.793 src/distrib/sets/lists/tests/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/sys

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 11:04:49 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_sendrecv.c

Log Message:
mark failed


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_sendrecv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/sys

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 11:04:49 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_sendrecv.c

Log Message:
mark failed


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_sendrecv.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_sendrecv.c
diff -u src/tests/lib/libc/sys/t_sendrecv.c:1.2 src/tests/lib/libc/sys/t_sendrecv.c:1.3
--- src/tests/lib/libc/sys/t_sendrecv.c:1.2	Tue Aug 21 07:03:27 2018
+++ src/tests/lib/libc/sys/t_sendrecv.c	Tue Aug 21 07:04:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_sendrecv.c,v 1.2 2018/08/21 11:03:27 christos Exp $	*/
+/*	$NetBSD: t_sendrecv.c,v 1.3 2018/08/21 11:04:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_sendrecv.c,v 1.2 2018/08/21 11:03:27 christos Exp $");
+__RCSID("$NetBSD: t_sendrecv.c,v 1.3 2018/08/21 11:04:49 christos Exp $");
 
 #include 
 #include 
@@ -115,6 +115,8 @@ ATF_TC_BODY(sendrecv_basic, tc)
 	int fd[2], error;
 	struct sigaction sa;
 
+	atf_tc_fail("does not terminate");
+
 	error = socketpair(AF_UNIX, SOCK_DGRAM, 0, fd);
 //	error = pipe(fd);
 	ATF_REQUIRE_MSG(error != -1, "socketpair failed (%s)", strerror(errno));



CVS commit: src/tests/lib/libc/sys

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 11:03:27 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_sendrecv.c

Log Message:
should terminate and does with ktrace, but it does not normally.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_sendrecv.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_sendrecv.c
diff -u src/tests/lib/libc/sys/t_sendrecv.c:1.1 src/tests/lib/libc/sys/t_sendrecv.c:1.2
--- src/tests/lib/libc/sys/t_sendrecv.c:1.1	Tue Aug 21 06:41:00 2018
+++ src/tests/lib/libc/sys/t_sendrecv.c	Tue Aug 21 07:03:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_sendrecv.c,v 1.1 2018/08/21 10:41:00 christos Exp $	*/
+/*	$NetBSD: t_sendrecv.c,v 1.2 2018/08/21 11:03:27 christos Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -15,13 +15,6 @@
  * 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.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *This product includes software developed by the NetBSD
- *Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -36,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_sendrecv.c,v 1.1 2018/08/21 10:41:00 christos Exp $");
+__RCSID("$NetBSD: t_sendrecv.c,v 1.2 2018/08/21 11:03:27 christos Exp $");
 
 #include 
 #include 
@@ -49,6 +42,7 @@ __RCSID("$NetBSD: t_sendrecv.c,v 1.1 201
 #include 
 #include 
 #include 
+#include 
 
 ATF_TC(sendrecv_basic);
 ATF_TC_HEAD(sendrecv_basic, tc)
@@ -56,13 +50,22 @@ ATF_TC_HEAD(sendrecv_basic, tc)
 	atf_tc_set_md_var(tc, "descr", "A basic test of sendrecv(2)");
 }
 
-#define COUNT 1000
+#define COUNT 100
 
 union packet {
 	uint8_t buf[1316];
 	uintmax_t seq;
 };
 
+static volatile sig_atomic_t rdied;
+
+static void
+handle_sigchld(__unused int pid)
+{
+
+	rdied = 1;
+}
+
 static void
 sender(int fd)
 {
@@ -73,9 +76,11 @@ sender(int fd)
 		for (; (n = send(fd, , sizeof(p), 0)) == sizeof(p);
 		p.seq++)
 			continue;
-//		printf(">>%zd %d %ju\n", n, errno, p.seq);
+		printf(">>%zd %d %ju\n", n, errno, p.seq);
 		ATF_REQUIRE_MSG(errno == ENOBUFS, "send %s", strerror(errno));
+		sched_yield();
 	}
+	printf("sender done\n");
 }
 
 static void
@@ -85,12 +90,16 @@ receiver(int fd)
 	ssize_t n;
 	uintmax_t seq = 0;
 
-	for (size_t i = 0; i < COUNT; i++) {
+	do {
+		if (rdied)
+			return;
 		while ((n = recv(fd, , sizeof(p), 0), sizeof(p))
 		== sizeof(p))
 		{
-//			if (p.seq != seq)
-//printf("%ju != %ju\n", p.seq, seq);
+			if (rdied)
+return;
+			if (p.seq != seq)
+printf("%ju != %ju\n", p.seq, seq);
 			seq = p.seq + 1;
 		}
 		printf("<<%zd %d %ju\n", n, errno, seq);
@@ -98,17 +107,26 @@ receiver(int fd)
 			return;
 		ATF_REQUIRE_EQ(n, -1);
 		ATF_REQUIRE_MSG(errno == ENOBUFS, "recv %s", strerror(errno));
-	}
+	} while (p.seq < COUNT);
 }
 
 ATF_TC_BODY(sendrecv_basic, tc)
 {
 	int fd[2], error;
+	struct sigaction sa;
 
 	error = socketpair(AF_UNIX, SOCK_DGRAM, 0, fd);
 //	error = pipe(fd);
 	ATF_REQUIRE_MSG(error != -1, "socketpair failed (%s)", strerror(errno));
 
+	memset(, 0, sizeof(sa));
+	sa.sa_flags = SA_RESTART;
+	sa.sa_handler = _sigchld;
+	sigemptyset(_mask);
+	error = sigaction(SIGCHLD, , 0);
+	ATF_REQUIRE_MSG(error != -1, "sigaction failed (%s)",
+	strerror(errno));
+
 	switch (fork()) {
 	case -1:
 		ATF_REQUIRE_MSG(errno == 0,



CVS commit: src/tests/lib/libc/sys

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 11:03:27 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_sendrecv.c

Log Message:
should terminate and does with ktrace, but it does not normally.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_sendrecv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/sys

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 10:41:00 UTC 2018

Added Files:
src/tests/lib/libc/sys: t_sendrecv.c

Log Message:
Now add the file I really meant to add.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_sendrecv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/sys

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 10:41:00 UTC 2018

Added Files:
src/tests/lib/libc/sys: t_sendrecv.c

Log Message:
Now add the file I really meant to add.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_sendrecv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/tests/lib/libc/sys/t_sendrecv.c
diff -u /dev/null src/tests/lib/libc/sys/t_sendrecv.c:1.1
--- /dev/null	Tue Aug 21 06:41:00 2018
+++ src/tests/lib/libc/sys/t_sendrecv.c	Tue Aug 21 06:41:00 2018
@@ -0,0 +1,135 @@
+/*	$NetBSD: t_sendrecv.c,v 1.1 2018/08/21 10:41:00 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *must display the following acknowledgement:
+ *This product includes software developed by the NetBSD
+ *Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *contributors may be used to endorse or promote products derived
+ *from this software without specific prior written permission.
+ *
+ * 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.
+ */
+#include 
+__RCSID("$NetBSD: t_sendrecv.c,v 1.1 2018/08/21 10:41:00 christos Exp $");
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+ATF_TC(sendrecv_basic);
+ATF_TC_HEAD(sendrecv_basic, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "A basic test of sendrecv(2)");
+}
+
+#define COUNT 1000
+
+union packet {
+	uint8_t buf[1316];
+	uintmax_t seq;
+};
+
+static void
+sender(int fd)
+{
+	union packet p;
+	ssize_t n;
+	p.seq = 0;
+	for (size_t i = 0; i < COUNT; i++) {
+		for (; (n = send(fd, , sizeof(p), 0)) == sizeof(p);
+		p.seq++)
+			continue;
+//		printf(">>%zd %d %ju\n", n, errno, p.seq);
+		ATF_REQUIRE_MSG(errno == ENOBUFS, "send %s", strerror(errno));
+	}
+}
+
+static void
+receiver(int fd)
+{
+	union packet p;
+	ssize_t n;
+	uintmax_t seq = 0;
+
+	for (size_t i = 0; i < COUNT; i++) {
+		while ((n = recv(fd, , sizeof(p), 0), sizeof(p))
+		== sizeof(p))
+		{
+//			if (p.seq != seq)
+//printf("%ju != %ju\n", p.seq, seq);
+			seq = p.seq + 1;
+		}
+		printf("<<%zd %d %ju\n", n, errno, seq);
+		if (n == 0)
+			return;
+		ATF_REQUIRE_EQ(n, -1);
+		ATF_REQUIRE_MSG(errno == ENOBUFS, "recv %s", strerror(errno));
+	}
+}
+
+ATF_TC_BODY(sendrecv_basic, tc)
+{
+	int fd[2], error;
+
+	error = socketpair(AF_UNIX, SOCK_DGRAM, 0, fd);
+//	error = pipe(fd);
+	ATF_REQUIRE_MSG(error != -1, "socketpair failed (%s)", strerror(errno));
+
+	switch (fork()) {
+	case -1:
+		ATF_REQUIRE_MSG(errno == 0,
+		"socketpair failed (%s)", strerror(errno));
+		/*NOTREACHED*/
+	case 0:
+		sched_yield();
+		sender(fd[0]);
+		close(fd[0]);
+		exit(EXIT_SUCCESS);
+		/*NOTREACHED*/
+	default:
+		receiver(fd[1]);
+		return;
+	}
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+	ATF_TP_ADD_TC(tp, sendrecv_basic);
+
+	return atf_no_error();
+}



CVS commit: src/tests/lib/libc/sys

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 10:39:21 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_recvmmsg.c

Log Message:
revert copyright change.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_recvmmsg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/sys

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 10:39:21 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_recvmmsg.c

Log Message:
revert copyright change.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_recvmmsg.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_recvmmsg.c
diff -u src/tests/lib/libc/sys/t_recvmmsg.c:1.3 src/tests/lib/libc/sys/t_recvmmsg.c:1.4
--- src/tests/lib/libc/sys/t_recvmmsg.c:1.3	Tue Aug 21 06:38:09 2018
+++ src/tests/lib/libc/sys/t_recvmmsg.c	Tue Aug 21 06:39:21 2018
@@ -1,11 +1,11 @@
-/*	$NetBSD: t_recvmmsg.c,v 1.3 2018/08/21 10:38:09 christos Exp $	*/
+/*	$NetBSD: t_recvmmsg.c,v 1.4 2018/08/21 10:39:21 christos Exp $	*/
 
 /*-
- * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
+ * by Jared McNeill and Christos Zoulas.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -15,6 +15,13 @@
  * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *must display the following acknowledgement:
+ *This product includes software developed by the NetBSD
+ *Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *contributors may be used to endorse or promote products derived
+ *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -29,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_recvmmsg.c,v 1.3 2018/08/21 10:38:09 christos Exp $");
+__RCSID("$NetBSD: t_recvmmsg.c,v 1.4 2018/08/21 10:39:21 christos Exp $");
 
 #include 
 #include 



CVS commit: src/tests/lib/libc/sys

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 10:38:09 UTC 2018

Modified Files:
src/tests/lib/libc/sys: Makefile t_recvmmsg.c
Added Files:
src/tests/lib/libc/sys: t_sendmmsg.c

Log Message:
more tests


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/tests/lib/libc/sys/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_recvmmsg.c
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_sendmmsg.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/Makefile
diff -u src/tests/lib/libc/sys/Makefile:1.52 src/tests/lib/libc/sys/Makefile:1.53
--- src/tests/lib/libc/sys/Makefile:1.52	Fri May 25 11:42:30 2018
+++ src/tests/lib/libc/sys/Makefile	Tue Aug 21 06:38:09 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.52 2018/05/25 15:42:30 martin Exp $
+# $NetBSD: Makefile,v 1.53 2018/08/21 10:38:09 christos Exp $
 
 MKMAN=	no
 
@@ -62,6 +62,8 @@ TESTS_C+=		t_ptrace_waitpid
 TESTS_C+=		t_recvmmsg
 TESTS_C+=		t_revoke
 TESTS_C+=		t_select
+TESTS_C+=		t_sendmmsg
+TESTS_C+=		t_sendrecv
 TESTS_C+=		t_setrlimit
 TESTS_C+=		t_setuid
 TESTS_C+=		t_sigaction

Index: src/tests/lib/libc/sys/t_recvmmsg.c
diff -u src/tests/lib/libc/sys/t_recvmmsg.c:1.2 src/tests/lib/libc/sys/t_recvmmsg.c:1.3
--- src/tests/lib/libc/sys/t_recvmmsg.c:1.2	Wed Mar 21 08:37:12 2018
+++ src/tests/lib/libc/sys/t_recvmmsg.c	Tue Aug 21 06:38:09 2018
@@ -1,11 +1,11 @@
-/*	$NetBSD: t_recvmmsg.c,v 1.2 2018/03/21 12:37:12 roy Exp $	*/
+/*	$NetBSD: t_recvmmsg.c,v 1.3 2018/08/21 10:38:09 christos Exp $	*/
 
 /*-
- * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by Jared McNeill and Christos Zoulas.
+ * by Christos Zoulas.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -15,13 +15,6 @@
  * 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.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *This product includes software developed by the NetBSD
- *Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -36,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_recvmmsg.c,v 1.2 2018/03/21 12:37:12 roy Exp $");
+__RCSID("$NetBSD: t_recvmmsg.c,v 1.3 2018/08/21 10:38:09 christos Exp $");
 
 #include 
 #include 

Added files:

Index: src/tests/lib/libc/sys/t_sendmmsg.c
diff -u /dev/null src/tests/lib/libc/sys/t_sendmmsg.c:1.1
--- /dev/null	Tue Aug 21 06:38:09 2018
+++ src/tests/lib/libc/sys/t_sendmmsg.c	Tue Aug 21 06:38:09 2018
@@ -0,0 +1,212 @@
+/*	$NetBSD: t_sendmmsg.c,v 1.1 2018/08/21 10:38:09 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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.
+ */
+#include 

CVS commit: src/tests/lib/libc/sys

2018-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 21 10:38:09 UTC 2018

Modified Files:
src/tests/lib/libc/sys: Makefile t_recvmmsg.c
Added Files:
src/tests/lib/libc/sys: t_sendmmsg.c

Log Message:
more tests


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/tests/lib/libc/sys/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_recvmmsg.c
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_sendmmsg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/broadcom

2018-08-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Aug 21 08:45:17 UTC 2018

Modified Files:
src/sys/arch/arm/broadcom: bcm283x_platform.c

Log Message:
Correctly report memory size, not clock rate when VERBOSE_INIT_ARM.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/broadcom/bcm283x_platform.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/broadcom

2018-08-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Aug 21 08:45:17 UTC 2018

Modified Files:
src/sys/arch/arm/broadcom: bcm283x_platform.c

Log Message:
Correctly report memory size, not clock rate when VERBOSE_INIT_ARM.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/broadcom/bcm283x_platform.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/broadcom/bcm283x_platform.c
diff -u src/sys/arch/arm/broadcom/bcm283x_platform.c:1.12 src/sys/arch/arm/broadcom/bcm283x_platform.c:1.13
--- src/sys/arch/arm/broadcom/bcm283x_platform.c:1.12	Fri Aug 10 04:44:15 2018
+++ src/sys/arch/arm/broadcom/bcm283x_platform.c	Tue Aug 21 08:45:17 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm283x_platform.c,v 1.12 2018/08/10 04:44:15 rin Exp $	*/
+/*	$NetBSD: bcm283x_platform.c,v 1.13 2018/08/21 08:45:17 rin Exp $	*/
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.12 2018/08/10 04:44:15 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.13 2018/08/21 08:45:17 rin Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -663,10 +663,9 @@ bcm283x_bootparams(bus_space_tag_t iot, 
 		curcpu()->ci_data.cpu_cc_freq = vb.vbt_armclockrate.rate;
 
 #ifdef VERBOSE_INIT_ARM
-	if (vcprop_tag_success_p(_memory.tag)) {
-		printf("%s: memory size  %d\n", __func__,
-		vb.vbt_armclockrate.rate);
-	}
+	if (vcprop_tag_success_p(_memory.tag))
+		printf("%s: memory size  %zu\n", __func__,
+		bcm283x_memorysize);
 	if (vcprop_tag_success_p(_armclockrate.tag))
 		printf("%s: arm clock%d\n", __func__,
 		vb.vbt_armclockrate.rate);



CVS commit: src/sys/rump/include/rump

2018-08-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Aug 21 08:22:33 UTC 2018

Modified Files:
src/sys/rump/include/rump: makerumpdefs.sh

Log Message:
rumpdefs.h, rumperr.h and rumperrno2host.h are generated from makerumpdefs.sh.
Don't edit those files directly. Use __inline instead of inline in the
script file. OK'd by christos.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/rump/include/rump/makerumpdefs.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/include/rump/makerumpdefs.sh
diff -u src/sys/rump/include/rump/makerumpdefs.sh:1.29 src/sys/rump/include/rump/makerumpdefs.sh:1.30
--- src/sys/rump/include/rump/makerumpdefs.sh:1.29	Tue Feb  2 01:15:24 2016
+++ src/sys/rump/include/rump/makerumpdefs.sh	Tue Aug 21 08:22:33 2018
@@ -8,7 +8,7 @@ echo Generating rumpdefs.h
 rm -f rumpdefs.h
 exec 3>&1 > rumpdefs.h
 
-printf '/*	$NetBSD: makerumpdefs.sh,v 1.29 2016/02/02 01:15:24 pooka Exp $	*/\n\n'
+printf '/*	$NetBSD: makerumpdefs.sh,v 1.30 2018/08/21 08:22:33 msaitoh Exp $	*/\n\n'
 printf '/*\n *\tAUTOMATICALLY GENERATED.  DO NOT EDIT.\n */\n\n'
 printf '#ifndef _RUMP_RUMPDEFS_H_\n'
 printf '#define _RUMP_RUMPDEFS_H_\n\n'
@@ -135,12 +135,12 @@ exec 1>&3
 echo Generating rumperr.h
 rm -f rumperr.h
 exec > rumperr.h
-printf '/*	$NetBSD: makerumpdefs.sh,v 1.29 2016/02/02 01:15:24 pooka Exp $	*/\n\n'
+printf '/*	$NetBSD: makerumpdefs.sh,v 1.30 2018/08/21 08:22:33 msaitoh Exp $	*/\n\n'
 printf '/*\n *\tAUTOMATICALLY GENERATED.  DO NOT EDIT.\n */\n'
 
 fromvers ../../../sys/errno.h
 
-printf "\nstatic inline const char *\nrump_strerror(int error)\n{\n\n"
+printf "\nstatic __inline const char *\nrump_strerror(int error)\n{\n\n"
 printf "\tswitch (error) {\n\tcase 0:\n"
 printf "\t\t return \"No error: zero, zip, zilch, none!\";\n"
 awk '/^#define[ 	]*E.*[0-9]/{
@@ -176,13 +176,13 @@ fi
 echo Generating rumperrno2host.h 1>&3
 rm -f rumperrno2host.h
 exec > rumperrno2host.h
-printf '/*	$NetBSD: makerumpdefs.sh,v 1.29 2016/02/02 01:15:24 pooka Exp $	*/\n\n'
+printf '/*	$NetBSD: makerumpdefs.sh,v 1.30 2018/08/21 08:22:33 msaitoh Exp $	*/\n\n'
 printf '/*\n *\tAUTOMATICALLY GENERATED.  DO NOT EDIT.\n */\n'
 
 fromvers ../../../sys/errno.h
 
 printf "\n#ifndef ERANGE\n#error include ISO C style errno.h first\n#endif\n"
-printf "\nstatic inline int \nrump_errno2host(int rumperrno)\n{\n\n"
+printf "\nstatic __inline int \nrump_errno2host(int rumperrno)\n{\n\n"
 printf "\tswitch (rumperrno) {\n\tcase 0:\n"
 printf "\t\t return 0;\n"
 awk '/^#define[ 	]*E.*[0-9]/{



CVS commit: src/sys/rump/include/rump

2018-08-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Aug 21 08:22:33 UTC 2018

Modified Files:
src/sys/rump/include/rump: makerumpdefs.sh

Log Message:
rumpdefs.h, rumperr.h and rumperrno2host.h are generated from makerumpdefs.sh.
Don't edit those files directly. Use __inline instead of inline in the
script file. OK'd by christos.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/rump/include/rump/makerumpdefs.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/kern

2018-08-21 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Aug 21 07:56:53 UTC 2018

Modified Files:
src/sys/kern: kern_malloc.c

Log Message:
Need to keep track of the requested size, when realloc is used under kASan.
Maybe we could use mh_rqsz by default.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/kern/kern_malloc.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/kern_malloc.c
diff -u src/sys/kern/kern_malloc.c:1.149 src/sys/kern/kern_malloc.c:1.150
--- src/sys/kern/kern_malloc.c:1.149	Tue Aug 21 01:25:57 2018
+++ src/sys/kern/kern_malloc.c	Tue Aug 21 07:56:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_malloc.c,v 1.149 2018/08/21 01:25:57 pgoyette Exp $	*/
+/*	$NetBSD: kern_malloc.c,v 1.150 2018/08/21 07:56:53 maxv Exp $	*/
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.149 2018/08/21 01:25:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.150 2018/08/21 07:56:53 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kasan.h"
@@ -101,7 +101,10 @@ MALLOC_DEFINE(M_MRTABLE, "mrt", "multica
  * Header contains total size, including the header itself.
  */
 struct malloc_header {
-	size_t		mh_size;
+	size_t mh_size;
+#ifdef KASAN
+	size_t mh_rqsz;
+#endif
 } __aligned(ALIGNBYTES + 1);
 
 void *
@@ -139,6 +142,9 @@ kern_malloc(unsigned long size, int flag
 	}
 	mh = (void *)((char *)p + hdroffset);
 	mh->mh_size = allocsize - hdroffset;
+#ifdef KASAN
+	mh->mh_rqsz = origsize;
+#endif
 	mh++;
 
 #ifdef KASAN
@@ -195,7 +201,11 @@ kern_realloc(void *curaddr, unsigned lon
 	mh = curaddr;
 	mh--;
 
+#ifdef KASAN
+	cursize = mh->mh_rqsz;
+#else
 	cursize = mh->mh_size - sizeof(struct malloc_header);
+#endif
 
 	/*
 	 * If we already actually have as much as they want, we're done.



CVS commit: src/sys/kern

2018-08-21 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Aug 21 07:56:53 UTC 2018

Modified Files:
src/sys/kern: kern_malloc.c

Log Message:
Need to keep track of the requested size, when realloc is used under kASan.
Maybe we could use mh_rqsz by default.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/kern/kern_malloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2018-08-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Aug 21 06:49:21 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: mi
src/sys/sys: Makefile

Log Message:
There is no possible reason that  can be useful to
userland, all it contains is a few prototypes for kernel functions.
So, don't install asan.h in /usr/include/sys (if it ever gains
anything which would be useful, then this can be changed).

Note: I have simply removed /usr/includ/esys/asan.hit from the sets
list, rather than marking it obsolete - it has not been there for
very long, If you get build problems (sets list errors) from an
update build because you managed to install it during the last few
hours, just remove asan.h from /usr/include/sys


To generate a diff of this commit:
cvs rdiff -u -r1.2220 -r1.2221 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.167 -r1.168 src/sys/sys/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2018-08-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Aug 21 06:49:21 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: mi
src/sys/sys: Makefile

Log Message:
There is no possible reason that  can be useful to
userland, all it contains is a few prototypes for kernel functions.
So, don't install asan.h in /usr/include/sys (if it ever gains
anything which would be useful, then this can be changed).

Note: I have simply removed /usr/includ/esys/asan.hit from the sets
list, rather than marking it obsolete - it has not been there for
very long, If you get build problems (sets list errors) from an
update build because you managed to install it during the last few
hours, just remove asan.h from /usr/include/sys


To generate a diff of this commit:
cvs rdiff -u -r1.2220 -r1.2221 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.167 -r1.168 src/sys/sys/Makefile

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.2220 src/distrib/sets/lists/comp/mi:1.2221
--- src/distrib/sets/lists/comp/mi:1.2220	Tue Aug 21 04:16:38 2018
+++ src/distrib/sets/lists/comp/mi	Tue Aug 21 06:49:21 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2220 2018/08/21 04:16:38 pgoyette Exp $
+#	$NetBSD: mi,v 1.2221 2018/08/21 06:49:21 kre Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -2872,7 +2872,6 @@
 ./usr/include/sys/aio.hcomp-c-include
 ./usr/include/sys/ansi.h			comp-c-include
 ./usr/include/sys/aout_mids.h			comp-c-include
-./usr/include/sys/asan.h			comp-c-include
 ./usr/include/sys/ataio.h			comp-c-include
 ./usr/include/sys/atomic.h			comp-c-include
 ./usr/include/sys/audioio.h			comp-c-include

Index: src/sys/sys/Makefile
diff -u src/sys/sys/Makefile:1.167 src/sys/sys/Makefile:1.168
--- src/sys/sys/Makefile:1.167	Mon Aug 20 15:04:52 2018
+++ src/sys/sys/Makefile	Tue Aug 21 06:49:21 2018
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.167 2018/08/20 15:04:52 maxv Exp $
+#	$NetBSD: Makefile,v 1.168 2018/08/21 06:49:21 kre Exp $
 
 .include 
 
 INCSDIR= /usr/include/sys
 
-INCS=	acct.h agpio.h aio.h ansi.h aout_mids.h asan.h ataio.h atomic.h \
+INCS=	acct.h agpio.h aio.h ansi.h aout_mids.h ataio.h atomic.h \
 	audioio.h \
 	bitops.h bootblock.h bswap.h buf.h \
 	callback.h callout.h cdbr.h cdefs.h cdefs_aout.h \