CVS commit: src/sys/arch/x86/x86

2019-05-28 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue May 28 13:20:23 UTC 2019

Modified Files:
src/sys/arch/x86/x86: patch.c

Log Message:
Disable sanitizer instrumentation in x86_hotpatch()

Local variables have empty (0-sized), unknown alignment to UBSan.
This is hard to workaround without mutating the code too much.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/x86/x86/patch.c

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

Modified files:

Index: src/sys/arch/x86/x86/patch.c
diff -u src/sys/arch/x86/x86/patch.c:1.35 src/sys/arch/x86/x86/patch.c:1.36
--- src/sys/arch/x86/x86/patch.c:1.35	Sat Jul 14 14:34:32 2018
+++ src/sys/arch/x86/x86/patch.c	Tue May 28 13:20:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: patch.c,v 1.35 2018/07/14 14:34:32 maxv Exp $	*/
+/*	$NetBSD: patch.c,v 1.36 2019/05/28 13:20:23 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.35 2018/07/14 14:34:32 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.36 2019/05/28 13:20:23 kamil Exp $");
 
 #include "opt_lockdebug.h"
 #ifdef i386
@@ -132,6 +132,12 @@ patchbytes(void *addr, const uint8_t *by
 	}
 }
 
+/* The local variables have unknown alignment to UBSan */
+#if defined(__clang__)
+__attribute__((no_sanitize("undefined")))
+#else
+__attribute__((no_sanitize_undefined))
+#endif
 void
 x86_hotpatch(uint32_t name, const uint8_t *bytes, size_t size)
 {



Re: CVS commit: src/external/gpl3/gcc/dist/libsanitizer/tsan

2019-06-01 Thread Kamil Rytarowski
On 01.06.2019 20:38, Christos Zoulas wrote:
> I just checked and the offsets are correct (we are the same as FreeBSD).
> We are missing support for the the names of the functions __setjmp14 etc.
> 
> Thanks,
> 

There is some overlap, but not full.

https://github.com/llvm-mirror/compiler-rt/blob/master/lib/tsan/rtl/tsan_rtl_amd64.S

Each call of this code was verified and it passed regression suite.

There is also need to handle NetBSD specific renaming of symbols in this
.S file and in .c file.

> christos
> 
>> On Jun 1, 2019, at 1:52 PM, Kamil Rytarowski  wrote:
>>
>> On 01.06.2019 19:22, Christos Zoulas wrote:
>>> Module Name:src
>>> Committed By:   christos
>>> Date:   Sat Jun  1 17:22:58 UTC 2019
>>>
>>> Modified Files:
>>> src/external/gpl3/gcc/dist/libsanitizer/tsan: tsan_rtl_amd64.S
>>>
>>> Log Message:
>>> Do as FreeBSD does now (I have not checked that the offsets are correct)
>>>
>>
>> These values differ on NetBSD.
>>
>> There is upstreamed support into upstream repository here:
>>
>> https://github.com/llvm-mirror/compiler-rt/tree/master/lib/tsan/rtl
>>
>> Please grep for NetBSD specific code. We will get it with GCC9, maybe
>> GCC8.. but I would need to check.
>>
>> 
> 




signature.asc
Description: OpenPGP digital signature


CVS commit: src/share/man/man7

2019-06-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun  1 19:54:34 UTC 2019

Modified Files:
src/share/man/man7: sysctl.7

Log Message:
Document KERN_PROC_CWD in sysctl(7)


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/share/man/man7/sysctl.7

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

Modified files:

Index: src/share/man/man7/sysctl.7
diff -u src/share/man/man7/sysctl.7:1.138 src/share/man/man7/sysctl.7:1.139
--- src/share/man/man7/sysctl.7:1.138	Fri Mar  1 03:05:08 2019
+++ src/share/man/man7/sysctl.7	Sat Jun  1 19:54:34 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysctl.7,v 1.138 2019/03/01 03:05:08 christos Exp $
+.\"	$NetBSD: sysctl.7,v 1.139 2019/06/01 19:54:34 kamil Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)sysctl.3	8.4 (Berkeley) 5/9/95
 .\"
-.Dd February 28, 2019
+.Dd June 1, 2019
 .Dt SYSCTL 7
 .Os
 .Sh NAME
@@ -1026,6 +1026,7 @@ The fourth level name is as follows:
 .It Dv KERN_PROC_NARGV	The number of argv strings
 .It Dv KERN_PROC_NENV	The number of environ strings
 .It Dv KERN_PROC_PATHNAME	The full pathname of the executable
+.It Dv KERN_PROC_CWD	The current working directory
 .El
 .It Li kern.profiling ( Dv KERN_PROF )
 Return profiling information about the kernel.



CVS commit: src/sys/kern

2019-06-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun  1 19:48:29 UTC 2019

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

Log Message:
Align the KERN_PROC_CWD interface to semantics closer to KERN_PROC_PATHNAME

Allow specifying oldlenp as 0 and return size with success for oldp != NULL


To generate a diff of this commit:
cvs rdiff -u -r1.231 -r1.232 src/sys/kern/kern_proc.c

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



CVS commit: src/sys/kern

2019-06-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun  1 19:48:29 UTC 2019

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

Log Message:
Align the KERN_PROC_CWD interface to semantics closer to KERN_PROC_PATHNAME

Allow specifying oldlenp as 0 and return size with success for oldp != NULL


To generate a diff of this commit:
cvs rdiff -u -r1.231 -r1.232 src/sys/kern/kern_proc.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_proc.c
diff -u src/sys/kern/kern_proc.c:1.231 src/sys/kern/kern_proc.c:1.232
--- src/sys/kern/kern_proc.c:1.231	Sat Jun  1 00:19:43 2019
+++ src/sys/kern/kern_proc.c	Sat Jun  1 19:48:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_proc.c,v 1.231 2019/06/01 00:19:43 kamil Exp $	*/
+/*	$NetBSD: kern_proc.c,v 1.232 2019/06/01 19:48:29 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.231 2019/06/01 00:19:43 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.232 2019/06/01 19:48:29 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kstack.h"
@@ -2599,11 +2599,6 @@ fill_cwd(struct lwp *l, pid_t pid, void 
 		return error;
 
 	len = MAXPATHLEN * 4;
-	if (*oldlenp < 2) {
-		if (pid != -1)
-			mutex_exit(p->p_lock);
-		return ERANGE;
-	}
 
 	path = kmem_alloc(len, KM_SLEEP);
 



Re: CVS commit: src/external/gpl3/gcc/dist/libsanitizer/tsan

2019-06-01 Thread Kamil Rytarowski
On 01.06.2019 21:04, Christos Zoulas wrote:
> On Jun 1,  8:48pm, n...@gmx.com (Kamil Rytarowski) wrote:
> -- Subject: Re: CVS commit: src/external/gpl3/gcc/dist/libsanitizer/tsan
> 
> | There is some overlap, but not full.
> 
> I understand.
> 
> | https://github.com/llvm-mirror/compiler-rt/blob/master/lib/tsan/rtl/tsan_rt=
> | l_amd64.S
> | 
> | Each call of this code was verified and it passed regression suite.
> | 
> | There is also need to handle NetBSD specific renaming of symbols in this
> | file and in .c file.
> 
> I also said that the NetBSD symbols are not handled. Newer gcc will fix it.
> I just wanted to make it compile.
> 
> christos
> 

I see, thank you! I'm doing it in the way that code flows with new
upstream versions into the basesystem. Cherry picking TSan support
shouldn't be that difficult probably.



signature.asc
Description: OpenPGP digital signature


CVS commit: src

2019-06-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun  1 19:49:03 UTC 2019

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/kernel: Makefile
Added Files:
src/tests/kernel: t_proccwd.c

Log Message:
Add ATF KERN_PROC_CWD tests


To generate a diff of this commit:
cvs rdiff -u -r1.283 -r1.284 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.814 -r1.815 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.58 -r1.59 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/t_proccwd.c

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.283 src/distrib/sets/lists/debug/mi:1.284
--- src/distrib/sets/lists/debug/mi:1.283	Fri Apr 26 08:52:16 2019
+++ src/distrib/sets/lists/debug/mi	Sat Jun  1 19:49:02 2019
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.283 2019/04/26 08:52:16 maya Exp $
+# $NetBSD: mi,v 1.284 2019/06/01 19:49:02 kamil 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
@@ -1742,6 +1742,7 @@
 ./usr/libdata/debug/usr/tests/kernel/t_poll3w.debug			tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/t_pollts.debug			tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/t_posix_fadvise.debug		tests-obsolete		obsolete,compattestfile
+./usr/libdata/debug/usr/tests/kernel/t_proccwd.debug			tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/t_ptrace.debug			tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/t_ptrace_wait.debug		tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/t_ptrace_wait3.debug		tests-obsolete		obsolete,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.814 src/distrib/sets/lists/tests/mi:1.815
--- src/distrib/sets/lists/tests/mi:1.814	Sun May 26 21:04:56 2019
+++ src/distrib/sets/lists/tests/mi	Sat Jun  1 19:49:02 2019
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.814 2019/05/26 21:04:56 christos Exp $
+# $NetBSD: mi,v 1.815 2019/06/01 19:49:02 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2191,6 +2191,7 @@
 ./usr/tests/kernel/t_pollts			tests-obsolete		obsolete
 ./usr/tests/kernel/t_posix_fadvise		tests-obsolete		obsolete
 ./usr/tests/kernel/t_posix_fallocate		tests-obsolete		obsolete
+./usr/tests/kernel/t_proccwd			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_procpath			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_ps_strings			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_ptrace			tests-obsolete		obsolete

Index: src/tests/kernel/Makefile
diff -u src/tests/kernel/Makefile:1.58 src/tests/kernel/Makefile:1.59
--- src/tests/kernel/Makefile:1.58	Mon Feb  4 05:24:18 2019
+++ src/tests/kernel/Makefile	Sat Jun  1 19:49:02 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.58 2019/02/04 05:24:18 mrg Exp $
+# $NetBSD: Makefile,v 1.59 2019/06/01 19:49:02 kamil Exp $
 
 NOMAN=		# defined
 
@@ -11,6 +11,7 @@ TESTS_C=	t_lock
 TESTS_C+=	t_lockf
 TESTS_C+=	t_pty
 TESTS_C+=	t_mqueue
+TESTS_C+=	t_proccwd
 TESTS_C+=	t_sysv
 TESTS_C+=	t_subr_prf
 TESTS_C+=	t_kauth_pr_47598

Added files:

Index: src/tests/kernel/t_proccwd.c
diff -u /dev/null src/tests/kernel/t_proccwd.c:1.1
--- /dev/null	Sat Jun  1 19:49:03 2019
+++ src/tests/kernel/t_proccwd.c	Sat Jun  1 19:49:02 2019
@@ -0,0 +1,154 @@
+/*	$NetBSD: t_proccwd.c,v 1.1 2019/06/01 19:49:02 kamil Exp $	*/
+/*-
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT 

CVS commit: src

2019-06-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun  1 19:49:03 UTC 2019

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/kernel: Makefile
Added Files:
src/tests/kernel: t_proccwd.c

Log Message:
Add ATF KERN_PROC_CWD tests


To generate a diff of this commit:
cvs rdiff -u -r1.283 -r1.284 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.814 -r1.815 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.58 -r1.59 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/t_proccwd.c

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



Re: CVS commit: src/external/gpl3/gcc/dist/libsanitizer/tsan

2019-06-01 Thread Kamil Rytarowski
On 01.06.2019 19:22, Christos Zoulas wrote:
> Module Name:  src
> Committed By: christos
> Date: Sat Jun  1 17:22:58 UTC 2019
> 
> Modified Files:
>   src/external/gpl3/gcc/dist/libsanitizer/tsan: tsan_rtl_amd64.S
> 
> Log Message:
> Do as FreeBSD does now (I have not checked that the offsets are correct)
> 

These values differ on NetBSD.

There is upstreamed support into upstream repository here:

https://github.com/llvm-mirror/compiler-rt/tree/master/lib/tsan/rtl

Please grep for NetBSD specific code. We will get it with GCC9, maybe
GCC8.. but I would need to check.



signature.asc
Description: OpenPGP digital signature


CVS commit: src/sys/netinet

2019-06-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun  1 15:18:42 UTC 2019

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
Replace potentially misaligned pointer dereference + htonl() with be32dec()

Reported by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.413 -r1.414 src/sys/netinet/tcp_input.c

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



CVS commit: src/sys/netinet

2019-06-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun  1 15:18:42 UTC 2019

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
Replace potentially misaligned pointer dereference + htonl() with be32dec()

Reported by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.413 -r1.414 src/sys/netinet/tcp_input.c

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

Modified files:

Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.413 src/sys/netinet/tcp_input.c:1.414
--- src/sys/netinet/tcp_input.c:1.413	Thu Nov  8 06:43:52 2018
+++ src/sys/netinet/tcp_input.c	Sat Jun  1 15:18:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.413 2018/11/08 06:43:52 msaitoh Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.414 2019/06/01 15:18:42 kamil Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.413 2018/11/08 06:43:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.414 2019/06/01 15:18:42 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1350,11 +1350,11 @@ tcp_input(struct mbuf *m, int off, int p
 		if ((optlen == TCPOLEN_TSTAMP_APPA ||
 		 (optlen > TCPOLEN_TSTAMP_APPA &&
 		  optp[TCPOLEN_TSTAMP_APPA] == TCPOPT_EOL)) &&
-		*(u_int32_t *)optp == htonl(TCPOPT_TSTAMP_HDR) &&
+		be32dec(optp) == TCPOPT_TSTAMP_HDR &&
 		(th->th_flags & TH_SYN) == 0) {
 			opti.ts_present = 1;
-			opti.ts_val = ntohl(*(u_int32_t *)(optp + 4));
-			opti.ts_ecr = ntohl(*(u_int32_t *)(optp + 8));
+			opti.ts_val = be32dec(optp + 4);
+			opti.ts_ecr = be32dec(optp + 8);
 			optp = NULL;	/* we've parsed the options */
 		}
 	}



CVS commit: src/tests/kernel

2019-06-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun  1 22:18:23 UTC 2019

Modified Files:
src/tests/kernel: t_proccwd.c

Log Message:
Fix a mistake in a test for KERN_PROC_CWD

Emit properly ENOENT scenario in chroot. For some reason the final patch
did not hit the tree.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/kernel/t_proccwd.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/kernel/t_proccwd.c
diff -u src/tests/kernel/t_proccwd.c:1.1 src/tests/kernel/t_proccwd.c:1.2
--- src/tests/kernel/t_proccwd.c:1.1	Sat Jun  1 19:49:02 2019
+++ src/tests/kernel/t_proccwd.c	Sat Jun  1 22:18:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_proccwd.c,v 1.1 2019/06/01 19:49:02 kamil Exp $	*/
+/*	$NetBSD: t_proccwd.c,v 1.2 2019/06/01 22:18:23 kamil Exp $	*/
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,7 +28,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2019\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_proccwd.c,v 1.1 2019/06/01 19:49:02 kamil Exp $");
+__RCSID("$NetBSD: t_proccwd.c,v 1.2 2019/06/01 22:18:23 kamil Exp $");
 
 #include 
 #include 
@@ -84,7 +84,7 @@ ATF_TC_BODY(prompt_pid, tc)
 		ATF_REQUIRE_EQ(strlen(buf) + 1, prompted_len);
 		ATF_REQUIRE(strlen(buf) > 0);
 
-		if (t[i] == -1 || t[i] == getpid() || t[i] == getppid()) {
+		if (t[i] == -1 || t[i] == getpid()) {
 			getcwd(cwdbuf, MAXPATHLEN);
 			ATF_REQUIRE_EQ(strcmp(buf, cwdbuf), 0);
 			ATF_REQUIRE(strlen(buf) > strlen("/"));
@@ -133,7 +133,7 @@ ATF_TC_BODY(chroot, tc)
 		ASSERT(chroot(buf) == 0);
 
 		errno = 0;
-		rv = getproccwd(NULL, , pid_one);
+		rv = getproccwd(buf, , pid_one);
 		ASSERT(rv == -1);
 		ASSERT(errno == ENOENT);
 



CVS commit: src/tests/kernel

2019-06-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun  1 22:18:23 UTC 2019

Modified Files:
src/tests/kernel: t_proccwd.c

Log Message:
Fix a mistake in a test for KERN_PROC_CWD

Emit properly ENOENT scenario in chroot. For some reason the final patch
did not hit the tree.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/kernel/t_proccwd.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

2019-06-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun  1 21:42:02 UTC 2019

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

Log Message:
Fix CATPAGES entries in distrib files

Register CMSG_DATA.0, getcchar.0, acorn32/boot.0.

These files were marked as obsolete which is no longer true.


To generate a diff of this commit:
cvs rdiff -u -r1.2274 -r1.2275 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.1645 -r1.1646 src/distrib/sets/lists/man/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

2019-06-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun  1 21:42:02 UTC 2019

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

Log Message:
Fix CATPAGES entries in distrib files

Register CMSG_DATA.0, getcchar.0, acorn32/boot.0.

These files were marked as obsolete which is no longer true.


To generate a diff of this commit:
cvs rdiff -u -r1.2274 -r1.2275 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.1645 -r1.1646 src/distrib/sets/lists/man/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.2274 src/distrib/sets/lists/comp/mi:1.2275
--- src/distrib/sets/lists/comp/mi:1.2274	Sat May 18 08:38:00 2019
+++ src/distrib/sets/lists/comp/mi	Sat Jun  1 21:42:02 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2274 2019/05/18 08:38:00 mlelstv Exp $
+#	$NetBSD: mi,v 1.2275 2019/06/01 21:42:02 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -4614,7 +4614,7 @@
 ./usr/share/man/cat3/CIRCLEQ_NEXT.0		comp-obsolete		obsolete
 ./usr/share/man/cat3/CIRCLEQ_PREV.0		comp-obsolete		obsolete
 ./usr/share/man/cat3/CIRCLEQ_REMOVE.0		comp-obsolete		obsolete
-./usr/share/man/cat3/CMSG_DATA.0		comp-obsolete		obsolete
+./usr/share/man/cat3/CMSG_DATA.0		comp-c-catman		.cat
 ./usr/share/man/cat3/CMSG_FIRSTHDR.0		comp-c-catman		.cat
 ./usr/share/man/cat3/CMSG_LEN.0			comp-c-catman		.cat
 ./usr/share/man/cat3/CMSG_NXTHDR.0		comp-c-catman		.cat
@@ -7154,7 +7154,7 @@
 ./usr/share/man/cat3/getc.0			comp-c-catman		.cat
 ./usr/share/man/cat3/getc_unlocked.0		comp-c-catman		.cat
 ./usr/share/man/cat3/getcap.0			comp-obsolete		obsolete
-./usr/share/man/cat3/getcchar.0			comp-obsolete		obsolete
+./usr/share/man/cat3/getcchar.0			comp-c-catman		.cat
 ./usr/share/man/cat3/getch.0			comp-c-catman		.cat
 ./usr/share/man/cat3/getchar.0			comp-c-catman		.cat
 ./usr/share/man/cat3/getchar_unlocked.0		comp-c-catman		.cat

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1645 src/distrib/sets/lists/man/mi:1.1646
--- src/distrib/sets/lists/man/mi:1.1645	Sat Jun  1 13:21:27 2019
+++ src/distrib/sets/lists/man/mi	Sat Jun  1 21:42:02 2019
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1645 2019/06/01 13:21:27 jmcneill Exp $
+# $NetBSD: mi,v 1.1646 2019/06/01 21:42:02 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2346,7 +2346,7 @@
 ./usr/share/man/cat8/acorn26/boot26.0		man-obsolete		obsolete
 ./usr/share/man/cat8/acorn26/makedev.0		man-obsolete		obsolete
 ./usr/share/man/cat8/acorn32/MAKEDEV.0		man-obsolete		obsolete
-./usr/share/man/cat8/acorn32/boot.0		man-obsolete		obsolete
+./usr/share/man/cat8/acorn32/boot.0		man-sys-catman		.cat
 ./usr/share/man/cat8/acorn32/boot32.0		man-sys-catman		.cat
 ./usr/share/man/cat8/acorn32/makedev.0		man-obsolete		obsolete
 ./usr/share/man/cat8/acorn32/nbfs.0		man-sys-catman		.cat



CVS commit: src/include

2019-05-27 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon May 27 07:31:11 UTC 2019

Modified Files:
src/include: assert.h

Log Message:
As a _NETBSD_SOURCE extension define static_assert for pre-c11/c++99

Proposed on source-changes-d.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/include/assert.h

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

Modified files:

Index: src/include/assert.h
diff -u src/include/assert.h:1.23 src/include/assert.h:1.24
--- src/include/assert.h:1.23	Wed May 22 21:25:01 2019
+++ src/include/assert.h	Mon May 27 07:31:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: assert.h,v 1.23 2019/05/22 21:25:01 maya Exp $	*/
+/*	$NetBSD: assert.h,v 1.24 2019/05/27 07:31:11 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -105,8 +105,10 @@ void __diagassert13(const char *, int, c
 __END_DECLS
 #endif /* __ASSERT_DECLARED */
 
-#if defined(_ISOC11_SOURCE) || (__STDC_VERSION__ - 0) >= 201101L
 #ifndef static_assert
+#if defined(_ISOC11_SOURCE) || (__STDC_VERSION__ - 0) >= 201101L
 #define static_assert _Static_assert
+#elif defined(_NETBSD_SOURCE) && (__cplusplus - 0) < 201103L
+#define static_assert(x, y) __CTASSERT(x)
 #endif /* static_assert */
 #endif



CVS commit: src/include

2019-05-27 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon May 27 07:31:11 UTC 2019

Modified Files:
src/include: assert.h

Log Message:
As a _NETBSD_SOURCE extension define static_assert for pre-c11/c++99

Proposed on source-changes-d.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/include/assert.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/x86/x86

2019-05-28 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue May 28 16:43:24 UTC 2019

Modified Files:
src/sys/arch/x86/x86: procfs_machdep.c

Log Message:
Avoid the 1<<31 construct

Shift unsigned int rather than signed one.

Detected with kUBSan when reading /proc/cpuinfo.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/x86/x86/procfs_machdep.c

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

Modified files:

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.31 src/sys/arch/x86/x86/procfs_machdep.c:1.32
--- src/sys/arch/x86/x86/procfs_machdep.c:1.31	Thu May 16 04:26:13 2019
+++ src/sys/arch/x86/x86/procfs_machdep.c	Tue May 28 16:43:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.31 2019/05/16 04:26:13 msaitoh Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.32 2019/05/28 16:43:24 kamil Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.31 2019/05/16 04:26:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.32 2019/05/28 16:43:24 kamil Exp $");
 
 #include 
 #include 
@@ -235,7 +235,7 @@ procfs_getonefeatreg(uint32_t reg, const
 	size_t l;
 
 	for (size_t i = 0; i < 32; i++) {
-		if ((reg & (1 << i)) && table[i]) {
+		if ((reg & (1U << i)) && table[i]) {
 			l = snprintf(p, *left, "%s ", table[i]);
 			if (l < *left) {
 *left -= l;



CVS commit: src/sys/arch/x86/x86

2019-05-28 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue May 28 16:43:24 UTC 2019

Modified Files:
src/sys/arch/x86/x86: procfs_machdep.c

Log Message:
Avoid the 1<<31 construct

Shift unsigned int rather than signed one.

Detected with kUBSan when reading /proc/cpuinfo.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/x86/x86/procfs_machdep.c

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



CVS commit: src/doc

2019-06-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 14 16:11:12 UTC 2019

Modified Files:
src/doc: TODO.ptrace

Log Message:
Update TODO.ptrace

Drop compat32 entries as they were mostly addressed.
Drop MD specific calls, it's up to port's CPU to contain various features
like PT_STEP.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/doc/TODO.ptrace

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



CVS commit: src/doc

2019-06-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 14 16:11:12 UTC 2019

Modified Files:
src/doc: TODO.ptrace

Log Message:
Update TODO.ptrace

Drop compat32 entries as they were mostly addressed.
Drop MD specific calls, it's up to port's CPU to contain various features
like PT_STEP.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/doc/TODO.ptrace

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.ptrace
diff -u src/doc/TODO.ptrace:1.30 src/doc/TODO.ptrace:1.31
--- src/doc/TODO.ptrace:1.30	Sun Aug  5 13:07:33 2018
+++ src/doc/TODO.ptrace	Fri Jun 14 16:11:11 2019
@@ -1,4 +1,4 @@
-$NetBSD: TODO.ptrace,v 1.30 2018/08/05 13:07:33 kamil Exp $
+$NetBSD: TODO.ptrace,v 1.31 2019/06/14 16:11:11 kamil Exp $
 
 Items we (currently) plan to finish in the ptrace(2) field:
 
@@ -13,12 +13,8 @@ Items we (currently) plan to finish in t
GUI toolkits (and perhaps other libraries) - this is long term wishlist in
GDB for Linux - the current approach is to fork and debug through GDB remote
protocol (this is how it is done in LLDB)
- - add support for PT_STEP, PT_GETREGS, PT_SETREGS, PT_GETFPREGS, PT_SETFPREGS
-   in all ports
  - add ATF tests for SIGCHLD
- - fix more calls for netbsd32 compat
  - research kgdb(4)
- - check 64-bit debugger on 64-bit kernel tracing capabilities of 32-bit tracee
 
 and of course: fix as many bugs as possible.
 



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2019-06-11 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 12 04:20:18 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: vdev_disk.c

Log Message:
Fix build with -Wgnu-designator in the ZFS code

struct buf buf = { b_bcount: MAXPHYS }; is a legacy style designator
extension and this raised a compiler error reported by a.rin@mix.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.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/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.10 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.11
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.10	Tue Jun 11 09:04:37 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	Wed Jun 12 04:20:18 2019
@@ -224,7 +224,7 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi
 		dvd->vd_maxphys = (pdk ? disk_maxphys(pdk) : MACHINE_MAXPHYS);
 	*/
 	{
-		struct buf buf = { b_bcount: MAXPHYS };
+		struct buf buf = { .b_bcount = MAXPHYS };
 		const char *dev_name;
 
 		dev_name = devsw_blk2name(major(vp->v_rdev));



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2019-06-11 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 12 04:20:18 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: vdev_disk.c

Log Message:
Fix build with -Wgnu-designator in the ZFS code

struct buf buf = { b_bcount: MAXPHYS }; is a legacy style designator
extension and this raised a compiler error reported by a.rin@mix.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c

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



CVS commit: src/lib/libc/sys

2019-06-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 12 12:30:42 UTC 2019

Modified Files:
src/lib/libc/sys: ptrace.2

Log Message:
Try to make posix_spawn(3) note in ptrace(2) less confusing


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/lib/libc/sys/ptrace.2

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



CVS commit: src/lib/libc/sys

2019-06-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 12 12:30:42 UTC 2019

Modified Files:
src/lib/libc/sys: ptrace.2

Log Message:
Try to make posix_spawn(3) note in ptrace(2) less confusing


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/lib/libc/sys/ptrace.2

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/sys/ptrace.2
diff -u src/lib/libc/sys/ptrace.2:1.72 src/lib/libc/sys/ptrace.2:1.73
--- src/lib/libc/sys/ptrace.2:1.72	Wed Jun 12 10:09:26 2019
+++ src/lib/libc/sys/ptrace.2	Wed Jun 12 12:30:42 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ptrace.2,v 1.72 2019/06/12 10:09:26 wiz Exp $
+.\"	$NetBSD: ptrace.2,v 1.73 2019/06/12 12:30:42 kamil Exp $
 .\"
 .\" This file is in the public domain.
 .Dd June 12, 2019
@@ -489,20 +489,15 @@ The
 .Dv PTRACE_VFORK_DONE
 event can be used to report unblocking of the parent.
 .Pp
-The
-.Xr posix_spawn 3
-operation implements
-.Xr vfork 2
-and
-.Xr exec 3
-as a single syscall in the kernel.
+.Fn posix_spawn
+on
+.Nx
+directly creates the child process without intermediant fork.
 The
 .Dv PTRACE_POSIX_SPAWN
 event semantics are the same as
 .Dv PTRACE_FORK ,
-but the child is reported with implied
-.Xr exec 3
-operation.
+but the child is reported with implied execution of a file.
 .Pp
 A pointer to this structure is passed in
 .Fa addr .



CVS commit: src/lib/libc/gen

2019-06-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 12 12:26:24 UTC 2019

Modified Files:
src/lib/libc/gen: posix_spawn.3

Log Message:
Rephrase sentence about vfork+exec in posix_spawn(3)

Try to make it less confusing.

Requested by 


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/gen/posix_spawn.3

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/gen/posix_spawn.3
diff -u src/lib/libc/gen/posix_spawn.3:1.9 src/lib/libc/gen/posix_spawn.3:1.10
--- src/lib/libc/gen/posix_spawn.3:1.9	Wed Jun 12 00:05:48 2019
+++ src/lib/libc/gen/posix_spawn.3	Wed Jun 12 12:26:24 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: posix_spawn.3,v 1.9 2019/06/12 00:05:48 kamil Exp $
+.\" $NetBSD: posix_spawn.3,v 1.10 2019/06/12 12:26:24 kamil Exp $
 .\"
 .\" Copyright (c) 2008 Ed Schouten 
 .\" All rights reserved.
@@ -315,11 +315,10 @@ had been called by the child process to 
 This implementation does not run
 .Xr pthread_atfork 3
 callbacks.
-The
-.Xr vfork 2
-and
-.Xr exec 3
-operations are implemented as a single syscall.
+.Fn posix_spawn
+on
+.Nx
+directly creates the child process without intermediant fork.
 .Sh RETURN VALUES
 Upon successful completion,
 .Fn posix_spawn



CVS commit: src/lib/libc/gen

2019-06-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 12 12:26:24 UTC 2019

Modified Files:
src/lib/libc/gen: posix_spawn.3

Log Message:
Rephrase sentence about vfork+exec in posix_spawn(3)

Try to make it less confusing.

Requested by 


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/gen/posix_spawn.3

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

2019-06-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 10 22:16:06 UTC 2019

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

Log Message:
Add posix_spawn(3) ATF tests in t_ptrace_wait*

New tests verify whether forking process reports forking events to a
debugger.

Right now there is no support in the kernel for this system.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.123 src/tests/lib/libc/sys/t_ptrace_wait.c:1.124
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.123	Mon Jun 10 21:18:04 2019
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Mon Jun 10 22:16:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.123 2019/06/10 21:18:04 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.124 2019/06/10 22:16:06 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.123 2019/06/10 21:18:04 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.124 2019/06/10 22:16:06 kamil Exp $");
 
 #include 
 #include 
@@ -46,6 +46,7 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.12
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2985,7 +2986,7 @@ EVENTMASK_PRESERVED(eventmask_preserved_
 /// 
 
 static void
-fork_body(pid_t (*fn)(void), bool trackfork, bool trackvfork,
+fork_body(pid_t (*fn)(void), bool spawn, bool trackfork, bool trackvfork,
 bool trackvforkdone)
 {
 	const int exitval = 5;
@@ -3000,6 +3001,11 @@ fork_body(pid_t (*fn)(void), bool trackf
 	ptrace_event_t event;
 	const int elen = sizeof(event);
 
+	char * const arg[] = { __UNCONST("/bin/echo"), NULL };
+
+	if (spawn)
+		atf_tc_skip("posix_spawn() is not supported");
+
 	DPRINTF("Before forking process PID=%d\n", getpid());
 	SYSCALL_REQUIRE((child = fork()) != -1);
 	if (child == 0) {
@@ -3009,11 +3015,15 @@ fork_body(pid_t (*fn)(void), bool trackf
 		DPRINTF("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
-		FORKEE_ASSERT((child2 = (fn)()) != -1);
-
-		if (child2 == 0)
-			_exit(exitval2);
+		if (spawn) {
+			FORKEE_ASSERT_EQ(posix_spawn(,
+			arg[0], NULL, NULL, arg, NULL), 0);
+		} else if (fn == fork || fn == vfork) {
+			FORKEE_ASSERT((child2 = (fn)()) != -1);
 
+			if (child2 == 0)
+_exit(exitval2);
+		}
 		FORKEE_REQUIRE_SUCCESS
 		(wpid = TWAIT_GENERIC(child2, , 0), child2);
 
@@ -3158,7 +3168,7 @@ fork_body(pid_t (*fn)(void), bool trackf
 	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, , 0));
 }
 
-#define FORK_TEST(name,fun,tfork,tvfork,tvforkdone)			\
+#define FORK_TEST(name,fun,spawn,tfork,tvfork,tvforkdone)		\
 ATF_TC(name);\
 ATF_TC_HEAD(name, tc)			\
 {	\
@@ -3172,37 +3182,51 @@ ATF_TC_HEAD(name, tc)			\
 ATF_TC_BODY(name, tc)			\
 {	\
 	\
-	fork_body(fun, tfork, tvfork, tvforkdone);			\
+	fork_body(fun, spawn, tfork, tvfork, tvforkdone);		\
 }
 
-FORK_TEST(fork1, fork, false, false, false)
+FORK_TEST(fork1, fork, false, false, false, false)
 #if defined(TWAIT_HAVE_PID)
-FORK_TEST(fork2, fork, true, false, false)
-FORK_TEST(fork3, fork, false, true, false)
-FORK_TEST(fork4, fork, true, true, false)
+FORK_TEST(fork2, fork, false, true, false, false)
+FORK_TEST(fork3, fork, false, false, true, false)
+FORK_TEST(fork4, fork, false, true, true, false)
 #endif
-FORK_TEST(fork5, fork, false, false, true)
+FORK_TEST(fork5, fork, false, false, false, true)
 #if defined(TWAIT_HAVE_PID)
-FORK_TEST(fork6, fork, true, false, true)
-FORK_TEST(fork7, fork, false, true, true)
-FORK_TEST(fork8, fork, true, true, true)
+FORK_TEST(fork6, fork, false, true, false, true)
+FORK_TEST(fork7, fork, false, false, true, true)
+FORK_TEST(fork8, fork, false, true, true, true)
 #endif
 
 #if TEST_VFORK_ENABLED
-FORK_TEST(vfork1, vfork, false, false, false)
+FORK_TEST(vfork1, vfork, false, false, false, false)
 #if defined(TWAIT_HAVE_PID)
-FORK_TEST(vfork2, vfork, true, false, false)
-FORK_TEST(vfork3, vfork, false, true, false)
-FORK_TEST(vfork4, vfork, true, true, false)
+FORK_TEST(vfork2, vfork, false, true, false, false)
+FORK_TEST(vfork3, vfork, false, false, true, false)
+FORK_TEST(vfork4, vfork, false, true, true, false)
 #endif
-FORK_TEST(vfork5, vfork, false, false, true)
+FORK_TEST(vfork5, vfork, false, false, false, true)
 #if defined(TWAIT_HAVE_PID)
-FORK_TEST(vfork6, vfork, true, false, true)
-FORK_TEST(vfork7, vfork, false, true, true)
-FORK_TEST(vfork8, vfork, true, true, true)
+FORK_TEST(vfork6, vfork, false, true, false, true)
+FORK_TEST(vfork7, vfork, false, false, true, true)
+FORK_TEST(vfork8, vfork, false, true, true, true)
 

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

2019-06-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 10 22:16:06 UTC 2019

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

Log Message:
Add posix_spawn(3) ATF tests in t_ptrace_wait*

New tests verify whether forking process reports forking events to a
debugger.

Right now there is no support in the kernel for this system.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/tests/lib/libc/sys/t_ptrace_wait.c

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



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

2019-06-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 10 21:18:04 UTC 2019

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

Log Message:
Add more verbosity to debug messages in t_ptrace_wait

Log func() file:line for each debug message.

Most messages are similar one with the other and this change allows easier
navigation in the code.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/tests/lib/libc/sys/t_ptrace_wait.c

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



CVS commit: src/lib/libc/gen

2019-06-11 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 11 12:47:34 UTC 2019

Modified Files:
src/lib/libc/gen: posix_spawn.3

Log Message:
Correct outdated note that posix_spawn(3) is implemented with vfork(2)

The original FreeBSD libc code uses vfork(2), it's not the case for NetBSD
as there is a dedicated kernel syscall.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/gen/posix_spawn.3

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



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

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 17 14:31:51 UTC 2019

Modified Files:
src/sys/arch/i386/include: ptrace.h

Log Message:
Define PTRACE_ILLEGAL_ASM for i386


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/include/ptrace.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/ia64/include

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 17 15:08:34 UTC 2019

Modified Files:
src/sys/arch/ia64/include: mcontext.h

Log Message:
Enhance ia64/mcontext defines

Stop mapping _UC_MACHINE_FP() to a register as it is not supported by CPU.
There is need to use in code __builtin_frame_address() inlined in the code
to get the frame pointer.

Return a constant value 0 instead. New value does not pretend to return
a meaningful value.

While there, fix the definition of _UC_MACHINE_SET_PC as it didn't contain
the pc argument in the definition.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/ia64/include/mcontext.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/ia64/include

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 17 15:08:34 UTC 2019

Modified Files:
src/sys/arch/ia64/include: mcontext.h

Log Message:
Enhance ia64/mcontext defines

Stop mapping _UC_MACHINE_FP() to a register as it is not supported by CPU.
There is need to use in code __builtin_frame_address() inlined in the code
to get the frame pointer.

Return a constant value 0 instead. New value does not pretend to return
a meaningful value.

While there, fix the definition of _UC_MACHINE_SET_PC as it didn't contain
the pc argument in the definition.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/ia64/include/mcontext.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/ia64/include/mcontext.h
diff -u src/sys/arch/ia64/include/mcontext.h:1.8 src/sys/arch/ia64/include/mcontext.h:1.9
--- src/sys/arch/ia64/include/mcontext.h:1.8	Thu Apr 26 18:06:25 2018
+++ src/sys/arch/ia64/include/mcontext.h	Mon Jun 17 15:08:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.8 2018/04/26 18:06:25 scole Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.9 2019/06/17 15:08:34 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -112,10 +112,10 @@ typedef struct __mcontext {
 } mcontext_t;
 
 #define _UC_MACHINE_SP(uc)	((uc)->uc_mcontext.mc_special.sp)  /* gregs[12] */
-#define _UC_MACHINE_FP(uc)	((uc)->uc_mcontext.__gregs[79])
+#define _UC_MACHINE_FP(uc)	0 /* Not supported in target */
 #define	_UC_MACHINE_PC(uc)	((uc)->uc_mcontext.mc_special.iip)
 #define	_UC_MACHINE_INTRV(uc)	((uc)->uc_mcontext.__gregs[8])
-#define _UC_MACHINE_SET_PC(uc)  _UC_MACHINE_PC(uc) = (pc)  /* XXX */
+#define _UC_MACHINE_SET_PC(uc, pc)	(uc)->uc_mcontext.mc_special.iip = (pc)
 
 static __inline void *
 __lwp_getprivate_fast(void)



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

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 17 14:31:51 UTC 2019

Modified Files:
src/sys/arch/i386/include: ptrace.h

Log Message:
Define PTRACE_ILLEGAL_ASM for i386


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/include/ptrace.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/i386/include/ptrace.h
diff -u src/sys/arch/i386/include/ptrace.h:1.20 src/sys/arch/i386/include/ptrace.h:1.21
--- src/sys/arch/i386/include/ptrace.h:1.20	Tue May 22 21:03:09 2018
+++ src/sys/arch/i386/include/ptrace.h	Mon Jun 17 14:31:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.20 2018/05/22 21:03:09 kamil Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.21 2019/06/17 14:31:51 kamil Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -111,6 +111,8 @@
 #define PTRACE_REG_SP(r)	(r)->r_esp
 #define PTRACE_REG_INTRV(r)	(r)->r_eax
 
+#define PTRACE_ILLEGAL_ASM	__asm __volatile ("ud2" : : : "memory")
+
 #define PTRACE_BREAKPOINT	((const uint8_t[]) { 0xcc })
 #define PTRACE_BREAKPOINT_ASM	__asm __volatile ("int3" : : : "memory")
 #define PTRACE_BREAKPOINT_SIZE	1



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

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 14:25:04 UTC 2019

Modified Files:
src/lib/libc/compat/sys: compat_mknod.c

Log Message:
Fix warning message for mknod symbol linkage

The correct reference for mknod(2) is in 


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/compat/sys/compat_mknod.c

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



CVS commit: src/common/lib/libc/misc

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 17 18:55:37 UTC 2019

Modified Files:
src/common/lib/libc/misc: ubsan.c

Log Message:
Introduce UBSAN_ALWAYS_FATAL in micro-UBSan

UBSAN_ALWAYS_FATAL is a CPP option to mark all reports fatal always.


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

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

Modified files:

Index: src/common/lib/libc/misc/ubsan.c
diff -u src/common/lib/libc/misc/ubsan.c:1.5 src/common/lib/libc/misc/ubsan.c:1.6
--- src/common/lib/libc/misc/ubsan.c:1.5	Wed Feb 13 17:17:02 2019
+++ src/common/lib/libc/misc/ubsan.c	Mon Jun 17 18:55:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsan.c,v 1.5 2019/02/13 17:17:02 kamil Exp $	*/
+/*	$NetBSD: ubsan.c,v 1.6 2019/06/17 18:55:37 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,9 +38,9 @@
 
 #include 
 #if defined(_KERNEL)
-__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.5 2019/02/13 17:17:02 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.6 2019/06/17 18:55:37 kamil Exp $");
 #else
-__RCSID("$NetBSD: ubsan.c,v 1.5 2019/02/13 17:17:02 kamil Exp $");
+__RCSID("$NetBSD: ubsan.c,v 1.6 2019/06/17 18:55:37 kamil Exp $");
 #endif
 
 #if defined(_KERNEL)
@@ -79,6 +79,12 @@ __RCSID("$NetBSD: ubsan.c,v 1.5 2019/02/
 #define CLR(t, f)	((t) &= ~(f))
 #endif
 
+#ifdef UBSAN_ALWAYS_FATAL
+static const bool alwaysFatal = true;
+#else
+static const bool alwaysFatal = false;
+#endif
+
 #define REINTERPRET_CAST(__dt, __st)	((__dt)(__st))
 #define STATIC_CAST(__dt, __st)		((__dt)(__st))
 
@@ -1122,7 +1128,7 @@ Report(bool isFatal, const char *pFormat
 
 	va_start(ap, pFormat);
 #if defined(_KERNEL)
-	if (isFatal)
+	if (isFatal || alwaysFatal)
 		vpanic(pFormat, ap);
 	else
 		vprintf(pFormat, ap);
@@ -1190,7 +1196,7 @@ Report(bool isFatal, const char *pFormat
 		ubsan_vsyslog(LOG_DEBUG | LOG_USER, , pFormat, tmp);
 		va_end(tmp);
 	}
-	if (isFatal || ISSET(ubsan_flags, UBSAN_ABORT)) {
+	if (isFatal || alwaysFatal || ISSET(ubsan_flags, UBSAN_ABORT)) {
 		abort();
 		__unreachable();
 		/* NOTREACHED */



CVS commit: src/common/lib/libc/misc

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 17 18:55:37 UTC 2019

Modified Files:
src/common/lib/libc/misc: ubsan.c

Log Message:
Introduce UBSAN_ALWAYS_FATAL in micro-UBSan

UBSAN_ALWAYS_FATAL is a CPP option to mark all reports fatal always.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/misc/ubsan.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

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 17 19:01:18 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC

Log Message:
Register UBSAN_ALWAYS_FATAL in kernel configs for kUBSan


To generate a diff of this commit:
cvs rdiff -u -r1.529 -r1.530 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1207 -r1.1208 src/sys/arch/i386/conf/GENERIC

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

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.529 src/sys/arch/amd64/conf/GENERIC:1.530
--- src/sys/arch/amd64/conf/GENERIC:1.529	Sat Jun 15 06:40:34 2019
+++ src/sys/arch/amd64/conf/GENERIC	Mon Jun 17 19:01:17 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.529 2019/06/15 06:40:34 maxv Exp $
+# $NetBSD: GENERIC,v 1.530 2019/06/17 19:01:17 kamil Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.529 $"
+#ident		"GENERIC-$Revision: 1.530 $"
 
 maxusers	64		# estimated number of users
 
@@ -116,6 +116,7 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 #options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
 makeoptions	DEBUG="-g"	# compile full symbol table for CTF
 #options	KUBSAN		# Kernel Undefined Behavior Sanitizer (kUBSan)
+#options	UBSAN_ALWAYS_FATAL	# (optional) Panic on all kUBSan reports
 #options 	SYSCALL_STATS	# per syscall counts
 #options 	SYSCALL_TIMES	# per syscall times
 #options 	SYSCALL_TIMES_HASCOUNTER	# use 'broken' rdtsc (soekris)

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1207 src/sys/arch/i386/conf/GENERIC:1.1208
--- src/sys/arch/i386/conf/GENERIC:1.1207	Fri May 24 14:28:48 2019
+++ src/sys/arch/i386/conf/GENERIC	Mon Jun 17 19:01:17 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1207 2019/05/24 14:28:48 nonaka Exp $
+# $NetBSD: GENERIC,v 1.1208 2019/06/17 19:01:17 kamil Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1207 $"
+#ident		"GENERIC-$Revision: 1.1208 $"
 
 maxusers	64		# estimated number of users
 
@@ -121,6 +121,7 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 #options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
 #makeoptions	DEBUG="-g"	# compile full symbol table
 #options	KUBSAN		# Kernel Undefined Behavior Sanitizer (kUBSan)
+#options	UBSAN_ALWAYS_FATAL	# (optional) Panic on all kUBSan reports
 #options 	SYSCALL_STATS	# per syscall counts
 #options 	SYSCALL_TIMES	# per syscall times
 #options 	SYSCALL_TIMES_HASCOUNTER	# use 'broken' rdtsc (soekris)



CVS commit: src/sys/arch

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 17 19:01:18 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC

Log Message:
Register UBSAN_ALWAYS_FATAL in kernel configs for kUBSan


To generate a diff of this commit:
cvs rdiff -u -r1.529 -r1.530 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1207 -r1.1208 src/sys/arch/i386/conf/GENERIC

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



CVS commit: src/sys/sys

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 22:40:09 UTC 2019

Modified Files:
src/sys/sys: lwp.h

Log Message:
Stop defining in lwp.h: LSDEAD

Not used since NetBSD-5.0.

It had a confusing comment that suggested that all entries after LSDEAD
are removed, which wasn't true.


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/sys/sys/lwp.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/sys/lwp.h
diff -u src/sys/sys/lwp.h:1.184 src/sys/sys/lwp.h:1.185
--- src/sys/sys/lwp.h:1.184	Thu Jun 13 20:20:18 2019
+++ src/sys/sys/lwp.h	Tue Jun 18 22:40:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.184 2019/06/13 20:20:18 kamil Exp $	*/
+/*	$NetBSD: lwp.h,v 1.185 2019/06/18 22:40:09 kamil Exp $	*/
 
 /*
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
@@ -287,8 +287,7 @@ extern int		maxlwp __read_mostly;	/* max
 #define	LSSLEEP		3	/* Sleeping on an address. */
 #define	LSSTOP		4	/* Process debugging or suspension. */
 #define	LSZOMB		5	/* Awaiting collection by parent. */
-/* unused, for source compatibility with NetBSD 4.0 and earlier. */
-#define	LSDEAD		6	/* Process is almost a zombie. */
+/* define	LSDEAD	6	Process is almost a zombie. (removed in 5.0) */
 #define	LSONPROC	7	/* Process is currently on a CPU. */
 #define	LSSUSPENDED	8	/* Not running, not signalable. */
 



CVS commit: src/sys/sys

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 22:40:09 UTC 2019

Modified Files:
src/sys/sys: lwp.h

Log Message:
Stop defining in lwp.h: LSDEAD

Not used since NetBSD-5.0.

It had a confusing comment that suggested that all entries after LSDEAD
are removed, which wasn't true.


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/sys/sys/lwp.h

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



Re: CVS commit: src/bin/ps

2019-06-18 Thread Kamil Rytarowski
On 19.06.2019 00:31, matthew green wrote:
> "Kamil Rytarowski" writes:
>> Module Name: src
>> Committed By:kamil
>> Date:Tue Jun 18 02:23:29 UTC 2019
>>
>> Modified Files:
>>  src/bin/ps: print.c
>>
>> Log Message:
>> Make LSDEAD usage conditional
>>
>> LSDEAD is not used since NetBSD-5.0 and will be gone.
>>
>> The same conditional usage is already in ps.c in the same program.
> 
> please revert this so that it works on netbsd-4 and earlier
> kernels.
> 
> ps(1) is expected to be binary compatible for a very long
> time now.
> 
> 
> .mrg.
> 

It still works on NetBSD-4 kernels (if it doesn't, it's not caused by
this change).

The only difference is that it will print '?' for (LS)DEAD process
(short-lived state).

sysstat ps.c has this change for a long time now.

How about this change:

Index: bin/ps/print.c
===
RCS file: /cvsroot/src/bin/ps/print.c,v
retrieving revision 1.131
diff -u -r1.131 print.c
--- bin/ps/print.c  18 Jun 2019 02:23:29 -  1.131
+++ bin/ps/print.c  19 Jun 2019 00:01:20 -
@@ -588,6 +588,8 @@
case LSZOMB:
 #ifdef LSDEAD
case LSDEAD:
+#else
+   case 6:
 #endif
*cp = 'Z';
break;



signature.asc
Description: OpenPGP digital signature


CVS commit: src/sys/sys

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 22:41:32 UTC 2019

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome 8.99.46!

do_sys_mknod{,at}() changes
quota modules refactoring


To generate a diff of this commit:
cvs rdiff -u -r1.593 -r1.594 src/sys/sys/param.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/sys/param.h
diff -u src/sys/sys/param.h:1.593 src/sys/sys/param.h:1.594
--- src/sys/sys/param.h:1.593	Thu Jun 13 20:23:56 2019
+++ src/sys/sys/param.h	Tue Jun 18 22:41:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.593 2019/06/13 20:23:56 kamil Exp $	*/
+/*	$NetBSD: param.h,v 1.594 2019/06/18 22:41:32 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	899004500	/* NetBSD 8.99.45 */
+#define	__NetBSD_Version__	899004600	/* NetBSD 8.99.46 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/sys

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 22:41:32 UTC 2019

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome 8.99.46!

do_sys_mknod{,at}() changes
quota modules refactoring


To generate a diff of this commit:
cvs rdiff -u -r1.593 -r1.594 src/sys/sys/param.h

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



CVS commit: src/sys/kern

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 23:53:55 UTC 2019

Modified Files:
src/sys/kern: kern_exec.c kern_sig.c

Log Message:
Add support for KTR logs of SIGTRAP for TRAP_CHILD events

Previously it was disabled due to vfork(2) synchronization issues.
These problems are now gone.

While there, set l_vforkwaiting to false in posix_spawn. This is not very
needed but it does not make harm to keep it initialized explicitly.


To generate a diff of this commit:
cvs rdiff -u -r1.467 -r1.468 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.360 -r1.361 src/sys/kern/kern_sig.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

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 21:14:26 UTC 2019

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

Log Message:
Allow to conditionally enable LWP ATF tests in t_ptrace_wait*

By default the tests are disabled.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.127 src/tests/lib/libc/sys/t_ptrace_wait.c:1.128
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.127	Thu Jun 13 20:26:06 2019
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Tue Jun 18 21:14:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.127 2019/06/13 20:26:06 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.128 2019/06/18 21:14:26 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.127 2019/06/13 20:26:06 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.128 2019/06/18 21:14:26 kamil Exp $");
 
 #include 
 #include 
@@ -103,6 +103,10 @@ static int debug = 0;
 #define TEST_VFORK_ENABLED 1
 #endif
 
+#ifndef TEST_LWP_ENABLED
+#define TEST_LWP_ENABLED 0
+#endif
+
 /// 
 
 static void
@@ -5454,8 +5458,10 @@ trace_threads(bool trace_create, bool tr
 	/* Track created and exited threads */
 	bool traced_lwps[__arraycount(t)];
 
+#if !TEST_LWP_ENABLED
 	if (trace_create || trace_exit)
 		atf_tc_skip("PR kern/51995");
+#endif
 
 	DPRINTF("Before forking process PID=%d\n", getpid());
 	SYSCALL_REQUIRE((child = fork()) != -1);



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

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 21:14:26 UTC 2019

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

Log Message:
Allow to conditionally enable LWP ATF tests in t_ptrace_wait*

By default the tests are disabled.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/tests/lib/libc/sys/t_ptrace_wait.c

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



CVS commit: src/sys/arch

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 21:18:13 UTC 2019

Modified Files:
src/sys/arch/aarch64/include: ptrace.h
src/sys/arch/alpha/include: ptrace.h
src/sys/arch/amd64/include: ptrace.h
src/sys/arch/arm/include: ptrace.h
src/sys/arch/hppa/include: ptrace.h
src/sys/arch/i386/include: ptrace.h
src/sys/arch/ia64/include: ptrace.h
src/sys/arch/m68k/include: ptrace.h
src/sys/arch/mips/include: ptrace.h
src/sys/arch/or1k/include: ptrace.h
src/sys/arch/powerpc/include: ptrace.h
src/sys/arch/riscv/include: ptrace.h
src/sys/arch/sh3/include: ptrace.h
src/sys/arch/sparc/include: ptrace.h
src/sys/arch/vax/include: ptrace.h

Log Message:
Introduce PTRACE_REG_FP() a helper macro to retrieve the frame pointer

The macro is dummy for ia64 (the FP register is unknown and can change
freely) and sparc/sparc64 (not stored in struct reg).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/include/ptrace.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/include/ptrace.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amd64/include/ptrace.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/include/ptrace.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hppa/include/ptrace.h
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/include/ptrace.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/ia64/include/ptrace.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/m68k/include/ptrace.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/mips/include/ptrace.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/or1k/include/ptrace.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/include/ptrace.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/riscv/include/ptrace.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sh3/include/ptrace.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sparc/include/ptrace.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/vax/include/ptrace.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

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 21:18:13 UTC 2019

Modified Files:
src/sys/arch/aarch64/include: ptrace.h
src/sys/arch/alpha/include: ptrace.h
src/sys/arch/amd64/include: ptrace.h
src/sys/arch/arm/include: ptrace.h
src/sys/arch/hppa/include: ptrace.h
src/sys/arch/i386/include: ptrace.h
src/sys/arch/ia64/include: ptrace.h
src/sys/arch/m68k/include: ptrace.h
src/sys/arch/mips/include: ptrace.h
src/sys/arch/or1k/include: ptrace.h
src/sys/arch/powerpc/include: ptrace.h
src/sys/arch/riscv/include: ptrace.h
src/sys/arch/sh3/include: ptrace.h
src/sys/arch/sparc/include: ptrace.h
src/sys/arch/vax/include: ptrace.h

Log Message:
Introduce PTRACE_REG_FP() a helper macro to retrieve the frame pointer

The macro is dummy for ia64 (the FP register is unknown and can change
freely) and sparc/sparc64 (not stored in struct reg).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/include/ptrace.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/include/ptrace.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amd64/include/ptrace.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/include/ptrace.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hppa/include/ptrace.h
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/include/ptrace.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/ia64/include/ptrace.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/m68k/include/ptrace.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/mips/include/ptrace.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/or1k/include/ptrace.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/include/ptrace.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/riscv/include/ptrace.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sh3/include/ptrace.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sparc/include/ptrace.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/vax/include/ptrace.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/aarch64/include/ptrace.h
diff -u src/sys/arch/aarch64/include/ptrace.h:1.8 src/sys/arch/aarch64/include/ptrace.h:1.9
--- src/sys/arch/aarch64/include/ptrace.h:1.8	Thu Dec 13 10:44:25 2018
+++ src/sys/arch/aarch64/include/ptrace.h	Tue Jun 18 21:18:11 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ptrace.h,v 1.8 2018/12/13 10:44:25 ryo Exp $ */
+/* $NetBSD: ptrace.h,v 1.9 2019/06/18 21:18:11 kamil Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -57,6 +57,7 @@
 
 #include 
 #define PTRACE_REG_PC(r)	(r)->r_pc
+#define PTRACE_REG_FP(r)	(r)->r_reg[29]
 #define PTRACE_REG_SET_PC(r, v)	(r)->r_pc = (v)
 #define PTRACE_REG_SP(r)	(r)->r_sp
 #define PTRACE_REG_INTRV(r)	(r)->r_reg[0]

Index: src/sys/arch/alpha/include/ptrace.h
diff -u src/sys/arch/alpha/include/ptrace.h:1.9 src/sys/arch/alpha/include/ptrace.h:1.10
--- src/sys/arch/alpha/include/ptrace.h:1.9	Wed Apr 12 18:17:59 2017
+++ src/sys/arch/alpha/include/ptrace.h	Tue Jun 18 21:18:11 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ptrace.h,v 1.9 2017/04/12 18:17:59 kamil Exp $ */
+/* $NetBSD: ptrace.h,v 1.10 2019/06/18 21:18:11 kamil Exp $ */
 
 /*
  * Copyright (c) 1994 Christopher G. Demetriou
@@ -48,6 +48,7 @@
 #include 
 
 #define PTRACE_REG_PC(r)	(r)->r_regs[R_ZERO]
+#define PTRACE_REG_FP(r)	(r)->r_regs[R_S6]
 #define PTRACE_REG_SET_PC(r, v)	(r)->r_regs[R_ZERO] = (v)
 #define PTRACE_REG_SP(r)	(r)->r_regs[R_SP]
 #define PTRACE_REG_INTRV(r)	(r)->r_regs[R_V0]

Index: src/sys/arch/amd64/include/ptrace.h
diff -u src/sys/arch/amd64/include/ptrace.h:1.14 src/sys/arch/amd64/include/ptrace.h:1.15
--- src/sys/arch/amd64/include/ptrace.h:1.14	Tue Jun  4 16:29:53 2019
+++ src/sys/arch/amd64/include/ptrace.h	Tue Jun 18 21:18:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.14 2019/06/04 16:29:53 mgorny Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.15 2019/06/18 21:18:11 kamil Exp $	*/
 
 /*
  * Copyright (c) 1993 Christopher G. Demetriou
@@ -59,6 +59,7 @@
 
 #include 
 #define PTRACE_REG_PC(r)	(r)->regs[_REG_RIP]
+#define PTRACE_REG_FP(r)	(r)->regs[_REG_RBP]
 #define PTRACE_REG_SET_PC(r, v)	(r)->regs[_REG_RIP] = (v)
 #define PTRACE_REG_SP(r)	(r)->regs[_REG_RSP]
 #define PTRACE_REG_INTRV(r)	(r)->regs[_REG_RAX]

Index: src/sys/arch/arm/include/ptrace.h
diff -u src/sys/arch/arm/include/ptrace.h:1.14 src/sys/arch/arm/include/ptrace.h:1.15
--- src/sys/arch/arm/include/ptrace.h:1.14	Tue Jun 18 15:21:19 2019
+++ src/sys/arch/arm/include/ptrace.h	Tue Jun 18 21:18:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.14 2019/06/18 15:21:19 skrll Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.15 2019/06/18 21:18:12 kamil Exp $	*/
 
 /*
  * Copyright (c) 1995 Frank Lancaster
@@ -60,6 +60,7 @@
 
 #include 
 #define PTRACE_REG_PC(_r)		(_r)->r_pc
+#define PTRACE_REG_FP(_r)		(_r)->r[11]
 #define PTRACE_REG_SET_PC(_r, _v)	(_r)->r_pc = (_v)
 #define PTRACE_REG_SP(_r)		(_r)->r_sp
 #define PTRACE_REG_INTRV(_r)		(_r)->r[0]

Index: src/sys/arch/hppa/include/ptrace.h

CVS commit: src

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 22:34:26 UTC 2019

Modified Files:
src/external/cddl/osnet/sys/kern: ddi.c
src/sys/compat/common: vfs_syscalls_50.c
src/sys/compat/linux/common: linux_file.c
src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_netbsd.c
src/sys/kern: vfs_syscalls.c
src/sys/rump/librump/rumpvfs: devnodes.c
src/sys/sys: vfs_syscalls.h

Log Message:
Drop unused retval pointer from do_sys_mknod{,at}()

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/sys/kern/ddi.c
cvs rdiff -u -r1.22 -r1.23 src/sys/compat/common/vfs_syscalls_50.c
cvs rdiff -u -r1.115 -r1.116 src/sys/compat/linux/common/linux_file.c
cvs rdiff -u -r1.37 -r1.38 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.226 -r1.227 src/sys/compat/netbsd32/netbsd32_netbsd.c
cvs rdiff -u -r1.528 -r1.529 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.12 -r1.13 src/sys/rump/librump/rumpvfs/devnodes.c
cvs rdiff -u -r1.23 -r1.24 src/sys/sys/vfs_syscalls.h

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



CVS commit: src/sys/kern

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 23:53:55 UTC 2019

Modified Files:
src/sys/kern: kern_exec.c kern_sig.c

Log Message:
Add support for KTR logs of SIGTRAP for TRAP_CHILD events

Previously it was disabled due to vfork(2) synchronization issues.
These problems are now gone.

While there, set l_vforkwaiting to false in posix_spawn. This is not very
needed but it does not make harm to keep it initialized explicitly.


To generate a diff of this commit:
cvs rdiff -u -r1.467 -r1.468 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.360 -r1.361 src/sys/kern/kern_sig.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_exec.c
diff -u src/sys/kern/kern_exec.c:1.467 src/sys/kern/kern_exec.c:1.468
--- src/sys/kern/kern_exec.c:1.467	Thu Jun 13 20:20:18 2019
+++ src/sys/kern/kern_exec.c	Tue Jun 18 23:53:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.467 2019/06/13 20:20:18 kamil Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.468 2019/06/18 23:53:55 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.467 2019/06/13 20:20:18 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.468 2019/06/18 23:53:55 kamil Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -2470,6 +2470,7 @@ do_posix_spawn(struct lwp *l1, pid_t *pi
 	}
 
 	p2->p_lflag = 0;
+	l1->l_vforkwaiting = false;
 	p2->p_sflag = 0;
 	p2->p_slflag = 0;
 	p2->p_pptr = p1;

Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.360 src/sys/kern/kern_sig.c:1.361
--- src/sys/kern/kern_sig.c:1.360	Thu Jun 13 00:07:19 2019
+++ src/sys/kern/kern_sig.c	Tue Jun 18 23:53:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.360 2019/06/13 00:07:19 kamil Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.361 2019/06/18 23:53:55 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.360 2019/06/13 00:07:19 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.361 2019/06/18 23:53:55 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -1621,9 +1621,12 @@ eventswitch(int code)
 
 	sigswitch(0, signo, false);
 
-	/* XXX: hangs for VFORK */
-	if (code == TRAP_CHLD)
-		return;
+	if (code == TRAP_CHLD) {
+		mutex_enter(proc_lock);
+		while (l->l_vforkwaiting)
+			cv_wait(>l_waitcv, proc_lock);
+		mutex_exit(proc_lock);
+	}
 
 	if (ktrpoint(KTR_PSIG)) {
 		if (p->p_emul->e_ktrpsig)



CVS commit: src

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 22:34:26 UTC 2019

Modified Files:
src/external/cddl/osnet/sys/kern: ddi.c
src/sys/compat/common: vfs_syscalls_50.c
src/sys/compat/linux/common: linux_file.c
src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_netbsd.c
src/sys/kern: vfs_syscalls.c
src/sys/rump/librump/rumpvfs: devnodes.c
src/sys/sys: vfs_syscalls.h

Log Message:
Drop unused retval pointer from do_sys_mknod{,at}()

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/sys/kern/ddi.c
cvs rdiff -u -r1.22 -r1.23 src/sys/compat/common/vfs_syscalls_50.c
cvs rdiff -u -r1.115 -r1.116 src/sys/compat/linux/common/linux_file.c
cvs rdiff -u -r1.37 -r1.38 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.226 -r1.227 src/sys/compat/netbsd32/netbsd32_netbsd.c
cvs rdiff -u -r1.528 -r1.529 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.12 -r1.13 src/sys/rump/librump/rumpvfs/devnodes.c
cvs rdiff -u -r1.23 -r1.24 src/sys/sys/vfs_syscalls.h

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

Modified files:

Index: src/external/cddl/osnet/sys/kern/ddi.c
diff -u src/external/cddl/osnet/sys/kern/ddi.c:1.7 src/external/cddl/osnet/sys/kern/ddi.c:1.8
--- src/external/cddl/osnet/sys/kern/ddi.c:1.7	Wed May 22 08:44:48 2019
+++ src/external/cddl/osnet/sys/kern/ddi.c	Tue Jun 18 22:34:26 2019
@@ -613,7 +613,6 @@ ddi_create_minor_node(dev_info_t *dip, c
 	char *pn;
 	dev_t dev;
 	int error;
-	register_t ret;
 
 	pn = PNBUF_GET();
 	if (spec_type == S_IFCHR) {
@@ -649,7 +648,7 @@ ddi_create_minor_node(dev_info_t *dip, c
 		(void)do_sys_unlink(pn, UIO_SYSSPACE);
 	}
 
-	error = do_sys_mknod(l, pn, spec_type, dev, , UIO_SYSSPACE);
+	error = do_sys_mknod(l, pn, spec_type, dev, UIO_SYSSPACE);
 
 exit:
 	PNBUF_PUT(pn);

Index: src/sys/compat/common/vfs_syscalls_50.c
diff -u src/sys/compat/common/vfs_syscalls_50.c:1.22 src/sys/compat/common/vfs_syscalls_50.c:1.23
--- src/sys/compat/common/vfs_syscalls_50.c:1.22	Mon Jun 17 14:59:15 2019
+++ src/sys/compat/common/vfs_syscalls_50.c	Tue Jun 18 22:34:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_50.c,v 1.22 2019/06/17 14:59:15 christos Exp $	*/
+/*	$NetBSD: vfs_syscalls_50.c,v 1.23 2019/06/18 22:34:25 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.22 2019/06/17 14:59:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.23 2019/06/18 22:34:25 kamil Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -343,7 +343,7 @@ compat_50_sys_mknod(struct lwp *l,
 		syscallarg(uint32_t) dev;
 	} */
 	return do_sys_mknod(l, SCARG(uap, path), SCARG(uap, mode),
-	SCARG(uap, dev), retval, UIO_USERSPACE);
+	SCARG(uap, dev), UIO_USERSPACE);
 }
 
 #ifdef QUOTA

Index: src/sys/compat/linux/common/linux_file.c
diff -u src/sys/compat/linux/common/linux_file.c:1.115 src/sys/compat/linux/common/linux_file.c:1.116
--- src/sys/compat/linux/common/linux_file.c:1.115	Sun Mar  1 13:19:39 2015
+++ src/sys/compat/linux/common/linux_file.c	Tue Jun 18 22:34:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_file.c,v 1.115 2015/03/01 13:19:39 njoly Exp $	*/
+/*	$NetBSD: linux_file.c,v 1.116 2019/06/18 22:34:25 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.115 2015/03/01 13:19:39 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.116 2019/06/18 22:34:25 kamil Exp $");
 
 #include 
 #include 
@@ -675,8 +675,7 @@ linux_sys_mknodat(struct lwp *l, const s
 		 */
 
 		return do_sys_mknodat(l, SCARG(uap, fd), SCARG(uap, path),
-		SCARG(uap, mode), SCARG(uap, dev) & 0x, retval,
-		UIO_USERSPACE);
+		SCARG(uap, mode), SCARG(uap, dev) & 0x, UIO_USERSPACE);
 	}
 }
 

Index: src/sys/compat/netbsd32/netbsd32_compat_50.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.37 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.38
--- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.37	Tue Jun 18 01:37:03 2019
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c	Tue Jun 18 22:34:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_50.c,v 1.37 2019/06/18 01:37:03 christos Exp $	*/
+/*	$NetBSD: netbsd32_compat_50.c,v 1.38 2019/06/18 22:34:25 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.37 2019/06/18 01:37:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.38 2019/06/18 22:34:25 kamil Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -117,7 +117,7 @@ compat_50_netbsd32_mknod(struct lwp *l,
 		syscallarg(uint32_t) 

CVS commit: src/bin/ps

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 02:23:29 UTC 2019

Modified Files:
src/bin/ps: print.c

Log Message:
Make LSDEAD usage conditional

LSDEAD is not used since NetBSD-5.0 and will be gone.

The same conditional usage is already in ps.c in the same program.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/bin/ps/print.c

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

Modified files:

Index: src/bin/ps/print.c
diff -u src/bin/ps/print.c:1.130 src/bin/ps/print.c:1.131
--- src/bin/ps/print.c:1.130	Wed Sep 19 15:20:39 2018
+++ src/bin/ps/print.c	Tue Jun 18 02:23:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: print.c,v 1.130 2018/09/19 15:20:39 maxv Exp $	*/
+/*	$NetBSD: print.c,v 1.131 2019/06/18 02:23:29 kamil Exp $	*/
 
 /*
  * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)print.c	8.6 (Berkeley) 4/16/94";
 #else
-__RCSID("$NetBSD: print.c,v 1.130 2018/09/19 15:20:39 maxv Exp $");
+__RCSID("$NetBSD: print.c,v 1.131 2019/06/18 02:23:29 kamil Exp $");
 #endif
 #endif /* not lint */
 
@@ -586,7 +586,9 @@ lstate(struct pinfo *pi, VARENT *ve, enu
 		break;
 
 	case LSZOMB:
+#ifdef LSDEAD
 	case LSDEAD:
+#endif
 		*cp = 'Z';
 		break;
 



CVS commit: src/bin/ps

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 18 02:23:29 UTC 2019

Modified Files:
src/bin/ps: print.c

Log Message:
Make LSDEAD usage conditional

LSDEAD is not used since NetBSD-5.0 and will be gone.

The same conditional usage is already in ps.c in the same program.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/bin/ps/print.c

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



CVS commit: src/tools/compat

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 19 03:40:15 UTC 2019

Modified Files:
src/tools/compat: compat_defs.h configure configure.ac
nbtool_config.h.in

Log Message:
Add sys/uio.h & enum uio_seg, enum uio_rw to tools/compat

This is needed for bootstrapping the tools on Ubuntu 16.x.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/tools/compat/compat_defs.h
cvs rdiff -u -r1.93 -r1.94 src/tools/compat/configure
cvs rdiff -u -r1.94 -r1.95 src/tools/compat/configure.ac
cvs rdiff -u -r1.49 -r1.50 src/tools/compat/nbtool_config.h.in

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

Modified files:

Index: src/tools/compat/compat_defs.h
diff -u src/tools/compat/compat_defs.h:1.114 src/tools/compat/compat_defs.h:1.115
--- src/tools/compat/compat_defs.h:1.114	Thu Aug 30 12:05:34 2018
+++ src/tools/compat/compat_defs.h	Wed Jun 19 03:40:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_defs.h,v 1.114 2018/08/30 12:05:34 christos Exp $	*/
+/*	$NetBSD: compat_defs.h,v 1.115 2019/06/19 03:40:15 kamil Exp $	*/
 
 #ifndef	__NETBSD_COMPAT_DEFS_H__
 #define	__NETBSD_COMPAT_DEFS_H__
@@ -52,6 +52,17 @@ typedef unsigned int id_t;
 typedef int socklen_t;
 #endif
 
+#if !HAVE_ENUM_UIO_RW
+enum uio_rw { UIO_READ, UIO_WRITE };
+#endif
+
+#if !HAVE_ENUM_UIO_SEG
+enum uio_seg {
+	UIO_USERSPACE,		/* from user data space */
+	UIO_SYSSPACE		/* from system space */
+};
+#endif
+
 #if !HAVE_U_LONG
 typedef unsigned long u_long;
 #endif
@@ -113,6 +124,10 @@ typedef unsigned short u_short;
 #include 
 #endif
 
+#if HAVE_SYS_UIO_H
+#include 
+#endif
+
 #ifdef _NETBSD_SOURCE
 #error _NETBSD_SOURCE is *not* to be defined.
 #endif

Index: src/tools/compat/configure
diff -u src/tools/compat/configure:1.93 src/tools/compat/configure:1.94
--- src/tools/compat/configure:1.93	Thu Aug 30 12:05:34 2018
+++ src/tools/compat/configure	Wed Jun 19 03:40:15 2019
@@ -4098,7 +4098,8 @@ fi
 fi
 
 for ac_header in sys/mtio.h sys/sysmacros.h sys/syslimits.h stdio_ext.h \
-	getopt.h features.h malloc.h sys/poll.h pthread.h stddef.h rpc/types.h
+	getopt.h features.h malloc.h sys/poll.h pthread.h stddef.h rpc/types.h \
+	sys/uio.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -4240,6 +4241,54 @@ $as_echo "#define HAVE_SOCKLEN_T 1" >>co
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for enum uio_rw" >&5
+$as_echo_n "checking for enum uio_rw... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include 
+#ifdef HAVE_SYS_UIO_H
+#include 
+#endif
+int
+main ()
+{
+enum uio_rw rw;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+$as_echo "#define HAVE_ENUM_UIO_RW 1" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for enum uio_seg" >&5
+$as_echo_n "checking for enum uio_seg... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include 
+#ifdef HAVE_SYS_UIO_H
+#include 
+#endif
+int
+main ()
+{
+enum uio_seg seg;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+$as_echo "#define HAVE_ENUM_UIO_SEG 1" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
 
 
 
@@ -7416,4 +7465,3 @@ if test -n "$ac_unrecognized_opts" && te
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
-

Index: src/tools/compat/configure.ac
diff -u src/tools/compat/configure.ac:1.94 src/tools/compat/configure.ac:1.95
--- src/tools/compat/configure.ac:1.94	Thu Aug 30 12:05:34 2018
+++ src/tools/compat/configure.ac	Wed Jun 19 03:40:15 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: configure.ac,v 1.94 2018/08/30 12:05:34 christos Exp $
+#	$NetBSD: configure.ac,v 1.95 2019/06/19 03:40:15 kamil Exp $
 #
 # Autoconf definition file for libnbcompat.
 #
@@ -79,7 +79,8 @@ AC_CHECK_HEADERS(sys/ioctl.h sys/mman.h 
 # Find headers that may not be available.
 AC_HEADER_DIRENT
 AC_CHECK_HEADERS(sys/mtio.h sys/sysmacros.h sys/syslimits.h stdio_ext.h \
-	getopt.h features.h malloc.h sys/poll.h pthread.h stddef.h rpc/types.h)
+	getopt.h features.h malloc.h sys/poll.h pthread.h stddef.h rpc/types.h \
+	sys/uio.h)
 AC_CHECK_HEADERS(sys/bswap.h machine/bswap.h sys/cdefs.h machine/endian.h \
 	sys/endian.h sys/featuretest.h err.h inttypes.h libgen.h paths.h \
 	libgen.h stdint.h util.h resolv.h arpa/nameser.h,,
@@ -105,6 +106,24 @@ AC_CHECK_TYPE(socklen_t, [AC_DEFINE([HAV
 #endif
 #include ])
 
+AC_MSG_CHECKING([for enum uio_rw])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include 
+#ifdef HAVE_SYS_UIO_H
+#include 
+#endif]],
+[[enum uio_rw rw;]])],[AC_DEFINE([HAVE_ENUM_UIO_RW], 1,
+			[Define if you have the enum uio_rw 

CVS commit: src/tools/compat

2019-06-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 19 03:40:15 UTC 2019

Modified Files:
src/tools/compat: compat_defs.h configure configure.ac
nbtool_config.h.in

Log Message:
Add sys/uio.h & enum uio_seg, enum uio_rw to tools/compat

This is needed for bootstrapping the tools on Ubuntu 16.x.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/tools/compat/compat_defs.h
cvs rdiff -u -r1.93 -r1.94 src/tools/compat/configure
cvs rdiff -u -r1.94 -r1.95 src/tools/compat/configure.ac
cvs rdiff -u -r1.49 -r1.50 src/tools/compat/nbtool_config.h.in

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



Re: CVS commit: src/tools

2019-06-22 Thread Kamil Rytarowski
On 22.06.2019 15:42, Juergen Hannken-Illjes wrote:
> Module Name:  src
> Committed By: hannken
> Date: Sat Jun 22 13:42:53 UTC 2019
> 
> Modified Files:
>   src/tools/compat: configure configure.ac nbtool_config.h.in
>   src/tools/rpcgen: Makefile
> 
> Log Message:
> Update tools/compat/configure for new path of "rpc/types.h".
> 
> Remove intermediate patch from rpcgen/Makefile.
> 

Why intermediate? It worked for me and it was final. Was there anything
wrong with it?

Other compat tools include in the same way other headers from compat/.

How is the never version better than the older one?

> @@ -5111,8 +5130,6 @@ else
>  # ifdef _MSC_VER
>  #  include 
>  #  define alloca _alloca
> -# elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) 
> || defined(__OpenBSD__)
> -#   include 
>  # else
>  #  ifdef HAVE_ALLOCA_H
>  #   include 

This looks like unintended change?




signature.asc
Description: OpenPGP digital signature


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

2019-06-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 12 17:07:11 UTC 2019

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

Log Message:
Add new ATF ptrace(2) tests for posix_spawn, reusing tests for fork/vfork

New tests:
 - posix_spawn_detach_spawner
 - posix_spawn_kill_spawner
 - posix_spawn_singalmasked
 - posix_spawn_singalignored

All test pass.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/tests/lib/libc/sys/t_ptrace_wait.c

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



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

2019-06-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 12 17:07:11 UTC 2019

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

Log Message:
Add new ATF ptrace(2) tests for posix_spawn, reusing tests for fork/vfork

New tests:
 - posix_spawn_detach_spawner
 - posix_spawn_kill_spawner
 - posix_spawn_singalmasked
 - posix_spawn_singalignored

All test pass.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.125 src/tests/lib/libc/sys/t_ptrace_wait.c:1.126
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.125	Tue Jun 11 23:30:05 2019
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Wed Jun 12 17:07:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.125 2019/06/11 23:30:05 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.126 2019/06/12 17:07:11 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.125 2019/06/11 23:30:05 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.126 2019/06/12 17:07:11 kamil Exp $");
 
 #include 
 #include 
@@ -3195,7 +3195,7 @@ ATF_TC_HEAD(name, tc)			\
 {	\
 	atf_tc_set_md_var(tc, "descr", "Verify " fun "() "		\
 	"called with 0%s%s%s%s in EVENT_MASK",			\
-	tspawn ? "|PTRACE_FORK" : "",\
+	tspawn ? "|PTRACE_POSIX_SPAWN" : "",			\
 	tfork ? "|PTRACE_FORK" : "",\
 	tvfork ? "|PTRACE_VFORK" : "",\
 	tvforkdone ? "|PTRACE_VFORK_DONE" : "");			\
@@ -3282,11 +3282,10 @@ FORK_TEST(posix_spawn16, "spawn", true, 
 
 #if defined(TWAIT_HAVE_PID)
 static void
-fork_detach_forker_body(bool detachfork, bool detachvfork,
-bool detachvforkdone, bool kill_process)
+fork_detach_forker_body(const char *fn, bool kill_process)
 {
 	const int exitval = 5;
-	const int exitval2 = 15;
+	const int exitval2 = 0; /* Matches exit value from /bin/echo */
 	const int sigval = SIGSTOP;
 	pid_t child, child2 = 0, wpid;
 #if defined(TWAIT_HAVE_STATUS)
@@ -3297,17 +3296,9 @@ fork_detach_forker_body(bool detachfork,
 	ptrace_event_t event;
 	const int elen = sizeof(event);
 
-	pid_t (*fn)(void);
 	int op;
 
-	ATF_REQUIRE((detachfork && !detachvfork && !detachvforkdone) ||
-	(!detachfork && detachvfork && !detachvforkdone) ||
-	(!detachfork && !detachvfork && detachvforkdone));
-
-	if (detachfork)
-		fn = fork;
-	else
-		fn = vfork;
+	char * const arg[] = { __UNCONST("/bin/echo"), NULL };
 
 	DPRINTF("Before forking process PID=%d\n", getpid());
 	SYSCALL_REQUIRE((child = fork()) != -1);
@@ -3318,10 +3309,19 @@ fork_detach_forker_body(bool detachfork,
 		DPRINTF("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
-		FORKEE_ASSERT((child2 = (fn)()) != -1);
+		if (strcmp(fn, "spawn") == 0) {
+			FORKEE_ASSERT_EQ(posix_spawn(,
+			arg[0], NULL, NULL, arg, NULL), 0);
+		} else  {
+			if (strcmp(fn, "fork") == 0) {
+FORKEE_ASSERT((child2 = fork()) != -1);
+			} else {
+FORKEE_ASSERT((child2 = vfork()) != -1);
+			}
 
-		if (child2 == 0)
-			_exit(exitval2);
+			if (child2 == 0)
+_exit(exitval2);
+		}
 
 		FORKEE_REQUIRE_SUCCESS
 		(wpid = TWAIT_GENERIC(child2, , 0), child2);
@@ -3339,7 +3339,8 @@ fork_detach_forker_body(bool detachfork,
 	validate_status_stopped(status, sigval);
 
 	DPRINTF("Set EVENT_MASK for the child %d\n", child);
-	event.pe_set_event = PTRACE_FORK | PTRACE_VFORK | PTRACE_VFORK_DONE;
+	event.pe_set_event = PTRACE_POSIX_SPAWN | PTRACE_FORK | PTRACE_VFORK
+		| PTRACE_VFORK_DONE;
 	SYSCALL_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, , elen) != -1);
 
 	DPRINTF("Before resuming the child process where it left off and "
@@ -3353,13 +3354,21 @@ fork_detach_forker_body(bool detachfork,
 
 	SYSCALL_REQUIRE(
 	ptrace(PT_GET_PROCESS_STATE, child, , slen) != -1);
-	op = (fn == fork) ? PTRACE_FORK : PTRACE_VFORK;
+
+	if (strcmp(fn, "spawn") == 0)
+		op = PTRACE_POSIX_SPAWN;
+	else if (strcmp(fn, "fork") == 0)
+		op = PTRACE_FORK;
+	else
+		op = PTRACE_VFORK;
+
 	ATF_REQUIRE_EQ(state.pe_report_event & op, op);
 
 	child2 = state.pe_other_pid;
 	DPRINTF("Reported ptrace event with forkee %d\n", child2);
 
-	if (detachfork || detachvfork)
+	if (strcmp(fn, "spawn") == 0 || strcmp(fn, "fork") == 0 ||
+	strcmp(fn, "vfork") == 0)
 		op = kill_process ? PT_KILL : PT_DETACH;
 	else
 		op = PT_CONTINUE;
@@ -3373,7 +3382,13 @@ fork_detach_forker_body(bool detachfork,
 
 	SYSCALL_REQUIRE(
 	ptrace(PT_GET_PROCESS_STATE, child2, , slen) != -1);
-	op = (fn == fork) ? PTRACE_FORK : PTRACE_VFORK;
+	if (strcmp(fn, "spawn") == 0)
+		op = PTRACE_POSIX_SPAWN;
+	else if (strcmp(fn, "fork") == 0)
+		op = PTRACE_FORK;
+	else
+		op = PTRACE_VFORK;
+	
 	ATF_REQUIRE_EQ(state.pe_report_event 

CVS commit: src/sys/sys

2019-06-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 13 20:23:56 UTC 2019

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome to 8.99.45!

struct lwp includes now l_vforkwaiting.


To generate a diff of this commit:
cvs rdiff -u -r1.592 -r1.593 src/sys/sys/param.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/sys/param.h
diff -u src/sys/sys/param.h:1.592 src/sys/sys/param.h:1.593
--- src/sys/sys/param.h:1.592	Tue Jun 11 23:20:18 2019
+++ src/sys/sys/param.h	Thu Jun 13 20:23:56 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.592 2019/06/11 23:20:18 kamil Exp $	*/
+/*	$NetBSD: param.h,v 1.593 2019/06/13 20:23:56 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	899004400	/* NetBSD 8.99.44 */
+#define	__NetBSD_Version__	899004500	/* NetBSD 8.99.45 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/sys

2019-06-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 13 20:23:56 UTC 2019

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome to 8.99.45!

struct lwp includes now l_vforkwaiting.


To generate a diff of this commit:
cvs rdiff -u -r1.592 -r1.593 src/sys/sys/param.h

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



CVS commit: src/sys

2019-06-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 13 20:20:18 UTC 2019

Modified Files:
src/sys/kern: kern_exec.c kern_exit.c kern_fork.c
src/sys/sys: lwp.h

Log Message:
Correct use-after-free issue in vfork(2)

In the previous behavior vforking parent was keeping pointer to a child
and checking whether it clears a PL_PPWAIT in its bitfield p_lflag. However
a child can go invalid between exec/exit event from child and waking up
vforked parent and this can cause invalid pointer read and in the worst
scenario kernel crash.

In the new behavior vforked child keeps a reference to vforked parent LWP
and sets a value l_vforkwaiting to false. This means that vforked child
can finish its work, exec/exit and be terminated and once parent will be
woken up it will read its own field whether its child is still blocking.

Add new field in struct lwp: l_vforkwaiting protected by proc_lock.
In future it should be refactored and all PL_PPWAIT users transformed to
l_vforkwaiting and next l_vforkwaiting probably transformed into a bit
field.

This is another attempt of fixing this bug after  from 2012 in
commit:

Author: rmind 
Date:   Sun Jul 22 22:40:18 2012 +

fork1: fix use-after-free problems.  Addresses PR/46128 from Andrew Doran.
Note: PL_PPWAIT should be fully replaced and modificaiton of l_pflag by
other LWP is undesirable, but this is enough for netbsd-6.

The new version no longer performs unsafe access in l_lflag changing the
LP_VFORKWAIT bit.

Verified with ATF t_vfork and t_ptrace* tests and they are no longer
causing any issues in my local setup.

Fixes PR/46128 by Andrew Doran


To generate a diff of this commit:
cvs rdiff -u -r1.466 -r1.467 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.275 -r1.276 src/sys/kern/kern_exit.c
cvs rdiff -u -r1.212 -r1.213 src/sys/kern/kern_fork.c
cvs rdiff -u -r1.183 -r1.184 src/sys/sys/lwp.h

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



CVS commit: src/sys

2019-06-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 13 20:20:18 UTC 2019

Modified Files:
src/sys/kern: kern_exec.c kern_exit.c kern_fork.c
src/sys/sys: lwp.h

Log Message:
Correct use-after-free issue in vfork(2)

In the previous behavior vforking parent was keeping pointer to a child
and checking whether it clears a PL_PPWAIT in its bitfield p_lflag. However
a child can go invalid between exec/exit event from child and waking up
vforked parent and this can cause invalid pointer read and in the worst
scenario kernel crash.

In the new behavior vforked child keeps a reference to vforked parent LWP
and sets a value l_vforkwaiting to false. This means that vforked child
can finish its work, exec/exit and be terminated and once parent will be
woken up it will read its own field whether its child is still blocking.

Add new field in struct lwp: l_vforkwaiting protected by proc_lock.
In future it should be refactored and all PL_PPWAIT users transformed to
l_vforkwaiting and next l_vforkwaiting probably transformed into a bit
field.

This is another attempt of fixing this bug after  from 2012 in
commit:

Author: rmind 
Date:   Sun Jul 22 22:40:18 2012 +

fork1: fix use-after-free problems.  Addresses PR/46128 from Andrew Doran.
Note: PL_PPWAIT should be fully replaced and modificaiton of l_pflag by
other LWP is undesirable, but this is enough for netbsd-6.

The new version no longer performs unsafe access in l_lflag changing the
LP_VFORKWAIT bit.

Verified with ATF t_vfork and t_ptrace* tests and they are no longer
causing any issues in my local setup.

Fixes PR/46128 by Andrew Doran


To generate a diff of this commit:
cvs rdiff -u -r1.466 -r1.467 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.275 -r1.276 src/sys/kern/kern_exit.c
cvs rdiff -u -r1.212 -r1.213 src/sys/kern/kern_fork.c
cvs rdiff -u -r1.183 -r1.184 src/sys/sys/lwp.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/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.466 src/sys/kern/kern_exec.c:1.467
--- src/sys/kern/kern_exec.c:1.466	Tue Jun 11 23:18:55 2019
+++ src/sys/kern/kern_exec.c	Thu Jun 13 20:20:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.466 2019/06/11 23:18:55 kamil Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.467 2019/06/13 20:20:18 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.466 2019/06/11 23:18:55 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.467 2019/06/13 20:20:18 kamil Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -1207,10 +1207,17 @@ execve_runproc(struct lwp *l, struct exe
 	 * exited and exec()/exit() are the only places it will be cleared.
 	 */
 	if ((p->p_lflag & PL_PPWAIT) != 0) {
+		lwp_t *lp;
+
 		mutex_enter(proc_lock);
+		lp = p->p_vforklwp;
+		p->p_vforklwp = NULL;
+
 		l->l_lwpctl = NULL; /* was on loan from blocked parent */
 		p->p_lflag &= ~PL_PPWAIT;
-		cv_broadcast(>p_pptr->p_waitcv);
+		lp->l_vforkwaiting = false;
+
+		cv_broadcast(>l_waitcv);
 		mutex_exit(proc_lock);
 	}
 

Index: src/sys/kern/kern_exit.c
diff -u src/sys/kern/kern_exit.c:1.275 src/sys/kern/kern_exit.c:1.276
--- src/sys/kern/kern_exit.c:1.275	Fri May 17 03:34:26 2019
+++ src/sys/kern/kern_exit.c	Thu Jun 13 20:20:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exit.c,v 1.275 2019/05/17 03:34:26 ozaki-r Exp $	*/
+/*	$NetBSD: kern_exit.c,v 1.276 2019/06/13 20:20:18 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.275 2019/05/17 03:34:26 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.276 2019/06/13 20:20:18 kamil Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -342,9 +342,15 @@ exit1(struct lwp *l, int exitcode, int s
 	 */
 	mutex_enter(proc_lock);
 	if (p->p_lflag & PL_PPWAIT) {
+		lwp_t *lp;
+
 		l->l_lwpctl = NULL; /* was on loan from blocked parent */
 		p->p_lflag &= ~PL_PPWAIT;
-		cv_broadcast(>p_pptr->p_waitcv);
+
+		lp = p->p_vforklwp;
+		p->p_vforklwp = NULL;
+		lp->l_vforkwaiting = false;
+		cv_broadcast(>l_waitcv);
 	}
 
 	if (SESS_LEADER(p)) {

Index: src/sys/kern/kern_fork.c
diff -u src/sys/kern/kern_fork.c:1.212 src/sys/kern/kern_fork.c:1.213
--- src/sys/kern/kern_fork.c:1.212	Fri May  3 22:34:21 2019
+++ src/sys/kern/kern_fork.c	Thu Jun 13 20:20:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_fork.c,v 1.212 2019/05/03 22:34:21 kamil Exp $	*/
+/*	$NetBSD: kern_fork.c,v 1.213 2019/06/13 20:20:18 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.212 2019/05/03 22:34:21 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.213 2019/06/13 20:20:18 kamil Exp $");
 
 #include 

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

2019-06-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 13 20:26:06 UTC 2019

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

Log Message:
Enable vfork(2) ATF tests in t_ptrace_wait*

The racing issues are gone in my local setup.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.126 src/tests/lib/libc/sys/t_ptrace_wait.c:1.127
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.126	Wed Jun 12 17:07:11 2019
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Thu Jun 13 20:26:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.126 2019/06/12 17:07:11 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.127 2019/06/13 20:26:06 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.126 2019/06/12 17:07:11 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.127 2019/06/13 20:26:06 kamil Exp $");
 
 #include 
 #include 
@@ -100,7 +100,7 @@ static int debug = 0;
 while (/*CONSTCOND*/0)
 
 #ifndef TEST_VFORK_ENABLED
-#define TEST_VFORK_ENABLED 0
+#define TEST_VFORK_ENABLED 1
 #endif
 
 /// 



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

2019-06-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 13 20:26:06 UTC 2019

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

Log Message:
Enable vfork(2) ATF tests in t_ptrace_wait*

The racing issues are gone in my local setup.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/tests/lib/libc/sys/t_ptrace_wait.c

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



CVS commit: src/sys/kern

2019-06-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 13 00:07:19 UTC 2019

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

Log Message:
Correct inversed condition for dying process in sigswitch()

If a process is exiting and it was not asked to relock proc_lock, do not
free the mutex as it causes panic. This bug is a timing bug as the faulty
condition is not deterministic and fires only somtimes, but is quickly
triggerable when executed in an infinite loop.

Detected and reported with LLDB test-suite by 


To generate a diff of this commit:
cvs rdiff -u -r1.359 -r1.360 src/sys/kern/kern_sig.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_sig.c
diff -u src/sys/kern/kern_sig.c:1.359 src/sys/kern/kern_sig.c:1.360
--- src/sys/kern/kern_sig.c:1.359	Tue Jun  4 11:54:03 2019
+++ src/sys/kern/kern_sig.c	Thu Jun 13 00:07:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.359 2019/06/04 11:54:03 kamil Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.360 2019/06/13 00:07:19 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.359 2019/06/04 11:54:03 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.360 2019/06/13 00:07:19 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -1654,7 +1654,7 @@ sigswitch(int ppmask, int signo, bool re
 	 */
 	if (__predict_false(ISSET(p->p_sflag, PS_WEXIT))) {
 		mutex_exit(p->p_lock);
-		if (relock) {
+		if (!relock) {
 			mutex_exit(proc_lock);
 		}
 		lwp_exit(l);



CVS commit: src/sys/kern

2019-06-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 13 00:07:19 UTC 2019

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

Log Message:
Correct inversed condition for dying process in sigswitch()

If a process is exiting and it was not asked to relock proc_lock, do not
free the mutex as it causes panic. This bug is a timing bug as the faulty
condition is not deterministic and fires only somtimes, but is quickly
triggerable when executed in an infinite loop.

Detected and reported with LLDB test-suite by 


To generate a diff of this commit:
cvs rdiff -u -r1.359 -r1.360 src/sys/kern/kern_sig.c

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



CVS commit: src/external/gpl3/gdb/dist/gdb

2019-06-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 14 01:00:52 UTC 2019

Modified Files:
src/external/gpl3/gdb/dist/gdb: nbsd-nat.c

Log Message:
Enhance the GDB support for NetBSD

- Enable VFORK events
- Add syscall number for SCE/SCX events
- Add commented out posix_spawn(3) events


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/gdb/dist/gdb/nbsd-nat.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/gpl3/gdb/dist/gdb/nbsd-nat.c
diff -u src/external/gpl3/gdb/dist/gdb/nbsd-nat.c:1.11 src/external/gpl3/gdb/dist/gdb/nbsd-nat.c:1.12
--- src/external/gpl3/gdb/dist/gdb/nbsd-nat.c:1.11	Tue May 28 15:30:39 2019
+++ src/external/gpl3/gdb/dist/gdb/nbsd-nat.c	Fri Jun 14 01:00:52 2019
@@ -233,12 +233,13 @@ nbsd_enable_proc_events (pid_t pid)
 	  sizeof (events)) == -1)
 perror_with_name (("ptrace"));
   events |= PTRACE_FORK;
-#ifdef notyet
   events |= PTRACE_VFORK;
   events |= PTRACE_VFORK_DONE;
-#endif
   events |= PTRACE_LWP_CREATE;
   events |= PTRACE_LWP_EXIT;
+#if notyet
+  events |= PTRACE_POSIX_SPAWN;
+#endif
   if (ptrace (PT_SET_EVENT_MASK, pid, (PTRACE_TYPE_ARG3),
 	  sizeof (events)) == -1)
 perror_with_name (("ptrace"));
@@ -381,11 +382,11 @@ nbsd_nat_target::wait (ptid_t ptid, stru
   break;
 case TRAP_SCE:
   ourstatus->kind = TARGET_WAITKIND_SYSCALL_ENTRY;
-//  ourstatus->value.syscall_number = 0;
+  ourstatus->value.syscall_number = psi.psi_siginfo.si_sysnum;
   break;
 case TRAP_SCX:
   ourstatus->kind = TARGET_WAITKIND_SYSCALL_RETURN;
-//  ourstatus->value.syscall_number = 0;
+  ourstatus->value.syscall_number = psi.psi_siginfo.si_sysnum;
   break;
 case TRAP_EXEC:
   ourstatus->kind = TARGET_WAITKIND_EXECD;



CVS commit: src/external/gpl3/gdb/dist/gdb

2019-06-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 14 01:00:52 UTC 2019

Modified Files:
src/external/gpl3/gdb/dist/gdb: nbsd-nat.c

Log Message:
Enhance the GDB support for NetBSD

- Enable VFORK events
- Add syscall number for SCE/SCX events
- Add commented out posix_spawn(3) events


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/gdb/dist/gdb/nbsd-nat.c

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



CVS commit: src/doc/roadmaps

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 17 17:45:18 UTC 2019

Modified Files:
src/doc/roadmaps: verification

Log Message:
Drop asan/ubsan entry, implemented as MKSANITIZER and MKLIBCSANITIZER


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/doc/roadmaps/verification

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

Modified files:

Index: src/doc/roadmaps/verification
diff -u src/doc/roadmaps/verification:1.1 src/doc/roadmaps/verification:1.2
--- src/doc/roadmaps/verification:1.1	Fri Jan 13 10:14:58 2017
+++ src/doc/roadmaps/verification	Mon Jun 17 17:45:18 2019
@@ -1,4 +1,4 @@
-$NetBSD: verification,v 1.1 2017/01/13 10:14:58 dholland Exp $
+$NetBSD: verification,v 1.2 2019/06/17 17:45:18 kamil Exp $
 
 NetBSD Verification Roadmap
 ===
@@ -9,7 +9,6 @@ to verification and quality control.
 The following elements, projects, and goals are relatively near-term:
 
  1. Cut down the Coverity backlog
- 2. Deploy asan/ubsan
  3. Deploy clang-static-analyzer
 
 The following elements, projects, and goals are longer-term:
@@ -39,18 +38,6 @@ finds are pretty easily fixed, or are fa
  - Contact christos for further information.
 
 
-2. Deploy asan/ubsan
-
-It ought to be possible to build any program in NetBSD, or the whole
-world, using asan and/or ubsan. Currently there isn't an easy way to
-do this. We should also do regular test runs with asan and ubsan
-engaged.
-
- - As of January 2017 nobody is known to be working on this.
- - There is currently no clear timeframe or release target.
- - Contact joerg (?) for further information.
-
-
 3. Deploy clang-static-analyzer
 
 There is some makefile support for running clang-static-analyzer, but



CVS commit: src/doc/roadmaps

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 17 17:45:18 UTC 2019

Modified Files:
src/doc/roadmaps: verification

Log Message:
Drop asan/ubsan entry, implemented as MKSANITIZER and MKLIBCSANITIZER


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/doc/roadmaps/verification

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/include

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 17 17:53:22 UTC 2019

Modified Files:
src/sys/arch/arm/include: ptrace.h

Log Message:
Define PTRACE_ILLEGAL_ASM for arm (32-bit)

udf $0 is expected to raise SIGILL for all ARM 32-bit targets.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/include/ptrace.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/arm/include/ptrace.h
diff -u src/sys/arch/arm/include/ptrace.h:1.12 src/sys/arch/arm/include/ptrace.h:1.13
--- src/sys/arch/arm/include/ptrace.h:1.12	Wed Dec 27 19:35:05 2017
+++ src/sys/arch/arm/include/ptrace.h	Mon Jun 17 17:53:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.12 2017/12/27 19:35:05 christos Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.13 2019/06/17 17:53:22 kamil Exp $	*/
 
 /*
  * Copyright (c) 1995 Frank Lancaster
@@ -64,6 +64,8 @@
 #define PTRACE_REG_SP(_r)		(_r)->r_sp
 #define PTRACE_REG_INTRV(_r)		(_r)->r[0]
 
+#define PTRACE_ILLEGAL_ASM	__asm __volatile ("udf $0" : : : "memory")
+
 #ifdef __ARMEB__
 #define PTRACE_BREAKPOINT	((const uint8_t[]) { 0xfe, 0xde, 0xff, 0xe7 })
 #define PTRACE_BREAKPOINT_INSN	0xfedeffe7



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

2019-06-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Jun 17 17:53:22 UTC 2019

Modified Files:
src/sys/arch/arm/include: ptrace.h

Log Message:
Define PTRACE_ILLEGAL_ASM for arm (32-bit)

udf $0 is expected to raise SIGILL for all ARM 32-bit targets.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/include/ptrace.h

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



Re: CVS commit: src/sys/arch

2019-06-19 Thread Kamil Rytarowski
On 19.06.2019 06:41, m...@netbsd.org wrote:
> On Tue, Jun 18, 2019 at 09:18:13PM +0000, Kamil Rytarowski wrote:
>> Module Name: src
>> Committed By:kamil
>> Date:Tue Jun 18 21:18:13 UTC 2019
>>
>> Modified Files:
>>  src/sys/arch/aarch64/include: ptrace.h
>>  src/sys/arch/alpha/include: ptrace.h
>>  src/sys/arch/amd64/include: ptrace.h
>>  src/sys/arch/arm/include: ptrace.h
>>  src/sys/arch/hppa/include: ptrace.h
>>  src/sys/arch/i386/include: ptrace.h
>>  src/sys/arch/ia64/include: ptrace.h
>>  src/sys/arch/m68k/include: ptrace.h
>>  src/sys/arch/mips/include: ptrace.h
>>  src/sys/arch/or1k/include: ptrace.h
>>  src/sys/arch/powerpc/include: ptrace.h
>>  src/sys/arch/riscv/include: ptrace.h
>>  src/sys/arch/sh3/include: ptrace.h
>>  src/sys/arch/sparc/include: ptrace.h
>>  src/sys/arch/vax/include: ptrace.h
>>
>> Log Message:
>> Introduce PTRACE_REG_FP() a helper macro to retrieve the frame pointer
>>
>> The macro is dummy for ia64 (the FP register is unknown and can change
>> freely) and sparc/sparc64 (not stored in struct reg).
> 
> Wouldn't it be better not to declare PTRACE_REG_FP for the cases where
> obtaining it is more complicated?
> 
> e.g. someone who hasn't seen this commit and wants to use PTRACE_REG_FP
> thinks that they can just use it, and until they specifically test ia64
> and sparc64 they won't know it doesn't behave correctly.
> 

FP isn't reliable on any platform so every person has to be prepared.
For meaningful backtraces there is need to use DWARF or CTF.

Returning 0 doesn't make it much worse than on other CPUs. It's used in
simpler debuggers (my use-case is edb-debugger) and in tests mainly.



signature.asc
Description: OpenPGP digital signature


CVS commit: src/sys/kern

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 19 14:16:06 UTC 2019

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

Log Message:
Correct wrong type of uio_seg passed to do_sys_mknodat()

It was introduced by an accident in previous commit to this file.

Detected by syzbot:
https://syzkaller.appspot.com/text?tag=CrashLog=16635d9ea0


To generate a diff of this commit:
cvs rdiff -u -r1.529 -r1.530 src/sys/kern/vfs_syscalls.c

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



CVS commit: src/sys/kern

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 19 14:16:06 UTC 2019

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

Log Message:
Correct wrong type of uio_seg passed to do_sys_mknodat()

It was introduced by an accident in previous commit to this file.

Detected by syzbot:
https://syzkaller.appspot.com/text?tag=CrashLog=16635d9ea0


To generate a diff of this commit:
cvs rdiff -u -r1.529 -r1.530 src/sys/kern/vfs_syscalls.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/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.529 src/sys/kern/vfs_syscalls.c:1.530
--- src/sys/kern/vfs_syscalls.c:1.529	Tue Jun 18 22:34:25 2019
+++ src/sys/kern/vfs_syscalls.c	Wed Jun 19 14:16:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.529 2019/06/18 22:34:25 kamil Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.530 2019/06/19 14:16:06 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.529 2019/06/18 22:34:25 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.530 2019/06/19 14:16:06 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -2165,7 +2165,7 @@ sys___mknod50(struct lwp *l, const struc
 		syscallarg(dev_t) dev;
 	} */
 	return do_sys_mknodat(l, AT_FDCWD, SCARG(uap, path),
-	SCARG(uap, mode), SCARG(uap, dev), UIO_SYSSPACE);
+	SCARG(uap, mode), SCARG(uap, dev), UIO_USERSPACE);
 }
 
 int
@@ -2181,7 +2181,7 @@ sys_mknodat(struct lwp *l, const struct 
 	} */
 
 	return do_sys_mknodat(l, SCARG(uap, fd), SCARG(uap, path),
-	SCARG(uap, mode), SCARG(uap, dev), UIO_SYSSPACE);
+	SCARG(uap, mode), SCARG(uap, dev), UIO_USERSPACE);
 }
 
 int



CVS commit: src/bin/ps

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 19 21:25:51 UTC 2019

Modified Files:
src/bin/ps: print.c

Log Message:
Add a fallback definition of LSDEAD in ps(1)

The symbol is no longer available in headers.

Requested by 


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/bin/ps/print.c

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



CVS commit: src/bin/ps

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 19 21:25:51 UTC 2019

Modified Files:
src/bin/ps: print.c

Log Message:
Add a fallback definition of LSDEAD in ps(1)

The symbol is no longer available in headers.

Requested by 


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/bin/ps/print.c

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

Modified files:

Index: src/bin/ps/print.c
diff -u src/bin/ps/print.c:1.131 src/bin/ps/print.c:1.132
--- src/bin/ps/print.c:1.131	Tue Jun 18 02:23:29 2019
+++ src/bin/ps/print.c	Wed Jun 19 21:25:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: print.c,v 1.131 2019/06/18 02:23:29 kamil Exp $	*/
+/*	$NetBSD: print.c,v 1.132 2019/06/19 21:25:50 kamil Exp $	*/
 
 /*
  * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)print.c	8.6 (Berkeley) 4/16/94";
 #else
-__RCSID("$NetBSD: print.c,v 1.131 2019/06/18 02:23:29 kamil Exp $");
+__RCSID("$NetBSD: print.c,v 1.132 2019/06/19 21:25:50 kamil Exp $");
 #endif
 #endif /* not lint */
 
@@ -104,6 +104,11 @@ static time_t now;
 
 #define	min(a,b)	((a) <= (b) ? (a) : (b))
 
+/* pre-NetBSD 5.x support. */
+#ifndef LSDEAD
+#define LSDEAD 6
+#endif
+
 static int
 iwidth(u_int64_t v)
 {
@@ -586,9 +591,7 @@ lstate(struct pinfo *pi, VARENT *ve, enu
 		break;
 
 	case LSZOMB:
-#ifdef LSDEAD
 	case LSDEAD:
-#endif
 		*cp = 'Z';
 		break;
 



CVS commit: src/sys/sys

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 19 21:39:53 UTC 2019

Modified Files:
src/sys/sys: lwp.h

Log Message:
Add an explicit node that lwp status numbers are set in stone

Requested by 


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/sys/sys/lwp.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/sys/lwp.h
diff -u src/sys/sys/lwp.h:1.185 src/sys/sys/lwp.h:1.186
--- src/sys/sys/lwp.h:1.185	Tue Jun 18 22:40:09 2019
+++ src/sys/sys/lwp.h	Wed Jun 19 21:39:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.185 2019/06/18 22:40:09 kamil Exp $	*/
+/*	$NetBSD: lwp.h,v 1.186 2019/06/19 21:39:53 kamil Exp $	*/
 
 /*
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
@@ -281,6 +281,8 @@ extern int		maxlwp __read_mostly;	/* max
  * runnable but *not* yet running, i.e. is on a run queue.  LSONPROC
  * indicates that the process is actually executing on a CPU, i.e.
  * it is no longer on a run queue.
+ *
+ * These values are set in stone and must not be reused with future changes.
  */
 #define	LSIDL		1	/* Process being created by fork. */
 #define	LSRUN		2	/* Currently runnable. */



CVS commit: src/sys/sys

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 19 21:39:53 UTC 2019

Modified Files:
src/sys/sys: lwp.h

Log Message:
Add an explicit node that lwp status numbers are set in stone

Requested by 


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/sys/sys/lwp.h

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



Re: CVS commit: src/external/cddl/osnet

2019-06-19 Thread Kamil Rytarowski
On 19.06.2019 10:18, Juergen Hannken-Illjes wrote:
> Module Name:  src
> Committed By: hannken
> Date: Wed Jun 19 08:18:01 UTC 2019
> 
> Modified Files:
>   src/external/cddl/osnet/include: libintl.h stdio_ext.h thread.h
>   src/external/cddl/osnet/sys/sys: isa_defs.h procset.h sysmacros.h
> 
> Log Message:
> Sync with upstream r315983.
> 
> 

Shuffling these files keep breaking bootstrap on Linux and we need it
for syzbot..

Changes like #ifndef #include  #endif look highly
suspicious and probably break on every Linux.

I will try to fix it again the fallout with tools/compat.

https://syzkaller.appspot.com/text?tag=CrashLog=14dcf0b2a0



signature.asc
Description: OpenPGP digital signature


CVS commit: src/tools/compat

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 19 23:33:07 UTC 2019

Modified Files:
src/tools/compat: compat_defs.h configure.ac

Log Message:
Add more SunOS types to tools/compat

Add fallback defintions of: uchar_t, ushort_t, uint_t, ulong_t.

Needed by the libctf code on Ubuntu 16.x.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/tools/compat/compat_defs.h
cvs rdiff -u -r1.95 -r1.96 src/tools/compat/configure.ac

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

Modified files:

Index: src/tools/compat/compat_defs.h
diff -u src/tools/compat/compat_defs.h:1.115 src/tools/compat/compat_defs.h:1.116
--- src/tools/compat/compat_defs.h:1.115	Wed Jun 19 03:40:15 2019
+++ src/tools/compat/compat_defs.h	Wed Jun 19 23:33:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_defs.h,v 1.115 2019/06/19 03:40:15 kamil Exp $	*/
+/*	$NetBSD: compat_defs.h,v 1.116 2019/06/19 23:33:07 kamil Exp $	*/
 
 #ifndef	__NETBSD_COMPAT_DEFS_H__
 #define	__NETBSD_COMPAT_DEFS_H__
@@ -79,6 +79,22 @@ typedef unsigned int u_int;
 typedef unsigned short u_short;
 #endif
 
+#if !HAVE_UCHAR_T
+typedef unsigned char uchar_t;
+#endif
+
+#if !HAVE_USHORT_T
+typedef unsigned short ushort_t;
+#endif
+
+#if !HAVE_UINT_T
+typedef unsigned int uint_t;
+#endif
+
+#if !HAVE_ULONG_T
+typedef unsigned long ulong_t;
+#endif
+
 /* System headers needed for (re)definitions below. */
 
 #include 

Index: src/tools/compat/configure.ac
diff -u src/tools/compat/configure.ac:1.95 src/tools/compat/configure.ac:1.96
--- src/tools/compat/configure.ac:1.95	Wed Jun 19 03:40:15 2019
+++ src/tools/compat/configure.ac	Wed Jun 19 23:33:07 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: configure.ac,v 1.95 2019/06/19 03:40:15 kamil Exp $
+#	$NetBSD: configure.ac,v 1.96 2019/06/19 23:33:07 kamil Exp $
 #
 # Autoconf definition file for libnbcompat.
 #
@@ -98,6 +98,7 @@ AC_CHECK_HEADERS(rpc/types.h netconfig.h
 # Typedefs.
 AC_TYPE_SIZE_T
 AC_CHECK_TYPES([id_t, long long, u_long, u_char, u_short, u_int, u_quad_t])
+AC_CHECK_TYPES([uchar_t, ushort_t, uint_t, ulong_t])
 AC_CHECK_TYPE(socklen_t, [AC_DEFINE([HAVE_SOCKLEN_T], 1,
 			  [Define if you have the socklen_t type.])],,
 [#include 



CVS commit: src/tools/compat

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 19 23:33:07 UTC 2019

Modified Files:
src/tools/compat: compat_defs.h configure.ac

Log Message:
Add more SunOS types to tools/compat

Add fallback defintions of: uchar_t, ushort_t, uint_t, ulong_t.

Needed by the libctf code on Ubuntu 16.x.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/tools/compat/compat_defs.h
cvs rdiff -u -r1.95 -r1.96 src/tools/compat/configure.ac

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



CVS commit: src/sys/sys

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 20 03:34:38 UTC 2019

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome to 8.99.47!

New function do_posix_mknodat() that is called from the netbsd32 compat
module.


To generate a diff of this commit:
cvs rdiff -u -r1.594 -r1.595 src/sys/sys/param.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/sys/param.h
diff -u src/sys/sys/param.h:1.594 src/sys/sys/param.h:1.595
--- src/sys/sys/param.h:1.594	Tue Jun 18 22:41:32 2019
+++ src/sys/sys/param.h	Thu Jun 20 03:34:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.594 2019/06/18 22:41:32 kamil Exp $	*/
+/*	$NetBSD: param.h,v 1.595 2019/06/20 03:34:38 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	899004600	/* NetBSD 8.99.46 */
+#define	__NetBSD_Version__	899004700	/* NetBSD 8.99.47 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/sys

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 20 03:34:38 UTC 2019

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome to 8.99.47!

New function do_posix_mknodat() that is called from the netbsd32 compat
module.


To generate a diff of this commit:
cvs rdiff -u -r1.594 -r1.595 src/sys/sys/param.h

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



Re: CVS commit: src/external/cddl/osnet

2019-06-19 Thread Kamil Rytarowski
On 19.06.2019 22:47, Kamil Rytarowski wrote:
> On 19.06.2019 10:18, Juergen Hannken-Illjes wrote:
>> Module Name: src
>> Committed By:hannken
>> Date:Wed Jun 19 08:18:01 UTC 2019
>>
>> Modified Files:
>>  src/external/cddl/osnet/include: libintl.h stdio_ext.h thread.h
>>  src/external/cddl/osnet/sys/sys: isa_defs.h procset.h sysmacros.h
>>
>> Log Message:
>> Sync with upstream r315983.
>>
>>
> 
> Shuffling these files keep breaking bootstrap on Linux and we need it
> for syzbot..
> 
> Changes like #ifndef #include  #endif look highly
> suspicious and probably break on every Linux.
> 
> I will try to fix it again the fallout with tools/compat.
> 
> https://syzkaller.appspot.com/text?tag=CrashLog=14dcf0b2a0
> 

For the record. syzbot is up again!



signature.asc
Description: OpenPGP digital signature


CVS commit: src/tools/compat

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 19 23:35:55 UTC 2019

Modified Files:
src/tools/compat: configure nbtool_config.h.in

Log Message:
regen tools/compat


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/tools/compat/configure
cvs rdiff -u -r1.50 -r1.51 src/tools/compat/nbtool_config.h.in

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



CVS commit: src/tools/compat

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun 19 23:35:55 UTC 2019

Modified Files:
src/tools/compat: configure nbtool_config.h.in

Log Message:
regen tools/compat


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/tools/compat/configure
cvs rdiff -u -r1.50 -r1.51 src/tools/compat/nbtool_config.h.in

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

Modified files:

Index: src/tools/compat/configure
diff -u src/tools/compat/configure:1.94 src/tools/compat/configure:1.95
--- src/tools/compat/configure:1.94	Wed Jun 19 03:40:15 2019
+++ src/tools/compat/configure	Wed Jun 19 23:35:55 2019
@@ -4228,6 +4228,43 @@ _ACEOF
 
 fi
 
+ac_fn_c_check_type "$LINENO" "uchar_t" "ac_cv_type_uchar_t" "$ac_includes_default"
+if test "x$ac_cv_type_uchar_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UCHAR_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "ushort_t" "ac_cv_type_ushort_t" "$ac_includes_default"
+if test "x$ac_cv_type_ushort_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_USHORT_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "uint_t" "ac_cv_type_uint_t" "$ac_includes_default"
+if test "x$ac_cv_type_uint_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UINT_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "ulong_t" "ac_cv_type_ulong_t" "$ac_includes_default"
+if test "x$ac_cv_type_ulong_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ULONG_T 1
+_ACEOF
+
+
+fi
+
 ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include 
 #ifdef HAVE_RPC_TYPES_H
 #include 

Index: src/tools/compat/nbtool_config.h.in
diff -u src/tools/compat/nbtool_config.h.in:1.50 src/tools/compat/nbtool_config.h.in:1.51
--- src/tools/compat/nbtool_config.h.in:1.50	Wed Jun 19 03:40:15 2019
+++ src/tools/compat/nbtool_config.h.in	Wed Jun 19 23:35:55 2019
@@ -1,6 +1,6 @@
 /* nbtool_config.h.in.  Generated from configure.ac by autoheader.  */
 
-/*  $NetBSD: nbtool_config.h.in,v 1.50 2019/06/19 03:40:15 kamil Exp $*/
+/*  $NetBSD: nbtool_config.h.in,v 1.51 2019/06/19 23:35:55 kamil Exp $*/
  
 #ifndef __NETBSD_NBTOOL_CONFIG_H__
 #define __NETBSD_NBTOOL_CONFIG_H__
@@ -786,15 +786,27 @@
 /* Define to 1 if you have the  header file. */
 #undef HAVE_TERMIOS_H
 
+/* Define to 1 if the system has the type `uchar_t'. */
+#undef HAVE_UCHAR_T
+
 /* Define to 1 if you have the `uid_from_user' function. */
 #undef HAVE_UID_FROM_USER
 
+/* Define to 1 if the system has the type `uint_t'. */
+#undef HAVE_UINT_T
+
+/* Define to 1 if the system has the type `ulong_t'. */
+#undef HAVE_ULONG_T
+
 /* Define to 1 if you have the  header file. */
 #undef HAVE_UNISTD_H
 
 /* Define to 1 if you have the `user_from_uid' function. */
 #undef HAVE_USER_FROM_UID
 
+/* Define to 1 if the system has the type `ushort_t'. */
+#undef HAVE_USHORT_T
+
 /* Define to 1 if you have the  header file. */
 #undef HAVE_UTIL_H
 



CVS commit: src

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 20 03:31:54 UTC 2019

Modified Files:
src/lib/libc/sys: mknod.2
src/sys/compat/netbsd32: netbsd32_netbsd.c
src/sys/kern: vfs_syscalls.c
src/sys/sys: vfs_syscalls.h
src/tests/lib/libc/c063: t_mkfifoat.c
src/tests/lib/libc/sys: t_mkfifo.c

Log Message:
Add mkfifo{,at}(2) mode in mknod{,at}(2) as requested by POSIX

mknod with mode & S_IFIFO and dev=0 shall behave like mkfifo.

Update the documentation to reflect this state.

Add ATF tests.

This is an in-kernel implementation as typically user-space programs use
mkfifo(2) directly, however whenever there is need to bypass libc (like in
valgrind) then portable POSIX software calls the mknod syscall.

Noted on tech-kern@ by Greg Troxel.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libc/sys/mknod.2
cvs rdiff -u -r1.227 -r1.228 src/sys/compat/netbsd32/netbsd32_netbsd.c
cvs rdiff -u -r1.530 -r1.531 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.24 -r1.25 src/sys/sys/vfs_syscalls.h
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/c063/t_mkfifoat.c
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_mkfifo.c

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



CVS commit: src

2019-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 20 03:31:54 UTC 2019

Modified Files:
src/lib/libc/sys: mknod.2
src/sys/compat/netbsd32: netbsd32_netbsd.c
src/sys/kern: vfs_syscalls.c
src/sys/sys: vfs_syscalls.h
src/tests/lib/libc/c063: t_mkfifoat.c
src/tests/lib/libc/sys: t_mkfifo.c

Log Message:
Add mkfifo{,at}(2) mode in mknod{,at}(2) as requested by POSIX

mknod with mode & S_IFIFO and dev=0 shall behave like mkfifo.

Update the documentation to reflect this state.

Add ATF tests.

This is an in-kernel implementation as typically user-space programs use
mkfifo(2) directly, however whenever there is need to bypass libc (like in
valgrind) then portable POSIX software calls the mknod syscall.

Noted on tech-kern@ by Greg Troxel.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libc/sys/mknod.2
cvs rdiff -u -r1.227 -r1.228 src/sys/compat/netbsd32/netbsd32_netbsd.c
cvs rdiff -u -r1.530 -r1.531 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.24 -r1.25 src/sys/sys/vfs_syscalls.h
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/c063/t_mkfifoat.c
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_mkfifo.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/sys/mknod.2
diff -u src/lib/libc/sys/mknod.2:1.29 src/lib/libc/sys/mknod.2:1.30
--- src/lib/libc/sys/mknod.2:1.29	Mon Nov 20 17:03:31 2017
+++ src/lib/libc/sys/mknod.2	Thu Jun 20 03:31:54 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mknod.2,v 1.29 2017/11/20 17:03:31 uwe Exp $
+.\"	$NetBSD: mknod.2,v 1.30 2019/06/20 03:31:54 kamil Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)mknod.2	8.1 (Berkeley) 6/4/93
 .\"
-.Dd July 29, 2013
+.Dd June 20, 2019
 .Dt MKNOD 2
 .Os
 .Sh NAME
@@ -47,7 +47,28 @@
 .Ft int
 .Fn mknodat "int fd" "const char *path" "mode_t mode" "dev_t dev"
 .Sh DESCRIPTION
-The device special file
+.Nm
+with
+.Dv S_IFIFO
+specified in
+.Fa mode
+and 0 in
+.Fa dev
+makes a fifo file.
+This call is respectively a portable alias for
+.Xr mkfifo 2
+and
+.Xr mkfifoat 2 .
+.Pp
+.Nm
+with
+.Dv S_IFCHR
+or
+.Dv S_IFBLK
+in
+.Fa mode
+makes a device special file.
+The file
 .Fa path
 is created with the major and minor
 device numbers specified by
@@ -87,7 +108,7 @@ can be set to
 in order to specify the current directory.
 .Pp
 .Fn mknod
-requires super-user privileges.
+requires super-user privileges for creating device special files.
 .Sh RETURN VALUES
 .Rv -std mknod mknodat
 .Sh ERRORS
@@ -138,6 +159,8 @@ node is being created.
 A component of the path prefix is not a directory.
 .It Bq Er EPERM
 The process's effective user ID is not super-user.
+.It Bq Er EOPNOTSUPP
+The kernel has not been configured to support fifo's.
 .It Bq Er EROFS
 The named file resides on a read-only file system.
 .El
@@ -178,3 +201,10 @@ A
 .Fn mknod
 function call appeared in
 .At v6 .
+.Pp
+The alias mode for
+.Xr mkfifo 2
+and
+.Xr mkfifoat 2
+first appeared in
+.Nx 9 .

Index: src/sys/compat/netbsd32/netbsd32_netbsd.c
diff -u src/sys/compat/netbsd32/netbsd32_netbsd.c:1.227 src/sys/compat/netbsd32/netbsd32_netbsd.c:1.228
--- src/sys/compat/netbsd32/netbsd32_netbsd.c:1.227	Tue Jun 18 22:34:25 2019
+++ src/sys/compat/netbsd32/netbsd32_netbsd.c	Thu Jun 20 03:31:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_netbsd.c,v 1.227 2019/06/18 22:34:25 kamil Exp $	*/
+/*	$NetBSD: netbsd32_netbsd.c,v 1.228 2019/06/20 03:31:54 kamil Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.227 2019/06/18 22:34:25 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.228 2019/06/20 03:31:54 kamil Exp $");
 
 /*
  * below are all the standard NetBSD system calls, in the 32bit
@@ -297,8 +297,8 @@ netbsd32___mknod50(struct lwp *l, const 
 		syscallarg(netbsd32_dev_t) dev;
 	} */
 
-	return do_sys_mknod(l, SCARG_P32(uap, path), SCARG(uap, mode),
-	SCARG(uap, dev), UIO_USERSPACE);
+	return do_posix_mknodat(l, AT_FDCWD, SCARG_P32(uap, path),
+	SCARG(uap, mode), SCARG(uap, dev));
 }
 
 int

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.530 src/sys/kern/vfs_syscalls.c:1.531
--- src/sys/kern/vfs_syscalls.c:1.530	Wed Jun 19 14:16:06 2019
+++ src/sys/kern/vfs_syscalls.c	Thu Jun 20 03:31:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.530 2019/06/19 14:16:06 kamil Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.531 2019/06/20 03:31:54 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.530 2019/06/19 14:16:06 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.531 2019/06/20 03:31:54 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -2151,6 

CVS commit: src/sys/kern

2019-06-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 04:02:58 UTC 2019

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

Log Message:
Enhance reliability of ptrace(2) in a debuggee with multiple LWPs

Stop competing between threads which one emits event signal quicker and
overwriting the signal from another thread.

This fixes missed in action signals.

NetBSD truss can now report reliably all TRAP_SCE/SCX/etc events without
reports of missed ones.

This was one of the reasons why debuggee with multiple threads misbehaved
under a debugger.


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.363 src/sys/kern/kern_sig.c

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



CVS commit: src/sys/kern

2019-06-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 04:02:58 UTC 2019

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

Log Message:
Enhance reliability of ptrace(2) in a debuggee with multiple LWPs

Stop competing between threads which one emits event signal quicker and
overwriting the signal from another thread.

This fixes missed in action signals.

NetBSD truss can now report reliably all TRAP_SCE/SCX/etc events without
reports of missed ones.

This was one of the reasons why debuggee with multiple threads misbehaved
under a debugger.


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.363 src/sys/kern/kern_sig.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_sig.c
diff -u src/sys/kern/kern_sig.c:1.362 src/sys/kern/kern_sig.c:1.363
--- src/sys/kern/kern_sig.c:1.362	Fri Jun 21 01:03:51 2019
+++ src/sys/kern/kern_sig.c	Fri Jun 21 04:02:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.362 2019/06/21 01:03:51 kamil Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.363 2019/06/21 04:02:57 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.362 2019/06/21 01:03:51 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.363 2019/06/21 04:02:57 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -913,6 +913,7 @@ trapsignal(struct lwp *l, ksiginfo_t *ks
 	mutex_enter(proc_lock);
 	mutex_enter(p->p_lock);
 
+repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -926,6 +927,16 @@ trapsignal(struct lwp *l, ksiginfo_t *ks
 		/* NOTREACHED */
 	}
 
+	/*
+	 * The process is already stopping.
+	 */
+	if ((p->p_sflag & PS_STOPPING) != 0) {
+		sigswitch(0, p->p_xsig, false);
+		mutex_enter(proc_lock);
+		mutex_enter(p->p_lock);
+		goto repeat; /* XXX */
+	}
+
 	mask = >l_sigmask;
 	ps = p->p_sigacts;
 	action = SIGACTION_PS(ps, signo).sa_handler;
@@ -1580,6 +1591,7 @@ eventswitch(int code)
 	KASSERT((code == TRAP_CHLD) || (code == TRAP_LWP) ||
 	(code == TRAP_EXEC));
 
+repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -1603,6 +1615,16 @@ eventswitch(int code)
 		return;
 	}
 
+	/*
+	 * The process is already stopping.
+	 */
+	if ((p->p_sflag & PS_STOPPING) != 0) {
+		sigswitch(0, p->p_xsig, false);
+		mutex_enter(proc_lock);
+		mutex_enter(p->p_lock);
+		goto repeat; /* XXX */
+	}
+
 	KSI_INIT_TRAP();
 	ksi.ksi_lid = l->l_lid;
 	ksi.ksi_info._signo = signo;
@@ -2434,6 +2456,7 @@ proc_stoptrace(int trapno, int sysnum, c
 
 	mutex_enter(p->p_lock);
 
+repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -2455,6 +2478,15 @@ proc_stoptrace(int trapno, int sysnum, c
 		return;
 	}
 
+	/*
+	 * The process is already stopping.
+	 */
+	if ((p->p_sflag & PS_STOPPING) != 0) {
+		sigswitch(0, p->p_xsig, true);
+		mutex_enter(p->p_lock);
+		goto repeat; /* XXX */
+	}
+
 	/* Needed for ktrace */
 	ps = p->p_sigacts;
 	action = SIGACTION_PS(ps, signo).sa_handler;



CVS commit: src/sys

2019-06-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 01:03:51 UTC 2019

Modified Files:
src/sys/kern: kern_sig.c
src/sys/sys: proc.h

Log Message:
Eliminate PS_NOTIFYSTOP remnants from the kernel

This flag used to be useful in /proc (BSD4.4-style) debugging semantics.
Traced child events were notified without signaling the parent.

This property was removed in NetBSD-8.0 and had no users.

This change simplifies the signal code, removing dead branches.

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.361 -r1.362 src/sys/kern/kern_sig.c
cvs rdiff -u -r1.353 -r1.354 src/sys/sys/proc.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/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.361 src/sys/kern/kern_sig.c:1.362
--- src/sys/kern/kern_sig.c:1.361	Tue Jun 18 23:53:55 2019
+++ src/sys/kern/kern_sig.c	Fri Jun 21 01:03:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.361 2019/06/18 23:53:55 kamil Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.362 2019/06/21 01:03:51 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.361 2019/06/18 23:53:55 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.362 2019/06/21 01:03:51 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -1534,7 +1534,7 @@ proc_stop_lwps(struct proc *p)
 /*
  * Finish stopping of a process.  Mark it stopped and notify the parent.
  *
- * Drop p_lock briefly if PS_NOTIFYSTOP is set and ppsig is true.
+ * Drop p_lock briefly if ppsig is true.
  */
 static void
 proc_stop_done(struct proc *p, int ppmask)
@@ -1549,11 +1549,10 @@ proc_stop_done(struct proc *p, int ppmas
 	p->p_stat = SSTOP;
 	p->p_waited = 0;
 	p->p_pptr->p_nstopchild++;
-	if ((p->p_sflag & PS_NOTIFYSTOP) != 0) {
-		/* child_psignal drops p_lock briefly. */
-		child_psignal(p, ppmask);
-		cv_broadcast(>p_pptr->p_waitcv);
-	}
+
+	/* child_psignal drops p_lock briefly. */
+	child_psignal(p, ppmask);
+	cv_broadcast(>p_pptr->p_waitcv);
 }
 
 /*
@@ -2251,7 +2250,7 @@ proc_stop(struct proc *p, int signo)
 	 * LWPs to a halt so they are included in p->p_nrlwps.  We musn't
 	 * unlock between here and the p->p_nrlwps check below.
 	 */
-	p->p_sflag |= PS_STOPPING | PS_NOTIFYSTOP;
+	p->p_sflag |= PS_STOPPING;
 	membar_producer();
 
 	proc_stop_lwps(p);
@@ -2325,16 +2324,13 @@ proc_stop_callout(void *cookie)
  * We brought the process to a halt.
  * Mark it as stopped and notify the
  * parent.
+ *
+ * Note that proc_stop_done() will
+ * drop p->p_lock briefly.
+ * Arrange to restart and check
+ * all processes again.
  */
-if ((p->p_sflag & PS_NOTIFYSTOP) != 0) {
-	/*
-	 * Note that proc_stop_done() will
-	 * drop p->p_lock briefly.
-	 * Arrange to restart and check
-	 * all processes again.
-	 */
-	restart = true;
-}
+restart = true;
 proc_stop_done(p, PS_NOCLDSTOP);
 			} else
 more = true;

Index: src/sys/sys/proc.h
diff -u src/sys/sys/proc.h:1.353 src/sys/sys/proc.h:1.354
--- src/sys/sys/proc.h:1.353	Tue Jun 11 23:18:55 2019
+++ src/sys/sys/proc.h	Fri Jun 21 01:03:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.353 2019/06/11 23:18:55 kamil Exp $	*/
+/*	$NetBSD: proc.h,v 1.354 2019/06/21 01:03:51 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -395,7 +395,6 @@ struct proc {
 #define	PS_STOPFORK	0x0080 /* Child will be stopped on fork(2) */
 #define	PS_STOPEXEC	0x0100 /* Will be stopped on exec(2) */
 #define	PS_STOPEXIT	0x0200 /* Will be stopped at process exit */
-#define	PS_NOTIFYSTOP	0x1000 /* Notify parent of successful STOP */
 #define	PS_COREDUMP	0x2000 /* Process core-dumped */
 #define	PS_CONTINUED	0x4000 /* Process is continued */
 #define	PS_STOPPING	0x8000 /* Transitioning SACTIVE -> SSTOP */



CVS commit: src/sys

2019-06-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 01:03:51 UTC 2019

Modified Files:
src/sys/kern: kern_sig.c
src/sys/sys: proc.h

Log Message:
Eliminate PS_NOTIFYSTOP remnants from the kernel

This flag used to be useful in /proc (BSD4.4-style) debugging semantics.
Traced child events were notified without signaling the parent.

This property was removed in NetBSD-8.0 and had no users.

This change simplifies the signal code, removing dead branches.

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.361 -r1.362 src/sys/kern/kern_sig.c
cvs rdiff -u -r1.353 -r1.354 src/sys/sys/proc.h

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



CVS commit: src/sys/kern

2019-06-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 04:28:12 UTC 2019

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

Log Message:
Revert previous

There is fallout in gdb that will be investigated before relanding this.


To generate a diff of this commit:
cvs rdiff -u -r1.363 -r1.364 src/sys/kern/kern_sig.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_sig.c
diff -u src/sys/kern/kern_sig.c:1.363 src/sys/kern/kern_sig.c:1.364
--- src/sys/kern/kern_sig.c:1.363	Fri Jun 21 04:02:57 2019
+++ src/sys/kern/kern_sig.c	Fri Jun 21 04:28:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.363 2019/06/21 04:02:57 kamil Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.364 2019/06/21 04:28:12 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.363 2019/06/21 04:02:57 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364 2019/06/21 04:28:12 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -913,7 +913,6 @@ trapsignal(struct lwp *l, ksiginfo_t *ks
 	mutex_enter(proc_lock);
 	mutex_enter(p->p_lock);
 
-repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -927,16 +926,6 @@ repeat:
 		/* NOTREACHED */
 	}
 
-	/*
-	 * The process is already stopping.
-	 */
-	if ((p->p_sflag & PS_STOPPING) != 0) {
-		sigswitch(0, p->p_xsig, false);
-		mutex_enter(proc_lock);
-		mutex_enter(p->p_lock);
-		goto repeat; /* XXX */
-	}
-
 	mask = >l_sigmask;
 	ps = p->p_sigacts;
 	action = SIGACTION_PS(ps, signo).sa_handler;
@@ -1591,7 +1580,6 @@ eventswitch(int code)
 	KASSERT((code == TRAP_CHLD) || (code == TRAP_LWP) ||
 	(code == TRAP_EXEC));
 
-repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -1615,16 +1603,6 @@ repeat:
 		return;
 	}
 
-	/*
-	 * The process is already stopping.
-	 */
-	if ((p->p_sflag & PS_STOPPING) != 0) {
-		sigswitch(0, p->p_xsig, false);
-		mutex_enter(proc_lock);
-		mutex_enter(p->p_lock);
-		goto repeat; /* XXX */
-	}
-
 	KSI_INIT_TRAP();
 	ksi.ksi_lid = l->l_lid;
 	ksi.ksi_info._signo = signo;
@@ -2456,7 +2434,6 @@ proc_stoptrace(int trapno, int sysnum, c
 
 	mutex_enter(p->p_lock);
 
-repeat:
 	/*
 	 * If we are exiting, demise now.
 	 *
@@ -2478,15 +2455,6 @@ repeat:
 		return;
 	}
 
-	/*
-	 * The process is already stopping.
-	 */
-	if ((p->p_sflag & PS_STOPPING) != 0) {
-		sigswitch(0, p->p_xsig, true);
-		mutex_enter(p->p_lock);
-		goto repeat; /* XXX */
-	}
-
 	/* Needed for ktrace */
 	ps = p->p_sigacts;
 	action = SIGACTION_PS(ps, signo).sa_handler;



CVS commit: src/sys/kern

2019-06-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 04:28:12 UTC 2019

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

Log Message:
Revert previous

There is fallout in gdb that will be investigated before relanding this.


To generate a diff of this commit:
cvs rdiff -u -r1.363 -r1.364 src/sys/kern/kern_sig.c

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



CVS commit: src/tools/rpcgen

2019-06-21 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 14:56:40 UTC 2019

Modified Files:
src/tools/rpcgen: Makefile

Log Message:
Instruct tools/rpcgen about new path for rpc headers

Fixes build on Gentoo.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tools/rpcgen/Makefile

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

Modified files:

Index: src/tools/rpcgen/Makefile
diff -u src/tools/rpcgen/Makefile:1.4 src/tools/rpcgen/Makefile:1.5
--- src/tools/rpcgen/Makefile:1.4	Sun Dec  8 20:20:05 2002
+++ src/tools/rpcgen/Makefile	Fri Jun 21 14:56:39 2019
@@ -1,6 +1,10 @@
-#	$NetBSD: Makefile,v 1.4 2002/12/08 20:20:05 thorpej Exp $
+#	$NetBSD: Makefile,v 1.5 2019/06/21 14:56:39 kamil Exp $
 
 HOSTPROGNAME=	${_TOOL_PREFIX}rpcgen
 HOST_SRCDIR=	usr.bin/rpcgen
 
+RPCGEN_INC=	${.CURDIR}/../../common/include
+
+HOST_CPPFLAGS+=	-I${RPCGEN_INC}
+
 .include "${.CURDIR}/../Makefile.host"



CVS commit: src/tools/rpcgen

2019-06-21 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 14:56:40 UTC 2019

Modified Files:
src/tools/rpcgen: Makefile

Log Message:
Instruct tools/rpcgen about new path for rpc headers

Fixes build on Gentoo.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tools/rpcgen/Makefile

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



CVS commit: src/sys/kern

2019-06-21 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 21 14:58:32 UTC 2019

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

Log Message:
Restore ability to create regular files with mknod(2)

This behavior is requested in ATF tests.


To generate a diff of this commit:
cvs rdiff -u -r1.531 -r1.532 src/sys/kern/vfs_syscalls.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/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.531 src/sys/kern/vfs_syscalls.c:1.532
--- src/sys/kern/vfs_syscalls.c:1.531	Thu Jun 20 03:31:54 2019
+++ src/sys/kern/vfs_syscalls.c	Fri Jun 21 14:58:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.531 2019/06/20 03:31:54 kamil Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.532 2019/06/21 14:58:32 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.531 2019/06/20 03:31:54 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.532 2019/06/21 14:58:32 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -2156,13 +2156,18 @@ do_posix_mknodat(struct lwp *l, int fdat
 dev_t dev)
 {
 
+	/*
+	 * The POSIX mknod(2) call is an alias for mkfifo(2) for S_IFIFO
+	 * in mode and dev=0.
+	 *
+	 * In all the other cases it's implementation defined behavior.
+	 */
+
 	if ((mode & S_IFIFO) && dev == 0)
 		return do_sys_mkfifoat(l, fdat, pathname, mode);
-	else if (mode & (S_IFCHR | S_IFBLK))
+	else
 		return do_sys_mknodat(l, fdat, pathname, mode, dev,
 		UIO_USERSPACE);
-	else
-		return EINVAL;
 }
 
 /*



<    1   2   3   4   5   6   7   8   9   >